201040_02
authorhgs
Wed, 13 Oct 2010 16:20:29 +0300
changeset 51 20ac952a623c
parent 48 22de2e391156
child 52 321a10f609ef
201040_02
atext/server/inc/atextmetadata.h
atext/server/inc/utils.h
atext/server/src/atextmetadata.cpp
atext/server/src/atextsession.cpp
bluetooth/btcomm/src/states.cpp
bluetooth/btlogger/generic/public/components.h
bluetooth/btlogger/generic/public/logger.h
bluetooth/btsdp/BWINS/SDPDATABASEU.DEF
bluetooth/btsdp/EABI/sdpdatabaseU.DEF
bluetooth/btsdp/database/responsesizevisitor.cpp
bluetooth/btsdp/database/responsesizevisitor.h
bluetooth/btsdp/database/rsdpdatabase.cpp
bluetooth/btsdp/server/protocol/reqhandler.cpp
bluetooth/btstack/avctp/avctp.cpp
bluetooth/btstack/avctp/avctpmuxer.h
bluetooth/btstack/avctp/avctpmuxerstates.cpp
bluetooth/btstack/avctp/avctpsap.h
bluetooth/btstack/avctp/avctputils.h
bluetooth/btstack/avdtp/avdtpConfigurators.cpp
bluetooth/btstack/avdtp/avdtpConfigurators.h
bluetooth/btstack/avdtp/avdtpDirectChannel.cpp
bluetooth/btstack/avdtp/avdtpDirectChannel.h
bluetooth/btstack/avdtp/avdtpLogicalChannelFactory.cpp
bluetooth/btstack/avdtp/avdtpMediaSession.cpp
bluetooth/btstack/avdtp/avdtpMediaSession.h
bluetooth/btstack/avdtp/avdtpMuxChannel.cpp
bluetooth/btstack/avdtp/avdtpSignallingMessages.cpp
bluetooth/btstack/avdtp/avdtpSignallingMessages.h
bluetooth/btstack/avdtp/avdtpStream.cpp
bluetooth/btstack/avdtp/avdtpStream.h
bluetooth/btstack/bwins/btu.def
bluetooth/btstack/common/blogger.cpp
bluetooth/btstack/common/bt.h
bluetooth/btstack/common/bt_v2.mmp
bluetooth/btstack/common/btprt.cpp
bluetooth/btstack/common/secman.cpp
bluetooth/btstack/eabi/btU.def
bluetooth/btstack/inc/blogger.h
bluetooth/btstack/inc/debug.h
bluetooth/btstack/l2cap/L2CapFecNegotiator.cpp
bluetooth/btstack/l2cap/L2CapFecNegotiator.inl
bluetooth/btstack/l2cap/L2CapPDU.cpp
bluetooth/btstack/l2cap/L2CapSDUQueue.cpp
bluetooth/btstack/l2cap/L2CapSDUQueue.h
bluetooth/btstack/l2cap/l2sap.cpp
bluetooth/btstack/l2cap/l2sap.h
bluetooth/btstack/l2cap/l2sapstates.cpp
bluetooth/btstack/linkmgr/basebandsap.cpp
bluetooth/btstack/linkmgr/basebandsap.h
bluetooth/btstack/linkmgr/eSCOSAP.cpp
bluetooth/btstack/linkmgr/hostmbufpool.cpp
bluetooth/btstack/linkmgr/hostresolver.cpp
bluetooth/btstack/linkmgr/physicallinks.cpp
bluetooth/btstack/linkmgr/physicallinks.h
bluetooth/btstack/rfcomm/Rfcommfcs.cpp
bluetooth/btstack/rfcomm/rfcommmuxchannel.cpp
bluetooth/btstack/rfcomm/rfcommmuxchannel.h
bluetooth/btstack/rfcomm/rfcommstates.cpp
bluetooth/btstack/rfcomm/rfcommstates.h
bluetooth/btstack/secman/pairingserver.cpp
bluetooth/btstack/secman/public/pairingservershared.h
bluetoothmgmt/bluetoothclientlib/avctpservices/avctpremotedevices.cpp
bluetoothmgmt/bluetoothclientlib/btlib/btsocket.cpp
bluetoothmgmt/bluetoothclientlib/btlib/pairing.cpp
bluetoothmgmt/btcommon/bld.inf
bluetoothmgmt/btconfig/esock_bt.cmi
bluetoothmgmt/btconfig/esock_bt_399.cmi
bluetoothmgmt/btmgr/BTManClient/BTManClient.cpp
bluetoothmgmt/btmgr/BTManServer/BTManServer.cpp
bluetoothmgmt/btmgr/BTManServer/BTRegistryDB.cpp
bluetoothmgmt/btmgr/BTManServer/btmanserverburmgr.cpp
bluetoothmgmt/btmgr/Inc/BTManServer.h
bthci/bthci2/hcicmdq/interface/HciCmdQController.h
bthci/bthci2/hcicmdq/src/HciCmdQController.cpp
bthci/bthci2/hcicmdq/src/HciCommandQItem.cpp
bthci/bthci2/hciutil/src/hciutil.cpp
bthci/hci2implementations/CommandsEvents/symbian/src/Event.cpp
bthci/hci2implementations/corehcis/symbian/src/hciserver.cpp
package_definition.xml
remotecontrol/avrcp/absolutevolumeapi/bwins/remconabsolutevolumeu.def
remotecontrol/avrcp/absolutevolumeapi/eabi/remconabsolutevolumeu.def
remotecontrol/avrcp/absolutevolumeapi/group/absolutevolumeapi.mmp
remotecontrol/avrcp/absolutevolumeapi/group/bld.inf
remotecontrol/avrcp/absolutevolumeapi/inc/absolutevolumesender.h
remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeapi.h
remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeapicontroller.h
remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeapicontrollerobserver.h
remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeapitarget.h
remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeapitargetobserver.h
remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeutils.h
remotecontrol/avrcp/absolutevolumeapi/src/absolutevolumeapicontroller.cpp
remotecontrol/avrcp/absolutevolumeapi/src/absolutevolumeapitarget.cpp
remotecontrol/avrcp/absolutevolumeapi/src/absolutevolumesender.cpp
remotecontrol/avrcp/absolutevolumeapi/src/absolutevolumeutils.cpp
remotecontrol/avrcp/avc/avc.mmp
remotecontrol/avrcp/avc/avcframe.cpp
remotecontrol/avrcp/avc/avcframe.h
remotecontrol/avrcp/avc/avcpanel.h
remotecontrol/avrcp/avc/bld.inf
remotecontrol/avrcp/avrcpipc/bwins/avrcpipcu.def
remotecontrol/avrcp/avrcpipc/eabi/avrcpipcu.def
remotecontrol/avrcp/avrcpipc/group/avrcpipc.mmp
remotecontrol/avrcp/avrcpipc/group/bld.inf
remotecontrol/avrcp/avrcpipc/inc/avrcpipcutils.h
remotecontrol/avrcp/avrcpipc/public/avrcpspec.h
remotecontrol/avrcp/avrcpipc/src/avrcpipc.cpp
remotecontrol/avrcp/avrcpipc/src/ipc.cpp
remotecontrol/avrcp/avrcpipc/src/remconqueuemessage.cpp
remotecontrol/avrcp/batterystatusapi/bwins/remconbatterystatusapiu.def
remotecontrol/avrcp/batterystatusapi/eabi/remconbatterystatusapiu.def
remotecontrol/avrcp/batterystatusapi/group/bld.inf
remotecontrol/avrcp/batterystatusapi/group/remconbatterystatusapi.mmp
remotecontrol/avrcp/batterystatusapi/public/remconbatterytarget.h
remotecontrol/avrcp/batterystatusapi/public/remconbatterytargetobserver.h
remotecontrol/avrcp/batterystatusapi/src/batterystatusapi.cpp
remotecontrol/avrcp/bld.inf
remotecontrol/avrcp/bluetooth_avrcp.history.xml
remotecontrol/avrcp/bluetooth_avrcp.mrp
remotecontrol/avrcp/bwins/avcU.def
remotecontrol/avrcp/bwins/remconstatusapiU.DEF
remotecontrol/avrcp/common/avrcpinternalinterface.h
remotecontrol/avrcp/common/avrcpipc.h
remotecontrol/avrcp/common/browsingframe.h
remotecontrol/avrcp/common/mediabrowse.h
remotecontrol/avrcp/common/mediainformation.h
remotecontrol/avrcp/common/nowplaying.h
remotecontrol/avrcp/common/playerinformation.h
remotecontrol/avrcp/common/remconbattery.h
remotecontrol/avrcp/common/remcongroupnavigation.h
remotecontrol/avrcp/common/remconqueuemessage.h
remotecontrol/avrcp/common/remconstatusapi.h
remotecontrol/avrcp/eabi/avcU.def
remotecontrol/avrcp/eabi/remconstatusapiU.DEF
remotecontrol/avrcp/groupnavigationapi/bwins/remcongroupnavigationapiu.def
remotecontrol/avrcp/groupnavigationapi/eabi/remcongroupnavigationapiu.def
remotecontrol/avrcp/groupnavigationapi/group/bld.inf
remotecontrol/avrcp/groupnavigationapi/group/remcongroupnavigationapi.mmp
remotecontrol/avrcp/groupnavigationapi/public/remcongroupnavigationtarget.h
remotecontrol/avrcp/groupnavigationapi/public/remcongroupnavigationtargetobserver.h
remotecontrol/avrcp/groupnavigationapi/src/groupnavigationapi.cpp
remotecontrol/avrcp/mediabrowseapi/bwins/remconmediabrowseapiu.def
remotecontrol/avrcp/mediabrowseapi/eabi/remconmediabrowseapiu.def
remotecontrol/avrcp/mediabrowseapi/group/bld.inf
remotecontrol/avrcp/mediabrowseapi/group/remconmediabrowseapi.mmp
remotecontrol/avrcp/mediabrowseapi/inc/remconmediabrowsefault.h
remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseawaremediabrowsetarget.h
remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseawaremedialibrarybrowse.h
remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseawaremedialibrarybrowseobserver.h
remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseawarenowplayingbrowse.h
remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseawarenowplayingbrowseobserver.h
remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseunawaremediabrowsetarget.h
remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseunawaremedialibrarybrowse.h
remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseunawaremedialibrarybrowseobserver.h
remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseunawarenowplayingbrowse.h
remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseunawarenowplayingbrowseobserver.h
remotecontrol/avrcp/mediabrowseapi/public/remconmediabrowsepanic.h
remotecontrol/avrcp/mediabrowseapi/public/remconmediabrowsetargetbase.h
remotecontrol/avrcp/mediabrowseapi/public/remconmediabrowsetypes.h
remotecontrol/avrcp/mediabrowseapi/public/remconmediaerror.h
remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseawaremediabrowsetarget.cpp
remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseawaremedialibrarybrowse.cpp
remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseawarenowplayingbrowse.cpp
remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseunawaremediabrowsetarget.cpp
remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseunawaremedialibrarybrowse.cpp
remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseunawarenowplayingbrowse.cpp
remotecontrol/avrcp/mediabrowseapi/src/remconmediabrowsetargetbase.cpp
remotecontrol/avrcp/mediabrowseapi/src/remconmediabrowseutils.cpp
remotecontrol/avrcp/mediainformationapi/bwins/remconmediainformationapiu.def
remotecontrol/avrcp/mediainformationapi/eabi/remconmediainformationapiu.def
remotecontrol/avrcp/mediainformationapi/group/bld.inf
remotecontrol/avrcp/mediainformationapi/group/remconmediainformationapi.mmp
remotecontrol/avrcp/mediainformationapi/public/remconmediaattributeid.h
remotecontrol/avrcp/mediainformationapi/public/remconmediainformationtarget.h
remotecontrol/avrcp/mediainformationapi/public/remconmediainformationtargetobserver.h
remotecontrol/avrcp/mediainformationapi/src/mediainformationapi.cpp
remotecontrol/avrcp/nowplayingapi/bwins/remconnowplayingapiu.def
remotecontrol/avrcp/nowplayingapi/eabi/remconnowplayingapiu.def
remotecontrol/avrcp/nowplayingapi/group/bld.inf
remotecontrol/avrcp/nowplayingapi/group/remconnowplayingapi.mmp
remotecontrol/avrcp/nowplayingapi/inc/remconnowplayingfault.h
remotecontrol/avrcp/nowplayingapi/public/remcondatabaseawarenowplayingtarget.h
remotecontrol/avrcp/nowplayingapi/public/remcondatabaseawarenowplayingtargetobserver.h
remotecontrol/avrcp/nowplayingapi/public/remcondatabaseunawarenowplayingtarget.h
remotecontrol/avrcp/nowplayingapi/public/remcondatabaseunawarenowplayingtargetobserver.h
remotecontrol/avrcp/nowplayingapi/public/remconnowplayingtargetbase.h
remotecontrol/avrcp/nowplayingapi/src/remcondatabaseawarenowplayingtarget.cpp
remotecontrol/avrcp/nowplayingapi/src/remcondatabaseunawarenowplayingtarget.cpp
remotecontrol/avrcp/nowplayingapi/src/remconnowplayingtargetbase.cpp
remotecontrol/avrcp/nowplayingapi/src/remconnowplayingutils.cpp
remotecontrol/avrcp/playerinformation/bwins/remconplayerinformationu.def
remotecontrol/avrcp/playerinformation/eabi/remconplayerinformationu.def
remotecontrol/avrcp/playerinformation/group/bld.inf
remotecontrol/avrcp/playerinformation/group/remconplayerinformation.mmp
remotecontrol/avrcp/playerinformation/inc/eventsmask.h
remotecontrol/avrcp/playerinformation/inc/playereventsutils.h
remotecontrol/avrcp/playerinformation/inc/playersettingsutils.h
remotecontrol/avrcp/playerinformation/public/playerinformationtarget.h
remotecontrol/avrcp/playerinformation/public/playerinformationtargetobserver.h
remotecontrol/avrcp/playerinformation/resource/avrcp-settings.rls
remotecontrol/avrcp/playerinformation/resource/avrcp-settings.rss
remotecontrol/avrcp/playerinformation/resource/settings.rh
remotecontrol/avrcp/playerinformation/src/eventsmask.cpp
remotecontrol/avrcp/playerinformation/src/playerapplicationsetting.cpp
remotecontrol/avrcp/playerinformation/src/playerapplicationsetting.h
remotecontrol/avrcp/playerinformation/src/playercapabilities.cpp
remotecontrol/avrcp/playerinformation/src/playerevents.cpp
remotecontrol/avrcp/playerinformation/src/playerinformation.cpp
remotecontrol/avrcp/playerinformation/src/playersettings.cpp
remotecontrol/avrcp/playerinformation/src/settingsresource.cpp
remotecontrol/avrcp/remconbeareravrcp/group/bld.inf
remotecontrol/avrcp/remconbeareravrcp/group/remconbeareravrcp.mmp
remotecontrol/avrcp/remconbeareravrcp/inc/avrcp.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcpbearerinterface.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcpbrowsingcommandhandler.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcpcommand.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcpcommandframer.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcpfragmenter.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcpincomingcommandhandler.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcplog.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcpoutgoingcommandhandler.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcpplayerinfomanager.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcpremotedevice.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcprouter.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcpsdputils.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcptimer.h
remotecontrol/avrcp/remconbeareravrcp/inc/avrcputils.h
remotecontrol/avrcp/remconbeareravrcp/inc/browsecommand.h
remotecontrol/avrcp/remconbeareravrcp/inc/bulkbearer.h
remotecontrol/avrcp/remconbeareravrcp/inc/commandhandlerinterface.h
remotecontrol/avrcp/remconbeareravrcp/inc/controlbearer.h
remotecontrol/avrcp/remconbeareravrcp/inc/controlcommand.h
remotecontrol/avrcp/remconbeareravrcp/inc/internalcommand.h
remotecontrol/avrcp/remconbeareravrcp/inc/internalhelper.h
remotecontrol/avrcp/remconbeareravrcp/inc/passthroughhelper.h
remotecontrol/avrcp/remconbeareravrcp/inc/playerbitmasks.h
remotecontrol/avrcp/remconbeareravrcp/inc/playerstatewatcher.h
remotecontrol/avrcp/remconbeareravrcp/inc/remconcommandinterface.h
remotecontrol/avrcp/remconbeareravrcp/public/remconbeareravrcp.h
remotecontrol/avrcp/remconbeareravrcp/src/1020685e.rss
remotecontrol/avrcp/remconbeareravrcp/src/avrcpMetadataTransfer.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcpadvancedcontrol.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcpbrowsingcommandhandler.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcpcommand.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcpcommandframer.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcpfragmenter.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcpimplementationproxy.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcpoutgoingcommandhandler.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcpremotedevice.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcprouter.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcpsdputils.cpp
remotecontrol/avrcp/remconbeareravrcp/src/avrcputils.cpp
remotecontrol/avrcp/remconbeareravrcp/src/browsecommand.cpp
remotecontrol/avrcp/remconbeareravrcp/src/browsingframe.cpp
remotecontrol/avrcp/remconbeareravrcp/src/bulkbearer.cpp
remotecontrol/avrcp/remconbeareravrcp/src/controlcommand.cpp
remotecontrol/avrcp/remconbeareravrcp/src/internalcommand.cpp
remotecontrol/avrcp/remconbeareravrcp/src/passthroughhelper.cpp
remotecontrol/avrcp/remconbeareravrcp/src/playerbitmasks.cpp
remotecontrol/avrcp/remconbeareravrcp/src/playerstatewatcher.cpp
remotecontrol/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp
remotecontrol/avrcp/statusclient/bld.inf
remotecontrol/avrcp/statusclient/remconstatusapi.mmp
remotecontrol/avrcp/statusclient/remconstatusapicontroller.h
remotecontrol/avrcp/statusclient/remconstatusapicontrollerobserver.cpp
remotecontrol/avrcp/statusclient/remconstatusapicontrollerobserver.h
remotecontrol/avrcp/statusclient/statusapicontroller.cpp
remotecontrol/avrcp/statusconverter/10207ea3.rss
remotecontrol/avrcp/statusconverter/bld.inf
remotecontrol/avrcp/statusconverter/remconavrcpstatusconverter.cpp
remotecontrol/avrcp/statusconverter/remconavrcpstatusconverter.h
remotecontrol/avrcp/statusconverter/remconavrcpstatusconverter.mmp
remotecontrol/avrcp/statusconverter/remconavrcpstatusconvertermain.cpp
remotecontrol/remotecontrolfw/bearerplugin/bwins/remconbearerpluginU.DEF
remotecontrol/remotecontrolfw/bearerplugin/eabi/remconbearerpluginU.DEF
remotecontrol/remotecontrolfw/bearerplugin/group/bld.inf
remotecontrol/remotecontrolfw/bearerplugin/group/remconbearerplugin.mmp
remotecontrol/remotecontrolfw/bearerplugin/public/bearerparams.h
remotecontrol/remotecontrolfw/bearerplugin/public/remconbearerbulkinterface.h
remotecontrol/remotecontrolfw/bearerplugin/public/remconbearerbulkobserver.h
remotecontrol/remotecontrolfw/bearerplugin/public/remconbearerinterface.h
remotecontrol/remotecontrolfw/bearerplugin/public/remconbearerobserver.h
remotecontrol/remotecontrolfw/bearerplugin/public/remconbearerplugin.h
remotecontrol/remotecontrolfw/bearerplugin/src/bearerparams.cpp
remotecontrol/remotecontrolfw/bearerplugin/src/remconbearerbulkobserver.cpp
remotecontrol/remotecontrolfw/bearerplugin/src/remconbearerobserver.cpp
remotecontrol/remotecontrolfw/bearerplugin/src/remconbearerplugin.cpp
remotecontrol/remotecontrolfw/client/bld.inf
remotecontrol/remotecontrolfw/client/common/remconbulkclient.h
remotecontrol/remotecontrolfw/client/common/remconclient.h
remotecontrol/remotecontrolfw/client/coreapi/bwins/remconcoreapiU.DEF
remotecontrol/remotecontrolfw/client/coreapi/eabi/remconcoreapiU.DEF
remotecontrol/remotecontrolfw/client/coreapi/group/bld.inf
remotecontrol/remotecontrolfw/client/coreapi/group/remconcoreapi.mmp
remotecontrol/remotecontrolfw/client/coreapi/public/remconcoreapi.h
remotecontrol/remotecontrolfw/client/coreapi/public/remconcoreapicontroller.h
remotecontrol/remotecontrolfw/client/coreapi/public/remconcoreapicontrollerobserver.h
remotecontrol/remotecontrolfw/client/coreapi/public/remconcoreapitarget.h
remotecontrol/remotecontrolfw/client/coreapi/public/remconcoreapitargetobserver.h
remotecontrol/remotecontrolfw/client/coreapi/src/coreapicontroller.cpp
remotecontrol/remotecontrolfw/client/coreapi/src/coreapicontrollerobserver.cpp
remotecontrol/remotecontrolfw/client/coreapi/src/coreapitarget.cpp
remotecontrol/remotecontrolfw/client/coreapi/src/coreapitargetobserver.cpp
remotecontrol/remotecontrolfw/client/extapi1/bwins/remconextapi1U.DEF
remotecontrol/remotecontrolfw/client/extapi1/eabi/remconextapi1U.DEF
remotecontrol/remotecontrolfw/client/extapi1/group/bld.inf
remotecontrol/remotecontrolfw/client/extapi1/group/remconextapi1.mmp
remotecontrol/remotecontrolfw/client/extapi1/inc/absvolutils.h
remotecontrol/remotecontrolfw/client/extapi1/public/remconabsvolcontroller.h
remotecontrol/remotecontrolfw/client/extapi1/public/remconabsvolcontrollerobserver.h
remotecontrol/remotecontrolfw/client/extapi1/public/remconabsvoltarget.h
remotecontrol/remotecontrolfw/client/extapi1/public/remconabsvoltargetobserver.h
remotecontrol/remotecontrolfw/client/extapi1/public/remconextapi1.h
remotecontrol/remotecontrolfw/client/extapi1/public/remcontrackinfocontroller.h
remotecontrol/remotecontrolfw/client/extapi1/public/remcontrackinfocontrollerobserver.h
remotecontrol/remotecontrolfw/client/extapi1/public/remcontrackinfotarget.h
remotecontrol/remotecontrolfw/client/extapi1/public/remcontrackinfotargetobserver.h
remotecontrol/remotecontrolfw/client/extapi1/src/absvolcontroller.cpp
remotecontrol/remotecontrolfw/client/extapi1/src/absvolcontrollerobserver.cpp
remotecontrol/remotecontrolfw/client/extapi1/src/absvoltarget.cpp
remotecontrol/remotecontrolfw/client/extapi1/src/absvoltargetobserver.cpp
remotecontrol/remotecontrolfw/client/extapi1/src/absvolutils.cpp
remotecontrol/remotecontrolfw/client/extapi1/src/trackinfocontroller.cpp
remotecontrol/remotecontrolfw/client/extapi1/src/trackinfocontrollerobserver.cpp
remotecontrol/remotecontrolfw/client/extapi1/src/trackinfotarget.cpp
remotecontrol/remotecontrolfw/client/extapi1/src/trackinfotargetobserver.cpp
remotecontrol/remotecontrolfw/client/inner/bwins/remconclientU.DEF
remotecontrol/remotecontrolfw/client/inner/eabi/remconclientU.DEF
remotecontrol/remotecontrolfw/client/inner/group/bld.inf
remotecontrol/remotecontrolfw/client/inner/group/remconclient.mmp
remotecontrol/remotecontrolfw/client/inner/src/bulksession.cpp
remotecontrol/remotecontrolfw/client/inner/src/session.cpp
remotecontrol/remotecontrolfw/client/intermediate/bwins/remconinterfacebaseU.DEF
remotecontrol/remotecontrolfw/client/intermediate/eabi/remconinterfacebaseU.DEF
remotecontrol/remotecontrolfw/client/intermediate/group/bld.inf
remotecontrol/remotecontrolfw/client/intermediate/group/remconinterfacebase.mmp
remotecontrol/remotecontrolfw/client/intermediate/inc/bulkreceiver.h
remotecontrol/remotecontrolfw/client/intermediate/inc/interfacebaseextension.h
remotecontrol/remotecontrolfw/client/intermediate/inc/receiver.h
remotecontrol/remotecontrolfw/client/intermediate/public/remconerrorobserver.h
remotecontrol/remotecontrolfw/client/intermediate/public/remconinterfacebase.h
remotecontrol/remotecontrolfw/client/intermediate/public/remconinterfacefeatures.h
remotecontrol/remotecontrolfw/client/intermediate/public/remconinterfaceif.h
remotecontrol/remotecontrolfw/client/intermediate/public/remconinterfaceselector.h
remotecontrol/remotecontrolfw/client/intermediate/src/bulkreceiver.cpp
remotecontrol/remotecontrolfw/client/intermediate/src/interfacebase.cpp
remotecontrol/remotecontrolfw/client/intermediate/src/interfacebaseextension.cpp
remotecontrol/remotecontrolfw/client/intermediate/src/interfaceselector.cpp
remotecontrol/remotecontrolfw/client/intermediate/src/receiver.cpp
remotecontrol/remotecontrolfw/client/intermediate/src/remconinterfacefeatures.cpp
remotecontrol/remotecontrolfw/client/sidekeyapi/bwins/remconsidekeyapiu.def
remotecontrol/remotecontrolfw/client/sidekeyapi/eabi/remconsidekeyapiu.def
remotecontrol/remotecontrolfw/client/sidekeyapi/group/bld.inf
remotecontrol/remotecontrolfw/client/sidekeyapi/group/remconsidekeyapi.mmp
remotecontrol/remotecontrolfw/client/sidekeyapi/inc/remconsidekeyapipaniccodes.h
remotecontrol/remotecontrolfw/client/sidekeyapi/public/remconsidekeyapi.h
remotecontrol/remotecontrolfw/client/sidekeyapi/public/remconsidekeytarget.h
remotecontrol/remotecontrolfw/client/sidekeyapi/public/remconsidekeytargetobserver.h
remotecontrol/remotecontrolfw/client/sidekeyapi/src/sidekeytarget.cpp
remotecontrol/remotecontrolfw/common/operationinformation.h
remotecontrol/remotecontrolfw/common/remconserver.h
remotecontrol/remotecontrolfw/common/utils.cpp
remotecontrol/remotecontrolfw/common/utils.h
remotecontrol/remotecontrolfw/converterplugin/bwins/remconconverterpluginU.DEF
remotecontrol/remotecontrolfw/converterplugin/eabi/remconconverterpluginU.DEF
remotecontrol/remotecontrolfw/converterplugin/group/bld.inf
remotecontrol/remotecontrolfw/converterplugin/group/remconconverterplugin.mmp
remotecontrol/remotecontrolfw/converterplugin/public/remconconverterinterface.h
remotecontrol/remotecontrolfw/converterplugin/public/remconconverterplugin.h
remotecontrol/remotecontrolfw/converterplugin/src/remconconverterplugin.cpp
remotecontrol/remotecontrolfw/group/bld.inf
remotecontrol/remotecontrolfw/group/bluetooth_remotecontrol.history.xml
remotecontrol/remotecontrolfw/group/bluetooth_remotecontrol.mrp
remotecontrol/remotecontrolfw/group/remotecontrol.iby
remotecontrol/remotecontrolfw/reference/bld.inf
remotecontrol/remotecontrolfw/reference/converters/Core_Serial/group/bld.inf
remotecontrol/remotecontrolfw/reference/converters/Core_Serial/group/coreserialconverter.iby
remotecontrol/remotecontrolfw/reference/converters/Core_Serial/group/coreserialconverter.mmp
remotecontrol/remotecontrolfw/reference/converters/Core_Serial/inc/coreserialconverter.h
remotecontrol/remotecontrolfw/reference/converters/Core_Serial/src/101F906E.rss
remotecontrol/remotecontrolfw/reference/converters/Core_Serial/src/coreserialconverter.cpp
remotecontrol/remotecontrolfw/reference/converters/Core_Serial/src/coreserialconvertermain.cpp
remotecontrol/remotecontrolfw/reference/converters/bld.inf
remotecontrol/remotecontrolfw/reference/serialbearer/group/bld.inf
remotecontrol/remotecontrolfw/reference/serialbearer/group/t_serialbearer.iby
remotecontrol/remotecontrolfw/reference/serialbearer/group/t_serialbearer.mmp
remotecontrol/remotecontrolfw/reference/serialbearer/inc/receiveobserver.h
remotecontrol/remotecontrolfw/reference/serialbearer/inc/receiver.h
remotecontrol/remotecontrolfw/reference/serialbearer/inc/remconserialbearer.h
remotecontrol/remotecontrolfw/reference/serialbearer/inc/remconserialbeareruid.h
remotecontrol/remotecontrolfw/reference/serialbearer/inc/sender.h
remotecontrol/remotecontrolfw/reference/serialbearer/inc/sendobserver.h
remotecontrol/remotecontrolfw/reference/serialbearer/src/1020453D.rss
remotecontrol/remotecontrolfw/reference/serialbearer/src/receiver.cpp
remotecontrol/remotecontrolfw/reference/serialbearer/src/remconserialbearer.cpp
remotecontrol/remotecontrolfw/reference/serialbearer/src/remconserialbearermain.cpp
remotecontrol/remotecontrolfw/reference/serialbearer/src/sender.cpp
remotecontrol/remotecontrolfw/reference/tsp.iby
remotecontrol/remotecontrolfw/server/group/bld.inf
remotecontrol/remotecontrolfw/server/group/remconserver.mmp
remotecontrol/remotecontrolfw/server/inc/activehelper.h
remotecontrol/remotecontrolfw/server/inc/bearermanager.h
remotecontrol/remotecontrolfw/server/inc/bulkbearerinterface.h
remotecontrol/remotecontrolfw/server/inc/bulkserver.h
remotecontrol/remotecontrolfw/server/inc/bulkservermsgqueue.h
remotecontrol/remotecontrolfw/server/inc/bulkserversecuritypolicy.h
remotecontrol/remotecontrolfw/server/inc/bulksession.h
remotecontrol/remotecontrolfw/server/inc/connectionhistory.h
remotecontrol/remotecontrolfw/server/inc/connections.h
remotecontrol/remotecontrolfw/server/inc/connectionstate.h
remotecontrol/remotecontrolfw/server/inc/controllersession.h
remotecontrol/remotecontrolfw/server/inc/controllersession.inl
remotecontrol/remotecontrolfw/server/inc/convertermanager.h
remotecontrol/remotecontrolfw/server/inc/messagequeue.h
remotecontrol/remotecontrolfw/server/inc/messagerecipients.h
remotecontrol/remotecontrolfw/server/inc/messagesendobserver.h
remotecontrol/remotecontrolfw/server/inc/remconmessage.h
remotecontrol/remotecontrolfw/server/inc/remconmessage.inl
remotecontrol/remotecontrolfw/server/inc/server.h
remotecontrol/remotecontrolfw/server/inc/serversecuritypolicy.h
remotecontrol/remotecontrolfw/server/inc/session.h
remotecontrol/remotecontrolfw/server/inc/targetclientprocess.h
remotecontrol/remotecontrolfw/server/inc/targetclientprocess.inl
remotecontrol/remotecontrolfw/server/inc/targetsession.h
remotecontrol/remotecontrolfw/server/inc/tspv4stub.h
remotecontrol/remotecontrolfw/server/public/remconservercaps.mmh
remotecontrol/remotecontrolfw/server/public/remconserverid.h
remotecontrol/remotecontrolfw/server/public/remconserverpanic.h
remotecontrol/remotecontrolfw/server/src/activehelper.cpp
remotecontrol/remotecontrolfw/server/src/bearermanager.cpp
remotecontrol/remotecontrolfw/server/src/bulkbearerinterface.cpp
remotecontrol/remotecontrolfw/server/src/bulkmain.cpp
remotecontrol/remotecontrolfw/server/src/bulkserver.cpp
remotecontrol/remotecontrolfw/server/src/bulksession.cpp
remotecontrol/remotecontrolfw/server/src/connectionhistory.cpp
remotecontrol/remotecontrolfw/server/src/connections.cpp
remotecontrol/remotecontrolfw/server/src/controllersession.cpp
remotecontrol/remotecontrolfw/server/src/convertermanager.cpp
remotecontrol/remotecontrolfw/server/src/main.cpp
remotecontrol/remotecontrolfw/server/src/messagequeue.cpp
remotecontrol/remotecontrolfw/server/src/messagerecipients.cpp
remotecontrol/remotecontrolfw/server/src/remconmessage.cpp
remotecontrol/remotecontrolfw/server/src/server.cpp
remotecontrol/remotecontrolfw/server/src/session.cpp
remotecontrol/remotecontrolfw/server/src/targetclientprocess.cpp
remotecontrol/remotecontrolfw/server/src/targetsession.cpp
remotecontrol/remotecontrolfw/server/src/tspv4stub.cpp
remotecontrol/remotecontrolfw/targetselectorplugin/bwins/remcontargetselectorpluginU.DEF
remotecontrol/remotecontrolfw/targetselectorplugin/eabi/remcontargetselectorpluginU.DEF
remotecontrol/remotecontrolfw/targetselectorplugin/group/bld.inf
remotecontrol/remotecontrolfw/targetselectorplugin/group/remcontargetselectorplugin.mmp
remotecontrol/remotecontrolfw/targetselectorplugin/public/bearersecurity.h
remotecontrol/remotecontrolfw/targetselectorplugin/public/clientinfo.h
remotecontrol/remotecontrolfw/targetselectorplugin/public/remcontargetselectorplugin.h
remotecontrol/remotecontrolfw/targetselectorplugin/public/remcontargetselectorplugininterface.h
remotecontrol/remotecontrolfw/targetselectorplugin/public/remcontargetselectorpluginobserver.h
remotecontrol/remotecontrolfw/targetselectorplugin/src/bearersecurity.cpp
remotecontrol/remotecontrolfw/targetselectorplugin/src/clientinfo.cpp
remotecontrol/remotecontrolfw/targetselectorplugin/src/targetselectorplugin.cpp
remotecontrol/remotecontrolfw/targetselectorplugin/src/targetselectorpluginobserver.cpp
remotecontrol/remotecontrolfw/test/bld.inf
remotecontrol/remotecontrolfw/test/headercheck/group/bld.inf
remotecontrol/remotecontrolfw/test/headercheck/group/t_remconheadercheck.mmp
remotecontrol/remotecontrolfw/test/headercheck/src/main.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_bearerparams.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_bearersecurity.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_clientinfo.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_clienttype.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_messagetype.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconabsvolcontroller.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconabsvolcontrollerobserver.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconabsvoltarget.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconabsvoltargetobserver.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconaddress.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconbearerinterface.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconbearerobserver.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconbearerplugin.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconclient.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconconverterinterface.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconconverterplugin.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconcoreapi.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconcoreapicontroller.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconcoreapicontrollerobserver.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconcoreapitarget.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconcoreapitargetobserver.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconerrorobserver.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconextapi1.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconinterfacebase.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconinterfaceif.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconinterfaceselector.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconserialbeareruid.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconserverid.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remconserverpanic.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontargetselectorplugin.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontargetselectorplugininterface.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontargetselectorpluginobserver.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontrackinfocontroller.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontrackinfocontrollerobserver.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontrackinfotarget.cpp
remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontrackinfotargetobserver.cpp
remotecontrol/remotecontrolfw/types/bwins/remcontypesU.DEF
remotecontrol/remotecontrolfw/types/eabi/remcontypesU.DEF
remotecontrol/remotecontrolfw/types/group/bld.inf
remotecontrol/remotecontrolfw/types/group/remcontypes.mmp
remotecontrol/remotecontrolfw/types/public/clientid.h
remotecontrol/remotecontrolfw/types/public/clienttype.h
remotecontrol/remotecontrolfw/types/public/messagetype.h
remotecontrol/remotecontrolfw/types/public/playertype.h
remotecontrol/remotecontrolfw/types/public/remconaddress.h
remotecontrol/remotecontrolfw/types/public/remconifdetails.h
remotecontrol/remotecontrolfw/types/src/remconaddress.cpp
remotecontrol/remotecontrolfw/types/src/remconifdetails.cpp
--- a/atext/server/inc/atextmetadata.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/atext/server/inc/atextmetadata.h	Wed Oct 13 16:20:29 2010 +0300
@@ -324,7 +324,7 @@
 public:
 
     TATExtEntrySupport( TDesC8& aAtCmdFull,
-                        const RMessage2& aMessage,
+                        RMessage2& aMessage,
                         CArrayFixFlat<TATExtOneCmdSupport>* aSupport ) :
                         iAtCmdFull( aAtCmdFull ),
                         iMessage( aMessage ),
@@ -333,6 +333,8 @@
                         iStartIndex( KErrNotFound ),
                         iSupportFound( EFalse ){}
 
+    TATExtEntrySupport& operator=( TATExtEntrySupport& aEntrySupport );
+    
     /**
      * Full AT command for which to check the support
      * (base part + parameters)
@@ -342,7 +344,7 @@
     /**
      * Client request message for reading
      */
-    const RMessage2& iMessage;
+    RMessage2& iMessage;
 
     /**
      * AT command's plugin entry support data.
@@ -365,7 +367,7 @@
      * Found plugin support for HandlePartialAndMasterPluginSupportL().
      */
     TBool iSupportFound;
-
+    
     };
 
 /**
--- a/atext/server/inc/utils.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/atext/server/inc/utils.h	Wed Oct 13 16:20:29 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -46,6 +46,23 @@
     {CleanupResetDestroyClose<T>::PushL(aRef);}
 
 template <class T>
+class CleanupDeleteAndNull
+    {
+public:
+    inline static void PushL(T*& aRef) {CleanupStack::PushL(TCleanupItem(&DeleteAndNull,&aRef));};
+private:
+    static void DeleteAndNull(TAny *aPtr) {T*& ptr = *static_cast<T**>(aPtr); delete ptr; ptr = NULL;};
+    };
+
+/**
+ * Pushes an object into CleanupStack and specifies the cleanup
+ * function as delete followed by NULLing the pointer reference.
+*/
+template <class T>
+inline void CleanupDeleteAndNullPushL(T*& aRef)
+    {CleanupDeleteAndNull<T>::PushL(aRef);}
+
+template <class T>
 static TBool OperatorEqual(const T& aT1, const T& aT2)
     {
     return aT1 == aT2;
--- a/atext/server/src/atextmetadata.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/atext/server/src/atextmetadata.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1529,7 +1529,6 @@
         aCleanupInfo.iEntryCreated = ETrue;
         aCleanupInfo.iEntryIndex = iPluginData->Count() - 1;
         foundIndex = aCleanupInfo.iEntryIndex;
-        foundEntry = &(*iPluginData)[foundIndex];
         }
     // Now foundEntry is either the found entry or a newly added entry.
     // Make the iSupport metadata point to this.
@@ -1565,9 +1564,12 @@
         TRACE_FUNC_EXIT
         User::Leave( KErrGeneral );
         }
+    TBool createdEntries = EFalse;
     if ( !aEntries )
         {
         aEntries = new (ELeave) CArrayFixFlat<TATExtOneCmdSupport>( KGranularity );
+        CleanupDeleteAndNullPushL( aEntries ); // we can't expect the caller to do this as they don't know about it yet
+        createdEntries = ETrue;
         }
     TATExtOneCmdSupport oneCmdSupport;
     oneCmdSupport.iSupportType = aSupportType;
@@ -1601,6 +1603,11 @@
             User::Leave( KErrNotSupported );
             }
         }
+    if ( createdEntries )
+        {
+        // ownership is transferred to the caller
+        CleanupStack::Pop( aEntries );
+        }
     TRACE_FUNC_EXIT
     return retVal;
     }
@@ -1996,21 +2003,40 @@
     TRACE_FUNC_ENTRY
     // First extract the base of AT command from aAtCmdFull
     // ('=' and everything after that)
-    TInt newLength = aAtCmdFull.Length();
+    TInt fullLength = aAtCmdFull.Length();
+    TInt newLength = fullLength;
+    TInt findIndex = KErrNotFound;
     TInt foundPos = aAtCmdFull.Locate( '=' );
-    if ( foundPos >= 2 )  // After "AT"
+    TRACE_INFO(( _L8("Base length before = %d"), fullLength ));
+    if ( foundPos >= 0 )
         {
+        findIndex = foundPos - 1;
         newLength = foundPos;
+        TRACE_INFO(( _L8("Adjust case 1 = %d/%d"), findIndex, newLength ));
         }
-    else if ( newLength >= 1 )
+    else
         {
         // There was no '=' so check if the last character is '?'.
         // If it is then remove it.
-        if ( aAtCmdFull[newLength-1] == '?' )
+        TInt lastIndex = fullLength - 1;
+        if ( aAtCmdFull[lastIndex] == '?' )
             {
-            newLength--;
+            findIndex = lastIndex - 1;
+            newLength = fullLength - 1;
+            }
+        TRACE_INFO(( _L8("Adjust case 2 = %d/%d"), findIndex, newLength ));
+        }
+    // Next correct newLength so that it doesn't contain the space(s)
+    for ( ; findIndex>=0; findIndex--,newLength-- )
+        {
+        TChar character = aAtCmdFull[findIndex];
+        if ( !(character.IsSpace()||character==0x00) )
+            {
+            break;
             }
         }
+    // The following should tolerate also zero length
+    TRACE_INFO(( _L8("Base length after = %d"), newLength ));
     HBufC8* baseCmd = HBufC8::NewMaxLC( newLength );
     TPtr8 baseCmdPtr = baseCmd->Des();
     baseCmdPtr.Copy( &aAtCmdFull[0], newLength );
@@ -2045,11 +2071,12 @@
         aComplInfo.iProcessed = EFalse;
         aComplInfo.iReplyExpected = ETrue;
         CreateSelfReplyData( aMessage );
-        CleanupStack::PopAndDestroy();
         TRACE_FUNC_EXIT
         return;
         }
-    TATExtEntrySupport entrySupport( aAtCmdFull, aMessage, support );
+    TATExtEntrySupport entrySupport( aAtCmdFull,
+                                     const_cast<RMessage2&>(aMessage),
+                                     support );
     TInt i;
     aComplInfo.iProcessed = EFalse;
     TInt count = support->Count();
@@ -2141,11 +2168,14 @@
     HBufC8* atCmdFull = HBufC8::NewMaxLC( aEntrySupport.iAtCmdFull.Length() );
     TPtr8 atCmdFullPtr = atCmdFull->Des();
     atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull );
+    // First send the entry to the observers
+    TATExtEntrySupport handleCommandEntry = aEntrySupport;
+    aEntrySupport.iStartIndex = aStartIndex;
+    SendToMultipleObserverL( aEntrySupport, atCmdFull );
+    aEntrySupport = handleCommandEntry;
     // Now execute the HandleCommand()
     iCmdData.iReplyExpected = ETrue;  // Set before HandleCommandL()
     HandleCommandL( aEntrySupport, ETrue );
-    aEntrySupport.iStartIndex = aStartIndex;
-    SendToMultipleObserverL( aEntrySupport, atCmdFull );
     CleanupStack::PopAndDestroy( atCmdFull );
     aReplyExpected = ETrue;
     TRACE_FUNC_EXIT
@@ -2187,8 +2217,8 @@
         TPtr8 atCmdFullPtr = atCmdFull->Des();
         atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull );
         // Now execute the HandleCommand()
+        SendToMultipleObserverL( nextSupport, atCmdFull );
         HandleCommandL( aEntrySupport, EFalse );
-        SendToMultipleObserverL( nextSupport, atCmdFull );
         CleanupStack::PopAndDestroy( atCmdFull );
         }
     else
@@ -2289,6 +2319,7 @@
         TRACE_FUNC_EXIT
         return support;
         }
+    CleanupStack::PopAndDestroy( support );
     TRACE_FUNC_EXIT
     return NULL;
     }
@@ -2727,3 +2758,22 @@
     TRACE_FUNC_EXIT
     return KErrNone;
     }
+
+// ---------------------------------------------------------------------------
+// Assignment operator for ease of usage
+// ---------------------------------------------------------------------------
+//
+TATExtEntrySupport& TATExtEntrySupport::operator=( TATExtEntrySupport& aEntrySupport )
+    {
+    if ( &aEntrySupport == this )
+        {
+        return aEntrySupport;
+        }
+    iAtCmdFull = aEntrySupport.iAtCmdFull;
+    iMessage = aEntrySupport.iMessage;
+    iSupport = aEntrySupport.iSupport;
+    iEntry = aEntrySupport.iEntry;
+    iStartIndex = aEntrySupport.iStartIndex;
+    iSupportFound = aEntrySupport.iSupportFound;
+    return *this;
+    }
--- a/atext/server/src/atextsession.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/atext/server/src/atextsession.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -898,6 +898,7 @@
     if ( iEComSession )
         {
         iEComSession->Close();
+        iEComSession = NULL; 
         }
     if ( !aSyncClose )
         {
--- a/bluetooth/btcomm/src/states.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btcomm/src/states.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -625,6 +625,12 @@
 
 	key.iStateLength = 0;
 
+	// Coverity[uninit_use_in_call]
+	// This refers to the elements in the continuation state key. 
+	// However iStateLength is the expected length of that continaution state key, 
+	// which here has been set to zero - indicating the query is too short to 
+	// require continuation. Hence no elements in this continuation state need 
+	// initialising.
 	aContext->iSDPRequest.Copy(TSDPServiceSearchKeyBuf(key));
 	aContext->iSDPServRecordHandle.SetMax(); 
 	netdb.Query(aContext->iSDPRequest,aContext->iSDPServRecordHandle,aContext->iStatus);
--- a/bluetooth/btlogger/generic/public/components.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btlogger/generic/public/components.h	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -24,15 +24,6 @@
 // This file provides a centralised place for the definition
 // of log component strings for use with the Bluetooth logger.
 
-// The Bluetooth PRT
-#define LOG_COMPONENT_BT_PRT				"BtPrt"
-
-// Class of Device (CoD) Service Manager
-#define LOG_COMPONENT_BT_COD				"CoD"
-
-// Incoming connection listener
-#define LOG_COMPONENT_IN_CONN_LISTENER		"InConnListener"
-
 // The Bluetooth Logger
 #define LOG_COMPONENT_LOGGER				"LogEngine"
 
@@ -61,6 +52,12 @@
 #define LOG_COMPONENT_HCI_WATCHDOG			"HciWatchdog"
 
 // Bluetooth Stack Components
+//// The common Bluetooth protocol components
+#define LOG_COMPONENT_BT_PRT				"BtPrt"
+//// Class of Device (CoD) Service Manager
+#define LOG_COMPONENT_BT_COD				"CoD"
+//// Incoming connection listener
+#define LOG_COMPONENT_IN_CONN_LISTENER		"InConnListener"
 #define LOG_COMPONENT_SECMAN				"SecMan"
 #define LOG_COMPONENT_HOSTRESOLVER			"HostResolver"
 #define LOG_COMPONENT_LINKMGR				"LinkMgr"
--- a/bluetooth/btlogger/generic/public/logger.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btlogger/generic/public/logger.h	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -59,6 +59,7 @@
 #ifdef __FLOG_ACTIVE
 #define CONNECT_LOGGER					static_cast<void>(CBtLog::Connect());
 #define CLOSE_LOGGER					CBtLog::Close();
+#define DEFINE_LOG_COMPONENT(a)			_LIT8(KLogComponent, a);
 #define LEAVEIFERRORL(a)				VerboseLeaveIfErrorL(KLogComponent, __FILE__, __LINE__, a)
 #define LEAVEL(a)						VerboseLeaveL(KLogComponent, __FILE__, __LINE__, a)
 #define PANIC(CAT, CODE) 				VerbosePanic(KLogComponent, __FILE__, __LINE__, CODE, (TText8*)#CODE, CAT)
@@ -81,6 +82,7 @@
 #else
 #define CONNECT_LOGGER
 #define CLOSE_LOGGER
+#define DEFINE_LOG_COMPONENT(a)
 #define LEAVEIFERRORL(a)				static_cast<void>(User::LeaveIfError(a))
 #define LEAVEL(a)						User::Leave(a)
 #define PANIC(CAT, CODE) 				User::Panic(CAT, CODE)
@@ -141,6 +143,9 @@
 
 // We want a 10-character string (but allow for the NULL terminator).
 #define PANICCATEGORY(aaa) __ASSERT_COMPILE(sizeof(L##aaa)/2 <= 11); _LIT(KMungedPanicCat, aaa) 
+#define PANIC_CATEGORY(aaa) PANICCATEGORY(aaa);
+
+#define DEBUG_PANIC_CATEGORY(aaa) __DEBUG_ONLY(PANICCATEGORY(aaa);)
 
 // A handy panic-self macro- the category is whatever has been declared with 
 // BTPANICCATEGORY, with " line#" appended. The panic code is the line number. 
--- a/bluetooth/btsdp/BWINS/SDPDATABASEU.DEF	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btsdp/BWINS/SDPDATABASEU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -26,7 +26,7 @@
 	?AppendValueL@CSdpAttrValueList@@QAEXPAVCSdpAttrValue@@@Z @ 25 NONAME ; void CSdpAttrValueList::AppendValueL(class CSdpAttrValue *)
 	?At@CSdpSearchPattern@@QBE?BVTUUID@@H@Z @ 26 NONAME ; class TUUID const CSdpSearchPattern::At(int) const
 	?AttrCount@CSizeAccumulator@@QAEHH@Z @ 27 NONAME ; int CSizeAccumulator::AttrCount(int)
-	?AttributeOf@CSizeAccumulator@@QAEPAVCAttrSizeItem@@HH@Z @ 28 NONAME ; class CAttrSizeItem * CSizeAccumulator::AttributeOf(int, int)
+	?AttributeOf@CSizeAccumulator@@QAEPAVTAttrSizeItem@@HH@Z @ 28 NONAME ; class TAttrSizeItem * CSizeAccumulator::AttributeOf(int, int)
 	?BufferedParseL@CElementParser@@QAEHABVTDesC8@@@Z @ 29 NONAME ; int CElementParser::BufferedParseL(class TDesC8 const &)
 	?BuildBooleanL@CSdpAttrValueList@@UAEPAVMSdpElementBuilder@@H@Z @ 30 NONAME ABSENT ; class MSdpElementBuilder * CSdpAttrValueList::BuildBooleanL(int)
 	?BuildBooleanL@MSdpElementBuilder@@UAEPAV1@H@Z @ 31 NONAME ; class MSdpElementBuilder * MSdpElementBuilder::BuildBooleanL(int)
@@ -50,7 +50,7 @@
 	?BuildUnknownL@CSdpAttrValueList@@UAEPAVMSdpElementBuilder@@EEABVTDesC8@@@Z @ 49 NONAME ABSENT ; class MSdpElementBuilder * CSdpAttrValueList::BuildUnknownL(unsigned char, unsigned char, class TDesC8 const &)
 	?BuildUnknownL@MSdpElementBuilder@@UAEPAV1@EEABVTDesC8@@@Z @ 50 NONAME ; class MSdpElementBuilder * MSdpElementBuilder::BuildUnknownL(unsigned char, unsigned char, class TDesC8 const &)
 	?Builder@CElementParser@@QAEPAVMSdpElementBuilder@@XZ @ 51 NONAME ; class MSdpElementBuilder * CElementParser::Builder(void)
-	?CHandleItemL@CHandleItem@@SAPAV1@KPAVCSdpServRecord@@@Z @ 52 NONAME ; class CHandleItem * CHandleItem::CHandleItemL(unsigned long, class CSdpServRecord *)
+	?CHandleItemL@CHandleItem@@SAPAV1@KPAVCSdpServRecord@@@Z @ 52 NONAME ABSENT ; class CHandleItem * CHandleItem::CHandleItemL(unsigned long, class CSdpServRecord *)
 	?ClientUid@CSdpServRecord@@QBE?AVTUid@@XZ @ 53 NONAME ; class TUid CSdpServRecord::ClientUid(void) const
 	?Close@RSdpDatabase@@UAEXXZ @ 54 NONAME ; void RSdpDatabase::Close(void)
 	?Connect@RSdp@@QAEHXZ @ 55 NONAME ; int RSdp::Connect(void)
@@ -91,7 +91,7 @@
 	?NewEncodedL@CSdpAttrValueEncoded@@SAPAV1@ABVTDesC8@@@Z @ 90 NONAME ; class CSdpAttrValueEncoded * CSdpAttrValueEncoded::NewEncodedL(class TDesC8 const &)
 	?NewIntL@CSdpAttrValueInt@@SAPAV1@ABVTDesC8@@@Z @ 91 NONAME ; class CSdpAttrValueInt * CSdpAttrValueInt::NewIntL(class TDesC8 const &)
 	?NewL@CElementParser@@SAPAV1@PAVMSdpElementBuilder@@@Z @ 92 NONAME ; class CElementParser * CElementParser::NewL(class MSdpElementBuilder *)
-	?NewL@CHandleItem@@SAPAV1@XZ @ 93 NONAME ; class CHandleItem * CHandleItem::NewL(void)
+	?NewL@CHandleItem@@SAPAV1@XZ @ 93 NONAME ABSENT ; class CHandleItem * CHandleItem::NewL(void)
 	?NewL@CResponseSizeVisitor@@CAPAV1@XZ @ 94 NONAME ABSENT ; class CResponseSizeVisitor * CResponseSizeVisitor::NewL(void)
 	?NewL@CSdpAttr@@SAPAV1@GPAVMSdpElementBuilder@@@Z @ 95 NONAME ; class CSdpAttr * CSdpAttr::NewL(unsigned short, class MSdpElementBuilder *)
 	?NewL@CSdpAttrIdMatchList@@SAPAV1@ABV1@@Z @ 96 NONAME ; class CSdpAttrIdMatchList * CSdpAttrIdMatchList::NewL(class CSdpAttrIdMatchList const &)
@@ -101,7 +101,7 @@
 	?NewL@CSdpServRecord@@SAPAV1@XZ @ 100 NONAME ; class CSdpServRecord * CSdpServRecord::NewL(void)
 	?NewL@CServiceSearchVisitor@@SAPAV1@ABVCSdpSearchPattern@@@Z @ 101 NONAME ; class CServiceSearchVisitor * CServiceSearchVisitor::NewL(class CSdpSearchPattern const &)
 	?NewL@CSizeAccumulator@@SAPAV1@XZ @ 102 NONAME ; class CSizeAccumulator * CSizeAccumulator::NewL(void)
-	?NewLC@CHandleItem@@SAPAV1@XZ @ 103 NONAME ; class CHandleItem * CHandleItem::NewLC(void)
+	?NewLC@CHandleItem@@SAPAV1@XZ @ 103 NONAME ABSENT ; class CHandleItem * CHandleItem::NewLC(void)
 	?NewLC@CResponseSizeVisitor@@CAPAV1@XZ @ 104 NONAME ABSENT ; class CResponseSizeVisitor * CResponseSizeVisitor::NewLC(void)
 	?NewLC@CSdpDatabase@@SAPAV1@XZ @ 105 NONAME ; class CSdpDatabase * CSdpDatabase::NewLC(void)
 	?NewLC@CServiceSearchVisitor@@SAPAV1@ABVCSdpSearchPattern@@@Z @ 106 NONAME ; class CServiceSearchVisitor * CServiceSearchVisitor::NewLC(class CSdpSearchPattern const &)
--- a/bluetooth/btsdp/EABI/sdpdatabaseU.DEF	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btsdp/EABI/sdpdatabaseU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -11,9 +11,9 @@
 	_ZN10TSdpIntBufImEC2ERKm @ 10 NONAME
 	_ZN10TSdpIntBufItEC1ERKt @ 11 NONAME
 	_ZN10TSdpIntBufItEC2ERKt @ 12 NONAME
-	_ZN11CHandleItem12CHandleItemLEmP14CSdpServRecord @ 13 NONAME
-	_ZN11CHandleItem4NewLEv @ 14 NONAME
-	_ZN11CHandleItem5NewLCEv @ 15 NONAME
+	_ZN11CHandleItem12CHandleItemLEmP14CSdpServRecord @ 13 NONAME ABSENT
+	_ZN11CHandleItem4NewLEv @ 14 NONAME ABSENT
+	_ZN11CHandleItem5NewLCEv @ 15 NONAME ABSENT
 	_ZN11CRecordAttrC1Ev @ 16 NONAME
 	_ZN11CRecordAttrC2Ev @ 17 NONAME
 	_ZN11CRecordAttrD0Ev @ 18 NONAME
--- a/bluetooth/btsdp/database/responsesizevisitor.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btsdp/database/responsesizevisitor.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -19,30 +19,40 @@
 #include "mignorer.h"
 #include "DataEncoder.h"
 
+#include <bluetooth/logger.h>
+DEFINE_LOG_COMPONENT(LOG_COMPONENT_SDPDATABASE)
+
+DEBUG_PANIC_CATEGORY("sdprspvis")
+
 
 // Class CHandleItem
-EXPORT_C CHandleItem* CHandleItem::NewLC()
+
+CHandleItem* CHandleItem::NewLC(TSdpServRecordHandle aHandleID, CSdpServRecord* aRecord)
 	{
-	CHandleItem* self = new(ELeave)CHandleItem();
+	LOG_STATIC_FUNC
+	CHandleItem* self = new(ELeave) CHandleItem(aHandleID, aRecord);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	return self;
 	}
 
-EXPORT_C CHandleItem* CHandleItem::NewL()
+CHandleItem::CHandleItem(TSdpServRecordHandle aHandleID, CSdpServRecord* aRecord)
+	: CBase()
+	, iHandleID(aHandleID)
+	, iRecord(aRecord)
 	{
-	CHandleItem* self = CHandleItem::NewLC();
-	CleanupStack::Pop();
-	return self;
+	LOG_FUNC
 	}
 
 void CHandleItem::ConstructL()
 	{
-	iAttrSizeList = new (ELeave) CArrayPtrFlat<CAttrSizeItem>(KSDPAttListGran);
+	LOG_FUNC
+	iAttrSizeList = new (ELeave) CArrayPtrFlat<TAttrSizeItem>(KSDPAttListGran);
 	}
 
 CHandleItem::~CHandleItem()
 	{
+	LOG_FUNC
 	if (iAttrSizeList)
 		{
 		iAttrSizeList->ResetAndDestroy();
@@ -50,16 +60,7 @@
 		}
 	}
 
-EXPORT_C CHandleItem* CHandleItem::CHandleItemL(TSdpServRecordHandle aHandleID, CSdpServRecord* aRecord)
-	{
-	CHandleItem* self = NewL();
-	self->iHandleID = aHandleID;
-	self->iRecord = aRecord;
-	self->iRecordSize = 0;
-	return self;
-	}
-
-void CHandleItem::AddAttrItemL(CAttrSizeItem* aItem)
+void CHandleItem::AddAttrItemL(TAttrSizeItem* aItem)
 	{
 	iAttrSizeList->AppendL(aItem);
 	iRecordSize += aItem->Size() + 3; // add the attrID header size;
@@ -67,8 +68,10 @@
 
 void CHandleItem::AddAttrItemL(const TSdpAttributeID aAttributeID, TUint aSize, CSdpAttr* aAttribute)
 	{
-	CAttrSizeItem* sizeItem = new (ELeave) CAttrSizeItem(aAttributeID, aSize, aAttribute);
+	TAttrSizeItem* sizeItem = new (ELeave) TAttrSizeItem(aAttributeID, aSize, aAttribute);
+	CleanupStack::PushL(sizeItem);
 	AddAttrItemL(sizeItem);
+	CleanupStack::Pop(sizeItem);
 	}
 
 
@@ -116,13 +119,12 @@
 		{
 		for (TInt j = 0; j<AttrCount(i); j++)
 			{
-			CAttrSizeItem* attr = AttributeOf(i,j);
+			TAttrSizeItem* attr = AttributeOf(i,j);
 			CSdpAttrValue& theVal = attr->Attr()->Value();
 			Mem::Crc(totalCrc, reinterpret_cast<const TAny*>(theVal.Des()[0]), attr->Size());
 			}
 		}
 	return totalCrc;
-
 	}
 
 /**
@@ -160,7 +162,7 @@
 		TInt attrCount = AttrCount(i); // for testing
 		for (TInt j = iFirstAtt; j < attrCount; j++)
 			{
-			CAttrSizeItem* attr = AttributeOf(i,j);
+			TAttrSizeItem* attr = AttributeOf(i,j);
 			recordSize += attr->Size();
 			recordSize +=3;		// the size of a attribute ID in the list
 			}
@@ -284,7 +286,7 @@
 		totalSize += desSize;
 		while (more && (iFirstAtt < topAtt))
 			{
-			CAttrSizeItem* attr = AttributeOf(iFirstRec, iFirstAtt);
+			TAttrSizeItem* attr = AttributeOf(iFirstRec, iFirstAtt);
 			TUint nextSize = attr->Size();
 			nextSize += 3;	// Attribute ID and its header
 			if (totalSize + nextSize > aOffset)
@@ -309,7 +311,6 @@
 	aAtt = iFirstAtt;
 	aPartSent = aOffset - totalSize;
 	return ETrue;
-//	__ASSERT_DEBUG(totalSize != aOffset, DbPanic(ESdpDbBadSearchPattern));
 	}
 
 EXPORT_C TInt CSizeAccumulator::HandleCount()
@@ -330,77 +331,69 @@
 
 EXPORT_C TInt CSizeAccumulator::AttrCount(TInt aOffset)
 	{
-	if (iHandleList->Count() == 0) return 0;
+	if (iHandleList->Count() == 0)
+		{
+		return 0;
+		}
 	__ASSERT_DEBUG(aOffset <= iHandleList->Count(), DbPanic(ESdpDbBadSearchPattern));
-	if (iHandleList->At(aOffset) == NULL) return 0;
-	return iHandleList->At(aOffset)->CHandleItem::iAttrSizeList->Count();
-	}
-
-EXPORT_C CAttrSizeItem* CSizeAccumulator::AttributeOf(TInt aHandleOffset, TInt aAttOffset)
-	{
-	if (iHandleList->Count() == 0) return (CAttrSizeItem*)0;
-	__ASSERT_DEBUG(aHandleOffset < iHandleList->Count(), DbPanic(ESdpDbBadSearchPattern));
-	CHandleItem* hnd = iHandleList->At(aHandleOffset);
-	if (hnd->iAttrSizeList->Count() == 0) return (CAttrSizeItem*)0;
-	__ASSERT_DEBUG(aAttOffset < hnd->iAttrSizeList->Count(), DbPanic(ESdpDbBadSearchPattern));
-//	return iHandleList->At(aHandleOffset)->CHandleItem::iAttrSizeList->At(aAttOffset);
-	return hnd->iAttrSizeList->At(aAttOffset);
+	
+	if (!iHandleList->At(aOffset))
+		{
+		return 0;
+		}
+	
+	return iHandleList->At(aOffset)->iAttrSizeList->Count();
 	}
 
-
-
-// need this because CResponseSizeVisitor already has start list method...
-class CSizeEncVisitorAdaptor : public MIgnorer
+EXPORT_C TAttrSizeItem* CSizeAccumulator::AttributeOf(TInt aHandleOffset, TInt aAttOffset)
 	{
-public:
-	CSizeEncVisitorAdaptor(CResponseSizeVisitor& aVisitor)
-		:iVisitor(aVisitor)
-		{}
-	MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID)
+	if (iHandleList->Count() == 0)
 		{
-		iVisitor.FoundUUIDL(aUUID);
-		return this;
+		return NULL;
 		}
-private:
-	CResponseSizeVisitor& iVisitor;
-	};
-
-
+	__ASSERT_DEBUG(aHandleOffset < iHandleList->Count(), DbPanic(ESdpDbBadSearchPattern));
+	
+	CHandleItem* hnd = iHandleList->At(aHandleOffset);
+	
+	if (hnd->iAttrSizeList->Count() == 0)
+		{
+		return NULL;
+		}
+	__ASSERT_DEBUG(aAttOffset < hnd->iAttrSizeList->Count(), DbPanic(ESdpDbBadSearchPattern));
+	
+	return hnd->iAttrSizeList->At(aAttOffset);
+	}
 
 
 // Class CResponseSizeVisitor 
 
 CResponseSizeVisitor::CResponseSizeVisitor()
+	: CBase()
+	, iAdapter(*this)
 	{
+	LOG_FUNC
 	}
 
 CResponseSizeVisitor::~CResponseSizeVisitor()
 	{
+	LOG_FUNC
 	delete iFoundIndex;
-	delete iCurrentRec;
-	delete iAdapter;
 	delete iParser;
 	}
 
 CResponseSizeVisitor* CResponseSizeVisitor::NewLC()
 	{
-	CResponseSizeVisitor* self = new(ELeave)CResponseSizeVisitor();
+	LOG_STATIC_FUNC
+	CResponseSizeVisitor* self = new(ELeave) CResponseSizeVisitor();
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	return self;
 	}
 
-CResponseSizeVisitor* CResponseSizeVisitor::NewL()
-	{
-	CResponseSizeVisitor* self = CResponseSizeVisitor::NewLC();
-	CleanupStack::Pop();
-	return self;
-	}
-
 void CResponseSizeVisitor::ConstructL()
 	{
-	iAdapter = new(ELeave) CSizeEncVisitorAdaptor(*this);
-	iParser = CElementParser::NewL(iAdapter);
+	LOG_FUNC
+	iParser = CElementParser::NewL(&iAdapter);
 	}
 
 // Iterate thru attributes in record
@@ -412,121 +405,138 @@
 */
 void CResponseSizeVisitor::SearchRecordL(CSdpServRecord& aRec)
 	{
-// could be in calling routine
+	LOG_FUNC
+	// could be in calling routine
 	if (iSearchPattern)
-	{
-		if (iFoundIndex)
-			{
-			delete iFoundIndex;
-			iFoundIndex = 0;
-			}
+		{
+		delete iFoundIndex;
+		iFoundIndex = NULL;
 		iFoundIndex = CBitMapAllocator::NewL(iSearchSize);
 		iUseThis = EFalse;
-	}
+		}
 	else
+		{
 		iUseThis = ETrue;
-//	if (iCurrentRec) delete iCurrentRec;	// I want a reset.
-	iCurrentRec = CHandleItem::CHandleItemL(aRec.Handle(), &aRec);
+		}
+		
+	CHandleItem* currentRec = CHandleItem::NewLC(aRec.Handle(), &aRec);
 	
 	for(TServAttrIter attrIter(aRec.AttributeIter()); attrIter; attrIter++)
 		{
-/* 
-	we are checking every attribute, searching for the UUIDs. We don't exit if
-	we find them all because we also want to get the sizes of any attributes which
-	match our list if we have one.
-	The array of sizes is built, then thrown away if it doesn't match.
- 
-*/
+		// we are checking every attribute, searching for the UUIDs. We don't exit if
+		// we find them all because we also want to get the sizes of any attributes which
+		// match our list if we have one.
+		// The array of sizes is built, then thrown away if it doesn't match.
+		
+		CSdpAttr* attr = attrIter;
+		
 		if (iAtMatList)
 			{
-			TSdpAttributeID theAttrID = (*attrIter).AttributeID();
+			TSdpAttributeID theAttrID = attr->AttributeID();
 			if(iAtMatList->InMatchList(theAttrID))
 				{// create a new array entry
-				TUint size = (*attrIter).Value().DataSize();
-				TSdpElementType type = (*attrIter).Value().Type();
+				TUint size = attr->Value().DataSize();
+				TSdpElementType type = attr->Value().Type();
 				if (type != ETypeEncoded) 
 					{
-// some server records may be un-encoded
+					// some server records may be un-encoded
 					size += TElementEncoder::HeaderSize(type, size); // add the header size
 					}
-				if(!(type==ETypeNil)&&!(type==ETypeEncoded&&size<=1))
-				{ // only include attribute if not either null or encoded null ...
-				  // (size of encoded (which INCLUDES header) in all non-null cases is > 1
-				  //  because other attribute types either have
-				  //  to have a header plus at least one byte, or they have at least a two byte header.)
-					iCurrentRec->AddAttrItemL(theAttrID, size, attrIter);
+				if(type != ETypeNil && !(type == ETypeEncoded && size <= 1))
+					{
+					// only include attribute if not either null or encoded null ...
+					// (size of encoded (which INCLUDES header) in all non-null cases is > 1
+					//  because other attribute types either have
+					//  to have a header plus at least one byte, or they have at least a two byte header.)
+					currentRec->AddAttrItemL(theAttrID, size, attr);
 					}
 				}
 			}
 		// check if any UUIDs match only if we have a UUIDList.
-		if (iSearchPattern) (*attrIter).AcceptVisitorL(*this);
+		if (iSearchPattern)
+			{
+			attr->AcceptVisitorL(*this);
+			}
 		}
+	
 	if (iUseThis)
 		{
 		// now we have to copy the array(s) we've built up.
-		iCollector->AddHandleL(iCurrentRec);
-		iCurrentRec = 0;
+		iCollector->AddHandleL(currentRec);
+		CleanupStack::Pop(currentRec);
 		}
 	else
 		{
-		delete iCurrentRec;	// I don't want a heap fault.
-		iCurrentRec = 0;
+		CleanupStack::PopAndDestroy(currentRec);
 		}
 	}
 
 
-//	static void SizeRespSSL(CSdpDatabase& aDb, const CSdpSearchPattern &aPattern, const CSizeAccumulator& aCollector);
-//	static void SizeRespARL(CSdpServRecord& aRec, CSdpAttrIdMatchList &aList, const CSizeAccumulator& aCollector);
-//	static void SizeRespSAL(CSdpDatabase &aDb, const CSdpSearchPattern &aPattern, CSdpAttrIdMatchList &aList, const CSizeAccumulator& aCollector);
-// we need three of these calls, all slightly different
-	EXPORT_C void CResponseSizeVisitor::SizeRespSSL(CSdpDatabase& aDb, const CSdpSearchPattern& aPattern, CSizeAccumulator& aCollector)
-   	{
-	if (aPattern.Count() == 0) User::Leave(KErrArgument); // this is part of spec.
-//	SDP_DEBUG(3, FPrint(_L("Sizing SDP DB for pattern with %d entries\n"), aPattern.Count()));
+EXPORT_C void CResponseSizeVisitor::SizeRespSSL(CSdpDatabase& aDb, const CSdpSearchPattern& aPattern, CSizeAccumulator& aCollector)
+	{
+	LOG_STATIC_FUNC
+	if (aPattern.Count() == 0)
+		{
+		User::Leave(KErrArgument); // this is part of spec.
+		}
+	
+	LOG1(_L8("Sizing SDP DB for pattern with %d entries"), aPattern.Count());
 	CResponseSizeVisitor* theVisitor = CResponseSizeVisitor::NewLC();
+	
 	theVisitor->iCollector = &aCollector;
-	theVisitor->iAtMatList = NULL;		// using it as a flag...
+	theVisitor->iAtMatList = NULL; // using it as a flag...
 	theVisitor->iSearchPattern = &aPattern;
 	theVisitor->iSearchSize = theVisitor->iSearchPattern->Count();
-
+	
 	for(TServRecordIter recIter(aDb.RecordIter()); recIter; recIter++)
 		{// Iterate thru records in Db
 		theVisitor->SearchRecordL(*recIter);
 		}
-	CleanupStack::PopAndDestroy();//theVisitor
+	
+	CleanupStack::PopAndDestroy(theVisitor);
 	}
 
-	EXPORT_C void CResponseSizeVisitor::SizeRespARL(CSdpServRecord& aRec, const CSdpAttrIdMatchList& aList, CSizeAccumulator& aCollector)
+EXPORT_C void CResponseSizeVisitor::SizeRespARL(CSdpServRecord& aRec, const CSdpAttrIdMatchList& aList, CSizeAccumulator& aCollector)
 	{
-//	SDP_DEBUG(3, FPrint(_L("Sizing SDP DB for single record\n")));
+	LOG_STATIC_FUNC
+	
+	LOG(_L8("Sizing SDP DB for single record"));
 	CResponseSizeVisitor* theVisitor = CResponseSizeVisitor::NewLC();
+	
 	theVisitor->iCollector = &aCollector;
-	theVisitor->iAtMatList = &aList;		// using it as a flag...
+	theVisitor->iAtMatList = &aList; // using it as a flag...
 	theVisitor->iSearchPattern = NULL;
 	theVisitor->iSearchSize = 0;
+	
 	theVisitor->SearchRecordL(aRec);
-	CleanupStack::PopAndDestroy();//theVisitor
+	
+	CleanupStack::PopAndDestroy(theVisitor);
 	}
 
-	EXPORT_C void CResponseSizeVisitor::SizeRespSAL(CSdpDatabase &aDb, const CSdpSearchPattern &aPattern, const CSdpAttrIdMatchList& aList, CSizeAccumulator& aCollector)
+EXPORT_C void CResponseSizeVisitor::SizeRespSAL(CSdpDatabase &aDb, const CSdpSearchPattern &aPattern, const CSdpAttrIdMatchList& aList, CSizeAccumulator& aCollector)
 	{
-	if (aPattern.Count() == 0) User::Leave(KErrArgument); // this is part of spec.
-//	SDP_DEBUG(3, FPrint(_L("Sizing SDP DB (and attribs) with %d UUIDs\n"), aPattern.Count()));
+	LOG_STATIC_FUNC
+	if (aPattern.Count() == 0)
+		{
+		User::Leave(KErrArgument); // this is part of spec.
+		}
+	
+	LOG1(_L8("Sizing SDP DB (and attribs) with %d UUIDs"), aPattern.Count());
 	CResponseSizeVisitor* theVisitor = CResponseSizeVisitor::NewLC();
+	
 	theVisitor->iCollector = &aCollector;
-	theVisitor->iAtMatList = &aList;		// using it as a flag...
+	theVisitor->iAtMatList = &aList; // using it as a flag...
 	theVisitor->iSearchPattern = &aPattern;
 	theVisitor->iSearchSize = theVisitor->iSearchPattern->Count();
-
+	
 	for(TServRecordIter recIter(aDb.RecordIter()); recIter; recIter++)
 		{// Iterate thru records in Db
 		theVisitor->SearchRecordL(*recIter);
 		}
-	CleanupStack::PopAndDestroy();//theVisitor
+	
+	CleanupStack::PopAndDestroy(theVisitor);
 	}
 
-
-
 void CResponseSizeVisitor::VisitAttributeL(CSdpAttr& /*aAttribute*/)
 	{
 	}
@@ -538,13 +548,15 @@
 	case ETypeUUID:
 		FoundUUIDL(aValue.UUID());
 		break;
-		case ETypeEncoded:
-// parse out any UUIDs in this encoded attribute
+		
+	case ETypeEncoded:
+		// parse out any UUIDs in this encoded attribute
 		iParser->Reset();
 		/*rem = */iParser->ParseElementsL(aValue.Des());
 		break;
+		
 	default:
-		return;
+		break;
 		}
 	}
 
@@ -558,6 +570,8 @@
 
 void CResponseSizeVisitor::FoundUUIDL(const TUUID& aUUID)
 	{
+	ASSERT_DEBUG(iSearchPattern);
+	ASSERT_DEBUG(iFoundIndex);
 	TInt pos;
 	if (iSearchPattern->Find(aUUID, pos)==0 &&
 		iFoundIndex->IsFree(pos))
@@ -569,3 +583,14 @@
 			}
 		}
 	}
+
+
+TSizeEncVisitorAdaptor::TSizeEncVisitorAdaptor(CResponseSizeVisitor& aVisitor)
+	:iVisitor(aVisitor)
+	{}
+
+MSdpElementBuilder* TSizeEncVisitorAdaptor::BuildUUIDL(const TUUID& aUUID)
+	{
+	iVisitor.FoundUUIDL(aUUID);
+	return this;
+	}
--- a/bluetooth/btsdp/database/responsesizevisitor.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btsdp/database/responsesizevisitor.h	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -35,34 +35,30 @@
 class CSdpAttr;
 
 /** 
-	CAttrSizeItem
+	TAttrSizeItem
 	contains the attribute ID, the size of the attribute and a pointer to the attribute
 	This object is attached to a list (CArrayPtrFlat) contained in CHandleItem object
 **/
-NONSHARABLE_CLASS(CAttrSizeItem) // not a cbase because no benefit, just overhead
-{
+NONSHARABLE_CLASS(TAttrSizeItem)
+	{
 friend class CSizeAccumulator;
 public:
-	CAttrSizeItem(){};
-	~CAttrSizeItem(){iAttribute=0;};
-	CAttrSizeItem(const TSdpAttributeID aAttributeID, TUint aSize, CSdpAttr* aAttribute):
+	TAttrSizeItem(){};
+	TAttrSizeItem(const TSdpAttributeID aAttributeID, TUint aSize, CSdpAttr* aAttribute):
 		iAttributeID(aAttributeID),
 		iSize(aSize),
 		iAttribute(aAttribute) {};
-	inline TSdpAttributeID AttID();
-	inline TUint Size();
-	inline CSdpAttr* Attr();
+	inline TSdpAttributeID AttID() {return iAttributeID;}
+	inline TUint Size() {return iSize;}
+	inline CSdpAttr* Attr() {return iAttribute;}
 
 private:
 	TSdpAttributeID iAttributeID;
 	TUint iSize;
 	CSdpAttr* iAttribute;
-};
-inline TSdpAttributeID CAttrSizeItem::AttID() {return iAttributeID;};
-inline TUint CAttrSizeItem::Size() {return iSize;};
-inline CSdpAttr* CAttrSizeItem::Attr() {return iAttribute;};
+	};
 
-// const TUint KSDPAttListGran = 8*(sizeof(CAttrSizeItem*)); granularity for a Seg
+// const TUint KSDPAttListGran = 8*(sizeof(TAttrSizeItem*)); granularity for a Seg
 const TUint KSDPAttListGran = 8; // granularity for a flat
 
 /**
@@ -71,28 +67,25 @@
 	for that record which match the Attribute ID match list
 **/
 NONSHARABLE_CLASS(CHandleItem) : public CBase
-{
+	{
 friend class CSizeAccumulator;
 public:
 	CHandleItem(){};
+	static CHandleItem* NewLC(TSdpServRecordHandle aHandleID, CSdpServRecord* aRecord);
 	~CHandleItem();
-	IMPORT_C static CHandleItem* NewL();
-	IMPORT_C static CHandleItem* NewLC();
-	IMPORT_C static CHandleItem* CHandleItemL(TSdpServRecordHandle aHandleID, CSdpServRecord* aRecord);
-
-//	PutRecord(TSdpServRecordHandle aHandleID, const CSdpServRecord* aRecord); // update the NULL data
-
-	void AddAttrItemL(CAttrSizeItem* aItem);
+	
+	void AddAttrItemL(TAttrSizeItem* aItem);
 	void AddAttrItemL(const TSdpAttributeID aAttributeID, TUint aSize, CSdpAttr* aAttribute);
-	inline TInt Count();
+	inline TInt Count() {return iAttrSizeList->Count();}
+	
 private:
+	CHandleItem(TSdpServRecordHandle aHandleID, CSdpServRecord* aRecord);
 	void ConstructL();
 	TSdpServRecordHandle iHandleID;
 	CSdpServRecord* iRecord;
 	TUint iRecordSize;
-	CArrayPtrFlat<CAttrSizeItem>* iAttrSizeList; // stores the attributes found
-};
-inline TInt CHandleItem::Count() {return iAttrSizeList->Count();};
+	CArrayPtrFlat<TAttrSizeItem>* iAttrSizeList; // stores the attributes found
+	};
 
 // const TUint KSDPHandListGran = 8*(sizeof(CHandleItem*)); granularity for a Seg
 const TUint KSDPHandListGran = 8; // granularity for a flat
@@ -105,8 +98,6 @@
 	IMPORT_C static CSizeAccumulator* NewL();
 	IMPORT_C static CSizeAccumulator* NewLC();
 	void AddHandleL(CHandleItem* aHandleItem); // create a new array element
-//	void AddHandle(TSdpServRecordHandle aHandleID, CSdpServRecord* aRecord); // create a new array element
-//	void AddAttrib(TSdpAttributeID aAttributeID, CSdpAttr* aAttribute, TUint aSize);
 
 // these methods are used in building the server response once the search has been carried out
 	IMPORT_C TUint SizeLeft(); // can be called before or after setting the start point
@@ -116,7 +107,7 @@
 	IMPORT_C TSdpServRecordHandle HandleAt(TInt aOffset); // returns the Record handle at offset i
 	IMPORT_C TUint HandleSize(TInt aOffset);  // returns the size of the record at offset aOffset
 	IMPORT_C TInt AttrCount(TInt aOffset);	// returns the count of attributes for record at offset i
-	IMPORT_C CAttrSizeItem* AttributeOf(TInt aHandleOffset, TInt aAttOffset); // returns the attribute size object (CAttrSizeItem) at i,j
+	IMPORT_C TAttrSizeItem* AttributeOf(TInt aHandleOffset, TInt aAttOffset); // returns the attribute size object (TAttrSizeItem) at i,j
 
 private:
 	CSizeAccumulator():iFirstRec(0),iFirstAtt(0){};
@@ -137,40 +128,50 @@
 	b carries out the same selection of attributes as CAttrExtractVisitor::EncodeAttributesL
 
 **/
-class CSizeEncVisitorAdaptor;
+class CResponseSizeVisitor;
+
+// need this because CResponseSizeVisitor already has start list method...
+NONSHARABLE_CLASS(TSizeEncVisitorAdaptor) : public MIgnorer
+	{
+public:
+	TSizeEncVisitorAdaptor(CResponseSizeVisitor& aVisitor);
+	MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID);
+	
+private:
+	CResponseSizeVisitor& iVisitor;
+	};
 
 NONSHARABLE_CLASS(CResponseSizeVisitor) : public CBase, public MAttributeVisitor
 	{
+friend class TSizeEncVisitorAdaptor;
 public:
-    ~CResponseSizeVisitor();
-
+	~CResponseSizeVisitor();
+	
 	IMPORT_C static void SizeRespSSL(CSdpDatabase& aDb, const CSdpSearchPattern& aPattern, CSizeAccumulator& aCollector);
 	IMPORT_C static void SizeRespARL(CSdpServRecord& aRec, const CSdpAttrIdMatchList& aList, CSizeAccumulator& aCollector);
 	IMPORT_C static void SizeRespSAL(CSdpDatabase& aDb, const CSdpSearchPattern& aPattern, const CSdpAttrIdMatchList& aList, CSizeAccumulator& aCollector);
-
-	void FoundUUIDL(const TUUID& aUUID); // needs to be public because of the encoder visitor adaptor
-
+	
 private:
-	static CResponseSizeVisitor* NewL();
 	static CResponseSizeVisitor* NewLC();
-    CResponseSizeVisitor();
+	CResponseSizeVisitor();
 	void ConstructL();
-
+	
 	void SearchRecordL(CSdpServRecord& aRec);
-
+	
+	void FoundUUIDL(const TUUID& aUUID);
+	
 	// MAttributeVisitor interface
-    void VisitAttributeL(CSdpAttr &aAttribute);
-    void VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType);
-    void StartListL(CSdpAttrValueList &aList);
-    void EndListL();
-
+	void VisitAttributeL(CSdpAttr &aAttribute);
+	void VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType);
+	void StartListL(CSdpAttrValueList &aList);
+	void EndListL();
+	
 private:
-	CSizeEncVisitorAdaptor* iAdapter;
+	TSizeEncVisitorAdaptor iAdapter;
 	CElementParser* iParser;				// used by the encoded UUID parser
 	const CSdpSearchPattern* iSearchPattern;	// a local pointer to the UUID search list
 	CSizeAccumulator* iCollector;			// a local pointer to the size collector object supplied
 	const CSdpAttrIdMatchList* iAtMatList;		// a local pointer to the attribute match list or NULL
-	CHandleItem* iCurrentRec;				// we build the handle and attribute list and perhaps throw it away
 	CBitMapAllocator* iFoundIndex;			// a simpler match
 	TInt iSearchSize;						// how many items in search pattern
 	TBool	iUseThis;						// do we use this record ?
--- a/bluetooth/btsdp/database/rsdpdatabase.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btsdp/database/rsdpdatabase.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -149,7 +149,13 @@
 This should be used by clients to do resource leakage debugging checks. */
 	{
 	LOG_FUNC
-	SendReceive(ESdpResourceCountMarkStart, TIpcArgs(NULL)); //ss//
+	IF_FLOGGING(TInt err = ) SendReceive(ESdpResourceCountMarkStart, TIpcArgs(NULL)); //ss//
+	IF_FLOGGING(
+		if (err != KErrNone)
+			{
+			LOG1(_L("ALERT: Resource count mark start completed with %d"), err);
+			}
+		);
 	}
 
 EXPORT_C void RSdp::ResourceCountMarkEnd()
@@ -158,7 +164,13 @@
 This should be used by clients to do resource leakage debugging checks. */
 	{
 	LOG_FUNC
-	SendReceive(ESdpResourceCountMarkEnd, TIpcArgs(NULL)); //ss//
+	IF_FLOGGING(TInt err = ) SendReceive(ESdpResourceCountMarkEnd, TIpcArgs(NULL)); //ss//
+	IF_FLOGGING(
+		if (err != KErrNone)
+			{
+			LOG1(_L("ALERT: Resource count mark end completed with %d"), err);
+			}
+		);
 	}
 
 EXPORT_C TInt RSdp::ResourceCount()
@@ -171,7 +183,13 @@
 	LOG_FUNC
 	TInt count = 0;
 	TPckgBuf<TInt> pckg(count);
-	SendReceive(ESdpResourceCount, TIpcArgs(&pckg)); //ss//
+	IF_FLOGGING(TInt err = ) SendReceive(ESdpResourceCount, TIpcArgs(&pckg)); //ss//
+	IF_FLOGGING(
+		if (err != KErrNone)
+			{
+			LOG1(_L("ALERT: Resource count completed with %d"), err);
+			}
+		);
 	return pckg();
 	}
 
@@ -449,7 +467,8 @@
 	if (SubSessionHandle())
 		{
 		 //The '5' below is max ratio of number of UTF_8 chars to number of unicode chars .
-		HBufC8* buf = HBufC8::NewLC(5*aDesCValue.Length());
+		TInt size = 5*aDesCValue.Length(); 
+		HBufC8* buf = HBufC8::NewLC(size);
 		TPtr8 ptr = buf->Des();
 		CnvUtfConverter::ConvertFromUnicodeToUtf8(ptr, aDesCValue);
 		UpdateAttributeL(aHandle, aAttrID, ptr);
@@ -545,7 +564,13 @@
 		TPckg<TSdpAttributeID> idPckg(aAttrID);
 		TPckg<TSdpServRecordHandle> handlePckg(aHandle);
 
-		SendReceive(ESdpDatabaseDeleteAttribute, TIpcArgs(&handlePckg, &idPckg));
+		IF_FLOGGING(TInt err = ) SendReceive(ESdpDatabaseDeleteAttribute, TIpcArgs(&handlePckg, &idPckg));
+		IF_FLOGGING(
+			if (err != KErrNone)
+				{
+				LOG1(_L("ALERT: Delete attribute completed with %d"), err);
+				}
+			);
 		}
 	else
 		{
@@ -589,7 +614,13 @@
 		{
 		TPckg<TSdpServRecordHandle> handlePckg(aHandle);
 
-		SendReceive(ESdpDatabaseDeleteServiceRecord, TIpcArgs(&handlePckg));
+		IF_FLOGGING(TInt err = ) SendReceive(ESdpDatabaseDeleteServiceRecord, TIpcArgs(&handlePckg));
+		IF_FLOGGING(
+			if (err != KErrNone)
+				{
+				LOG1(_L("ALERT: Delete service record completed with %d"), err);
+				}
+			);
 		}
 	else
 		{
--- a/bluetooth/btsdp/server/protocol/reqhandler.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btsdp/server/protocol/reqhandler.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -49,11 +49,7 @@
 		}
 	}
 
-#ifdef __FLOGGING__
-TInt SdpReqHandler::RunError(TInt aError, const TSdpPdu& aReqPdu, TSdpPdu &aRespPdu)
-#else
 TInt SdpReqHandler::RunError(TInt aError, const TSdpPdu& /*aReqPdu*/, TSdpPdu &aRespPdu)
-#endif
 /**
 	Send an appropriate error.
 
@@ -371,7 +367,7 @@
 	TInt oldLen = responseAttributes.Length();
 	responseAttributes.SetLength(oldLen + KRspAttributeCountSize);
 	BigEndian::Put16(&responseAttributes[KRspAttributeCountOffset], (TUint16)(pduSize));
-	CAttrSizeItem* currentAttItem = collector->AttributeOf(sentRecords, sentAttributes);
+	TAttrSizeItem* currentAttItem = collector->AttributeOf(sentRecords, sentAttributes);
 	TInt lastAttr = collector->AttrCount(sentRecords);
 	TPtrC8 attrValPtr(0,0);
 	TBuf8<1> wBuffer(1); // used for byte insertion
@@ -615,7 +611,7 @@
 	TInt oldLen = responseAttributes.Length();
 	responseAttributes.SetLength(oldLen + KRspAttributeCountSize);
 	BigEndian::Put16(&responseAttributes[KRspAttributeCountOffset], (TUint16)(pduSize));
-	CAttrSizeItem* currentAttItem = collector->AttributeOf(sentRecords, sentAttributes);
+	TAttrSizeItem* currentAttItem = collector->AttributeOf(sentRecords, sentAttributes);
 	TInt lastAttr = collector->AttrCount(sentRecords);
 	TPtrC8 attrValPtr(0,0);
 	TBuf8<1> wBuffer(1); // used for byte insertion
--- a/bluetooth/btstack/avctp/avctp.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avctp/avctp.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -388,6 +388,7 @@
 	localAddr.SetSecurity(sec);
 	
 	CleanupStack::Pop(sap);
+	__ASSERT_DEBUG(!iListener, Panic(EObjectAlreadyExists));
 	iListener = CIncomingConnectionListener::NewL(*this, sap, localAddr, KProtocolListeningQueueSize);										
 	
 	CServProviderBase* sap2 =iLowerProtocol->NewSAPL(KSockSeqPacket);
--- a/bluetooth/btstack/avctp/avctpmuxer.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avctp/avctpmuxer.h	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -39,7 +39,7 @@
 
 typedef THashMapIter<TInt, const TClientItem*> TClientItemIter;
 
-class TAvctpSecondChannelPseudoSocket : public MSocketNotify
+NONSHARABLE_CLASS(TAvctpSecondChannelPseudoSocket) : public MSocketNotify
 	{
 public:
 	TAvctpSecondChannelPseudoSocket(MSecondChannelPseudoSocketNotify& aNotify);
--- a/bluetooth/btstack/avctp/avctpmuxerstates.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avctp/avctpmuxerstates.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -410,6 +410,7 @@
 	if (aAddr != TBTDevAddr(0))
 		{
 		// New this up just in time.
+		__ASSERT_DEBUG(!aTransport.iChannelSAPs[KAvctpPrimaryChannel], Panic(EObjectAlreadyExists));
 		TRAP(ret, aTransport.iChannelSAPs[KAvctpPrimaryChannel] = aTransport.iProtocol.LowerProtocol()->NewSAPL(KSockSeqPacket));
 		if (ret == KErrNone)
 			{
--- a/bluetooth/btstack/avctp/avctpsap.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avctp/avctpsap.h	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -191,7 +191,7 @@
 
 // the SAPs are "sockets" so that the avctp transport can be very thin and "transient" so effectively forwards calls from L2CAP
 // perhaps with a bit of roundrobinning in the CanSend
-class CAvctpControlSAP : public CBluetoothSAP, public MSocketNotify
+NONSHARABLE_CLASS(CAvctpControlSAP) : public CBluetoothSAP, public MSocketNotify
 	{
 public:
 	static CAvctpControlSAP* NewL(CAvctpProtocol& aProtocol);
--- a/bluetooth/btstack/avctp/avctputils.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avctp/avctputils.h	Wed Oct 13 16:20:29 2010 +0300
@@ -165,6 +165,7 @@
 	EAvctpInvalidChannelIoctl = 66,
 	EAvctpSapClosed = 67,
 	ENullAvctpProtocol = 68,
+	EObjectAlreadyExists = 69,
 	};
 
 /**
--- a/bluetooth/btstack/avdtp/avdtpConfigurators.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpConfigurators.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -39,7 +39,10 @@
 	}
 
 
-
+CSEPConfigurator::~CSEPConfigurator()
+	{
+	LOG_FUNC
+	}
 
 CRemoteSEPConfigurator* CRemoteSEPConfigurator::NewL(CSignallingSession& aSignallingSession,
 													 CAvdtpProtocol& aProtocol,
--- a/bluetooth/btstack/avdtp/avdtpConfigurators.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpConfigurators.h	Wed Oct 13 16:20:29 2010 +0300
@@ -33,6 +33,8 @@
 public:
 	virtual TInt AddCapability(const TDesC8& aOption) =0;
 	virtual TInt Finalise() =0;
+	~CSEPConfigurator();
+
 protected:
 	CSEPConfigurator(CSignallingSession& aSignallingSession, CAvdtpProtocol& aProtocol);
 	inline CSignallingSession& SignallingSession() const 
--- a/bluetooth/btstack/avdtp/avdtpDirectChannel.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpDirectChannel.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -45,6 +45,11 @@
 	LOG_FUNC
 	}
 		
+CDirectChannel::~CDirectChannel()
+	{
+	LOG_FUNC
+	}
+
 TInt CDirectChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType /*aType*/, TL2CapConfig::TChannelPriority aPriority)
 	{
 	LOG_FUNC
--- a/bluetooth/btstack/avdtp/avdtpDirectChannel.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpDirectChannel.h	Wed Oct 13 16:20:29 2010 +0300
@@ -33,6 +33,8 @@
 public:
 	static CDirectChannel* NewL(CAvdtpProtocol& aProtocol,
 								const TBTDevAddr& aRemoteDevice);
+	~CDirectChannel();
+
 	//from base
 // can just forward down to L2CAP...
 
--- a/bluetooth/btstack/avdtp/avdtpLogicalChannelFactory.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpLogicalChannelFactory.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -672,6 +672,11 @@
 	{
 	LOG_FUNC
 	__ASSERT_DEBUG(iCurrentActiveJob && iCurrentActiveJob->iNumChannelsRequired, Panic(EAvdtpLogicalChannelFactoryJobHasNoLogicalChannels));
+	if(!(iCurrentActiveJob && iCurrentActiveJob->iNumChannelsRequired))
+	    {
+	    FLOG(_L("CLogicalChannelFactory::DoObtainChannelL called when current job was either non existant or not requiring channels."));
+	    User::Leave(KErrNotReady);
+	    }
 	
 	static const TInt KAVDTPPSM = 0x19;	
 	
@@ -720,6 +725,7 @@
 	// The call to ActiveOpen could affect iCurrentActiveJob if 
 	// L2CAP synchrononously errors -- in which case iCurrentActiveJob could now
 	// have become NULL. Make sure it is still valid.
+    // coverity[check_after_deref]
 	if (iCurrentActiveJob)
 		{		
 		// decrement how many more channels required for this job
--- a/bluetooth/btstack/avdtp/avdtpMediaSession.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpMediaSession.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -59,6 +59,11 @@
 	iPacketsLost = 0;
 	}
 	
+CMediaSession::~CMediaSession()
+	{
+	LOG_FUNC
+	}
+
 void CMediaSession::ConstructL()
 	{
 	LOG_FUNC
--- a/bluetooth/btstack/avdtp/avdtpMediaSession.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpMediaSession.h	Wed Oct 13 16:20:29 2010 +0300
@@ -34,6 +34,7 @@
 public:
 	static CMediaSession* NewLC(CAvdtpProtocol& aProtocol, CAvdtpSAP& aSAP, CAVStream& aStream);
 	static CMediaSession* NewL(CAvdtpProtocol& aProtocol, CAvdtpSAP& aSAP, CAVStream& aStream);
+	~CMediaSession();
 
 	virtual TInt GetOption(TUint aLevel, TUint aName, TDes8& aOption) const;
 	virtual void Ioctl(TUint aLevel, TUint aName,  const TDesC8* aOption);
--- a/bluetooth/btstack/avdtp/avdtpMuxChannel.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpMuxChannel.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -163,7 +163,7 @@
 void CMuxChannel::ConstructL(TTCID aRemotelyAssignedTCID)
 	{
 	LOG_FUNC
-//	iHeartbeat = CHeartbeat::NewL()
+	
 	iMuxSendTimer = CPeriodic::NewL(EPriorityHigh);
 #ifdef HAVE_INBOUND_MUX_PACKET
 	iInboundMessage = CAvdtpInboundMuxedMessage::NewL(*this);
@@ -205,7 +205,7 @@
 CMuxChannel::~CMuxChannel()
 	{
 	LOG_FUNC
-	iMuxSendTimer->Cancel();
+	delete iMuxSendTimer;
 	iTCID.Close();
 	}
 	
@@ -435,6 +435,9 @@
 		case ERecovery:
 			array = &iRecoverySessions;
 			break;
+		default:
+			__ASSERT_DEBUG(ETrue, Panic(EAVDTPBadSessionDetachFromTransportChannel));
+			break;
 		}
 	
 #ifdef _DEBUG
--- a/bluetooth/btstack/avdtp/avdtpSignallingMessages.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpSignallingMessages.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -37,13 +37,23 @@
 	LOG_FUNC
 	Data().Init();
 	}
-	
+
+CAvdtpSignallingMessage::~CAvdtpSignallingMessage()
+	{
+	LOG_FUNC
+	}
+
 CAvdtpInboundSignallingMessage::CAvdtpInboundSignallingMessage(CSignallingChannel& aSignallingChannel)
 : iSignallingChannel(aSignallingChannel)
 	{
 	LOG_FUNC
 	}
 
+CAvdtpInboundSignallingMessage::~CAvdtpInboundSignallingMessage()
+	{
+	LOG_FUNC
+	}
+
 /*static*/ void CAvdtpOutboundSignallingMessage::PrependSignallingHeaderL(
 									RMBufChain& aDest,
 									const TAvdtpPacketType& aPacketType,
--- a/bluetooth/btstack/avdtp/avdtpSignallingMessages.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpSignallingMessages.h	Wed Oct 13 16:20:29 2010 +0300
@@ -202,6 +202,7 @@
 	inline TAvdtpMessage Signal() const;
 protected:
 	CAvdtpSignallingMessage();
+	~CAvdtpSignallingMessage();
 protected:
 	TAvdtpMessageType		iMessageType;
 	TAvdtpMessage			iSignal;
@@ -219,6 +220,7 @@
 	{
 public:
 	explicit CAvdtpInboundSignallingMessage(CSignallingChannel& aSignallingChannel);
+	~CAvdtpInboundSignallingMessage();
 	virtual TInt NewData(TUint aCount);
 private:	
 	static TAvdtpMessage SignalIdentifier(const RMBufChain& aMessage);
--- a/bluetooth/btstack/avdtp/avdtpStream.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpStream.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -645,7 +645,7 @@
 	LOG_FUNC
 	CTimer::ConstructL();
 	}
-	
+
 CWatchdogTimer::CWatchdogTimer(CAVStream& aObserver)
 : CTimer(EPriorityStandard), iObserver(aObserver)
 	{
@@ -653,6 +653,11 @@
 	CActiveScheduler::Add(this);
 	}
 	
+CWatchdogTimer::~CWatchdogTimer()
+	{
+	LOG_FUNC
+	}
+
 void CWatchdogTimer::RunL()
 	{
 	LOG_FUNC
--- a/bluetooth/btstack/avdtp/avdtpStream.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpStream.h	Wed Oct 13 16:20:29 2010 +0300
@@ -254,6 +254,7 @@
 	{
 public:
 	static CWatchdogTimer* NewL(CAVStream& aObserver);
+	~CWatchdogTimer();
 private:
 	CWatchdogTimer(CAVStream& aObserver);
 	void RunL();
--- a/bluetooth/btstack/bwins/btu.def	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/bwins/btu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -1,6 +1,3 @@
 EXPORTS
 	InstallBTProtocolFamily @ 1 NONAME
-	?NewMuxerL@CAvctpProtocol@@QAEPAVCSubConnectionProviderBase@@AAVCSubConnectionProviderFactoryBase@@AAVCConnectionProviderBase@@@Z @ 2 NONAME ABSENT ; class CSubConnectionProviderBase * CAvctpProtocol::NewMuxerL(class CSubConnectionProviderFactoryBase &, class CConnectionProviderBase &)
-	?NewSapLinksMgrL@CAvctpProtocol@@QAEPAVCSubConnectionProviderBase@@AAVCSubConnectionProviderFactoryBase@@AAVCConnectionProviderBase@@@Z @ 3 NONAME ABSENT ; class CSubConnectionProviderBase * CAvctpProtocol::NewSapLinksMgrL(class CSubConnectionProviderFactoryBase &, class CConnectionProviderBase &)
-	?GetFloggerInfo@CBlogger@@QAEPAXXZ @ 4 NONAME ; void * CBlogger::GetFloggerInfo(void)
 
--- a/bluetooth/btstack/common/blogger.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,894 +0,0 @@
-// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-
-#include "blogger.h"
-
-#ifndef BLOGGING__
-EXPORT_C TAny* CBlogger::GetFloggerInfo()
-	{
-	return 0;
-	}
-#endif
-
-#ifdef BLOGGING__
-#include "rfcommmuxer.h"
-#include "rfcommframe.h"
-
-
-CBlogger::~CBlogger()
-	{
-	delete ifilename;
-	ifile.Close ();
-	ifileserv.Close ();
-	}
-
-CBlogger::CBlogger() : 
-	iOutputWindowSize(KBlogOutputWindowDefault),
-	iVerbosityLevel(KBlogVerbosityAllLevels), 
-	iLayersToLogMask(KBlogAllLayers),
-	iLoggingMask(KBlogTypeLogAllMask)
-	{
-	}
-
-CBlogger* CBlogger::NewL()
-	{
-	CBlogger* self = new (ELeave)CBlogger();
-	self->ConstructL();
-	return self;
-	}
-
-void CBlogger::ConstructL()
-	{
-	User::LeaveIfError(ifileserv.Connect());
-	MakefilenameL(_L("Blog.txt"));
-	iFileExists = EFalse;
-	}
-
-TInt CBlogger::LoggingMask(TInt aLayer, TInt aVerbosity) const
-	{
-	if(aLayer&iLayersToLogMask)
-		{
-		if(aVerbosity<=iVerbosityLevel)
-			{
-			return iLoggingMask;
-			}
-		}
-	//else
-	return 0;
-	}
-
-CBloggette* CBlogger::GetLayerBloggette(TInt aLayer)
-	{
-	switch(aLayer)
-		{
-		case KBlogLayerLinkLayer :
-			{
-			return iLLBloggette;
-			}
-		case KBlogLayerL2CAP :
-			{
-			return iL2Bloggette;
-			}
-		case KBlogLayerRFComm :
-			{
-			return iRFBloggette;
-			}
-		default:
-			{
-			Panic(EBloggerLayerRequestedOutOfRange);
-			return NULL; //for compiler to shut up
-			}
-		};
-	}
-
-void CBlogger::Register(CBloggette* aLayerBloggette)
-/** 
-	only one per layer please
-*/
-	{
-	TUint layer = aLayerBloggette->Layer();
-	switch(layer)
-		{
-		case KBlogLayerLinkLayer:
-			{
-			__ASSERT_DEBUG(iLLBloggette==NULL,Panic(EBloggerLayerBloggetteAlreadyRegistered));
-			iLLBloggette=aLayerBloggette;
-			break;
-			}
-		case KBlogLayerL2CAP :
-			{
-			__ASSERT_DEBUG(iL2Bloggette==NULL,Panic(EBloggerLayerBloggetteAlreadyRegistered));
-			iL2Bloggette=aLayerBloggette;
-			break;
-			}
-		case KBlogLayerRFComm :
-			{
-			__ASSERT_DEBUG(iRFBloggette==NULL,Panic(EBloggerLayerBloggetteAlreadyRegistered));
-			iRFBloggette=aLayerBloggette;
-			break;
-			}
-		default:
-			{
-			Panic(EBloggerLayerRegistrationOutOfRange);
-			}
-		};
-	}
-
-
-TInt CBlogger::UpdateLoggingSettings(TUint aOptionType,const TDesC8& aOption)
-	{
-#define CHECK_OPT_IS_(type) {if (aOption.Size() != sizeof(type)) \
-										return KErrArgument;}
-	switch(aOptionType)
-		{
-		case KBloggerSetLayers:
-			{
-			CHECK_OPT_IS_(TInt);
-			iLayersToLogMask= *(TUint*)aOption.Ptr();
-			break;
-			}
-		case KBloggerSetVerbosity:
-			{
-			CHECK_OPT_IS_(TInt);
-			TInt verbosity=*(TUint*)aOption.Ptr();
-			if((verbosity<KBlogVerbosityOff)||(verbosity>KBlogVerbosityAllLevels))
-				{
-				return KErrArgument;
-				}
-			iVerbosityLevel= verbosity;
-			break;
-			}
-		case KBloggerSetLoggingMask:
-			{
-			CHECK_OPT_IS_(TInt);
-			iLoggingMask= *(TInt*)aOption.Ptr();
-			break;
-			}
-		case KBloggerSetMedium:
-			{
-			CHECK_OPT_IS_(TInt);
-			TInt mediumType=*(TUint*)aOption.Ptr();
-			if((mediumType!=KBlogOutputTypeIsFlogger)||(mediumType!=KBlogOutputTypeIsRDebug))
-				{//otherwise we will panic when we try to output
-				return KErrArgument;
-				}
-			iMediumType= mediumType;
-			break;
-			}
-		case KBloggerSetTestCaseName:
-			{
-			TInt length=Min(KRDBMaxLit,aOption.Length());
-			iTestCaseLit.Copy(((TDesC16*)aOption.Ptr())->Left(length));
-			BlogTestCase(iTestCaseLit);
-			break;
-			}
-		case KBloggerSetOutputWindow:
-			{
-			CHECK_OPT_IS_(TInt);
-			TInt windowSize=*(TUint*)aOption.Ptr();
-			if((windowSize<1)||(windowSize>KRDBMaxLit))
-				{
-				return KErrArgument;
-				}
-			iOutputWindowSize=windowSize;			
-			break;
-			}
-		case KBloggerSetTestCaseResult:
-			{
-			CHECK_OPT_IS_(TInt);
-			TInt tcResult=*(TUint*)aOption.Ptr();
-			if(tcResult>KBlogTestCaseResultUpperNo)
-				{
-				return KErrArgument;	
-				}
-			BlogTestCaseResult(tcResult);
-			break;
-			}
-		case KBloggerSetTesterMessage:
-			{
-			BlogTesterMessage(*(TDesC16*)aOption.Ptr());						
-			break;
-			}
-		case KBloggerSetAllOptions:
-			{
-			CHECK_OPT_IS_(TBlogSettings); // we care about the data pckgd not he pckg itself
-			TBlogSettingsPckg theSettings;
-			theSettings.Copy(aOption);
-
-			TInt verbosity=(theSettings()).iVerbosity;
-			if((verbosity<KBlogVerbosityOff)||(verbosity>KBlogVerbosityAllLevels))
-				{
-				return KErrArgument;
-				}
-
-			TInt mediumType=(theSettings()).iMediumToLog;
-			if((mediumType!=KBlogOutputTypeIsFlogger)&&(mediumType!=KBlogOutputTypeIsRDebug))
-				{//otherwise we will panic when we try to output
-				return KErrArgument;
-				}
-
-			TInt windowSize=(theSettings()).iOutputWindowSize;
-			if((windowSize<1)||(windowSize>KRDBMaxLit))
-				{
-				return KErrArgument;
-				}
-
-			iLayersToLogMask  =(theSettings()).iLayersToLog;
-			iVerbosityLevel   =verbosity;
-			iLoggingMask      =(theSettings()).iLoggingMask;
-			iMediumType       =mediumType;
-			iOutputWindowSize =windowSize;
-			iTestCaseLit      =(theSettings()).iTestCaseLit;
-			
-			if (iTestCaseLit!=KNullDesC)
-				BlogTestCase(iTestCaseLit);
-
-			break;
-			}
-		default:
-			{
-			return KErrArgument;
-			}
-		};
-	return KErrNone;
-	}
-
-
-void CBlogger::Panic(TBloggerPanic aPanic)
-	{
-	User::Panic(_L("BLogger Panic"),aPanic);
-	}
-
-void CBlogger::Blog(const TDesC& aMessage,TInt aFrameWindow)
-/**
-	Formats the message with a date and time preamble and blogs it.
-	But a limitation is that although it breaks the message in parts of
-	aFrameWindow size characters, it cannot accept amessage which is longer 
-	than KBlogMessageMaxLitLength
-*/
-	{
-	__ASSERT_DEBUG((KBlogMessageMaxLitLength-KBlogDateTimeLitLength)>=aMessage.Length(),Panic(EBloggerMessageLengthTooLong));
-	TBuf<KBlogMessageMaxLitLength> logMessage;
-	DoDateTimeFormat(logMessage);
-	logMessage.Append(aMessage);
-	DoBlog(logMessage,aFrameWindow);
-	}
-
-void CBlogger::Blog(const TDesC& aMessage)
-/**
-	Formats the message with a date and time preamble and blogs it.
-	But a limitation is that it cannot accept a message which is longer 
-	than KBlogMessageMaxLitLength.
-*/
-	{	
-	Blog(aMessage,iOutputWindowSize);
-	}
-
-
-void CBlogger::BlogTestCase(TDesC& aTestCaseName)
-	{
-	// output a preamble indicating new test case (or a repeat of the previous one:-)
-	// include time date and a Lit for the preamble
-	__ASSERT_DEBUG(KBlogTestCaseMaxLitLength>=KBlogDateTimeLitLength,Panic(EBloggerDescriptorLengthWasShorter));
-	TBuf<KBlogTestCaseMaxLitLength> testCaseString;
-	DoDateTimeFormat(testCaseString); // no need for ret val check here	
-	testCaseString.Append(KBlogTestCaseLit);
-	testCaseString.Append(aTestCaseName);
-	DoBlog(testCaseString,iOutputWindowSize);
-	}
-
-void CBlogger::BlogTesterMessage(TDesC& aTesterMessage)
-/**
-	A Test App can output a string in the Blogger logs through this method.
-	To do this the test app should issue a SetOpt of type KBloggerSetTesterMessage
-	and pass a packaged TDesC16.
-*/
-	{
-	TBuf<KBlogTesterMessageInfoMaxLitLength> tstInfoString;
-	DoDateTimeFormat(tstInfoString);
-	tstInfoString.Append(KBlogTesterMessageInfoLit);
-	tstInfoString.Append(aTesterMessage);
-	DoBlog(tstInfoString,iOutputWindowSize);
-//	DoBlog(aTesterMessage,iOutputWindowSize);
-	}
-
-void CBlogger::BlogTestCaseResult(TInt aTestCaseResult)
-	{
-	if(!(iTestCaseLit.Length())) //in the case the TC Lit was not setup
-		{
-		return;
-		}
-
-	TBuf<KBlogTestCaseResultMaxLitLength> tcMessage;
-	__ASSERT_DEBUG(KBlogTestCaseResultMaxLitLength>KBlogDateTimeLitLength,Panic(EBloggerDescriptorLengthWasShorter));	
-	DoDateTimeFormat(tcMessage);
-	
-	switch(aTestCaseResult)
-		{
-		case KBlogTestCaseResultPassed:
-			{
-			tcMessage.Append(KBlogTestCaseResultLitPass);
-			break;
-			}
-		case KBlogTestCaseResultFailed:
-			{
-			tcMessage.Append(KBlogTestCaseResultLitFailed);
-			break;
-			}
-		case KBlogTestCaseResultInconclusive:
-			{
-			tcMessage.Append(KBlogTestCaseResultLitInconclusive);
-			break;
-			}
-		case KBlogTestCaseResultSkipped:
-			{
-			tcMessage.Append(KBlogTestCaseResultLitSkipped);
-			break;
-			}
-		default:
-			{
-			// check your bounds checking in the handler
-			Panic(EBloggerTestCaseResultIsBogus); 
-			}
-		};
-	
-	tcMessage.Append(iTestCaseLit);
-	DoBlog(tcMessage,iOutputWindowSize);
-	}
-
-void CBlogger::DoBlog(const TDesC& aMessage,TInt aFrameWindow)
-	{	
-	TInt msgLength=aMessage.Length();
-	if(!msgLength)
-		{return;}
-
-	TInt min=Min(KRDBMaxLit,aMessage.Length());
-	TInt len=Min(min,aFrameWindow);
-		
-	TInt frames=msgLength/len; 
-	TInt lastFrameSize=msgLength%len;// i.e the remainder
-	
-	TInt position=0;
-	for(TInt f=0;f<frames;f++,position=f*len)
-		{
-		DoOutputToResourceL(aMessage.Mid(position,len)); //Qualified
-		}
-	// log last frame
-	if(lastFrameSize)
-		{		
-		DoOutputToResourceL(aMessage.Mid(position));  //Qualified
-		}
-	}
-
-TInt CBlogger::DoDateTimeFormat(TDes& aDesToPrepend)
-	{
-
-	//FIXME:if the options are for time critical logging then spare the date and time 
-	
-	if(aDesToPrepend.MaxLength()<KBlogDateTimeLitLength)
-		{
-		return KErrArgument;
-		}
-	TBuf<KBlogDateTimeLitLength> timeLit; // abit more bytes than needed
-	TTime time;
-	time.HomeTime();
-	TRAPD(errD,time.FormatL(aDesToPrepend,KBlogDateFormat));
-	if(errD)
-		{
-		//since we OOMed
-		aDesToPrepend.Append(KBlogBlankDate);
-		}
-	TRAPD(errT,time.FormatL(timeLit,KBlogTimeFormat));
-	if (errT)
-		{
-		timeLit.Copy(KBlogBlankTime);
-		}
-
-	aDesToPrepend.Append(timeLit);
-
-	// although OOM may have happened, but the point is to get the log out quickly
-	return KErrNone; 
-	}
-
-
-void CBlogger::HexDump(const TDesC& aDescription,const TDesC8& aHexFrame, TInt aFrameWindow)
-/**
-	It will trim the sDescription to fit in the aFrameWindow size.
-	It also log the HexFrame in chunks of size=aFrameWindow.
-*/
-	{
-	//255 is the max RDebug::Print size
-
-	DoBlog(aDescription,aFrameWindow);
-
-	TInt bufferSize=aHexFrame.Length();
-	if(!bufferSize)
-		{return;}
-
-	TInt frames=bufferSize/(aFrameWindow/5); // 5 is the size of the formating lit 
-	TInt lastFrameSize=(bufferSize*5)%aFrameWindow;// i.e the remainder
-	
-	TInt i=0;
-	TBuf<KRDBMaxLit> outBuf;
-
-	for ( TInt f=0;f<frames;f++)
-		{
-		outBuf.Zero();
-		for ( i = 0; i < aFrameWindow/5; ++i)
-			{// 5 is the size of the formating lit :-)
-			outBuf.AppendFormat(_L("0x%02x "),aHexFrame[(f*aFrameWindow/5)+i]);			
-			}
-		DoOutputToResourceL(outBuf); //Qualified
-		}
-
-	// log last frame
-	if(lastFrameSize)
-		{
-		outBuf.Zero();
-		for(i=(frames*aFrameWindow/5);i<bufferSize;i++)
-			{
-			outBuf.AppendFormat(_L("0x%02x "),aHexFrame[i]);
-			}
-		DoOutputToResourceL(outBuf); //Qualified
-		}
-	}
-void CBlogger::CreateBlogFileL()
-	{
-	//User::LeaveIfError(ifileserv.Connect());
-	User::LeaveIfError(ifile.Replace(ifileserv, *ifilename, EFileStream|EFileWrite));
-	}
-
-void CBlogger::DoFileL()
-	{
-	/*
-	if the file exists and is open then write to it 
-	otherwise create and open it
-	*/
-	TInt ret;
-	ret=ifile.Open(ifileserv,*ifilename,EFileStream|EFileWrite);	
-	if (ret==KErrNotFound) // file does not exist - create it
-		{
-		CreateBlogFileL();
-		}
-	iFileExists = ETrue;
-	}
-
-void CBlogger::MakefilenameL(const TDesC &aFileName)
-	{
-	//Connect to Fileserver
-	User::LeaveIfNull(ifilename=aFileName.AllocL());
-	TInt err = ifileserv.MkDirAll(*ifilename);
-	if ( (err != KErrAlreadyExists) && (err != KErrNone))
-		User::Leave(err);
-	}
-
-void CBlogger::DoOutputToResourceL(const TDesC& aMessage)
-	{
-	// It is reasonable to assume we only gonna have 2 types of output resource
-	// either COM:0 or File Flogging thus do the sipmlest thing here
-	
-	//iMediumType=1; //need this to be 1 for output to a file. 
-
-	switch(iMediumType) //yes I like dynamic binding myself but we only gonna have 2 isn't it ?
-		{
-		case KBlogOutputTypeIsRDebug:
-			{
-			RDebug::Print(_L("%S"),&aMessage);
-			break;
-			}
-		case KBlogOutputTypeIsFlogger:
-			{
-			//User::LeaveIfError(ifileserv.Connect());
-			//Makefilename(_L("Blog.txt"));
-			if(!iFileExists)
-				{
-				DoFileL();
-				}			
-			TBuf8<256> buf8;
-			buf8.Copy(aMessage);
-			User::LeaveIfError(ifile.Write(buf8));
-			User::LeaveIfError(ifile.Write(_L8("\r\n")));
-			User::LeaveIfError(ifile.Flush());
-			break;
-			}
-		default:
-			{
-			Panic(EBloggerResourceTypeIsBogus);
-			}
-		};
-
-	}
-
-void CBlogger::StoreFloggerInfo(TAny* aLogInfo)
-/**
-	Store the pointer from the HCI's TLS that indicates to which file the floffer should log.
-	This is necessary in order to be able (at will) to accomodate both Flogger
-	and Blogger functionality in the stack.
-
-	This method will only be used from the LinkMgr when Flogging is enabled.
-*/
-	{
-	iFloggerInfo=aLogInfo;
-	}
-
-
-EXPORT_C TAny* CBlogger::GetFloggerInfo()
-	{
-	return iFloggerInfo;
-	}
-
-void CBlogger::DoBloggerTests()
-	{
-#ifdef BLOGGING__SELF_TESTS__
-	LLQBLOG(1,Log(_L(" >>>>>>>>>>>>>>>>>> This is %d <<<<<<<<<<<<<<<<"),1));
-	LLQBLOG(1,Log(_L("123456789a123456789b123456789c123456789d123456789e123456789f123456789g123456789h123456789i")));
-	LLQBLOG(1,Log(_L(" a string %S and a number %d"),&_L("Andy"), 1));
-	LLQBLOG(1,HexDump(_L("A hex dump"),_L8(" read hex mate?"),10));
-	LLQBLOG(1,HexDump(_L("A long hex dump"),_L8("123456789a123456789b123456789c123456789d123456789e123456789f123456789g"),80));
-	
-	// Testing test case Lit setup 
-	TBuf<KRDBMaxLit> tcName(_L("My First Test Case ,NO1"));
-	TPckgBuf<TBlogTestCaseLit> tcNamePckg(tcName);
-	UpdateLoggingSettings(KBloggerSetTestCaseName,tcNamePckg);
-	
-	// Testing Test Case Results
-	TPckgBuf<TInt> tcResult(KBlogTestCaseResultPassed);
-	UpdateLoggingSettings(KBloggerSetTestCaseResult,tcResult);
-
-	//Testing Test app messages
-	TBuf<KRDBMaxLit> tstMsg(_L("This is message from the tester saying it is doing a test"));
-	TPckgBuf<TBlogTestCaseLit> tstMsgPckg(tstMsg);
-	UpdateLoggingSettings(KBloggerSetTesterMessage,tstMsgPckg);
-#endif
-	}
-
-// Blogettes
-
-CBloggette::~CBloggette()
-	{
-	}
-
-CBloggette::CBloggette(CBlogger* aProvider, TInt aLayer) : 
-	iLayer(aLayer),
-	iBlogger(aProvider)
-	{
-	}
-
-void CBloggette::Log(TRefByValue<const TDesC> aFormatingLit, ...)
-/**
-	The maximum length of the allowed string is 255.
-*/
-	{
-	VA_LIST tmpArgList;
-	VA_START(tmpArgList,aFormatingLit);
-	TBuf<KRDBMaxLit> blogBuf; 
-	blogBuf.Zero();
-	blogBuf.AppendFormatList(aFormatingLit, tmpArgList); //FIXME overflow handler possibly ?
-	iBlogger->Blog(blogBuf);
-	VA_END(tmpArgList);
-	}
-
-  
-void CBloggette::HexDump(TRefByValue<const TDesC> aDescription,const TDesC8& aHexFrame, TInt aFrameWindow)
-	{
-	iBlogger->HexDump(aDescription,aHexFrame,aFrameWindow);
-	}
-
-TInt CBloggette::Layer() const
-	{
-	return iLayer;
-	}
-
-
-// Link Layer Bloggette
-
-CLLBloggette* CLLBloggette::NewL(CBlogger* aProvider, TInt aLayer)
-	{
-	CLLBloggette* self = new (ELeave)CLLBloggette(aProvider,aLayer);
-	self->iBlogger->Register(self);
-	return self;
-	}
-
-CLLBloggette::CLLBloggette(CBlogger* aProvider, TInt aLayer) 
-	: CBloggette(aProvider,aLayer)
-	{	
-	}
-
-CLLBloggette::~CLLBloggette()
-	{
-	}
-
-TDesC CLLBloggette::NameDes()
-	{
-	return _L("LL Dummy Bloggette");
-	}
-
-// L2CAP Bloggette
-
-CL2Bloggette* CL2Bloggette::NewL(CBlogger* aProvider, TInt aLayer)
-	{
-	CL2Bloggette* self = new (ELeave)CL2Bloggette(aProvider,aLayer);
-	self->iBlogger->Register(self);
-	return self;
-	}
-
-CL2Bloggette::CL2Bloggette(CBlogger* aProvider, TInt aLayer) 
-	: CBloggette(aProvider,aLayer)
-	{	
-	}
-
-CL2Bloggette::~CL2Bloggette()
-	{
-	}
-
-TDesC CL2Bloggette::NameDes()
-	{
-	return _L("L2CAP Dummy Bloggette");
-	}
-
-// RFCOMM Bloggette
-
-CRFBloggette* CRFBloggette::NewL(CBlogger* aProvider, TInt aLayer)
-	{
-	CRFBloggette* self = new (ELeave)CRFBloggette(aProvider,aLayer);
-	self->iBlogger->Register(self);
-	return self;
-	}
-
-CRFBloggette::CRFBloggette(CBlogger* aProvider, TInt aLayer) 
-	: CBloggette(aProvider,aLayer)
-	{	
-	}
-
-CRFBloggette::~CRFBloggette()
-	{
-	}
-
-TDesC CRFBloggette::NameDes()
-	{
-	return _L("RFComm Dummy Bloggette");
-	}
-	
-void CRFBloggette::Timeout(/*CRfcommSAP* aSAP, CRfcommMuxer* aMux,*/ CRfcommFrame* aFrm )
-	{
-	TUint8 ctrlfield = aFrm->Ctrl();
-
-	switch((ctrlfield&~KPollFinalBitmask))
-		{
-		case KSABMCtrlField:
-			Log(KBlogTimeout);
-			Log(KBlogSABM);
-			break;
-		case KDISCCtrlField:
-			Log(KBlogTimeout);
-			Log(KBlogDISC);
-			break;
-		default:
-			break;
-		};
-	}
-
-void CRFBloggette::LogMuxCommand(CRfcommSAP* aSAP, CRfcommMuxer* aMux, TUint8 aCommand)
-	{
-	TUint8 signals;
-
-	switch(aCommand)
-		{
-	case KTestType:
-			Log(KBlogTestCommand); 
-			break;
-		case KPNType:
-			Log(KBlogPN);//
-			break;
-		case KRPNType:
-			Log(KBlogRPN);//
-			break;
-		case KFConType:
-			//may need length byte value
-			Log(KBlogFcOn);//
-			break;
-		case KFCoffType:
-			Log(KBlogFcOff);//
-			break;
-		case KMSCType:
-			signals = aSAP->Signals();//V.24 signals in MSC
-			Log(KBlogMSC);//
-			break;
-		case KNSCType:
-			Log(KBlogNSC);//
-			break;
-		case KRLSType:
-			Log(KBlogRLS);//
-		};
-
-	}
-void CRFBloggette::ExplainOutgoingFrame(CRfcommFrame* aFrm, CRfcommMuxer* aMux )
-	{
-#ifndef TCI
-	//Show what type of frame we have sent and the various parts of the frame which are important.
-
-	TInt frametype = aFrm->Type(); //Is it a Ctrl Frame, Data Frame, CreditDataFrame or Mux Ctrl Frame ?
-	TUint8 ctrlfield = aFrm->Ctrl();
-	TUint8 ctrl = ctrlfield&~KPollFinalBitmask; //tells whether SABM, DISC, UA, DM
-	TUint8 addressfield = aFrm->Address(); //Contains EA, CR, DLCI
-//	TUint8 dlci = aMux->DecodeDLCI(addressfield); //extracts dlci
-	TBool EA = addressfield & KEABitmask; //Is the EA bit set? 
-	TBool CR = addressfield & KCRBitmask; //Is the CR bit set?
-	TBool poll = ctrlfield & KPollFinalBitmask; //Is the p/f bit set?
-	
-	switch(frametype)
-		{
-		case KCtrlFrameType:
-			{
-			//CRfcommCtrlFrame* ctrlfrm=static_cast<CRfcommCtrlFrame*>(aFrm);
-			//TUint16 ctrlframelength = ctrlfrm->DataLength();
-			Log(_L("Tx:"));
-			
-			if(ctrl==KSABMCtrlField)
-				{
-				Log(_L("Tx: SABM"));
-				}
-			if(ctrl==KUACtrlField)
-				{
-				Log(_L("Tx: UA"));
-				}
-			if(ctrl==KDMCtrlField)
-				{
-				Log(_L("Tx: DM"));
-				}
-			if(ctrl==KDISCCtrlField)
-				{
-				Log(_L("Tx: DISC"));
-				}
-			}
-			break;
-		case KDataFrameType: //CRfCommUIHFrame
-			{
-			CRfcommUIHFrame* uihfrm=static_cast<CRfcommUIHFrame*>(aFrm);
-			TUint16 uihframelength = uihfrm->DataLength();
-
-			if(poll)
-				Log(_L("Tx: UIH credit data frame"));
-			
-			if (uihframelength<=127)
-				{
-				Log(_L("Tx: UIH simple data frame"));
-				}
-			else
-				{
-				Log(_L("Tx: UIH simple data frame"));
-				}
-			}
-			break;
-		case KCreditDataFrameType: //CRfcommCreditDataFrame
-			{
-			CRfcommCreditDataFrame* creditfrm=static_cast<CRfcommCreditDataFrame*>(aFrm);
-			TUint8 credits = creditfrm->Credit();
-			//BLOG Credits
-			TUint16 length = creditfrm->DataLength();
-			
-			if (length<=127)
-				{
-				Log(KBlogShortCreditUIH, credits);
-				}
-			else
-				{
-				Log(KBlogLongCreditUIH, credits);
-				}
-			}
-			break;
-		case KMuxCtrlFrameType: //CRfcommMuxCtrlFrame containing muxer messages/commands
-			{
-			//#ifndef TCI
-			CRfcommMuxCtrlFrame* muxfrm=static_cast<CRfcommMuxCtrlFrame*>(aFrm);
-			TUint8 muxdlci = muxfrm->iDLCI;
-			CRfcommSAP* sap = aMux->FindSAP(muxdlci); //Find the SAP that is on this dlci for aMux 
-			TUint8 command = muxfrm->CommandType(); 
-			LogMuxCommand(sap, aMux, command);
-			//#endif
-			}
-			break;
-		default: //CRfcommDataFrame
-			break;
-		};
-	Log(KBlogPFSet, poll);
-	Log(KBlogEASet, EA);
-	Log(KBlogCRSet, CR);
-
-	Log(KBlogFrameType, frametype);
-#endif
-	}
-
-void CRFBloggette::ExplainIncomingFrame(TUint8 aDlci, TUint8 aCtrl, TBool aPoll)
-	{
-	Log(_L("Rx: "));
-	switch (aCtrl)
-		{
-		case KSABMCtrlField:
-			Log(_L("Rx: SABM"));
-			break;
-		case KUACtrlField:
-			Log(_L("Rx: UA"));
-			break;
-		case KDMCtrlField:
-			Log(KBlogDM);
-			break;
-		case KDISCCtrlField:
-			Log(KBlogDISC);
-			break;
-		case KUIHCtrlField:
-			{
-			if(aDlci== KMuxDLCI)
-				{
-				Log(KBlogUIHCtrlFrame);
-				}
-			else
-				{
-				Log(KBlogSimpleUIH);
-				}
-			}
-			break;			
-		default:
-			//FLOG(_L("Error: RFCOMM: Unexpected frame ctrl field"));
-			break;
-		};
-	Log(KBlogDLCI, aDlci);
-	Log(KBlogPFSet, aPoll);
-	}
-
-void CRFBloggette::IncomingCtrlMessage(TUint8 aCommand, TInt aLength)
-	{
-	switch(aCommand)
-		{
-		case KTestType:
-			Log(KBlogTestCommand); 
-			break;
-		case KPNType:
-			Log(KBlogPN);
-			break;
-		case KRPNType:
-			Log(KBlogRPN);
-			break;
-		case KFConType:
-			{
-			Log(KBlogFcOn);
-			if(aLength!=0)
-				{
-				Log(KBlogNonZeroLength);
-				}
-			}
-			break;
-		case KFCoffType:
-			{
-			Log(KBlogFcOff);
-			if(aLength!=0)
-				{
-				Log(KBlogNonZeroLength);
-				}
-			}
-			break;
-		case KMSCType:
-			Log(KBlogMSC);
-			break;
-		case KNSCType:
-			Log(KBlogNSC);
-			break;
-		case KRLSType:
-			Log(KBlogRLS);
-		};
-	}
-
-#endif
--- a/bluetooth/btstack/common/bt.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/common/bt.h	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -21,7 +21,6 @@
 #include <es_prot.h>
 #include "secman.h"
 #include "debug.h"
-#include "blogger.h"
 #include "btsockettimer.h"
 #include "codman.h"
 
@@ -29,7 +28,6 @@
 class CBluetoothProtocolBase;
 class CL2CAPProtocol;
 class CRfcommProtocol;
-class CBlogger;
 class CIncomingConnectionListener;
 
 typedef TLinkType TPhysicalLinkPort;
--- a/bluetooth/btstack/common/bt_v2.mmp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/common/bt_v2.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -35,7 +35,6 @@
 SOURCEPATH .              // BT PRT
 
 SOURCE btprt.cpp
-SOURCE blogger.cpp  
 SOURCE btsap.cpp
 SOURCE btsockettimer.cpp
 SOURCE IncomingConnListener.cpp
--- a/bluetooth/btstack/common/btprt.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/common/btprt.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -350,6 +350,7 @@
 	{
 	LOG_FUNC
 	CServProviderBase* sap =iLowerProtocol->NewSAPL(aSockType);
+	ASSERT_DEBUG(!iListener);
 	iListener=CIncomingConnectionListener::NewL(*this, sap, aPort, aQueSize, aUid);
 	}
 
--- a/bluetooth/btstack/common/secman.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1272 +0,0 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include <bluetooth/logger.h>
-#include "secman.h"
-#include "hostresolver.h"
-#ifdef BT_LINKMGR_V2
-#include "physicallinks.h"
-#include "physicallinksmanager.h"
-#else
-#include "PhysicalLinks.h"
-#include "PhysicalLinksManager.h"
-#endif
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, LOG_COMPONENT_SECMAN);
-#endif
-
-#ifdef _DEBUG
-PANICCATEGORY("secman");
-#endif
-
-#pragma warning (disable: 4355) //'this' in base init list - is OK for our usage
-
-static const TInt KBTSecManAccessRequesterArrayGranularity = 4;
-static const TInt KBTSecManNotifierRequesterArrayGranularity = 4;
-
-
-//------------------------------------------------------------------------//
-//class CBTSecMan
-//------------------------------------------------------------------------//
-void Panic(TBTSecPanic aPanic)
-	{
-	LOG_FUNC
-	User::Panic(KBTSecPanic, aPanic);
-	}
-
-CBTSecMan* CBTSecMan::NewL()
-	{
-	LOG_FUNC
-	CBTSecMan* self = CBTSecMan::NewLC();
-	CleanupStack::Pop();	//self
-	return self;
-	}
-
-CBTSecMan* CBTSecMan::NewLC()
-	{
-	LOG_FUNC
-	CBTSecMan* self = new(ELeave) CBTSecMan();
-	CleanupStack::PushL(self);
-	self->ConstructL();
-	return self;
-	}
-
-CBTSecMan::CBTSecMan()
-	: iAccessRequesters(KBTSecManAccessRequesterArrayGranularity),
-	  iNotifierRequesters(KBTSecManNotifierRequesterArrayGranularity)
-	{
-	LOG_FUNC
-	}
-
-void CBTSecMan::ConstructL()
-	{
-	LOG_FUNC
-	}
-
-void CBTSecMan::SetPhysicalLinksMgr(const CPhysicalLinksManager& aConnectionsMgr)
-	{
-	LOG_FUNC
-	iPhysicalLinksManager = &const_cast<CPhysicalLinksManager&>(aConnectionsMgr);
-	}
-
-CPhysicalLinksManager& CBTSecMan::ConnectionsManager() const
-	{
-	LOG_FUNC
-	return *iPhysicalLinksManager;
-	}
-
-
-CBTSecMan::~CBTSecMan()
-	{
-	LOG_FUNC
-
-	iAccessRequesters.ResetAndDestroy();
-	iAccessRequesters.Close();
-
-	iNotifierRequesters.ResetAndDestroy();
-	iNotifierRequesters.Close();
-	}
-
-void CBTSecMan::AccessRequestL(const TBTServiceSecurity& aSecurity,
-							   const TBTServiceSecurityPerDevice* const aOverride,
-							   const TBTDevAddr& aBDAddr,
-							   MAccessRequestResponseHandler& aRequester)
-/**
-Handle an access request...
-Create a new CBTAccessRequester object to handle the request.
-**/
-	{
-	LOG_FUNC
-	// find the baseband this SAP is running on
-	CPhysicalLink& con = *iPhysicalLinksManager->FindPhysicalLink(aBDAddr);
-	CBTAccessRequester* p = CBTAccessRequester::NewLC(con, aSecurity,
-													  aOverride,
-													  aRequester,
-													  *this);
-	User::LeaveIfError(iAccessRequesters.Append(p));
-	CleanupStack::Pop(); //clean up of p now handled by iAccessRequesters
-	// Try to start- it may not happen (depends on if device retreived from registry
-	p->DoRequest();
-	
-	}
-
-void CBTSecMan::CancelRequest(MAccessRequestResponseHandler& aRequester)
-	{
-	LOG_FUNC
-	// search through access requesters to find correct one
-	LOG1(_L("sec\tCBTSecMan::CancelRequest from SAP 0x%08x"), &aRequester)
-	TInt count = iAccessRequesters.Count();
-
-	for (TInt i=(count-1); i>=0; i--)
-		{
-		CBTAccessRequester* requester = iAccessRequesters[i];
-		if(&requester->ServiceRequester() == &aRequester)
-			{
-			// should assert that aRequester is the same as in AccessRequester?
-			LOG(_L("sec\tRemoving AccessRequester..."))
-			iAccessRequesters.Remove(i);
-			delete requester;
-			break;
-			}
-		}
-	}
-	
-void CBTSecMan::GetPassKeyLengthAndOriginator(const TBTDevAddr& aAddr, TUint& aPasskeyMinLength,
-				   	   					      TBool& aLocallyInitiatedAuthentication)
-
-/**
-If authorisation request was initiated locally it will return true and will
-return the passkey minimal length requred by user
-**/
-	{
-	LOG_FUNC
-
-	TUint tmpPasskeyLength = 0;
-	TBool locallyInitiated = EFalse;
-	TInt count = iAccessRequesters.Count();
-
-	if (count == 0)
-		{
-		aLocallyInitiatedAuthentication = EFalse;
-		return;
-		}
-
-	// find all pending AccessRequesters for given BTAddr and find maximum of PasskeyMinLength
-	
-	for (TInt i=0; i<count;i++)
-		{
-		CBTAccessRequester* requester = iAccessRequesters[i];
-		if (requester->IsAuthenticationReqPending(aAddr, tmpPasskeyLength))
-			{
-			locallyInitiated = ETrue;
-			if (aPasskeyMinLength < tmpPasskeyLength)
-				{
-				aPasskeyMinLength = tmpPasskeyLength;
-				}
-			}	
-		}
-	
-	aLocallyInitiatedAuthentication = locallyInitiated;		
-	}
-	
-void CBTSecMan::AuthenticationInProgress()
-/**
-When authorisation request was sent to HW, HCI will notify SecMan
-**/
-	{
-	LOG_FUNC
-	
-	// find first pending AccessRequesters and set AuthenticationInProgress flag
-	for (TInt i=0; i<iAccessRequesters.Count(); i++)
-		{
-		CBTAccessRequester* requester = iAccessRequesters[i];
-		
-		if (requester->AuthenticationRequired() && !requester->AuthenticationInProgress())
-			{
-			requester->SetAuthenticationInProgress();
-			break;
-			}		
-		}
-	}
-
-void CBTSecMan::AccessRequestComplete(CBTAccessRequester* aAccessRequester, TInt aResult)
-/**
-The access request has been fully completed.
-Delete the CBTAccessRequester that was handling the request.
-**/
-	{
-	LOG_FUNC
-
-	TInt count = iAccessRequesters.Count();
-
-	ASSERT_DEBUG(count);
-
-	// find the originating service *now*
-	MAccessRequestResponseHandler& service = const_cast<MAccessRequestResponseHandler&>
-											(aAccessRequester->ServiceRequester());
-
-	// clean up the AccessRequester object
-	TInt i;
-	for (i=(count-1); i>=0; i--)
-		{
-		//find aRequester in iAccessRequesters and delete it
-		if(iAccessRequesters[i] == aAccessRequester)
-			{
-			iAccessRequesters.Remove(i);
-			delete aAccessRequester;
-			aAccessRequester = NULL;
-			break;
-			}
-		}
-	//compress the array if needs be
-	if ((count!=0) && (i!=count))
-		{
-		iAccessRequesters.GranularCompress();
-		}
-
-	// now tell the service
-	service.AccessRequestComplete(aResult);
-	}
-
-
-void CBTSecMan::AddNotifierRequestToQueL(CSecNotifierRequester& aRequest)
-/**
-Add notifier request to front of queue.  If there are no other requests already in the queue,
-initiate this request.
-**/
-	{
-	LOG_FUNC
-	TInt count = iNotifierRequesters.Count();
-	User::LeaveIfError(iNotifierRequesters.Insert(&aRequest,0));	//add to front of queue since requests are taken from the back
-	if (count == 0)	//ok since count was calculated before we inserted the new element
-		{
-		iActiveNotifierRequester = &aRequest;
-		aRequest.DoRequest();
-		}
-	else
-		{
-		LOG(_L("Secman: Request NOT initiated, should start later..."));
-		}
-	}
-
-void CBTSecMan::RemoveNotifierRequestFromQue(CSecNotifierRequester& aRequest)
-/**
-Remove the request from the queue.  If aRequest is the currently active request then we can activate
-the next one in the queue.  Otherwise, aRequest is being deleted prematurely and we must simply
-remove it from the array.
-**/
-	{
-	LOG_FUNC
-	LOG(_L("sec\tCBTSecMan - removing notifier request from queue"));
-	TInt count = iNotifierRequesters.Count();
-	TInt found = 0;
-	for (TInt i=(count-1); i>=0; i--)
-		{
-		if (iNotifierRequesters[i] == &aRequest)
-			{
-			found++;
-			iNotifierRequesters.Remove(i);
-			}
-		}
-	__ASSERT_DEBUG(found, User::Panic(KBTSecPanic, EBTSecBadNotifierArray));
-
-	if (&aRequest == iActiveNotifierRequester)
-		{
-		//start the next request if there is one...
-		count = iNotifierRequesters.Count();
-		if (count > 0)
-			{
-			LOG(_L("sec\tCBTSecMan - auto-starting next notifier request from queue"));
-			iActiveNotifierRequester = iNotifierRequesters[count-1];
-			iActiveNotifierRequester->DoRequest();
-			}
-		}
-	}
-
-
-CSecNotifierRequester::CSecNotifierRequester(CBTSecMan& aSecMan)
-: CActive(EPriorityStandard),
-  iInquiryMgr(aSecMan.ConnectionsManager().LinkManagerProtocol().InquiryMgr()),
-  iSecMgr(aSecMan)
-	{
-	LOG_FUNC
-	}
-
-void CSecNotifierRequester::ConstructL(const TBTDevAddr& aAddr)
-	{
-	LOG_FUNC
-	User::LeaveIfError(iNotifier.Connect());
-
-	// find the name at this stage for this device - may not be there yet
-	iDeviceName = iInquiryMgr.DeviceNameFromCache(aAddr);
-
-	if (!iDeviceName || iDeviceName->Length() ==0)
-		{
-		// cache didn't have name - so we'll ask for it as a HR action
-		TRAP_IGNORE(iHR = iInquiryMgr.NewHostResolverL());
-		iHRNameRecord = new TNameRecord;
-
-		// ignore error - only an optimisation - don't want to leave if there's
-		// a problem doing this optimisation
-		if (iHR && iHRNameRecord)
-			{
-			iHR->SetNotify(this);
-
-			TInquirySockAddr i;
-			i.SetAction(KHostResName);
-			i.SetBTAddr(aAddr);
-			iHRNameRecord->iAddr = i;
-			iHR->GetByAddress(*iHRNameRecord);
-			}
-		}
-		
-	iDevAddr = aAddr;
-	
-	iSecMgr.AddNotifierRequestToQueL(*this);
-	iIsAddedToNotifierQue = ETrue;
-	}
-
-CSecNotifierRequester::~CSecNotifierRequester()
-	{
-	LOG_FUNC
-	Cancel();
-	
-	//remove ourself from the notifier que if we're still on it.
-	if (iIsAddedToNotifierQue)
-		{
-		iSecMgr.RemoveNotifierRequestFromQue(*this);
-		iIsAddedToNotifierQue = EFalse;
-		}
-
-	delete iHR;
-	delete iHRNameRecord;
-	delete iUpdateNotifierAO; 
-	
-	iNotifier.Close();
-	}
-
-void CSecNotifierRequester::QueryComplete(TInt aErr)
-	{
-	LOG_FUNC
-	if ( (aErr==KErrNone) && (iHRNameRecord!=NULL) )
-		{
-		// now have device name - update notifiers
-		// we do have a copy of the name - but it is now wide :-|
-		// and also we have iDeviceName that is still NULL, so best bet is
-		// to just set our pointer and use the cache one (which we *know* is there!)
-		TBTDevAddr a = TBTSockAddr::Cast(iHRNameRecord->iAddr).BTAddr();
-		iDeviceName = iInquiryMgr.DeviceNameFromCache(a);
-		DoUpdateNotifier();
-		}
-
-	delete iHRNameRecord;
-	iHRNameRecord = NULL;
-	}
-
-//------------------------------------------------------------------------//
-//class CBTPinRequester
-//------------------------------------------------------------------------//
-
-
-CBTPinRequester* CBTPinRequester::NewL(CPhysicalLink& aParent,
-									   MPINCodeResponseHandler& aRequester,
-									   CBTSecMan& aSecMan,
-									   TUint aPasskeyMinLength,
-									   TBool aInternallyInitiated)
-	{
-	LOG_FUNC
-	CBTPinRequester* s = CBTPinRequester::NewLC(aParent, aRequester, aSecMan,
-	                                            aPasskeyMinLength, aInternallyInitiated);
-	CleanupStack::Pop();
-	return s;
-	}
-
-CBTPinRequester* CBTPinRequester::NewLC(CPhysicalLink& aParent,
-										MPINCodeResponseHandler& aRequester,
-										CBTSecMan& aSecMan,
-										TUint aPasskeyMinLength,
-										TBool aInternallyInitiated)
-	{
-	LOG_FUNC
-	CBTPinRequester* s = new(ELeave) CBTPinRequester(aParent, aRequester, aSecMan,
-	                                                 aPasskeyMinLength, aInternallyInitiated);
-	CleanupStack::PushL(s);
-	s->ConstructL(aParent.BDAddr());
-	return s;
-	}
-
-CBTPinRequester::CBTPinRequester(CPhysicalLink& aParent,
-								 MPINCodeResponseHandler& aRequester,
-								 CBTSecMan& aSecMan,
-								 TUint aPasskeyMinLength,
-								 TBool aInternallyInitiated) :
-	CSecNotifierRequester(aSecMan),
-	iParent(aParent),
-	iRequester(aRequester),
-	iSecMan(aSecMan),
-	iPasskeyMinLength(aPasskeyMinLength),
-	iInternallyInitiated(aInternallyInitiated)
-	{
-	LOG_FUNC
-	// a lot of inlines
-	CActiveScheduler::Add(this);
-	}
-
-CBTPinRequester::~CBTPinRequester()
-	{
-	LOG_FUNC
-	Cancel();
-	}
-
-
-void CBTPinRequester::DoUpdateNotifier()
-	{
-	LOG_FUNC
- 	if(IsActive())
- 		{	
- 		if(!iUpdateNotifierAO)
- 			{
- 			//Create a new CSecNotifierUpdateAO object
- 			TRAP_IGNORE(iUpdateNotifierAO = CSecNotifierUpdateAO::NewL(iNotifier, KBTManPinNotifierUid));
- 			}
- 		
- 		if( (iUpdateNotifierAO) && (!iUpdateNotifierAO->IsActive()) )
- 			{
- 			TBTNotifierUpdateParamsPckg pckg;
- 			if(iDeviceName)
- 				{
- 				TRAPD(err, pckg().iName = BTDeviceNameConverter::ToUnicodeL(*iDeviceName));
- 				pckg().iResult = err; 	// Error code can be KErrNone 
- 				if (err!=KErrNone)
-	 				{
-	 				pckg().iName = KNullDesC;
-	 				}
- 				}
- 			else
- 				{
- 				pckg().iName = KNullDesC;
- 				pckg().iResult = KErrNotFound;
- 				}
- 	
- 			iUpdateNotifierAO->DoUpdate(pckg);
- 			}
-   		}
-	}
-
-void CBTPinRequester::DoRequest()
-/**
-It's our turn...start the RNotifier plugin that deals with authorisation.
-**/
-	{
-	LOG_FUNC
-	ASSERT_DEBUG(iDevAddr == iParent.BDAddr());
-	
-	iPasskeyParamsPckg().iBDAddr = iDevAddr;
-	if (iDeviceName)
-		{
-		TRAPD(err, iPasskeyParamsPckg().iName =	BTDeviceNameConverter::ToUnicodeL(*iDeviceName));
-		if (err!=KErrNone)
-			{
-			iPasskeyParamsPckg().iName = KNullDesC;
-			}
-		}
-	else
-		{
-		iPasskeyParamsPckg().iName = KNullDesC;	
-		}			
-	iPasskeyParamsPckg().iPasskeyMinLength = iPasskeyMinLength;	
-	iPasskeyParamsPckg().iLocallyInitiated = iInternallyInitiated;	
-
-	iNotifier.StartNotifierAndGetResponse(iStatus, KBTManPinNotifierUid, iPasskeyParamsPckg, iPassKey);
-	SetActive();
-	}
-
-void CBTPinRequester::FriendlyNameRetrieved(const TDesC& /*aName*/, TInt /*aResult*/)
-	{
-	LOG_FUNC
-	// do nothing for now 
-	}
-
-
-void CBTPinRequester::DoCancel()
-	{
-	LOG_FUNC
-	iNotifier.CancelNotifier(KBTManPinNotifierUid);
-	if (iUpdateNotifierAO)
-		{
-	 	iUpdateNotifierAO->Cancel();
-		}
-	}
-
-void CBTPinRequester::RunL()
-	{
-	LOG_FUNC
-	//got a PIN or error, so finish off: unload the plugin
-	iNotifier.CancelNotifier(KBTManPinNotifierUid);
-
-	//remove ourself from the notifier que, allowing the next notifier to be activated
-	iSecMan.RemoveNotifierRequestFromQue(*this);
-	iIsAddedToNotifierQue = EFalse;
-
-	ASSERT_DEBUG(iPasskeyParamsPckg().iBDAddr == iParent.BDAddr());
-	if (iStatus.Int())
-		{
-		// it failed - be unpairable
-		iRequester.PINCodeRequestNegativeReply((iParent.BDAddr()));
-		}
-	else
-		{
-		// got a PIN
-		iRequester.PINCodeRequestReply(iParent.BDAddr(),iPassKey);		
-		iParent.SetPassKey(iPassKey);
-		iParent.PinRequestSent();
-		iParent.DeleteLinkKeyL(); //only delete link key when user has entered PIN
-		}
-	// in either case tell parent as we're done.
-	iParent.PinRequestComplete();
-	}
-
-#ifdef __FLOG_ACTIVE
-TInt CBTPinRequester::RunError(TInt aError) 
-#else
-TInt CBTPinRequester::RunError(TInt /*aError*/)
-#endif
-	{
-	LOG_FUNC
-	ASSERT_DEBUG(iPasskeyParamsPckg().iBDAddr == iParent.BDAddr());
-	LOG1(_L("sec\tCBTPinRequester::RunError(%d)"), aError);
-	iRequester.PINCodeRequestNegativeReply(iParent.BDAddr());
-	iParent.PinRequestComplete();
-	return KErrNone;
-	}
-
-//------------------------------------------------------------------------//
-//class CBTAuthorisor
-//------------------------------------------------------------------------//
-
-CBTAuthorisor* CBTAuthorisor::NewL(CBTAccessRequester& aParent, TUid aServiceUID)
-	{
-	LOG_FUNC
-	CBTAuthorisor* s = CBTAuthorisor::NewLC(aParent, aServiceUID);
-	CleanupStack::Pop();
-	return s;
-	}
-
-CBTAuthorisor* CBTAuthorisor::NewLC(CBTAccessRequester& aParent, TUid aServiceUID)
-	{
-	LOG_FUNC
-	CBTAuthorisor* s = new(ELeave) CBTAuthorisor(aParent, aServiceUID);
-	CleanupStack::PushL(s);
-	s->ConstructL(aParent.DeviceAddress());
-	return s;
-	}
-
-CBTAuthorisor::CBTAuthorisor(CBTAccessRequester& aAccessRequester, TUid aServiceUID) :
-	CSecNotifierRequester(aAccessRequester.SecMan()),iAccessRequester(aAccessRequester)
-	{
-	LOG_FUNC
-	iAuthorisationParamsPckg().iUid = aServiceUID;
-	CActiveScheduler::Add(this);
-	}
-
-CBTAuthorisor::~CBTAuthorisor()
-	{
-	LOG_FUNC
-	Cancel();
-	}
-
-
-void CBTAuthorisor::DoUpdateNotifier()
-	{
-	LOG_FUNC 
- 	if(IsActive())
- 		{	
- 		if(!iUpdateNotifierAO)
-   			{
- 			//Create a new CSecNotifierUpdateAO object
- 			TRAP_IGNORE(iUpdateNotifierAO = CSecNotifierUpdateAO::NewL(iNotifier, KBTManAuthNotifierUid));
-   			}
-	
- 		if( (iUpdateNotifierAO) && (!iUpdateNotifierAO->IsActive()) )
-   			{
- 			TBTNotifierUpdateParamsPckg pckg;
- 			if(iDeviceName)
- 				{
- 				TRAPD(err, pckg().iName = BTDeviceNameConverter::ToUnicodeL(*iDeviceName));
- 				pckg().iResult = err; 	// Error code can be KErrNone 
- 				if (err!=KErrNone)
-	 				{
-	 				pckg().iName = KNullDesC;
-	 				}
- 				}
- 			else
- 				{
- 				pckg().iName = KNullDesC;
- 				pckg().iResult = KErrNotFound;
- 				}
- 				
- 			iUpdateNotifierAO->DoUpdate(pckg);
- 			}
- 		}
-	}
-
-void CBTAuthorisor::DoRequest()
-/**
-Start the RNotifier plugin that deals with authorisation.
-**/
-	{
-	LOG_FUNC
-	TInt err(KErrNone);
-	
-	if (iDeviceName)
-		{
-		TRAP(err, iAuthorisationParamsPckg().iName = BTDeviceNameConverter::ToUnicodeL(*iDeviceName));
-		if (err!=KErrNone)
-			{
-			iAuthorisationParamsPckg().iName = KNullDesC;
-			}
-		}
-	else
-		{
-		iAuthorisationParamsPckg().iName = KNullDesC;
-		}			
-	iAuthorisationParamsPckg().iBDAddr  = iDevAddr;
-
-	iNotifier.StartNotifierAndGetResponse(iStatus, KBTManAuthNotifierUid, iAuthorisationParamsPckg, iResultPckg);
-	SetActive();
-	}
-
-
-void CBTAuthorisor::DoCancel()
-	{
-	LOG_FUNC
-
-	iNotifier.CancelNotifier(KBTManAuthNotifierUid);
-		
-	}
-
-void CBTAuthorisor::RunL()
-	{
-	LOG_FUNC
-	//unload the plugin
-	iNotifier.CancelNotifier(KBTManAuthNotifierUid);
-	//remove ourself from the notifier que, allowing the next notifier to be activated
-	iAccessRequester.SecMan().RemoveNotifierRequestFromQue(*this);
-	iIsAddedToNotifierQue = EFalse;
-	//check for errors + notify owner of completion
-	LOG1(_L("sec\tCBTAuthorisor::RunL(): iStatus = %d"), iStatus.Int());
-	if (iStatus.Int()!=KErrNone)
-		{
-		//error
-		iAccessRequester.CompleteRequest(iStatus.Int());
-		}
-	else
-		{
-		iAccessRequester.AuthorisationComplete(iResultPckg());
-		}
-	}
-
-TInt CBTAuthorisor::RunError(TInt aError)
-	{
-	LOG_FUNC
-	//will never get called as our RunL doesn't leave.
-	LOG1(_L("sec\tCBTAuthorisor::RunError(%d)"), aError);
-	return aError;
-	}
-
-
-/**
-	class CBTAccessRequester
-
-
-	The access requester handles the state machine involved in allowing accesses:
-	setting authentication, entering PINs, asking for authorisation and encrypting
-
-	This class deals only with security procedures we initiate (which could be for
-	inbound or outbound connections)
-
-*/
-
-CBTAccessRequester* CBTAccessRequester::NewLC(CPhysicalLink& aConnection,
-											  const TBTServiceSecurity& aSecurityRequired,
-  			  							      const TBTServiceSecurityPerDevice* const aOverride,
-											  MAccessRequestResponseHandler& aRequester,
-											  CBTSecMan& aParent)
-	{
-	LOG_FUNC
-	CBTAccessRequester* s = new(ELeave) CBTAccessRequester(aConnection, aSecurityRequired,
-															aOverride, aRequester, aParent);
-	CleanupStack::PushL(s);
-	s->ConstructL();
-	return s;
-	}
-
-
-CBTAccessRequester::CBTAccessRequester(CPhysicalLink& aConnection,
-									   const TBTServiceSecurity& aServiceSecurity,
- 	  							       const TBTServiceSecurityPerDevice* const aOverride,
-									   MAccessRequestResponseHandler& aRequester,
-									   CBTSecMan& aParent) :
-	iRequester(aRequester),
-	iSecMan(aParent),
-	iBaseband(aConnection),
-	iServiceRequirements(aServiceSecurity),
-	iOverride(aOverride),
-	iIsSubscribedToConnection(EFalse),
-	iDeviceRetrievedFromRegistry(EFalse),
-	iQueLink(this),
-	iAuthenticationInProgress(EFalse)
-	{
-	LOG_FUNC
-	// try to get name for UI dialogs
-	SetDeviceName();
-	}
-
-void CBTAccessRequester::ConstructL()
-	{
-	LOG_FUNC
-	LOG2(_L("sec\tCBTAccessRequester 0x%08x constructed; sizeof %d"), this, sizeof(*this));
-	}
-
-void CBTAccessRequester::SetDeviceName()
-	{
-	LOG_FUNC
-	// not *that* bad - mostly inlines
-
-	iDeviceName = iSecMan.ConnectionsManager().
-					LinkManagerProtocol().InquiryMgr().
-					  DeviceNameFromCache(iBaseband.BDAddr());
-	}
-
-
-const MAccessRequestResponseHandler& CBTAccessRequester::ServiceRequester() const
-	{
-	LOG_FUNC
-	return iRequester;
-	}
-
-const TBTDevAddr& CBTAccessRequester::DeviceAddress() const
-	{
-	LOG_FUNC
-	return (iBaseband.BDAddr());
-	}
-
-void CBTAccessRequester::DoRequest()
-/**
-Subscribe to the baseband link notifier to find out about the link state.
-This will kick off the state machine.
-**/
-	{
-	LOG_FUNC
-	LOG1(_L("sec\tAccessRequester 0x%08x DoRequest"),this);
-	iBaseband.SubscribeLinkObserver(*this);
-	iIsSubscribedToConnection = ETrue;
-
-	// if the link is already up (e.g. we're SecMode 2 for L2CAP/RFCOMM) then proceed
-	if (iBaseband.IsConnected())
-		{
-		TBTBasebandEventNotification event(ENotifyPhysicalLinkUp);
-		PhysicalLinkChange(event); // kick statemachine
-		}
-	// else wait until it is retrieved
-	}
-
-void CBTAccessRequester::CompleteRequest(TInt aResult)
-	{
-	LOG_FUNC
-	LOG2(_L("sec\tAccessRequester 0x%08x CompleteRequest, result %d"),this,aResult);
-	iSecMan.AccessRequestComplete(this, aResult);
-	}
-
-CBTAccessRequester::~CBTAccessRequester()
-	{
-	LOG_FUNC
-	LOG1(_L("sec\tAccessRequester 0x%08x Destroying"),this);
-	if (iIsSubscribedToConnection)
-		{
-		iBaseband.UnsubscribeLinkObserver(*this);
-		}
-	delete iAuthorisor;
-	}
-
-
-void CBTAccessRequester::NewStateL()
-/**
-This access request has entered a new state.  Work out what we should do next.
-**/
-	{
-	LOG_FUNC
-	
- 	// We should ensure that at each iteration through the state machine the requirements
- 	// are up-to-date.  This is needed as the physical link may have changed
- 	// some internal state e.g. as a result of the Registry having been modified.
- 	iRequirements = OverallRequirements(iServiceRequirements, iBaseband.RemoteDevice());
- 	
-#ifdef _DEBUG
-	_LIT(KRequestNone,					"Not Request.     ");
-	_LIT(KRequestPending,				"Request Pending. ");
-	_LIT(KRequestFailed,				"Request Failed.  ");
-	_LIT(KRequestComplete,				"Request Complete.");
-
-	TBuf<20> iStateName[4] = 
-		{
-		KRequestNone(),
-		KRequestPending(),
-		KRequestFailed(),
-		KRequestComplete(),
-		};
-
-	TBTDevAddr addr = iBaseband.BDAddr();
-	LOG3(_L("sec\tCBTAccessRequester::NewStateL(Authorised[%S] Authenticated[%S] Encrypted[%S])"),
-		&iStateName[iState.AuthorisationState()],
-		&iStateName[iState.AuthenticationState()], 
-		&iStateName[iState.EncryptionState()]);
-	LOG6(_L("\t\taddr[0x%02x%02x%02x%02x%02x%02x]"),
-		addr[0],addr[1],addr[2],addr[3],addr[4],addr[5]);
-	LOG4(_L("\t\tRequirements: a[%d] p[%d] e[%d] d[%d]"), iRequirements.AuthenticationRequired(),
-		iRequirements.AuthorisationRequired(), iRequirements.EncryptionRequired(), iRequirements.Denied());
-#endif
-
-	if (iRequirements.AuthenticationRequired() && iRequirements.PasskeyMinLength() &&
-	       iBaseband.Authenticated() )
-		{
-		LOG(_L("sec\tCheck min passkey length")) // for remotly initiated connection
-		TBTPinCode passKey = iBaseband.PassKey();
-		if ( passKey().iLength < iRequirements.PasskeyMinLength())
-			{
-			// the remote device is authenticated, but longer passkey is required
-			LOG(_L("sec\tCBTAccessRequester::Complete(ACCESS DENIED) Passkey min length requirement is longer, then current used for authentication"));
-			CompleteRequest(EBTSecManAccessDenied);
-			return;			
-			}		
-		}
-
-	//1. Check for any failures or for "Denied" in iRequirements
-	//If anything that was required has failed, complete the request with EBTManAccessDenied and delete this.
-	if ((iState.AuthenticationState() == TBTAccessRequestState::ERequestFailed && iRequirements.AuthenticationRequired()) 
-		|| (iState.EncryptionState() == TBTAccessRequestState::ERequestFailed && iRequirements.EncryptionRequired())
-		|| (iState.AuthorisationState() == TBTAccessRequestState::ERequestFailed && iRequirements.AuthorisationRequired())
-		|| iRequirements.Denied())
-		{
-		LOG(_L("sec\tCBTAccessRequester::Complete(ACCESS DENIED)"));
-		CompleteRequest(EBTSecManAccessDenied);
-		}
-	//2. Check for authentication
-	else if (iRequirements.AuthenticationRequired() && 
-			 !iBaseband.Authenticated() && !iBaseband.Encrypted())
-		{
-		// might have been encrypted by remote side - so no need to reauthenticate
-		// this makes us more interoperable with controllers that don't honour erratum E2244
-		LOG(_L("sec\tAuthentication required..."))
-		//if we don't have a pending authentication request, start authentication.
-		if (iState.AuthenticationState() != TBTAccessRequestState::ERequestPending)
-			{
-			LOG(_L("sec\tStarting Authentication..."));
-			iState.SetAuthenticationState(TBTAccessRequestState::ERequestPending);
-			User::LeaveIfError(iBaseband.Authenticate());
-			}
-		}	
-	//3. Check for encryption
-	else if (iRequirements.EncryptionRequired() && !iBaseband.Encrypted())
-		{
-		LOG(_L("sec\tEncryption required..."))
-
-		if (!iBaseband.IsEncryptionDisabledForRoleSwitch())
-			{
-			//if we don't have a pending encryption request, start encryption.
-			if (iState.EncryptionState() != TBTAccessRequestState::ERequestPending)
-				{
-				LOG(_L("sec\tStarting Encryption..."))
-				iState.SetEncryptionState(TBTAccessRequestState::ERequestPending);
-				User::LeaveIfError(iBaseband.ChangeEncryption(EPointToPointEncryption));
-				}			
-			}
-		}
-	//4. Check for authorisation
-	else if (iRequirements.AuthorisationRequired() && 
-	        (iState.AuthorisationState() == TBTAccessRequestState::ERequestNone || iState.AuthorisationState() == TBTAccessRequestState::ERequestPending))
-		{
-		//if we don't have a pending authorisation request, start authorisation.
-		LOG(_L("sec\tAuthorisation required..."))
-		if (iState.AuthorisationState() != TBTAccessRequestState::ERequestPending)
-			{
-			LOG(_L("sec\tStarting Authorisation..."))
-			__ASSERT_ALWAYS(!iAuthorisor, User::Panic(KBTSecPanic,EBTSecAuthorisationRequestAlreadyExists));
-			iAuthorisor = CBTAuthorisor::NewL(*this, iServiceRequirements.Uid());
-			iState.SetAuthorisationState(TBTAccessRequestState::ERequestPending);
-			}
-		}
-	//5. Before EBTManAccessGranted, doublecheck all the checks were done
-	else
-		{
-		TBool authenticationComplete;
-		TBool encryptionComplete;
-		TBool authorisationComplete;
-		
-		authenticationComplete = !iRequirements.AuthenticationRequired() || 
-		                         (iRequirements.AuthenticationRequired() && 
-		                           (iBaseband.Authenticated() || iBaseband.Encrypted()));
-		                         
-		                         
-		                         
-		encryptionComplete = !iRequirements.EncryptionRequired() ||
-							 (iRequirements.EncryptionRequired() && iBaseband.Encrypted());
-							 
-							 
-		authorisationComplete = !iRequirements.AuthorisationRequired() ||
-								(iRequirements.AuthorisationRequired()  && iState.AuthorisationState()==TBTAccessRequestState::ERequestComplete);
-		
-		                
-		if (authenticationComplete && encryptionComplete && authorisationComplete)
-			{
-			LOG(_L("sec\tEBTManAccessGranted"))
-			CompleteRequest(EBTSecManAccessGranted);	
-			}
-		else
-			{
-			LOG(_L("sec\tCBTAccessRequester::Complete(ACCESS DENIED) during double check"));
-			CompleteRequest(EBTSecManAccessDenied);			
-			}
-		}
-	}
-
-TBTAccessRequirements CBTAccessRequester::OverallRequirements(const TBTServiceSecurity& aServiceSecurity,
-														 const TBTNamelessDevice& aDevice)
-/**
-Take the access requirements of the service and compare them with the permissions given 
-to the device by the user.  This results in a list of tasks to be carried out by the 
-access requester before it may let the connection proceed.
-**/
-	{
-	LOG_FUNC
-	//Create the initial stab at the access requirements from the requirements of this service...
-	TBTAccessRequirements req;
-	req.SetAuthentication(aServiceSecurity.AuthenticationRequired());
-	req.SetAuthorisation(aServiceSecurity.AuthorisationRequired());
-	req.SetEncryption(aServiceSecurity.EncryptionRequired());
-	req.SetDenied(aServiceSecurity.Denied());
-	req.SetPasskeyMinLength(aServiceSecurity.PasskeyMinLength());
-
-	//Look at the global security setting of the device...
-	if (aDevice.IsValidGlobalSecurity())
-		{
-		LOG(_L("sec\tDevice has global security settings"));
-		TBTDeviceSecurity devSec = aDevice.GlobalSecurity();
-		if (devSec.Banned())
-			req.SetDenied(ETrue);
-		if (devSec.Encrypt())
-			req.SetEncryption(ETrue);
-		if (devSec.NoAuthenticate())
-			req.SetAuthentication(EFalse);
-		if (devSec.NoAuthorise())
-			req.SetAuthorisation(EFalse);
-		if (devSec.PasskeyMinLength() && devSec.PasskeyMinLength() > req.PasskeyMinLength())
-			req.SetPasskeyMinLength(devSec.PasskeyMinLength());
-		}
-
-	//Check to see if the device has anything specific about this service...
-
-	if (iOverride)
-		{
-		// get the device security from the override (the override points to the correct device)
-		LOG(_L("sec\tSAP has overriden global security settings for device"));
-		const TBTDeviceSecurity& servSec = iOverride->DeviceSecurity();
-		if (servSec.Banned())
-			req.SetDenied(ETrue);
-		if (servSec.Encrypt())
-			req.SetEncryption(ETrue);
-		if (servSec.NoAuthenticate())
-			req.SetAuthentication(EFalse);
-		if (servSec.NoAuthorise())
-			req.SetAuthorisation(EFalse);
-		if (servSec.PasskeyMinLength() && servSec.PasskeyMinLength() > req.PasskeyMinLength() )
-		    req.SetPasskeyMinLength(servSec.PasskeyMinLength());
-		}
-
-	// if only encryption is required, then must need authentication
-	if (req.EncryptionRequired())
-		{
-		req.SetAuthentication(ETrue);
-		}
-
-	return req;
-	}
-
-void CBTAccessRequester::FriendlyNameRetrieved(const TDesC& /*aName*/, TInt /*aResult*/)
-
-	{
-	LOG_FUNC
-	// do nothing for now
-	}
-
-void CBTAccessRequester::DeviceRetrieved(const TBTNamelessDevice& aDevice, TInt aError)
-/**
-	A device has been retrieved from the registry
-	If it's for us we need to continue the access request based on the overrides it has
-
-	This object chooses not to keep a copy of the device, but notes its availability
-**/
-	{
-	LOG_FUNC
-	if (aDevice.Address() != iBaseband.BDAddr())
-		{
-		return; // wasn't for us
-		}
-	
-	TInt err = aError;
-
-	iDeviceRetrievedFromRegistry = ETrue;
-
-	if (err == KErrNone || err == KErrNotFound)
-		{
-		// proceed with the security check...
-		iRequirements = OverallRequirements(iServiceRequirements, aDevice);
-		}
-
-	if (err!=KErrNone)
-		{
-		CompleteRequest(err);
-		}
-	}
-
-
-void CBTAccessRequester::AuthorisationComplete(TBool aResult)
-/**
-We have a new authorisation state.
-**/
-	{
-	LOG_FUNC
-	LOG1(_L("sec\tCBTAccessRequester::AuthorisationComplete(%d)"), aResult);
-	if (aResult)
-		{
-		iState.SetAuthorisationState(TBTAccessRequestState::ERequestComplete);
-		}
-	else
-		{
-		iState.SetAuthorisationState(TBTAccessRequestState::ERequestFailed);
-		}
-	TRAPD(err,NewStateL());
-	if (err)
-		{
-		CompleteRequest(err);
-		}
-	}
-
-
-void CBTAccessRequester::PhysicalLinkChange(const TBTBasebandEventNotification & aEvent, CPhysicalLink& /*aPhysicalLink*/)
-	{
-	LOG_FUNC
-	// only forward events that secman is interested in
-	// linkup, linkdown, encryption, authentication, error
-	// Care needed: other events may harm operation of secman 
-	// and open security hole, such as ENotifySniffMode, ENotifyParkMode
- 	// and ENotifyHoldMode
- 	TBTPhysicalLinkStateNotifier secmanEvents = static_cast<TBTPhysicalLinkStateNotifier>
- 	           (ENotifyPhysicalLinkUp |
- 	            ENotifyPhysicalLinkDown |
-	            ENotifyPhysicalLinkError |
-	            ENotifyAuthenticationComplete |
-	            ENotifyEncryptionChangeOn |
- 	            ENotifyEncryptionChangeOff);
-		            
-	if (aEvent.EventType() & secmanEvents)
-		{  
-		PhysicalLinkChange(aEvent); 		}
- 	// else drop
-	}
-
-void CBTAccessRequester::PhysicalLinkChange(const TBTBasebandEventNotification & aEvent)
-	{
-	LOG_FUNC
-	if(aEvent.EventType() & (ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError))
-		{
-		CompleteRequest(aEvent.ErrorCode());
-		return;
-		}
-
-	if (iState.AuthenticationState() == TBTAccessRequestState::ERequestPending && 
-		aEvent.EventType() == ENotifyAuthenticationComplete)
-		{
-		LOG(_L("sec\tAuthentication complete..."))
-
-		if(aEvent.ErrorCode() != KErrNone)
-			{
-			iState.SetAuthenticationState(TBTAccessRequestState::ERequestFailed);
-			//if Auth fail then ensure any previously stored Linkkey is removed
-			//Don't know which AccessRequester initiated this so can't complete
-			//the request with the error code, only thing to do is trap this error
-			//Deleting a LinkKey is not Critical merely cosmetic
-			LOG(_L("CPhysicalLink: Deleting link key due to failed Authentication"))
-			TRAP_IGNORE(iBaseband.DeleteLinkKeyL());
-			}
-		else
-			{
-			iState.SetAuthenticationState(TBTAccessRequestState::ERequestComplete);
-			}
-		}
-
-	if (iState.EncryptionState() == TBTAccessRequestState::ERequestPending && 
-		(aEvent.EventType() == ENotifyEncryptionChangeOn || aEvent.EventType() == ENotifyEncryptionChangeOff))
-		{
-		LOG(_L("sec\tEncryption Change complete..."))
-		
-		// We can try again as there was a race with some other PHY modification
-		// Curiously, the firmware always return ELMPErrorTransactionCollision (0x23) for both
-		// kinds of transaction collisions (0x23,0x2a), we guard against both situations here
-		// anyway just to be safe.
-		if(aEvent.ErrorCode() == ELMPErrorTransactionCollision || aEvent.ErrorCode() == EDifferentTransactionCollision)
-			{	
-			// This will force the state machine logic to try sending the command again
-			iState.SetEncryptionState(TBTAccessRequestState::ERequestNone);
-			}
-		else if(aEvent.ErrorCode() != KErrNone)
-			{
-			
-			iState.SetEncryptionState(TBTAccessRequestState::ERequestFailed);
-			}
-		else
-			{
-			iState.SetEncryptionState(TBTAccessRequestState::ERequestComplete);
-			}
-		}
-
-	TRAPD(err,NewStateL());
-	if (err)
-		{
-		CompleteRequest(err);
-		}
-	}
-
-
-CBTSecMan& CBTAccessRequester::SecMan()
-	{
-	LOG_FUNC
-	return iSecMan;
-	}
-
-TBool CBTAccessRequester::IsAuthenticationReqPending(const TBTDevAddr& aAddr, TUint& aPasskeyMinLength)
-	{
-	LOG_FUNC
-		if (iState.AuthenticationState() == TBTAccessRequestState::ERequestPending &&
-		    iAuthenticationInProgress && aAddr == iBaseband.BDAddr())
-			{
-			aPasskeyMinLength = iServiceRequirements.PasskeyMinLength();
-			return ETrue;
-			}
-		else 
-			{
-			aPasskeyMinLength = 0;
-			return EFalse;
-			}
-	}
-
-TBool CBTAccessRequester::AuthenticationRequired() const
-	{
-	LOG_FUNC
-	return iRequirements.AuthenticationRequired();
-	}
-
-TBool CBTAccessRequester::AuthenticationInProgress() const
-	{
-	LOG_FUNC
-	return iAuthenticationInProgress;
-	}
-
-void  CBTAccessRequester::SetAuthenticationInProgress()
-	{
-	LOG_FUNC
-	iAuthenticationInProgress = ETrue;
-	}
-	
-	 
- //------------------------------------------------------------------------//
- //class CSecNotifierUpdateAO
- //------------------------------------------------------------------------//
- 
-CSecNotifierUpdateAO* CSecNotifierUpdateAO::NewL(RNotifier& aNotifier, TUid aNotifierUid)
- 	{
-	LOG_FUNC
- 	CSecNotifierUpdateAO* s = CSecNotifierUpdateAO::NewLC(aNotifier, aNotifierUid);
- 	CleanupStack::Pop();
- 	return s;
- 	}
- 
-CSecNotifierUpdateAO* CSecNotifierUpdateAO::NewLC(RNotifier& aNotifier, TUid aNotifierUid)
- 	{
-	LOG_FUNC
- 	LOG(_L("sec\tCSecNotifierUpdateAO::NewLC()"));
- 	CSecNotifierUpdateAO* s = new(ELeave) CSecNotifierUpdateAO();
- 	CleanupStack::PushL(s);
- 	s->ConstructL(aNotifier, aNotifierUid);
- 	return s;
- 	}
- 
-CSecNotifierUpdateAO::CSecNotifierUpdateAO()
-: CActive(EPriorityStandard)
- 	{
-	LOG_FUNC
- 	CActiveScheduler::Add(this);
- 	}
- 
-CSecNotifierUpdateAO::~CSecNotifierUpdateAO()
- 	{
-	LOG_FUNC
- 	Cancel();
- 	}
- 
-void CSecNotifierUpdateAO::ConstructL(RNotifier& aNotifier, TUid aNotifierUid)
- 	{
-	LOG_FUNC
- 	iNotifier = aNotifier;
- 	iNotifierUid = aNotifierUid;	
- 	}
- 	
-void CSecNotifierUpdateAO::DoUpdate(const TBTNotifierUpdateParamsPckg& aPckg)
- 	{
-	LOG_FUNC
- 	//Retain a copy so that it does not go out of memory scope
- 	iPckg = aPckg;
- 	
- 	//we're not expecting an answer...
-	iNotifier.UpdateNotifierAndGetResponse(iStatus, iNotifierUid, iPckg, iAnswer);
- 	SetActive();	
- 	}
- 	
-void CSecNotifierUpdateAO::RunL()
- 	{
-	LOG_FUNC
- 	//We can't do anything if an error is returned - just make sure we haven't done anything stupid...	
- 	__ASSERT_DEBUG((iStatus==KErrNone)||(iStatus==KErrNoMemory)||(iStatus==KErrNotReady), User::Panic(KBTSecPanic, EBTSecBadNotifierUpdate));
- 	}
- 	
-void CSecNotifierUpdateAO::DoCancel()
- 	{
-	LOG_FUNC
- 	LOG(_L("sec\tCSecNotifierUpdateAO::DoCancel()"));
-	iNotifier.CancelNotifier(iNotifierUid); // no other API on Notifier to just cancel the update; but typically we'll want to cancel the whole notifier at this point(?)
-	}
- 	
-TInt CSecNotifierUpdateAO::RunError(TInt aError)
- 	{
-	LOG_FUNC
- 	LOG1(_L("sec\tCSecNotifierUpdateAO::RunError(%d)"), aError);
- 	
- 	#ifndef __FLOGGING__
- 		aError += 0; //Remove Compiler warning
- 	#endif
- 	 
- 	return KErrNone;	
- 	}
--- a/bluetooth/btstack/eabi/btU.def	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/eabi/btU.def	Wed Oct 13 16:20:29 2010 +0300
@@ -1,21 +1,3 @@
 EXPORTS
 	InstallBTProtocolFamily @ 1 NONAME
-	_ZN14CAvctpProtocol15NewSapLinksMgrLER33CSubConnectionProviderFactoryBaseR23CConnectionProviderBase @ 2 NONAME ABSENT
-	_ZN14CAvctpProtocol9NewMuxerLER33CSubConnectionProviderFactoryBaseR23CConnectionProviderBase @ 3 NONAME ABSENT
-	_ZN8CBlogger14GetFloggerInfoEv @ 4 NONAME
-	_ZTIN4Meta18RMetaDataContainerINS_13SMetaDataEComEEE @ 5 NONAME ABSENT ; #<TI>#
-	_ZTVN4Meta18RMetaDataContainerINS_13SMetaDataEComEEE @ 6 NONAME ABSENT ; #<VT>#
-	_ZTIN4Meta11TMetaVarLenI5RBuf8EE @ 7 NONAME ABSENT ; ##
-	_ZTIN4Meta11TMetaVarLenI6RBuf16EE @ 8 NONAME ABSENT ; ##
-	_ZTIN4Meta12TMetaVarLen8I5RBuf8EE @ 9 NONAME ABSENT ; ##
-	_ZTIN4Meta13TMetaVarLen16I6RBuf16EE @ 10 NONAME ABSENT ; ##
-	_ZTVN4Meta11TMetaVarLenI5RBuf8EE @ 11 NONAME ABSENT ; ##
-	_ZTVN4Meta11TMetaVarLenI6RBuf16EE @ 12 NONAME ABSENT ; ##
-	_ZTVN4Meta12TMetaVarLen8I5RBuf8EE @ 13 NONAME ABSENT ; ##
-	_ZTVN4Meta13TMetaVarLen16I6RBuf16EE @ 14 NONAME ABSENT ; ##
-	_ZTI16CAvctpControlSAP @ 15 NONAME
-	_ZTI31TAvctpBrowseChannelPseudoSocket @ 16 NONAME ABSENT
-	_ZTV16CAvctpControlSAP @ 17 NONAME
-	_ZTI31TAvctpSecondChannelPseudoSocket @ 18 NONAME
-	_ZTV31TAvctpSecondChannelPseudoSocket @ 19 NONAME
 
--- a/bluetooth/btstack/inc/blogger.h	Thu Sep 23 17:06:47 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,401 +0,0 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef BLOGGER_H__
-#define BLOGGER_H__
-
-#include "debug.h"
-
-#ifndef BLOGGING__
-NONSHARABLE_CLASS(CBlogger): public CBase
-	{
-public:
-	IMPORT_C TAny* GetFloggerInfo();
-	};
-#endif
-
-#ifdef BLOGGING__
-
-// Stack Blogging Layers
-const TInt KBlogLayerLinkLayer =1;
-const TInt KBlogLayerL2CAP     =2;
-const TInt KBlogBadLayerChoice =3;
-const TInt KBlogLayerRFComm    =4;
-
-// Stack Layers Logging Masks
-const TInt KBlogNoLayer   =0x00000000;
-const TInt KBLogLinkLayer =0x00000001;
-const TInt KBlogL2CAP     =0x00000002;
-const TInt KBLogRFComm    =0x00000004;
-const TInt KBlogAllLayers =0x7fffffff;
-
-//Blogging Verbosity Levels
-const TInt KBlogVerbosityOff          =0x00000000; 
-const TInt KBlogVerbosityTimeCritical =0x00000001; 
-const TInt KBlogVerbosityMinimal      =0x00000002; 
-const TInt KBlogVerbosityNormal       =0x00000003; 
-const TInt KBlogVerbosityBTQualLevel  =0x00000004;
-const TInt KBlogVerbosityLoud         =0x00000005; 
-const TInt KBlogVerbosityAllLevels    =0x00000006;
-
-
-//BLogging Type Masks
-const TInt KBlogTypeLogAllMask          = 0xffffffff;
-const TInt KBlogTypeProtocol	        = 0x00000001;
-const TInt KBlogTypeTimestamp           = 0x00000002;
-const TInt KBlogTypeTimeout             = 0x00000004;
-const TInt KBlogTypeTestAppContext      = 0x00000008;
-const TInt KBlogTypeFCS                 = 0x00000010;
-const TInt KBlogTypeBaseband            = 0x00000020;
-const TInt KBlogTypeChannelNumber       = 0x00000040;
-const TInt KBlogTypePSMNumber           = 0x00000080;
-const TInt KBlogTypeIncomingPacket      = 0x00000100;
-const TInt KBlogTypeOutgoingPacket      = 0x00000200;
-const TInt KBlogTypeRawFrames           = 0x00000400;
-const TInt KBlogTypeL2CAPSignallerState = 0x00000800;
-const TInt KBlogTypeRFCOMMMuxState      = 0x00001000;
-const TInt KBlogTypeSapState            = 0x00002000;
-const TInt KBlogTypeCurrentState        = 0x00004000;
-const TInt KBlogTypeStateChange         = 0x00008000;
-const TInt KBlogTypeRequest             = 0x00010000;
-const TInt KBlogTypeExpectedResponse    = 0x00020000;
-const TInt KBlogTypeActualResponse      = 0x00040000;
-const TInt KBlogTypeInquiry             = 0x00080000;
-const TInt KBlogTypeInquiryResult       = 0x00100000;
-const TInt KBlogTypeKeyRegistration     = 0x00200000;
-const TInt KBlogTypeKeyFailure          = 0x00400000;
-const TInt KBlogTypeLinkKeyInteraction  = 0x00800000;
-const TInt KBlogTypeCtrlFrames          = 0x01000000;
-const TInt KBlogTypeUIHFrames           = 0x02000000;
-const TInt KBlogTypeMuxCtrlFrames       = 0x04000000;
-const TInt KBlogTypeCtrlFrameBits       = 0x08000000; 
-const TInt KBlogTypeOutgoingFrames		= 0x10000000; 
-const TInt KBlogTypeCreditAccounting    = 0x20000000;
-const TInt KBlogTypeSecurity            = 0x40000000;
-const TInt KBLogTypeLocalHCPokes        = 0x80000000;
-
-//Logging LITs
-
-
-_LIT(KBlogCommand, "command");
-_LIT(KBlogResponse, "response");
-
-
-_LIT(KBlogBluetoothAddrLit,"Bluetooth Address:");
-
-//Layer/Protocol dependent
-_LIT(KBlogIncomingPacket, "Incoming packet, Type %d, Size %d, Payload %08x"); //received data pkt with size and type of pkt
-_LIT(KBlogOutgoingPacket, "Outgoing packet, Type %d, Size %d, Payload %08x"); //sent data pkt with size and type of pkt
-_LIT(KBlogRawFrames, "Frame Type %d, 0x%8x");// frame type and content - different specific info required from different types of Frame
-_LIT(KBlogSapId, "%d SAP %08x"); //type of SAP (RFCOMM/L2CAP) and sap id
-_LIT(KBlogSapState, "SAP State %d");
-_LIT(KBlogCurrentState, "Current State %d");
-_LIT(KBlogStateChange, "State %d");
-_LIT(KBlogInquiryResult, "Inquiry Result");
-
-//L2CAP
-_LIT(KBlogChannelNumber, "Channel %d");
-_LIT(KBlogL2CAPSignallerState, "Signaller State %d");
-_LIT(KBlogPSMNumber, "PSM %d");
-_LIT(KBlogL2, "L2: ");
-_LIT(KBlogL2Test, "Test");
-_LIT(KBlogTest, "L2: TEST NUMBER is %d");
-
-
-
-
-//RFCOMM
-
-_LIT(KBlogMuxId, "MUX %08x");
-_LIT(KBlogFrameid, "Frame id %08x");
-//States
-_LIT(KBlogRFCOMMMuxState, "Mux State %d");
-//Frame Parts
-_LIT(KBlogDLCI, "         DLCI %d");
-_LIT(KBlogPFSet, "         P/F bit = %d");
-_LIT(KBlogEASet, "         EA  bit = %d");
-_LIT(KBlogCRSet, "         C/R bit = %d");
-_LIT(KBlogActualFCS, "         Actual PDU FCS %d");
-_LIT(KBlogComputedFCS, "         Computed FCS %d - (should be 0xCF)");
-_LIT(KBlogComparedFCS, "         Compared FCS %d");
-_LIT(KBlogSignals, "         Signals 0x%02x");
-
-//Timeouts
-_LIT(KBlogTimeout, "T1 timer expired awaiting response for ");
-//Ctrl Frames
-_LIT(KBlogSABM, "SABM");
-_LIT(KBlogDM, "DM");
-_LIT(KBlogUA, "UA");
-_LIT(KBlogDISC, "DISC");
-//Frame Types
-_LIT(KBlogFrameType, "Frame of type %d");
-_LIT(KBlogCtrlFrame, "Ctrl Frame: ");
-_LIT(KBlogUIHCtrlFrame, "UIH Ctrl Frame");
-_LIT(KBlogSimpleUIH, "UIH simple data frame");
-_LIT(KBlogShortUIH, "UIH simple data frame");
-_LIT(KBlogLongUIH, "UIH simple data frame");
-_LIT(KBlogCreditUIH, "UIH credit data frame");
-_LIT(KBlogLongCreditUIH, "Tx :Long UIH credit data frame with %d credits");
-_LIT(KBlogShortCreditUIH, "Tx: Short UIH credit data frame with %d credits");
-_LIT(KBlogMuxCtrlFrame, "Mux Ctrlframe");
-//MuxCtrlCommands
-_LIT(KBlogTestCommand, "TestCommand");
-_LIT(KBlogFcOn, "FcOn");
-_LIT(KBlogFcOff, "FcOff");
-_LIT(KBlogMSC, "MSC");
-_LIT(KBlogRPN, "RPN");
-_LIT(KBlogRLS, "RLS");
-_LIT(KBlogPN, "PN");
-_LIT(KBlogNSC, "NSC");
-//Data
-_LIT(KBlogNewData, "New packet of data arrived from L2CAP, count %d");
-_LIT(KBlogNewDataFrame, "Creating new datapacket for outbound queue, dlci %d, data length %d, sap %08x, ");
-_LIT(KBlogWriteData, "Writing data, 0x%x");
-_LIT(KBlogNonZeroLength, "with non-zero length");
-
-//Link Layer
-_LIT(KBlogNewLinkConnectionEvent,"LL: Connection complete event. Code %d, link type=%d ");
-_LIT(KBlogNewLinkConnectionReqEvent, "LL: Incoming connection request event"); 
-_LIT(KBlogNewLinkDisconnectionEvent,"LL: Disconnection complete event. Handle %x, Code %d, Reason %d");
-_LIT(KBlogHCSendPacketsOK,"LL: Notifying DataQ Controller of %d Completed packets from HC to remote");
-_LIT(KBlogLLDataIn ,"LL: Data received for handle %d, flags %d, length %d");
-_LIT(KBlogACLFrame,"LL: ACL Frame:");
-_LIT(KBlogLLDataIn2Null,"LL: Warning!! Data received with no datalink notifier in place");
-_LIT(KBlogLLScanEnableResult,"LL: ReadScanEnableResult received, with error code %d, value %d");
-_LIT(KBlogHCBufferSizeResult,"LL: ReadBufferSizeResult - aErr %d, aAclMaxLen %d, aNoACL %d");
-_LIT(KBlogHCReadTimeoutResult,"LL: Warning!! Unhandled ReadTimeoutResult (EConnectionAcceptTimeout)");
-_LIT(KBlogVendorEvent,"LL: Warning!! Just received a Vendor Specific Debug Event !");
-_LIT(KBlogHardwareError,"LL: Error! HardwareErrorEvent Received: %d");
-_LIT(KBlogHCIBufferNewCredits,"LL: HCI Buffer Strategy, Credit available, trying to issue.");
-_LIT(KBlogLLTransportFreed,"LL: LinkMgr, Transport is now free");
-_LIT(KBlogHCIssuedCmdCredits,"LL: LinkMgr, HC issued %d command credits");
-_LIT(KBlogLLSetLocalNameComplete,"LL: SetLocalName Command Complete Event");
-_LIT(KBlogLLWritePageTOComplete,"LL: WritePageTimeout Command Complete Event");
-_LIT(KBlogLLWriteCoDComplete,"LL: WriteClassOfDevice Command Complete Event");
-_LIT(KBlogLLWriteVoiceSettingComplete,"LL: WriteVoiceSetting Command Complete Event");
-_LIT(KBlogLLWriteScanEnable,"LL: WriteScanEnable Command Complete Event");
-_LIT(KBlogLLWriteCurrentIACLAPComplete,"LL: WriteCurrentIACLAP Command Complete Event");
-_LIT(KBlogLLSetHC2HostFCComplete,"LL: SetHostControllerToHostFlow Command Complete Event");
-_LIT(KBlogLLCommandWarning,"LL: Warning, Unhandled Command complete event! Opcode %d error code %d");
-_LIT(KBlogLLWriteAFHHostChannelClassification,"LL: WriteAFHHostChannelClassificationComplete Command Complete Event");
-_LIT(KBlogLLReadAFHChannelAssessmentModeComplete,"LL: ReadAFHChannelAssessmentModeComplete Command Complete Event");
-_LIT(KBlogLLWriteAFHChannelAssessmentModeComplete,"LL: WriteAFHChannelAssessmentModeComplete Command Complete Event");
-
-//MISC
-_LIT(KKeyRegistration, "Key Registration");
-_LIT(KKeyFailure, "Key Failure");
-_LIT(KPINKeyInteraction, "PIN Key");
-
-// Const Lit Lengths for the predifined Lits
-//255 is the max RDebug::Print size
-const TInt KRDBMaxLit=255;
-const TInt KBlogDateTimeLitLength=36; //depends on date, time formating lits
-const TInt KBlogTCPreambleLitLength=20;
-const TInt KBlogTestCaseMaxLitLength=KRDBMaxLit+KBlogDateTimeLitLength+KBlogTCPreambleLitLength;
-const TInt KBlogTestCaseResultPreambleLitLength=36;
-const TInt KBlogTestCaseResultMaxLitLength=KBlogTestCaseResultPreambleLitLength+KBlogDateTimeLitLength+KRDBMaxLit;
-const TInt KBlogTesterMessageInfoLitLength=100;
-const TInt KBlogTesterMessageInfoMaxLitLength=KBlogDateTimeLitLength+KBlogTesterMessageInfoLitLength;
-const TInt KBlogMessageMaxLitLength=512;
-
-//Blogging Output Resource Types
-// if we ever need to put more than 2 then implement it with dynamic binding
-const TInt KBlogOutputTypeIsRDebug  =0;
-const TInt KBlogOutputTypeIsFlogger =1;
-
-// The number of chars to be printed on single line over COM1 or on a file
-const TInt KBlogOutputWindowDefault=80;
-
-
-// Common Lits
-
-// need to be in sync with KBlogDateTimeLitLength
-_LIT(KBlogTimeFormat,"%J%:1%T%:2%S      "); 
-_LIT(KBlogDateFormat,"%1%/1%2%/2%3      ");
-_LIT(KBlogBlankDate,"--:--:----      ");
-_LIT(KBlogBlankTime,"--:--:--      ");
-_LIT(KBlogTestCaseLit,"Test Case Running:  ");
-// need to be in sync with KBlogTesterMessageInfoLitLength
-//_LIT(KBlogTesterMessageInfoLit,"[Message from the tester follows:]"); 
-_LIT(KBlogTesterMessageInfoLit,"Tester: "); 
-
-// Test Case Result Consts
-// these should be used with the KBloggerSetTestCaseResult option
-const TInt KBlogTestCaseResultPassed       = 0;
-const TInt KBlogTestCaseResultFailed       = 1;
-const TInt KBlogTestCaseResultInconclusive = 2;
-const TInt KBlogTestCaseResultSkipped      = 3;
-const TInt KBlogTestCaseResultUpperNo      = 3; // for bounds checking
-
-// Test Case Result Lits
-// these should be used with the KBloggerSetTestCaseResult option
-// remember to cjheck with KBlogTestCaseResultPreambleLitLength
-// if any of the below Lits gets changed
-_LIT(KBlogTestCaseResultLitPass,"[PASSED] test for test case : ");
-_LIT(KBlogTestCaseResultLitFailed, "[FAILED] test for test case : ");
-_LIT(KBlogTestCaseResultLitInconclusive, "[INCONCLUSIVE] test for test case : ");
-_LIT(KBlogTestCaseResultLitSkipped,"[SKIPPED] test for test case : ");
-
-enum TBTBloggingOptions
-	{
-	KBloggerSetLayers,
-	KBloggerSetVerbosity,
-	KBloggerSetLoggingMask,
-	KBloggerSetMedium,
-	KBloggerSetTestCaseName,
-	KBloggerSetOutputWindow,
-	KBloggerSetTestCaseResult, // to be used with the appropriate lits to indicate result
-	KBloggerSetTesterMessage,  // to be formated according to the corresponding lit
-	KBloggerSetAllOptions //should use TBlogSettings
-	};
-
-struct TBlogSettings
-	{
-	TInt iLayersToLog;
-	TInt iVerbosity;
-	TInt iLoggingMask;
-	TInt iMediumToLog;
-	TInt iOutputWindowSize;
-	TBuf<255> iTestCaseLit;
-	};
-typedef TPckgBuf<TBlogSettings> TBlogSettingsPckg;
-
-typedef TBuf<255>  TBlogTestCaseLit;
-
-enum TBloggerPanic
-	{
-	EBloggerLayerRegistrationOutOfRange    =0,
-	EBloggerLayerBloggetteAlreadyRegistered=1,
-	EBloggerLayerRequestedOutOfRange       =2,
-	EBloggerResourceTypeIsBogus            =3,
-	EBloggerTestCaseResultIsBogus          =4, // check your KBlogTestCaseResultUpperNo
-	EBloggerDescriptorLengthWasShorter     =5,
-	EBloggerMessageLengthTooLong           =6
-	};
-
-class CRfcommSAP;
-class CRfcommMuxCtrlFrame;
-class CRfcommMuxer;
-class CRfcommFrame;
-class CRfcommCtrlFrame;
-class CBloggette;
-
-NONSHARABLE_CLASS(CBlogger) : public CBase
-	{
-public:
-	~CBlogger();
-	static CBlogger* NewL();
-	void ConstructL();
-	TInt LoggingMask(TInt aLayer, TInt aVerbosity) const;
-	CBloggette* GetLayerBloggette(TInt aLayer); //only one per layer please
-	void Register(CBloggette* aLayerBloggette);
-	void Blog(const TDesC& aMessage, TInt aFrameWindow);
-	void Blog(const TDesC& aMessage);
-	void HexDump(const TDesC& aDescription,const TDesC8& aHexFrame,TInt aFrameWindow=KBlogOutputWindowDefault);
-	// to be used by the protocol layer which receives the SetOp
-	TInt UpdateLoggingSettings(TUint aOptionType,const TDesC8& aOption);
-	void StoreFloggerInfo(TAny* aLogInfo);
-	IMPORT_C TAny* GetFloggerInfo();
-private:
-	CBlogger();
-	void Panic(TBloggerPanic aPanic);
-	// Blogging calls
-	void BlogTestCase(TDesC& aTestCaseName);
-	void BlogTestCaseResult(TInt aTestCaseResult);
-	void BlogTesterMessage(TDesC& aTesterMessage);	
-	void DoBlog(const TDesC& aMessage, TInt aFrameWindow=KBlogOutputWindowDefault);
-	// Output and formating
-	void DoOutputToResourceL(const TDesC& aMessage);
-	void CreateBlogFileL();
-	void DoFileL();
-	void MakefilenameL(const TDesC &aFileName);
-	TInt DoDateTimeFormat(TDes& aDesToPrepend);
-	//for testing and debugging only
-	void DoBloggerTests(); 
-private:
-	friend class CHCILinkMgr; // for testing
-	CBloggette* iLLBloggette;
-	CBloggette* iL2Bloggette;
-	CBloggette* iRFBloggette;
-
-	TInt  iOutputWindowSize;
-	TInt  iVerbosityLevel;
-	TInt  iLayersToLogMask;
-	TInt  iLoggingMask;
-	TInt  iMediumType;  // 0 for port 0, 1 for Flogger - defaults to zero because member of C Class.
-	TBuf<KRDBMaxLit> iTestCaseLit;
-
-	TAny* iFloggerInfo; // when flogging is compiled in
-	RFs	  ifileserv;
-	RFile ifile;
-	TBool iFileExists;
-	HBufC* ifilename;
-	};
-
-NONSHARABLE_CLASS(CBloggette) : public CBase
-	{
-public:
-	~CBloggette();
-	inline TInt Layer() const;
-	void Log(TRefByValue<const TDesC> aFormatingLit, ...);
-	void HexDump(TRefByValue<const TDesC> aDescription,const TDesC8& aHexFrame, TInt aFrameWindow=80);
-	virtual TDesC NameDes()=0;
-protected:
-	CBloggette(CBlogger* aProvider, TInt aLayer);
-	TInt	  iLayer;
-	CBlogger* iBlogger;
-	};
-
-NONSHARABLE_CLASS(CLLBloggette) : public CBloggette
-	{
-public:
-	static CLLBloggette* NewL(CBlogger* aProvider, TInt aLayer); //only one per layer please
-	~CLLBloggette();
-	virtual TDesC NameDes();
-private:
-	CLLBloggette(CBlogger* aProvider, TInt aLayer);
-	};
-
-NONSHARABLE_CLASS(CL2Bloggette) : public CBloggette
-	{
-public:
-	static CL2Bloggette* NewL(CBlogger* aProvider, TInt aLayer);
-	~CL2Bloggette();
-	virtual TDesC NameDes();
-private:
-	CL2Bloggette(CBlogger* aProvider, TInt aLayer);
-	};
-
-NONSHARABLE_CLASS(CRFBloggette) : public CBloggette
-	{
-	friend class CRfcommCtrlFrame;
-public:
-	static CRFBloggette* NewL(CBlogger* aProvider, TInt aLayer);
-	~CRFBloggette();
-	virtual TDesC NameDes();
-private:
-	CRFBloggette(CBlogger* aProvider, TInt aLayer);
-	friend class CRfcommFrame; //Shehla
-	friend class CRfcommMuxer; //Shehla	
-	void Timeout(/*CRfcommSAP* aSAP, CRfcommMuxer* aMux,  */CRfcommFrame* aFrm );
-	void ExplainOutgoingFrame(CRfcommFrame* aFrm, CRfcommMuxer* aMux);
-	void ExplainIncomingFrame(TUint8 addr, TUint8 ctrl, TBool poll);
-	void LogMuxCommand(CRfcommSAP* aSAP, CRfcommMuxer* aMux, TUint8 aCommand);
-	void IncomingCtrlMessage(TUint8 aCtrlmessage, TInt aLength);
-	};
-
-#endif
-#endif
-
--- a/bluetooth/btstack/inc/debug.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/inc/debug.h	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -27,11 +27,6 @@
 #include <f32file.h>
 #include <comms-infras/commsdebugutility.h>
 
-#ifdef __FLOG_ACTIVE	// = commsdbg logging on
-//#define BLOGGING__    //removed for MCL submission
-#define __FLOGGING__
-#endif // __FLOG_ACTIVE
-
 // Borrowed from comms-framework - experimental ASSERT variants that
 // breakpt at the scene of the crime.
 #ifdef _DEBUG
@@ -45,7 +40,6 @@
 #endif
 
 
-class CBlogger;
 class CDeltaTimer;
 class CDebugControlInterface;
 class CAvdtpLogEngine;
@@ -56,7 +50,6 @@
 public:
 	CDeltaTimer*			iTimer;	// always needed: not owned
 	TUint					iPort;	// the serial port we are on - for logging only
-	CBlogger*				iBlogger;	// for logging only	
 	CDebugControlInterface* iDebugCtrlIF;
 	CAvdtpLogEngine*		iAvdtpLogEngine;
 	CAvctpLogEngine*		iAvctpLogEngine;	
@@ -112,142 +105,14 @@
 
 #ifndef LOGGER_H
 
-_LIT(KLogFile,"btlog0.txt");
-const TInt KLogIndexOffset=5;
-_LIT(KLogDirFullName,"c:\\logs\\bt\\");
-_LIT(KLogDir,"BT");
-
-//#define COMMENT SLASH(/)
-#define COMMENT
-//#define SLASH(s) /##s
-#ifndef BLOGGING__
-// define empty blogging macro stubs
-#define BLOGGER                    COMMENT
-#define BLOG(layer,verbosity,type,blog_call,cbloggette_type) COMMENT
-//------- Blogging for BT Qual ------------
-#define LLQBLOG(type,blog_call)     COMMENT
-#define L2QBLOG(type,blog_call)     COMMENT
-#define RFQBLOG(type,blog_call)     COMMENT
-//------- Loud Blogging Calls -------------
-#define LLLBLOG(type,blog_call)     COMMENT
-#define L2LBLOG(type,blog_call)     COMMENT
-#define RFLBLOG(type,blog_call)     COMMENT
-//------- Generic Blogging calls ----------
-#define LLBLOG(verbosity,type,blog_call)      COMMENT
-#define L2BLOG(verbosity,type,blog_call)      COMMENT
-#define RFBLOG(verbosity,type,blog_call)      COMMENT
-#else   // define blogging calls
-#define BLOGGER BTTLS->iBlogger
-#define BLOG(layer,verbosity,type,blog_call,cbloggette_type) \
-	{ \
-	CBlogger* pBlog = BLOGGER;  \
-	CBloggette* pBloggette;\
-	if((pBlog->LoggingMask(layer,verbosity))&(type))  \
-		{  \
-		pBloggette=(pBlog->GetLayerBloggette(layer)); \
-		(STATIC_CAST(cbloggette_type*,pBloggette))->blog_call;  \
-		}  \
-	}
-// the blog_call should look like Log(KMyFormatingLit,var1,var2,varbla);
-// or L2BLOG(KVerbose,Log(KL2ConnLit, connH, addr));
-// or L2BLOG(KVerbose,ConnLog(connH,addr));
-//------- Blogging for BT Qual ------------
-#define LLQBLOG(type,blog_call) BLOG(KBlogLayerLinkLayer,KBlogVerbosityBTQualLevel,type,blog_call, CLLBloggette)
-#define L2QBLOG(type,blog_call) BLOG(KBlogLayerL2CAP,KBlogVerbosityBTQualLevel,type,blog_call, CL2Bloggette)
-#define RFQBLOG(type,blog_call) BLOG(KBlogLayerRFComm,KBlogVerbosityBTQualLevel,type,blog_call, CRFBloggette)
-//------- Loud Blogging Calls -------------
-#define LLLBLOG(type,blog_call) BLOG(KBlogLayerLinkLayer,KBlogVerbosityLoud,type,blog_call,CLLBloggette)
-#define L2LBLOG(type,blog_call) BLOG(KBlogLayerL2CAP,KBlogVerbosityLoud,type,blog_call, CL2Bloggette)
-#define RFLBLOG(type,blog_call) BLOG(KBlogLayerRFComm,KBlogVerbosityLoud,type,blog_call, CRFBloggette)
-//------- Generic Blogging calls ----------
-#define LLBLOG(verbosity,type,blog_call) BLOG(KBlogLayerLinkLayer,verbosity,type,blog_call,CLLBloggette)
-#define L2BLOG(verbosity,type,blog_call) BLOG(KBlogLayerL2CAP,verbosity,type,blog_call,CL2Bloggette)
-#define RFBLOG(verbosity,type,blog_call) BLOG(KBlogLayerRFComm,verbosity,type,blog_call,CRFBloggette)
-#endif
-  
 inline void __BTDEBUGGER()
 // needed to call __DEBUGGER inside an __ASSERT
 	{
 	__DEBUGGER()
 	}
 
-#ifdef __FLOGGING__
-#define FLOG(a) {FPrint(a);}
-#define FTRACE(a) {a;}
-
-inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
-	{
-	VA_LIST list;
-	VA_START(list,aFmt);
-	TBuf<32> logFile(KLogFile);
-#ifdef BLOGGING__
-	// the Blogger holds the flogging file index since it is pointed by the TLS
-	CBlogger* pBlog = BLOGGER;
-	logFile[KLogIndexOffset]=TText('0'+(TInt)pBlog->GetFloggerInfo());	
-#else
-	logFile[KLogIndexOffset]=TText('0'+BTTLS->iPort);
-#endif
-	RFileLogger::WriteFormat(KLogDir, logFile, EFileLoggingModeAppend, aFmt, list);
-#ifdef MEMTRACE
-	TInt size;
-	User::Heap().AllocSize(size);
-	
-	RFileLogger::WriteFormat(KLogDir, logFile, EFileLoggingModeAppend, _L("Mem usage: %d high: %d"), size, User::Heap().Size());
-#endif
-	}
-
-inline void FHex(const TUint8* aPtr, TInt aLen)
-	{
-	TBuf<32> logFile(KLogFile);
-	logFile[KLogIndexOffset]=TText('0'+BTTLS->iPort);
-	RFileLogger::HexDump(KLogDir, logFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen);
-	}
-
-inline void FHex(const TDesC8& aDes)
-	{
-	FHex(aDes.Ptr(), aDes.Length());
-	}
-
+#endif // LOGGER_H
 
-#define SCO_LOG(a) FPrint(a);
-#define SCO_LOG_2(a, b) FPrint(a, b);
-#define SCO_LOG_3(a, b, c) FPrint(a, b, c);
-#define SCO_LOG_4(a, b, c, d) FPrint(a, b, c, d);
-#define SCO_LOG_5(a, b, c, d, e) FPrint(a, b, c, d, e);
-#define SCO_LOG_6(a, b, c, d, e, f) FPrint(a, b, c, d, e, f);
-#define SCO_LOG_ADDR(string, addr) { TBuf<20> addrbuf; addrbuf.Format(_L("%02x:%02x:%02x:%02x:%02x:%02x"), addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); SCO_LOG_2(string, &addrbuf); }
-
-#else // i.e. __FLOGGING__ undefined
-#define FLOG(a)
-#define FTRACE(a)
-
-#define SCO_LOG(a)
-#define SCO_LOG_2(a, b)
-#define SCO_LOG_3(a, b, c)
-#define SCO_LOG_4(a, b, c, d)
-#define SCO_LOG_5(a, b, c, d, e)
-#define SCO_LOG_6(a, b, c, d, e, f)
-#define SCO_LOG_ADDR(string, addr)
-
-
-inline void FPrint(const TRefByValue<const TDesC> /*aFmt*/,...) 
-	{
-#ifdef _DEBUG // to quell linker warnings
-	RFileLogger dummy;
-#endif
-	}
-
-inline void FHex(const TUint8* /*aPtr*/, TInt /*aLen*/)
-	{
-	}
-
-inline void FHex(const TDesC8& /*aDes*/)
-	{
-	}
-
-#endif //	__FLOGGING__
-
-#endif // #ifndef LOGGER_H
 
 #define __PANIC_UNEXPECTED_CALL __ASSERT_DEBUG(NULL, User::Invariant());
 
--- a/bluetooth/btstack/l2cap/L2CapFecNegotiator.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/l2cap/L2CapFecNegotiator.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -592,32 +592,40 @@
 TInt TL2CapOutgoingFecNegotiator::ProcessPeerValue(const TRetransmissionAndFlowControlOption& aFecOption)
 	{
 	LOG_FUNC
+	TInt err = KErrNone;
 
-	TInt err = KErrNone;
-	TBool disconnect = EFalse;
-	TBool peerModeAcceptable = IsPeerModeAcceptable(aFecOption.LinkMode(), disconnect);
-	
-	if (peerModeAcceptable)
+	if (!iFecNegotiator.ModeSpecificHandlers().IsOptionValid(aFecOption))
 		{
-		iPeer = aFecOption;
-		iIncludeValueInPositiveConfigResponse = iFecNegotiator.ModeSpecificHandlers().BuildPositiveResponse(iPreferred, iPeer);
-		iConfigStatus = EOptionConfigComplete;
+		iConfigStatus = EOptionConfigFailed;
+		err = KErrBadPacketReceived;
 		}
 	else
 		{
-		if (disconnect)
+		TBool disconnect = EFalse;
+		TBool peerModeAcceptable = IsPeerModeAcceptable(aFecOption.LinkMode(), disconnect);
+
+		if (peerModeAcceptable)
 			{
-			// Disconnect immediately without sending an Unacceptable Parameters response.
-			iConfigStatus = EOptionConfigFailed;
-			err = KErrConfigRejected;
+			iPeer = aFecOption;
+			iIncludeValueInPositiveConfigResponse = iFecNegotiator.ModeSpecificHandlers().BuildPositiveResponse(iPreferred, iPeer);
+			iConfigStatus = EOptionConfigComplete;
 			}
 		else
 			{
-            iPreferred.SetLinkMode(iFecNegotiator.DesiredMode());			
-			iFecNegotiator.ModeSpecificHandlers().BuildNegativeResponse(iPreferred, aFecOption);
-			// Cause an Unacceptable Parameters response.
-			iConfigStatus = EOptionConfigFailed;
-			// Preferred contains our desired FEC, it will be included in the Unaccepted Parameters response.
+			if (disconnect)
+				{
+				// Disconnect immediately without sending an Unacceptable Parameters response.
+				iConfigStatus = EOptionConfigFailed;
+				err = KErrConfigRejected;
+				}
+			else
+				{
+				iPreferred.SetLinkMode(iFecNegotiator.DesiredMode());			
+				iFecNegotiator.ModeSpecificHandlers().BuildNegativeResponse(iPreferred, aFecOption);
+				// Cause an Unacceptable Parameters response.
+				iConfigStatus = EOptionConfigFailed;
+				// Preferred contains our desired FEC, it will be included in the Unaccepted Parameters response.
+				}
 			}
 		}
 	LOG1(_L("\tOutgoing FEC Config Status is now %d"), iConfigStatus);
--- a/bluetooth/btstack/l2cap/L2CapFecNegotiator.inl	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/l2cap/L2CapFecNegotiator.inl	Wed Oct 13 16:20:29 2010 +0300
@@ -175,14 +175,7 @@
 
 inline TInt TL2CapFecNegotiator::PeerRequestsOption(const TRetransmissionAndFlowControlOption& aFecOption)
 	{
-	if (iModeSpecificHandlers.IsOptionValid(aFecOption))
-		{
-		return iOutgoingNegotiator.ProcessPeerValue(aFecOption);
-		}
-	else
-		{
-		return KErrBadPacketReceived;
-		}
+	return iOutgoingNegotiator.ProcessPeerValue(aFecOption);
 	}
 
 inline TInt TL2CapFecNegotiator::PeerRequestsLastAcceptedValue()
--- a/bluetooth/btstack/l2cap/L2CapPDU.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/l2cap/L2CapPDU.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1252,7 +1252,7 @@
    iCommands(_FOFF(HL2CapCommand, iLink)),
    iCommandIter(iCommands)   
 	{
-	LOG_STATIC_FUNC
+	LOG_FUNC
 	L2CAP_DEBUG(ObjectAllocation(L2capDebugInfo::ECFrame,
 	                             L2capDebugInfo::EAllocated));
 	}
--- a/bluetooth/btstack/l2cap/L2CapSDUQueue.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/l2cap/L2CapSDUQueue.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -39,12 +39,13 @@
 	                                  TUint16 aFlushTimeout, 
 		                              TUint16 aMaxOutgoingMTU,
                                		  TUint16 aMaxIncomingMTU,
+                               		  TUint16 aAclBufSize,
                                		  TBool aCanDropSdus)
 	{
 	LOG_STATIC_FUNC
 	CL2CapSDUQueue* self = new(ELeave) CL2CapSDUQueue(aL2CapSap, aOutboundQueueSize, aPDUSize, aFlushTimeout, aMaxOutgoingMTU, aMaxIncomingMTU, aCanDropSdus);
 	CleanupStack::PushL(self);
-	self->ConstructL(aLocalCID, aRemoteCID, aMuxer, aConfig);
+	self->ConstructL(aLocalCID, aRemoteCID, aMuxer, aConfig, aAclBufSize);
 	return self;
 	}
 		                                  
@@ -58,15 +59,17 @@
 	                                 TUint16 aFlushTimeout, 
 		                             TUint16 aMaxOutgoingMTU,
                                		 TUint16 aMaxIncomingMTU,
+                               		 TUint16 aAclBufSize,
                                		 TBool aCanDropSdus)
 	{
 	LOG_STATIC_FUNC
-	CL2CapSDUQueue* self = NewLC(aL2CapSap, aLocalCID, aRemoteCID, aMuxer, aPDUSize, aOutboundQueueSize, aConfig, aFlushTimeout, aMaxOutgoingMTU, aMaxIncomingMTU, aCanDropSdus);
+	CL2CapSDUQueue* self = NewLC(aL2CapSap, aLocalCID, aRemoteCID, aMuxer, aPDUSize, aOutboundQueueSize, aConfig, aFlushTimeout,
+								 aMaxOutgoingMTU, aMaxIncomingMTU, aAclBufSize, aCanDropSdus);
 	CleanupStack::Pop();
 	return self;
 	}	                                 
  
-void CL2CapSDUQueue::ConstructL(TL2CAPPort aLocalCID, TL2CAPPort aRemoteCID, CL2CAPMux& aMuxer, TL2CapDataControllerConfig* aConfig)
+void CL2CapSDUQueue::ConstructL(TL2CAPPort aLocalCID, TL2CAPPort aRemoteCID, CL2CAPMux& aMuxer, TL2CapDataControllerConfig* aConfig, TUint16 aAclBufSize)
 	{
 	LOG_FUNC
 	iDataController = CL2CapBasicDataController::NewL(aLocalCID, aRemoteCID, aMuxer, *this, aConfig);
@@ -77,6 +80,8 @@
 	iSDUSentAsyncCallBack = new (ELeave)CAsyncCallBack(sdusSentCB, EActiveLowPriority);
 	TCallBack qClosingCB(QueueClosingAsyncCallBack, this);
 	iQueueClosingCallBack = new (ELeave)CAsyncCallBack(qClosingCB, EActiveHighPriority);
+
+	iCurrentPDUSize = HL2CapPDU::GetPDUOrFragmentSize(iMaxOutgoingMTU, iMaximumPDUSize, aAclBufSize, iDataController->IsBasicDataVersion());
 	}
 	
 
@@ -665,7 +670,8 @@
                     				TUint16 aFlushTimeout,
                     				TUint16 aPDUSize,
                     				TUint16 aMaxOutgoingMTU,
-                    				TUint16 aMaxIncomingMTU)
+                    				TUint16 aMaxIncomingMTU,
+                    				TUint16 aAclBufSize)
 	{
 	LOG_FUNC
 	// Update the data controller.
@@ -709,7 +715,7 @@
 		}
 	if (err == KErrNone)
 		{
-		iCurrentPDUSize = iNegotiatedPDUSize;
+		iCurrentPDUSize = HL2CapPDU::GetPDUOrFragmentSize(iMaxOutgoingMTU, iMaximumPDUSize, aAclBufSize, iDataController->IsBasicDataVersion());
 	
 		// Allow the outbound queue to send again, and tell the data
 		// plane if SDU's are available.
@@ -737,17 +743,56 @@
 		}
 	}
 
-TBool CL2CapSDUQueue::IsBasicDataVersion() const
+TUint CL2CapSDUQueue::GetOptimalMTUSizeL(TUint aMtuRestriction, TUint16 aAclBufSize)
 	{
 	LOG_FUNC
-	TBool rValue = EFalse;
-	if (iDataController)
+
+	if (!iDataController)
+		{
+		// Can happen if we're being shut down quickly due to an error and the upper layer
+		// still hasn't reacted to that.
+		LEAVEL(KErrNotReady);
+		}
+
+	// Ensure that the restriction is less then the current MTU.
+	if (aMtuRestriction < iMaxOutgoingMTU)
+		{
+		// We now need to recalculate the optimal PDU size for the restricted MTU as
+		// this is used in the calculation of the optimal MTU
+
+		iCurrentPDUSize = HL2CapPDU::GetPDUOrFragmentSize(aMtuRestriction, iMaximumPDUSize,
+                                                          aAclBufSize, iDataController->IsBasicDataVersion());
+		}
+	else
 		{
-		rValue = iDataController->IsBasicDataVersion();
+		// can't increase the MTU at this stage so just use the existing MTU
+		aMtuRestriction = iMaxOutgoingMTU;
 		}
-	return rValue;
+
+	// If the negotiated MTU minus any overhead will fit into the optimal PDU then that
+	// is the optimal MTU. The overhead will differ for basic and non-basic mode, for basic mode
+	// we have to consider the SDU overhead as there is no fragment overhead and for non-basic we 
+	// consider the PDU overhead only (the additional SDU overhead is taken account of later if 
+	// more than one PDU is required for the optimal MTU).
+	TUint optimalMTU = aMtuRestriction;
+
+	// Calculate the size of the MTU + any overhead assuming that the MTU is not segmented
+	TUint singlePduSize = iDataController->IsBasicDataVersion() ?
+						  (aMtuRestriction + CL2CapSDU::GetSDUOverhead(iDataController->IsBasicDataVersion())) : aMtuRestriction;
+
+	// If the unsegmented MTU + overhead can fit into the optimal PDU size then no 
+	// further calculation is required
+	if(singlePduSize > iCurrentPDUSize)
+		{
+		// The MTU will need to be segmented / fragmented (depending on L2CAP mode).
+		// Calculate an MTU size that will be a factor of the PDU size.
+		optimalMTU = aMtuRestriction - ((aMtuRestriction + CL2CapSDU::GetSDUOverhead(iDataController->IsBasicDataVersion())) % iCurrentPDUSize); 
+		}
+
+	return optimalMTU;
 	}
 
+
 #ifdef _DEBUG
 TInt CL2CapSDUQueue::GetDataPlaneConfig(TL2DataPlaneConfig& conf) const
 	{
--- a/bluetooth/btstack/l2cap/L2CapSDUQueue.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/l2cap/L2CapSDUQueue.h	Wed Oct 13 16:20:29 2010 +0300
@@ -66,6 +66,7 @@
 	                             TUint16 aFlushTimeout, 
 	                             TUint16 aMaxOutgoingMTU,
 	                             TUint16 aMaxIncomingMTU,
+	                             TUint16 aAclBufSize,
 	                             TBool aCanDropSdus);
 	static CL2CapSDUQueue* NewL(CL2CAPConnectionSAP& aL2CapSap,
                                 TL2CAPPort aLocalCID,
@@ -77,6 +78,7 @@
 	                            TUint16 aFlushTimeout, 
                                 TUint16 aMaxOutgoingMTU,
                                 TUint16 aMaxIncomingMTU,
+                                TUint16 aAclBufSize,
                                 TBool aCanDropSdus);
  
 	~CL2CapSDUQueue();
@@ -113,7 +115,8 @@
 	                    TUint16 aFlushTimeout, 
 	                    TUint16 aPDUSize,
 	                    TUint16 aMaxOutgoingMTU,
-	                    TUint16 aMaxIncomingMTU);
+	                    TUint16 aMaxIncomingMTU,
+	                    TUint16 aAclBufSize);
 	void UpdateChannelPriority(TUint8 aNewPriority);
 	void ErrorD(TInt aErrorCode);
 
@@ -122,17 +125,15 @@
 	void PretendIncomingSduQFull(TBool aIncomingSduQFull);
 #endif
 
+	inline TUint GetOptimalMTUSizeL();
+	TUint GetOptimalMTUSizeL(TUint aMtuRestriction, TUint16 aAclBufSize);
+
 	inline TUint16 MaxOutgoingMTU() const;
 	inline TUint16 MaxIncomingMTU() const;
 
-	inline TUint16 MaximumPDUSize() const;
-	inline TUint16 OptimalPDUSize() const;
-	inline void SetOptimalPDUSize(TUint16 aPDUSize);
-
-	TBool IsBasicDataVersion() const;
-
 private:
-	void ConstructL(TL2CAPPort aLocalCID, TL2CAPPort aRemoteCID, CL2CAPMux& aMuxer, TL2CapDataControllerConfig* aConfig);
+	void ConstructL(TL2CAPPort aLocalCID, TL2CAPPort aRemoteCID, CL2CAPMux& aMuxer,
+					TL2CapDataControllerConfig* aConfig, TUint16 aAclBufSize);
 	
 	CL2CapSDUQueue(CL2CAPConnectionSAP& aL2CapSap,
 				   TUint8 aOutboundQueueSize,
@@ -212,19 +213,13 @@
 	return iMaxIncomingMTU;
 	}
 
-inline TUint16 CL2CapSDUQueue::MaximumPDUSize() const
-	{
-	return iMaximumPDUSize;
-	}
-
-inline TUint16 CL2CapSDUQueue::OptimalPDUSize() const
+inline TUint CL2CapSDUQueue::GetOptimalMTUSizeL()
 	{
-	return iCurrentPDUSize;
-	}
-
-inline void CL2CapSDUQueue::SetOptimalPDUSize(TUint16 aPDUSize)
-	{
-	iCurrentPDUSize = aPDUSize;
+	// Pass in 0 as controller buffer size - it's only used in optimal PDU size
+	// calculation, which in turn is only done if a smaller than negotiated MTU
+	// size is passed in, and that's not the case here (iMaxOutgoingMTU is the
+	// negotiated L2CAP MTU).
+	return GetOptimalMTUSizeL(iMaxOutgoingMTU, 0);
 	}
 
 inline void CL2CapSDUQueue::SuspendSDUQueue()
--- a/bluetooth/btstack/l2cap/l2sap.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/l2cap/l2sap.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -344,32 +344,6 @@
 	LOGBTDEVADDR(iRemoteDev);
 	}
 
-TUint CL2CAPConnectionSAP::GetOptimalMTUSize(TUint aMTU, TUint aPduSize, TBool aBasicMode) const
-	{
-	LOG_FUNC
-
-	// If the negotiated MTU minus any overhead will fit into the optimal PDU then that
-	// is the optimal MTU. The overhead will differ for basic and non-basic mode, for basic mode
-	// we have to consider the SDU overhead as there is no fragment overhead and for non-basic we 
-	// consider the PDU overhead only (the additional SDU overhead is taken account of later if 
-	// more than one PDU is required for the optimal MTU).
-	TUint optimalMTU = aMTU;
-
-	// Calculate the size of the MTU + any overhead assuming that the MTU is not segmented
-	TUint singlePduSize = aBasicMode ? (aMTU + CL2CapSDU::GetSDUOverhead(aBasicMode)) : aMTU;
-
-	// If the unsegmented MTU + overhead can fit into the optimal PDU size then no 
-	// further calculation is required
-	if(singlePduSize > aPduSize)
-		{
-		// The MTU will need to be segmented / fragmented (depending on L2CAP mode).
-		// Calculate an MTU size that will be a factor of the PDU size.
-		optimalMTU = aMTU - ((aMTU + CL2CapSDU::GetSDUOverhead(aBasicMode)) % aPduSize); 
-		}
-
-	return optimalMTU;
-	}
-
 TInt CL2CAPConnectionSAP::SAPSetOption(TUint aLevel, TUint aName, const TDesC8& aOption)
 	{
 	LOG_FUNC
@@ -503,42 +477,35 @@
 
 		case KL2CAPOutboundMTUForBestPerformanceWithRestriction:
 			// get the restriction value
-			if((aOption.Length() == sizeof(TInt)) && iL2CapDataQueue && iL2CapSAPSignalHandler)
+			if(aOption.Length() == sizeof(TInt))
 				{
-				val = *reinterpret_cast<const TInt*>(aOption.Ptr());
-
-				// Ensure that the restriction is less then the current MTU.
-				if (val < iL2CapDataQueue->MaxOutgoingMTU())
+				if(iL2CapSAPSignalHandler && iL2CapDataQueue)
 					{
-					// We now need to recalculate the optimal PDU size for the restricted MTU as
-					// this is used in the calculation of the optimal MTU
-					TPckgBuf<TInt> buf;	
-					TInt err = iL2CapSAPSignalHandler->GetOption(KSolBtACL, ELMOutboundACLSize, buf);
+					val = *reinterpret_cast<const TInt*>(aOption.Ptr());
 
-					TInt optimalPduSize = HL2CapPDU::GetPDUOrFragmentSize(val, iL2CapDataQueue->MaximumPDUSize(), (err == KErrNone) ? buf() : 0, iL2CapDataQueue->IsBasicDataVersion());
+					TPckgBuf<TInt> aclBufSize;	
+					TInt getAclBufSizeErr = iL2CapSAPSignalHandler->GetOption(KSolBtACL, ELMOutboundACLSize, aclBufSize);
 
-					// update the data queue to use the new optimal PDU size from now on
-					iL2CapDataQueue->SetOptimalPDUSize(optimalPduSize);
+					TRAP(rValue, val = iL2CapDataQueue->GetOptimalMTUSizeL(val, (getAclBufSizeErr == KErrNone) ? aclBufSize() : 0));
+					aOption = TPtrC8(reinterpret_cast<TUint8*>(&val), sizeof(TInt));
 					}
 				else
 					{
-					// can't increase the MTU at this stage so just use the existing MTU
-					val = iL2CapDataQueue->MaxOutgoingMTU();
+					rValue = KErrNotReady;
 					}
-
-				// work out the optimal MTU
-				val = GetOptimalMTUSize(val, iL2CapDataQueue->OptimalPDUSize(), iL2CapDataQueue->IsBasicDataVersion());
-				aOption = TPtrC8(reinterpret_cast<TUint8*>(&val), sizeof(TInt));
-				}			
+				}
+			else
+				{
+				rValue = KErrArgument;
+				}
 			break;
 
 		case KL2CAPOutboundMTUForBestPerformance: //equals KL2CAPGetOutboundMTU
 			if(aOption.Length() == sizeof(TInt))
 				{
-				if(iL2CapDataQueue && iL2CapSAPSignalHandler)
+				if(iL2CapDataQueue)
 					{
-					// work out the optimal MTU
-					val = GetOptimalMTUSize(iL2CapDataQueue->MaxOutgoingMTU(), iL2CapDataQueue->OptimalPDUSize(), iL2CapDataQueue->IsBasicDataVersion());
+					TRAP(rValue, val = iL2CapDataQueue->GetOptimalMTUSizeL());
 					aOption = TPtrC8(reinterpret_cast<TUint8*>(&val), sizeof(TInt));
 					}
 				else
@@ -1089,6 +1056,10 @@
 			{
 			dataConfig->SetChannelPriority(iChannelPriority);
 			}
+
+		TPckgBuf<TInt> aclBufSize; 
+		TInt getAclBufSizeErr = iL2CapSAPSignalHandler->GetOption(KSolBtACL, ELMOutboundACLSize, aclBufSize);
+
 		TRAP(rerr, iL2CapDataQueue = CL2CapSDUQueue::NewL(*this,
 		                                                  aLocalPort,
 		                                                  aRemotePort,
@@ -1099,15 +1070,9 @@
 											   			  aConfig.OutgoingFlushTimeout().Negotiated().FlushTimeoutDuration(),
 					                       				  aConfig.OutgoingMTU().Negotiated().MTU(),
 					                       				  aConfig.IncomingMTU().Negotiated().MTU(),
+					                       				  (getAclBufSizeErr == KErrNone) ? aclBufSize() : 0,
 					                       				  // Allow ourselves to drop SDUs we can't assemble if channel mode is not Reliable.
 					                       				  !TRetransmissionAndFlowControlOption::IsModeReliable(fec.IncomingLinkMode())));
-
-		// Set the optimal PDU size that the data controller should use.
-		TPckgBuf<TInt> buf;	
-		TInt err = iL2CapSAPSignalHandler->GetOption(KSolBtACL, ELMOutboundACLSize, buf);
-
-		TInt optimalPduSize = HL2CapPDU::GetPDUOrFragmentSize(iL2CapDataQueue->MaxOutgoingMTU(), iL2CapDataQueue->MaximumPDUSize(), (err == KErrNone) ? buf() : 0, iL2CapDataQueue->IsBasicDataVersion());
-		iL2CapDataQueue->SetOptimalPDUSize(optimalPduSize);
 		}
 	else
 		{
--- a/bluetooth/btstack/l2cap/l2sap.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/l2cap/l2sap.h	Wed Oct 13 16:20:29 2010 +0300
@@ -169,8 +169,6 @@
 	void ConstructL();
 
 	TBool EnqueClone(CL2CAPConnectionSAP* aSAP);
-	
-	TUint GetOptimalMTUSize(TUint aMTU, TUint aPduSize, TBool aBasicMode) const;
 
 private:
 	TL2CAPSAPState* iState;
--- a/bluetooth/btstack/l2cap/l2sapstates.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/l2cap/l2sapstates.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -946,18 +946,15 @@
 
 	if(dataConfig)
 		{
+		TPckgBuf<TInt> aclBufSize;	
+		TInt getAclBufSizeErr = aSAP.GetOption(KSolBtACL, ELMOutboundACLSize, aclBufSize);
+
 		aSAP.DataQueue().ResumeSDUQueue(dataConfig,
 									 	aConfig.OutgoingFlushTimeout().Negotiated().FlushTimeoutDuration(),
 		                   				fec.OutgoingMaximumPDUSize(),
                        				    aConfig.OutgoingMTU().Negotiated().MTU(),
-                       				    aConfig.IncomingMTU().Negotiated().MTU());
-
-		// Adjust the optimal PDU size based on the new configuration values
-		TPckgBuf<TInt> buf;	
-		TInt err = aSAP.GetOption(KSolBtACL, ELMOutboundACLSize, buf);
-
-		TInt optimalPduSize = HL2CapPDU::GetPDUOrFragmentSize(aConfig.OutgoingMTU().Negotiated().MTU(), fec.OutgoingMaximumPDUSize(), (err == KErrNone) ? buf() : 0, aSAP.DataQueue().IsBasicDataVersion());
-		aSAP.DataQueue().SetOptimalPDUSize(optimalPduSize);
+                       				    aConfig.IncomingMTU().Negotiated().MTU(),
+                       				    (getAclBufSizeErr == KErrNone) ? aclBufSize() : 0);
 
 		// If this reconfiguration was initiated via an IOCTL complete it.
 		aSAP.TryToCompleteConfigurationIoctl(KErrNone);
@@ -1427,7 +1424,10 @@
     {
     LOG_FUNC
     // Already in the error state so no need to transition.
-    // Consume the event.
+    // Consume the event in UREL but panic in UDEB - even though we had a MobileCrash
+    // report which indicates it's possible I can't find a valid scenario which would
+    // lead to this, so play safe in UREL but try and catch the bug in UDEB.
+	DebugPanicInState(EL2CAPUnexpectedSAPSignalHandlerEvent);
     }   
 
 // State Transition Actions.
--- a/bluetooth/btstack/linkmgr/basebandsap.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/linkmgr/basebandsap.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -48,6 +48,11 @@
 	CBluetoothSAP::ConstructL();
 	}
 
+CBTBasebandSAP::~CBTBasebandSAP()
+	{
+	LOG_FUNC
+	}
+
 // from CServProviderBase - the saps will not do all of these
 void CBTBasebandSAP::Start()
 	{
--- a/bluetooth/btstack/linkmgr/basebandsap.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/linkmgr/basebandsap.h	Wed Oct 13 16:20:29 2010 +0300
@@ -142,7 +142,9 @@
 	virtual TBool IsIdle() const;
 	virtual TPhysicalLinkObserverQLink& ObserverQLink() {return iQueLink;};
 	virtual void ParentClosing();
-	
+
+	~CBTBasebandSAP();
+
 protected:
 	CBTBasebandSAP(CPhysicalLinksManager& aConnectionMan, CPhysicalLink* aConnection);
 	void ConstructL();
--- a/bluetooth/btstack/linkmgr/eSCOSAP.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/linkmgr/eSCOSAP.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -52,6 +52,7 @@
 CeSCOLink::CeSCOLink(CPhysicalLinksManager& aLinksMan, CPhysicalLink* aPhysicalLink)
 : CBTSynchronousLink(aLinksMan, aPhysicalLink, EeSCOLink)
 	{
+	LOG_FUNC
 	iUserPacketTypes = TBTSyncPackets::ESyncAnyESCOPacket;
 	}
 
@@ -62,6 +63,7 @@
 
 CeSCOLink::~CeSCOLink()
 	{
+	LOG_FUNC
 	}
 
 TInt CeSCOLink::GetOption(TUint aLevel, TUint aName, TDes8& aOption) const
--- a/bluetooth/btstack/linkmgr/hostmbufpool.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/linkmgr/hostmbufpool.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -146,9 +146,7 @@
 	// Speculatively attempt to allocate any queued allocations that may have previously failed.
 	TryToAllocQueuedBuffer();
 	
-	TPoolBuffer* ready = iBufferPool.First();
-	
-	if(!ready)
+	if(iBufferPool.IsEmpty())
 		{
 		// Whoops run out of buffers - even though we were trying to prevent this with
 		// flow control, in the case of disconnection the controller will assume all the
@@ -161,7 +159,9 @@
 		LOG(_L8("CHostMBufPool: Ran out of buffers!!!!"));
 		LEAVEL(KErrOverflow);
 		}
-	
+
+	TPoolBuffer* ready = iBufferPool.First();
+
 	// If here then we should have a valid pool buffer to use
 	__ASSERT_DEBUG(!ready->iMBufChain.IsEmpty(), Panic(ELinkMgrHostControllerHasOverflowedHost));
 	__ASSERT_DEBUG(ready->iCurrentHandle == KInvalidConnectionHandle, Panic(ELinkMgrHostControllerHasOverflowedHost));
--- a/bluetooth/btstack/linkmgr/hostresolver.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/linkmgr/hostresolver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1023,6 +1023,10 @@
 void CBTInquiryMgr::ConstructL()
 	{
 	LOG_FUNC
+	// Coverity [negative_returns]
+	// It is standard behaviour to call an active object with a negative valued priority
+	// even though with a CPeriodic a low priority often means that the period may become 
+	// higher than the period specified in the 'Start' method.
 	iFlusher = CPeriodic::NewL(CActive::EPriorityLow);
 #ifdef CONNECTION_PREEMPTS_INQUIRY
 	iConnectingStatus = CConnectingStatusSubscriber::NewL(*this);
--- a/bluetooth/btstack/linkmgr/physicallinks.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/linkmgr/physicallinks.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -3342,6 +3342,11 @@
 	CActiveScheduler::Add(this);
 	}
 
+CArbitrationDelayTimer::~CArbitrationDelayTimer()
+	{
+	LOG_FUNC
+	}
+
 void CArbitrationDelayTimer::ConstructL()
 	{
 	LOG_FUNC
--- a/bluetooth/btstack/linkmgr/physicallinks.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/linkmgr/physicallinks.h	Wed Oct 13 16:20:29 2010 +0300
@@ -71,6 +71,7 @@
 	{
 public:
 	static CArbitrationDelayTimer* NewL(CPhysicalLink* aParent);
+	~CArbitrationDelayTimer();
 	TInt Start(TBool aImmediate, TBool aLocalPriority);
 	void Restart();
 
--- a/bluetooth/btstack/rfcomm/Rfcommfcs.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/rfcomm/Rfcommfcs.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -63,7 +63,7 @@
 	}
 
 TBool CheckFCS(const TUint8* aData, TInt aLen, TUint8 aFCS)
-    /**
+	/**
 	   Check a received FCS.
 	 **/   
 	{
@@ -72,22 +72,9 @@
 		{
 		fcs=crctable[fcs^*aData++];
 		}
-    /*Ones complement*/
+	/*Ones complement*/
 	fcs=crctable[fcs^aFCS];
-// log "PDU FCS:" aFCS - Shehla
-	RFQBLOG(KBlogTypeFCS, Log(KBlogActualFCS, aFCS));
-// log this as "Calculated FCS (should be 0xCF): " fcs - Shehla
-	RFQBLOG(KBlogTypeFCS, Log(KBlogComputedFCS, fcs));
-    /*0xCF is the reversed order of 11110011.*/
-	TBool result=EFalse; //- Shehla
-	if (fcs==0xCF)
-		//return ETrue;
-		result=ETrue;
-	else 
-		//return EFalse;
-		result=EFalse;
-//log "FCS Computation" result - Shehla
-	RFQBLOG(KBlogTypeFCS, Log(KBlogComparedFCS, result));
-
+	/*0xCF is the reversed order of 11110011.*/
+	TBool result = (fcs==0xCF);
 	return result;
 }
--- a/bluetooth/btstack/rfcomm/rfcommmuxchannel.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/rfcomm/rfcommmuxchannel.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -24,6 +24,8 @@
 _LIT8(KLogComponent, LOG_COMPONENT_RFCOMM);
 #endif
 
+#define STATENAME(x) IF_FLOGGING(iName=_L(x))
+
 CRfcommMuxChannel::CRfcommMuxChannel(CMuxChannelStateFactory& aFact, CRfcommMuxer& aMux,
 									 CServProviderBase& aSAP, CMuxChannelStateFactory::TChannelState aInitialState)
 	: iSAP(aSAP),
--- a/bluetooth/btstack/rfcomm/rfcommmuxchannel.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/rfcomm/rfcommmuxchannel.h	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -332,11 +332,5 @@
 	TBool CanAttachSAP();
 	};
 
-#ifdef __FLOGGING__
-#define STATENAME(x)  iName=_L(x)
-#else
-#define STATENAME(x)
-#endif
-
 #include "rfcommmuxchannel.inl"
 #endif
--- a/bluetooth/btstack/rfcomm/rfcommstates.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/rfcomm/rfcommstates.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -26,6 +26,8 @@
 _LIT8(KLogComponent, LOG_COMPONENT_RFCOMM);
 #endif
 
+#define STATENAME(x) IF_FLOGGING(iName=_L(x))
+
 // Together, these classes and the SAP implement the State pattern
 // (GOF).  The states themselves are implemented using the Flyweight
 // pattern.  Each state is a Flyweight object, and CRfcommStateFactory
--- a/bluetooth/btstack/rfcomm/rfcommstates.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/rfcomm/rfcommstates.h	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -164,11 +164,6 @@
 	const TRfcommState& operator=(const TRfcommState&);
 	};
 
-#ifdef __FLOG_ACTIVE
-#define STATENAME(x) iName=_L(x)
-#else
-#define STATENAME(x)
-#endif
 
 /**
    A state class that provides default behaviours.
--- a/bluetooth/btstack/secman/pairingserver.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/secman/pairingserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -788,6 +788,7 @@
 
 	TBTSockAddr addr;
 	addr.SetBTAddr(addrBuf());
+	__ASSERT_DEBUG(!iProxySap, PANIC(KPairingServerFaultCat, EPairingServerObjectAlreadyExists));
 	iProxySap = CBTProxySAP::NewL(iPhysicalLinksManager, NULL);
 	
 	iStartBondingMsg = aMessage;
--- a/bluetooth/btstack/secman/public/pairingservershared.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/secman/public/pairingservershared.h	Wed Oct 13 16:20:29 2010 +0300
@@ -72,6 +72,7 @@
 	EPairingServerUnexpectedAccessCallback,
 	EPairingServerBadShutdownState,
 	EPairingServerMessageShouldBeNull,
+	EPairingServerObjectAlreadyExists,	
 	};
 
 #endif // PAIRINGSERVERSHARED_H
--- a/bluetoothmgmt/bluetoothclientlib/avctpservices/avctpremotedevices.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetoothmgmt/bluetoothclientlib/avctpservices/avctpremotedevices.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -64,17 +64,26 @@
 
 void RNestableLock::Wait()
 	{
-	iMetaLock.Wait();
+    iMetaLock.Wait();
+
 	TThreadId currentThreadId = RThread().Id();
 	if(iThreadId == TThreadId(KInvalidThreadId) || currentThreadId != iThreadId)
 		{
 		iMetaLock.Signal();
 		iLock.Wait();
 		iMetaLock.Wait();
+		// 'currentThreadId' will be the thread Id of the thread running
+		// this bit of code. See comment above 'currentThreadId definition.
+        // coverity[use]
 		iThreadId = currentThreadId;
 		}
 	++iRefCount;
 	iMetaLock.Signal();
+	// Coverity claims a missing unlock at the end of 
+	// this method. The missing unlock is from the 
+	// "iLock.Wait();" a few lines up.
+    // However this method is intended to take the lock.
+    // coverity[missing_unlock]
 	}
 
 void RNestableLock::Signal()
--- a/bluetoothmgmt/bluetoothclientlib/btlib/btsocket.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetoothmgmt/bluetoothclientlib/btlib/btsocket.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -25,10 +25,16 @@
 
 
 void Panic(TBTSocketPanics aCode)
-	{
-	_LIT(KPanicName, "BTSocket");
-	User::Panic(KPanicName, aCode);
-	}
+    {
+    _LIT(KPanicName, "BTSocket");
+    User::Panic(KPanicName, aCode);
+    }
+
+void GeneralPanic(TInt aCode)
+    {
+    _LIT(KPanicName, "BTSocket-General");
+    User::Panic(KPanicName, aCode);
+    }
 
 
 
@@ -1674,15 +1680,20 @@
 	// This is done as a best effort in order to make more efficient usage
 	// of the baseband packets being created. As a result we don't bother 
 	// checking the results as if they fail it won't cause the socket to 
-	// behave incorrectly	
-	TPckgBuf<TUint> optBuf(65535); //If all else fails we should get a max 64K buffer
+	// behave incorrectly
+    
+    // Note. We are managing the fact that the GetOpts might fail using
+    // this KMaxBufferSize, hence the Coverity tags.
+	const TUint KMaxBufferSize = 65535; //max 64K buffer	
+	TPckgBuf<TUint> optBuf(KMaxBufferSize); //If all else fails we should get a max 64K buffer
 	TProtocolDesc info;
 	
 	TInt err = iSocket.Info(info);
 	
 	if (err == KErrNone && info.iProtocol == KRFCOMM)
 		{
-		// For RFCOMM we set the buffers based on the optimal MTU for RFCOMM	
+		// For RFCOMM we set the buffers based on the optimal MTU for RFCOMM
+		// Coverity[check_return]
 		iSocket.GetOpt(KRFCOMMMaximumMTU, KSolBtRFCOMM, optBuf);
 		iSocket.SetOpt(KSOSendBuf, KSOLSocket, optBuf);
 		iSocket.SetOpt(KSORecvBuf, KSOLSocket, optBuf);		
@@ -1690,10 +1701,12 @@
 	else
 		{
 		// For L2CAP, or others, we just ensure that we can accomodate the negotiated MTU
+		// Coverity[check_return]
 		iSocket.GetOpt(KL2CAPNegotiatedOutboundMTU, KSolBtL2CAP, optBuf);
 		iSocket.SetOpt(KSOSendBuf, KSOLSocket, optBuf);
-			
-		iSocket.GetOpt(KL2CAPInboundMTU, KSolBtL2CAP, optBuf);
+
+		err = iSocket.GetOpt(KL2CAPInboundMTU, KSolBtL2CAP, optBuf);
+		optBuf = err?KMaxBufferSize:optBuf(); //if err use max buf not the result of the previous GetOpt
 		iSocket.SetOpt(KSORecvBuf, KSOLSocket, optBuf);
 		}
 	}
--- a/bluetoothmgmt/bluetoothclientlib/btlib/pairing.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetoothmgmt/bluetoothclientlib/btlib/pairing.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -121,7 +121,13 @@
 	{
 	LOG_FUNC
 	__ASSERT_ALWAYS(SubSessionHandle(), PANIC(KPairingServerPanicCat, EPairingServerOobDataSessionNotOpen));
-	static_cast<void>(SendReceive(EPairingServerOobDataRefreshLocal));
+	IF_FLOGGING(TInt err = ) SendReceive(EPairingServerOobDataRefreshLocal);
+	IF_FLOGGING(
+		if (err != KErrNone)
+			{
+			LOG1(_L("ALERT: Refresh local OOB data completed with error %d"), err);
+			}
+		);
 	}
 
 /**
@@ -152,7 +158,13 @@
 	{
 	LOG_FUNC
 	__ASSERT_ALWAYS(SubSessionHandle(), PANIC(KPairingServerPanicCat, EPairingServerOobDataSessionNotOpen));
-	static_cast<void>(SendReceive(EPairingServerOobDataCancelReadLocal));
+	IF_FLOGGING(TInt err = ) SendReceive(EPairingServerOobDataCancelReadLocal);
+	IF_FLOGGING(
+		if (err != KErrNone)
+			{
+			LOG1(_L("ALERT: Cancel read Local OOB data completed with error %d"), err);
+			}
+		);
 	}
 
 /**
@@ -219,7 +231,13 @@
 	__ASSERT_ALWAYS(SubSessionHandle(), PANIC(KPairingServerPanicCat, EPairingServerOobDataSessionNotOpen));
 	TPckgBuf<TBTDevAddr> addrBuf(aAddr);
 	TIpcArgs args(&addrBuf);
-	static_cast<void>(SendReceive(EPairingServerOobDataClearRemote, args));
+	IF_FLOGGING(TInt err = ) SendReceive(EPairingServerOobDataClearRemote, args);
+	IF_FLOGGING(
+		if (err != KErrNone)
+			{
+			LOG1(_L("ALERT: Clear Remote OOB data completed with %d"), err);
+			}
+		);
 	}
 
 
@@ -344,7 +362,13 @@
 EXPORT_C void RBluetoothPairingResult::CancelSimplePairingResult()
 	{
 	LOG_FUNC
-	SendReceive(EPairingServerCancelSimplePairingResult);
+	IF_FLOGGING(TInt err = ) SendReceive(EPairingServerCancelSimplePairingResult);
+	IF_FLOGGING(
+		if (err != KErrNone)
+			{
+			LOG1(_L("ALERT: Cancel simple pairing result completed with %d"), err);
+			}
+		);
 	}
 
 
@@ -416,7 +440,13 @@
 EXPORT_C void RBluetoothAuthenticationResult::CancelAuthenticationResult()
 	{
 	LOG_FUNC
-	SendReceive(EPairingServerCancelAuthenticationResult);
+	IF_FLOGGING(TInt err = ) SendReceive(EPairingServerCancelAuthenticationResult);
+	IF_FLOGGING(
+		if (err != KErrNone)
+			{
+			LOG1(_L("ALERT: Cancel authentication result completed with %d"), err);
+			}
+		);
 	}
 
 
--- a/bluetoothmgmt/btcommon/bld.inf	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetoothmgmt/btcommon/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -41,12 +41,12 @@
 #include "../../bluetooth/btstack/bld.inf"
 
 // Remote Control
-#include "../../../devicesrv/accessoryservices/remotecontrolfw/group/bld.inf"
+#include "../../remotecontrol/remotecontrolfw/group/bld.inf"
 
 // Profiles
 #include "../../bluetooth/gavdp/group/bld.inf"
 #include "../../bluetoothcommsprofiles/btpan/group/bld.inf"
-
+#include "../../remotecontrol/avrcp/bld.inf"
 
 // CSY
 #include "../../bluetooth/btcomm/bld.inf"
--- a/bluetoothmgmt/btconfig/esock_bt.cmi	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetoothmgmt/btconfig/esock_bt.cmi	Wed Oct 13 16:20:29 2010 +0300
@@ -26,7 +26,7 @@
 ScaledStartupState=0x3080
 HeapOption=ENewHeap
 MinHeapSize=256
-MaxHeapSize=524288
+MaxHeapSize=1048576
 SystemCritical=0
 SystemCriticalAfterInit=1
 Binding0=ESock_Bt:2,ESock_Main:0,ECustom,42,42 
--- a/bluetoothmgmt/btconfig/esock_bt_399.cmi	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetoothmgmt/btconfig/esock_bt_399.cmi	Wed Oct 13 16:20:29 2010 +0300
@@ -26,7 +26,7 @@
 ScaledStartupState=0x3080
 HeapOption=ENewHeap
 MinHeapSize=256
-MaxHeapSize=524288
+MaxHeapSize=1048576
 SystemCritical=0
 SystemCriticalAfterInit=1
 Binding0=ESock_Bt:2,ESock_Main:0,ECustom,20,20 
--- a/bluetoothmgmt/btmgr/BTManClient/BTManClient.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetoothmgmt/btmgr/BTManClient/BTManClient.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -181,7 +181,13 @@
 	LOG_FUNC
 	if (SubSessionHandle())
 		{
-		SendReceive(EBTManCancelRequest, TIpcArgs(&aStatus));
+		IF_FLOGGING(TInt err = ) SendReceive(EBTManCancelRequest, TIpcArgs(&aStatus));
+		IF_FLOGGING(
+			if (err != KErrNone)
+				{
+				LOG1(_L("ALERT: Cancel request completed with %d"), err);
+				}
+			);
 		}
 	else
 		{
@@ -307,7 +313,13 @@
 	LOG_FUNC
 	TInt count = 0;
 	TPckg<TInt> pckg(count);
-	SendReceive(EBTManSubSessionCount, TIpcArgs(&pckg));
+	IF_FLOGGING(TInt err = ) SendReceive(EBTManSubSessionCount, TIpcArgs(&pckg));
+	IF_FLOGGING(
+		if (err != KErrNone)
+			{
+			LOG1(_L("ALERT: Subsession count completed with %d") , err);
+			}
+		);
 	return count;
 	}
 
--- a/bluetoothmgmt/btmgr/BTManServer/BTManServer.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetoothmgmt/btmgr/BTManServer/BTManServer.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1187,6 +1187,11 @@
 	LOG_FUNC
 	}
 
+CBTManSubSession::~CBTManSubSession()
+	{
+	LOG_FUNC
+	}
+
 void CBTManSubSession::NotifyChange(TUint aTableChanged)
 	{
 	LOG_FUNC
--- a/bluetoothmgmt/btmgr/BTManServer/BTRegistryDB.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetoothmgmt/btmgr/BTManServer/BTRegistryDB.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -947,9 +947,13 @@
 		devSec.SetSecurityValue(aRowSet.ColUint8(column));
 		column = ColumnNoL(KDeviceColName_GlobalSecPasskeyLen, aRowSet);
 		devSec.SetPasskeyMinLength(aRowSet.ColUint32(column));
-				
+	    // TBTDeviceSecurity::iPadding2 is not initialised. iPadding2 is for future use.
+	    // It is not supposed to be initialised.
+        // coverity[uninit_use_in_call]
 		aDevice.SetGlobalSecurity(devSec);
 		}
+    //##== coverity[var_decl]
+
 
 	column = ColumnNoL(KDeviceColName_LinkKey, aRowSet);
 	TDbColNo typeColumn = ColumnNoL(KDeviceColName_LinkKeyType, aRowSet);
@@ -1203,7 +1207,7 @@
 	settings->SetBTAddr(static_cast<TBTDevAddr>(addrBuf));
 
 	// get the uuid
-	TUUID uuid;
+	TUUID uuid = TUUID();
 	uuid.SetL(view->ColDes8(ColumnNoL(KBTCOMMColName_ServiceUUID, *view)));
 	settings->SetUUID(uuid);
 
--- a/bluetoothmgmt/btmgr/BTManServer/btmanserverburmgr.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetoothmgmt/btmgr/BTManServer/btmanserverburmgr.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1225,6 +1225,9 @@
 		aStream.ReadL(addrPtr, KBTDevAddrSize);
 		if (addrPtr.Length() == KBTDevAddrSize)
 			{
+		    // Coverity [uninit_use]
+		    // TBTDevAdd::iPadding is not initialised. iPadding is for future use.
+		    // It is not supposed to be initialised.
 			iLocalDevice->SetAddress(address);
 			}
 		else
--- a/bluetoothmgmt/btmgr/Inc/BTManServer.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetoothmgmt/btmgr/Inc/BTManServer.h	Wed Oct 13 16:20:29 2010 +0300
@@ -228,6 +228,7 @@
 	virtual void Cleanup(TInt aError)=0;
 	virtual TBool IsOverlappingView(const TDesC& aViewDescriptor);
 	virtual void SetViewChangeNotificationMessage(const RMessage2& aMessage);
+	~CBTManSubSession();
 
 protected:
 	CBTManSubSession(CBTManSession& aSession, CBTRegistry& aRegistry);
--- a/bthci/bthci2/hcicmdq/interface/HciCmdQController.h	Thu Sep 23 17:06:47 2010 +0300
+++ b/bthci/bthci2/hcicmdq/interface/HciCmdQController.h	Wed Oct 13 16:20:29 2010 +0300
@@ -233,8 +233,8 @@
 	inline TUint ValidBlocks(TUint aBlocks);
 	inline TUint InvalidBlocks(TUint aBlocks);
 	inline TUint CmdBypassBlocks(const CHCICommandQItem& aCmd);
-	
-	inline void UpdateCommandCredits(TUint8 aCommandCredits);
+
+	inline void UpdateCommandCredits(TUint8 aCommandCredits, TBool aNOP);
 
 	inline TUint NextCommandQueueItemId();
 	
--- a/bthci/bthci2/hcicmdq/src/HciCmdQController.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bthci/bthci2/hcicmdq/src/HciCmdQController.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -119,7 +119,7 @@
 	__ASSERT_ALWAYS(iResendCommandQ.IsEmpty(), PANIC(KHCICmdQPanic, EResendCommandQNotEmptyInDestructor));
 		
 	delete iQStarvationTimer;
-	delete iSendingCommand;
+	DeleteCommand(iSendingCommand);
 	delete iQdpPlugin;
 
 	// Delete async CallBacks.	If running, these should be cancelled by the
@@ -693,7 +693,7 @@
 		{
 
 		const THCICommandCompleteEvent& event(THCICommandCompleteEvent::Cast(aEvent));
-		UpdateCommandCredits(event.NumHCICommandPackets());
+		UpdateCommandCredits(event.NumHCICommandPackets(), event.CommandOpcode() == KNopOpcode);
 
 		if (event.CommandOpcode() == KNopOpcode)
 			{
@@ -709,7 +709,7 @@
 	else if (eventCode == ECommandStatusEvent)
 		{
 		TCommandStatusEvent& event = TCommandStatusEvent::Cast(aEvent);
-		UpdateCommandCredits(event.NumHCICommandPackets());
+		UpdateCommandCredits(event.NumHCICommandPackets(), event.CommandOpcode() == KNopOpcode);
 
 		if (event.CommandOpcode() == KNopOpcode)
 			{
@@ -955,10 +955,42 @@
 /**
 Updates the command credits counter and maintains the EInsufficientCreditBlock
 */
-inline void CHCICmdQController::UpdateCommandCredits(TUint8 aCommandCredits)
+inline void CHCICmdQController::UpdateCommandCredits(TUint8 aCommandCredits, TBool aNOP)
 	{
-	iCommandCredits = aCommandCredits;
-	
+	// Assume no credits until we decide otherwise
+	iCommandCredits = 0;
+
+	if (aCommandCredits > 0)
+		{
+		// We need to workaround a problem with multiple command credits to ensure that
+		// we don't update the credits before the controller has processed all of the 
+		// commands we have sent it.
+		TDblQueIter<CHCICommandQItem> qIter(iSentCommandQ);
+		CHCICommandQItem* cmd = NULL;
+		TUint count = 0;
+
+		while (qIter != NULL)
+			{
+			// Count all the commands that we have sent that expect a command status but
+			// haven't had one yet or expects a command complete event.
+			cmd = qIter++;
+			if ((cmd->Command().ExpectsCommandStatusEvent() && !cmd->ReceivedCmdStatusEvent()) || 
+				cmd->Command().ExpectsCommandCompleteEvent())
+				{
+				count++;
+				}
+			}
+
+		if (((count == 0) && aNOP) || ((count == 1) && !aNOP))
+			{
+			// The credits are updated before the matching command is removed from the sent
+			// queue and therefore we only update the credits when we have 1 command that has
+			// not yet been processed or we have 0 commands and this update is due to a NOP
+			// event.
+			iCommandCredits = aCommandCredits;
+			}
+		}
+
 	if (iCommandCredits > 0)
 		{
 		// We clear block flags when sending priority commands, so there may be some
@@ -1717,7 +1749,8 @@
 	// Ensure we are in a state that allows commands to be added.
 	if(!CanAddCommands())
 		{
-		delete &aQueItem;
+	    CHCICommandQItem* pQueItem = &aQueItem;
+        DeleteCommand(pQueItem);
 		User::Leave(KErrHardwareNotAvailable);
 		}
 		
--- a/bthci/bthci2/hcicmdq/src/HciCommandQItem.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bthci/bthci2/hcicmdq/src/HciCommandQItem.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -64,6 +64,8 @@
 	delete iCompletionTimer;
 	delete iCommand;
 	delete iCmdFrame;
+    // The user (QDP) should clean up any internal allocations existing in its QDP data object.
+	// coverity[delete_void]
 	delete iQdpData;
 	}
 
--- a/bthci/bthci2/hciutil/src/hciutil.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bthci/bthci2/hciutil/src/hciutil.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -393,7 +393,7 @@
 
 	// Open file
 	TAutoClose<RFile> file;
-	TInt size;
+	TInt size = 0; //initialise to quell Coverity
 	User::LeaveIfError(file.iObj.Open(fs.iObj,*iName,EFileStreamText|EFileShareReadersOrWriters));
 	file.PushL();
 
@@ -406,7 +406,7 @@
 	TUint8* ptr = (TUint8*)data;
 
 	//
-	// This is orderred as FEFF assuming the processor is Little Endian
+	// This is ordered as FEFF assuming the processor is Little Endian
 	// The data in the file is FFFE.		PRR 28/9/98
 	//
 	if(size>=(TInt)sizeof(TText) && iPtr[0]==0xFEFF)
--- a/bthci/hci2implementations/CommandsEvents/symbian/src/Event.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bthci/hci2implementations/CommandsEvents/symbian/src/Event.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1531,7 +1531,9 @@
 		{
 		addr[KBTMaxDevAddrSize-1-i] = iEventData[aOffset + i];	// reading bdaddr from iEventBufPtr
 		}
-
+    // Coverity [uninit_use]
+	// TBTDevAdd::iPadding is not initialised. iPadding is for future use.
+	// It is not supposed to be initialised.
 	return addr;
 	}
 	
--- a/bthci/hci2implementations/corehcis/symbian/src/hciserver.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bthci/hci2implementations/corehcis/symbian/src/hciserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -52,6 +52,8 @@
 	
 	delete iBTPowerControlManager;
 	delete iHCIDirectAccessManager;
+	delete iBluetoothDutModeManager;
+	delete iA2dpOptimiserManager;
 	}
 
 CHCIServer::CHCIServer(CCoreHCIPluginImpl& aParent)
--- a/package_definition.xml	Thu Sep 23 17:06:47 2010 +0300
+++ b/package_definition.xml	Wed Oct 13 16:20:29 2010 +0300
@@ -96,9 +96,17 @@
    </component>
   </collection>
   <collection id="btsimulator" name="Bluetooth Simulator" level="internal-utils">
-   <component id="btaudioadaptation_stub" name="Bluetooth Audio Adaption Stub" purpose="optional" filter="oem_build">
+   <component id="btaudioadaptation_stub" name="Bluetooth Audio Adaption Stub" purpose="optional" filter="s60,oem_build">
     <unit bldFile="btsimulator/btaudioadaptation_stub/group"/>
    </component>
   </collection>
+  <collection id="remotecontrol" name="Remote Control" level="plugin">
+   <component id="avrcp" name="Bluetooth AVRCP" introduced="9.1" purpose="optional">
+    <unit bldFile="remotecontrol/avrcp" mrp="remotecontrol/avrcp/bluetooth_avrcp.mrp"/>
+   </component>
+   <component id="remotecontrolfw" name="Remote Control Framework" introduced="9.1" purpose="optional">
+    <unit bldFile="remotecontrol/remotecontrolfw/group" mrp="remotecontrol/remotecontrolfw/group/bluetooth_remotecontrol.mrp"/>
+   </component>
+  </collection>
  </package>
 </SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/bwins/remconabsolutevolumeu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,17 @@
+EXPORTS
+	?SetAbsoluteVolume@CRemConAbsoluteVolumeController@@QAEXAAVTRequestStatus@@KAAI@Z @ 1 NONAME ; void CRemConAbsoluteVolumeController::SetAbsoluteVolume(class TRequestStatus &, unsigned long, unsigned int &)
+	?RegisterAbsoluteVolumeNotification@CRemConAbsoluteVolumeController@@QAEXXZ @ 2 NONAME ; void CRemConAbsoluteVolumeController::RegisterAbsoluteVolumeNotification(void)
+	?NewL@CRemConAbsoluteVolumeTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConAbsoluteVolumeTargetObserver@@KK@Z @ 3 NONAME ; class CRemConAbsoluteVolumeTarget * CRemConAbsoluteVolumeTarget::NewL(class CRemConInterfaceSelector &, class MRemConAbsoluteVolumeTargetObserver &, unsigned long, unsigned long)
+	??1CRemConAbsoluteVolumeTarget@@UAE@XZ @ 4 NONAME ; CRemConAbsoluteVolumeTarget::~CRemConAbsoluteVolumeTarget(void)
+	?WriteL@RRemConAbsoluteVolumeResponse@@UAEXAAVTDes8@@@Z @ 5 NONAME ; void RRemConAbsoluteVolumeResponse::WriteL(class TDes8 &)
+	?AbsoluteVolumeChanged@CRemConAbsoluteVolumeTarget@@QAEXK@Z @ 6 NONAME ; void CRemConAbsoluteVolumeTarget::AbsoluteVolumeChanged(unsigned long)
+	?SetAbsoluteVolumeResponse@CRemConAbsoluteVolumeTarget@@QAEXKH@Z @ 7 NONAME ; void CRemConAbsoluteVolumeTarget::SetAbsoluteVolumeResponse(unsigned long, int)
+	?ReadL@RRemConAbsoluteVolumeRequest@@UAEXABVTDesC8@@@Z @ 8 NONAME ; void RRemConAbsoluteVolumeRequest::ReadL(class TDesC8 const &)
+	?WriteL@RRemConAbsoluteVolumeRequest@@UAEXAAVTDes8@@@Z @ 9 NONAME ; void RRemConAbsoluteVolumeRequest::WriteL(class TDes8 &)
+	?ReadL@RRemConAbsoluteVolumeResponse@@UAEXABVTDesC8@@@Z @ 10 NONAME ; void RRemConAbsoluteVolumeResponse::ReadL(class TDesC8 const &)
+	??1CRemConAbsoluteVolumeController@@UAE@XZ @ 11 NONAME ; CRemConAbsoluteVolumeController::~CRemConAbsoluteVolumeController(void)
+	?CancelAbsoluteVolumeNotification@CRemConAbsoluteVolumeController@@QAEXXZ @ 12 NONAME ; void CRemConAbsoluteVolumeController::CancelAbsoluteVolumeNotification(void)
+	?Close@RRemConAbsoluteVolume@@QAEXXZ @ 13 NONAME ; void RRemConAbsoluteVolume::Close(void)
+	?NewL@CRemConAbsoluteVolumeController@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConAbsoluteVolumeControllerObserver@@K@Z @ 14 NONAME ; class CRemConAbsoluteVolumeController * CRemConAbsoluteVolumeController::NewL(class CRemConInterfaceSelector &, class MRemConAbsoluteVolumeControllerObserver &, unsigned long)
+	?CancelSetAbsoluteVolume@CRemConAbsoluteVolumeController@@QAEXXZ @ 15 NONAME ; void CRemConAbsoluteVolumeController::CancelSetAbsoluteVolume(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/eabi/remconabsolutevolumeu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,25 @@
+EXPORTS	
+	_ZN21RRemConAbsoluteVolume5CloseEv @ 1 NONAME
+	_ZN27CRemConAbsoluteVolumeTarget21AbsoluteVolumeChangedEm @ 2 NONAME
+	_ZN27CRemConAbsoluteVolumeTarget25SetAbsoluteVolumeResponseEmi @ 3 NONAME
+	_ZN27CRemConAbsoluteVolumeTarget4NewLER24CRemConInterfaceSelectorR35MRemConAbsoluteVolumeTargetObservermm @ 4 NONAME
+	_ZN27CRemConAbsoluteVolumeTargetD0Ev @ 5 NONAME
+	_ZN27CRemConAbsoluteVolumeTargetD1Ev @ 6 NONAME
+	_ZN27CRemConAbsoluteVolumeTargetD2Ev @ 7 NONAME
+	_ZN28RRemConAbsoluteVolumeRequest5ReadLERK6TDesC8 @ 8 NONAME
+	_ZN28RRemConAbsoluteVolumeRequest6WriteLER5TDes8 @ 9 NONAME
+	_ZN29RRemConAbsoluteVolumeResponse5ReadLERK6TDesC8 @ 10 NONAME
+	_ZN29RRemConAbsoluteVolumeResponse6WriteLER5TDes8 @ 11 NONAME
+	_ZN31CRemConAbsoluteVolumeController17SetAbsoluteVolumeER14TRequestStatusmRj @ 12 NONAME
+	_ZN31CRemConAbsoluteVolumeController32CancelAbsoluteVolumeNotificationEv @ 13 NONAME
+	_ZN31CRemConAbsoluteVolumeController34RegisterAbsoluteVolumeNotificationEv @ 14 NONAME
+	_ZN31CRemConAbsoluteVolumeController4NewLER24CRemConInterfaceSelectorR39MRemConAbsoluteVolumeControllerObserverm @ 15 NONAME
+	_ZN31CRemConAbsoluteVolumeControllerD0Ev @ 16 NONAME
+	_ZN31CRemConAbsoluteVolumeControllerD1Ev @ 17 NONAME
+	_ZN31CRemConAbsoluteVolumeControllerD2Ev @ 18 NONAME
+	_ZTI28RRemConAbsoluteVolumeRequest @ 19 NONAME
+	_ZTI29RRemConAbsoluteVolumeResponse @ 20 NONAME
+	_ZTV28RRemConAbsoluteVolumeRequest @ 21 NONAME
+	_ZTV29RRemConAbsoluteVolumeResponse @ 22 NONAME
+	_ZN31CRemConAbsoluteVolumeController23CancelSetAbsoluteVolumeEv @ 23 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/group/absolutevolumeapi.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,57 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// absolutevolumeapicontroller.dll Remote Control Absolute Volume API- an outer-layer client 
+// side library.
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET            remconabsolutevolume.dll
+TARGETPATH        /system/libs   
+
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		  All -Tcb
+TARGETTYPE		  dll
+
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			  0x1000008d 0x101f9067
+VENDORID		  0x70000001
+
+SOURCEPATH		  ../src
+SOURCE            absolutevolumeapicontroller.cpp 
+SOURCE            absolutevolumeapitarget.cpp 
+SOURCE			  absolutevolumesender.cpp
+SOURCE            absolutevolumeutils.cpp
+
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+USERINCLUDE		  ../inc
+
+LIBRARY 		  euser.lib
+LIBRARY 		  remconinterfacebase.lib
+LIBRARY           avrcpipc.lib
+LIBRARY           estor.lib 
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,32 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+absolutevolumeapi.mmp
+
+PRJ_EXPORTS
+../public/absolutevolumeapicontroller.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(absolutevolumeapicontroller.h)
+../public/absolutevolumeapicontrollerobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(absolutevolumeapicontrollerobserver.h)
+../public/absolutevolumeapitarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(absolutevolumeapitarget.h)
+../public/absolutevolumeapitargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(absolutevolumeapitargetobserver.h)
+../public/absolutevolumeutils.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(absolutevolumeutils.h)
+../public/absolutevolumeapi.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(absolutevolumeapi.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/inc/absolutevolumesender.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,50 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef ABSOLUTEVOLUMESENDER_H
+#define ABSOLUTEVOLUMESENDER_H
+
+#include <e32base.h>
+#include <absolutevolumeapicontroller.h>
+#include <remconinterfaceselector.h>
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+NONSHARABLE_CLASS(CAbsVolSender) : public CActive
+	{
+public:
+	static CAbsVolSender* NewL(CRemConInterfaceSelector& aIfSel, MAbsVolSenderObserver& aObserver);
+	~CAbsVolSender();
+	
+	void SendNotify(const TDesC8& aData);
+	void SendSetAbsoluteVolume(TUint& aNumRemotes, const TDesC8& aData);
+
+private:
+	void RunL();
+	void DoCancel();
+	
+	CAbsVolSender(CRemConInterfaceSelector& aIfSel, MAbsVolSenderObserver& aObserver);
+	
+private:
+	CRemConInterfaceSelector& iIfSel;
+	MAbsVolSenderObserver& iObserver;
+	TBool iSendingNotify;
+	};
+
+#endif // ABSOLUTEVOLUMESENDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeapi.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,73 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef ABSOLUTEVOLUMEAPI_H_
+#define ABSOLUTEVOLUMEAPI_H_
+
+#include <e32base.h>
+
+const TInt KRemConAbsoluteVolumeControllerApiUid = 0x1020831E;
+const TInt KRemConAbsoluteVolumeTargetApiUid = 0x10215bbd;
+
+const TInt KErrAbsoluteVolumeInternalError     = -6537;
+
+/**
+Error code(4 bytes) + The relative volume(4 bytes) + 
+The maximum volume against which volume is relative(4 bytes)
+*/
+const TUint KAbsoluteVolumeResponseDataSize = 12;
+
+/** Operation Id of set absolute volume */
+const TUint    KRemConSetAbsoluteVolume						= 0x1050;
+/** Operation Id of register volume change notification */
+const TUint    KRemConAbsoluteVolumeNotification			= 0x0d31;
+
+/**
+The relative volume to be set(4 bytes) + 
+The maximum volume against which volume is relative(4 bytes) + 
+Reserved(4 bytes)
+*/
+const TInt KAbsoluteVolumeRequestDataSize = 12;
+
+/**
+The absolute volume is represented in one octet. The top bit(bit 7)
+is reserved for future use.
+*/
+const TUint8 KAbsoluteVolumeMask = 0x7f;
+
+/** PDU length of set absolute volume response */
+const TUint8 KLengthSetAbsoluteVolumeResponse = 11;
+/** PDU length of notify volume change response */
+const TUint8 KLengthNotifyVolumeChangeResponse = 12;
+
+/** Absolute Volume(1 byte) */
+const TUint8 KLengthSetAbsoluteVolumeRequestParameter = 1;
+/** Event ID(1 byte) + Reserved(4 bytes) */
+const TUint8 KLengthNotifyVolumeChangeRequestParameter = 5;
+
+/** Absolute Volume(1 byte) */
+const TUint8 KLengthSetAbsoluteVolumeResponseParamter = 1;
+/** Event ID(1 byte) + Absolute Volume(1 byte) */
+const TUint8 KLengthNotifyVolumeChangeResponseParameter = 2;
+	
+#endif /*ABSOLUTEVOLUMEAPI_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeapicontroller.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,148 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONABSOLUTEVOLUMEAPICONTROLLER_H_
+#define REMCONABSOLUTEVOLUMEAPICONTROLLER_H_
+
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+#include <absolutevolumeapi.h>
+
+_LIT(KAbsoluteVolumeControllerPanicName, "AbsoluteVolumeController");
+enum TAbsoluteVolumeControllerPanics
+	{
+	EControllerInvalidMaxVolume = 0,
+	EControllerVolumeBeyondMaxVolume = 1,
+	EAbsoluteVolumeNotificationAlreadyRegistered = 2,
+	EMultipleSetAbsoluteVolumes = 3,
+	EMultipleNotifies = 4,
+	};
+
+class MRemConAbsoluteVolumeControllerObserver;
+class CAbsVolSender;
+
+/**
+@internalComponent
+*/
+class MAbsVolSenderObserver
+	{
+public:
+	virtual void MavsoSendComplete(TInt aResult) = 0;
+	};
+
+/**
+This class is used to set and observer the volume level on a remote device.
+
+An active scheduler is required in order to use this class.
+*/
+NONSHARABLE_CLASS(CRemConAbsoluteVolumeController) 
+: public CRemConInterfaceBase, public MRemConInterfaceIf2, public MAbsVolSenderObserver
+	{
+public:    
+	IMPORT_C static CRemConAbsoluteVolumeController* NewL(
+			CRemConInterfaceSelector& aInterfaceSelector, 
+			MRemConAbsoluteVolumeControllerObserver& aObserver,
+			TUint32 aMaxVolume);
+	
+	IMPORT_C ~CRemConAbsoluteVolumeController();
+
+public:    
+	IMPORT_C void SetAbsoluteVolume(TRequestStatus& aStatus, 
+			TUint32 aVolume, 
+			TUint& aNumRemotes); 
+	IMPORT_C void CancelSetAbsoluteVolume();
+	
+	IMPORT_C void RegisterAbsoluteVolumeNotification();    
+	IMPORT_C void CancelAbsoluteVolumeNotification();
+    
+private:    
+	CRemConAbsoluteVolumeController(
+			CRemConInterfaceSelector& aInterfaceSelector, 
+			MRemConAbsoluteVolumeControllerObserver& aObserver,
+			TUint32 aMaxVolume); 
+    void ConstructL();
+
+private: // Utility functions    
+	void HandleNotify(const TDesC8& aData, 
+			TRemConMessageSubType aMessageSubType);  
+    
+    void HandleSetAbsoluteVolumeResponse( const TDesC8& aData );
+    static TInt AsyncErrorCallBack(TAny* aObserver);
+    void KickOffSendIfNeeded();
+    void SetAbsoluteVolumeSendComplete(TInt aResult);
+    void RegisterNotifySendComplete();
+    void SendSetAbsoluteVolume();
+    void SendNotify();
+    
+    void VolumeUpdate(TUint32 aVolume, TUint32 aMaxVolume);
+
+private: // From CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+    
+private: // From MRemConInterfaceIf2
+	void MrcibNewMessage(TUint aOperationId, 
+			const TDesC8& aData, 
+			TRemConMessageSubType 
+			aMessageSubType);
+    
+private: // From MAbsVolSenderObserver
+		void MavsoSendComplete(TInt aResult);
+	
+private: // Unowned
+	MRemConAbsoluteVolumeControllerObserver& iObserver;
+	  
+private: // Owned
+	// For operation-specific data.
+	TBuf8<KAbsoluteVolumeRequestDataSize> iNotifyData;
+	TBuf8<KAbsoluteVolumeRequestDataSize> iSetData;
+	
+	// Records the current absolute volume value.
+	TUint32 iCurrentVolume;  
+	TUint32 iCurrentMaxVolume;
+	
+	// Used when sending SetAbsoluteVolume commands
+	TUint32 iClientMaxVolume;
+	
+	CAbsVolSender* iAbsVolSender;
+	
+	TBool iNotificationRequested;
+
+	// Only used for abs vol sends.
+	TRequestStatus* iClientStatus;
+	TUint* iClientNumRemotes;
+
+	enum TRequestState
+		{
+	// There is no request outstanding
+	ENotInUse = 0,
+	// We're currently sending this request.
+	ESending,
+	// This request is waiting to be sent (possibly because we were busy sending a previous request when this one arose).
+	EPending,
+		};
+	// The two requests we support.
+	TRequestState iAbsVolRequest;
+	TRequestState iNotifyRequest;
+	};
+
+#endif /*REMCONABSOLUTEVOLUMEAPICONTROLLER_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeapicontrollerobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,71 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+
+#ifndef REMCONABSOLUTEVOLUMEAPICONTROLLEROBSERVER_H_
+#define REMCONABSOLUTEVOLUMEAPICONTROLLEROBSERVER_H_
+
+#include <e32base.h>
+
+/**
+Clients must implement this interface in order to instantiate objects of type 
+CRemConAbsoluteVolumeController. This interface passes incoming responses 
+from RemCon to the client.
+*/
+class MRemConAbsoluteVolumeControllerObserver
+	{
+public:
+	/** 
+	The current volume has been received.
+	 
+	@param aVolume The current relative volume on the target device.
+	@param aMaxVolume The maximum volume against which aVolume is relative.
+	@param aError The response error.
+	*/
+	virtual void MrcavcoCurrentVolume(TUint32 aVolume, 
+			TUint32 aMaxVolume, 
+			TInt aError)=0;
+
+	/**
+	The response for setting absolute volume.
+	
+	@param aVolume The relative volume that has been set on the target device.
+	@param aMaxVolume The maximum volume against which aVolume is relative.
+	@param aError The response error.
+	*/
+	virtual void MrcavcoSetAbsoluteVolumeResponse(TUint32 aVolume, 
+			TUint32 aMaxVolume, 
+			TInt aError)=0;
+	
+	/**
+	The error occurs for absolute volume notification. 
+	
+	When this is called, the client must call
+	RegisterAbsoluteVolumeNotification() to register again if the client 
+	wants to receive the notification.
+	*/
+	virtual void MrcavcoAbsoluteVolumeNotificationError() = 0;
+
+	};
+
+#endif /*REMCONABSOLUTEVOLUMEAPICONTROLLEROBSERVER_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeapitarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,96 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONABSOLUTEVOLUMEAPITARGET_H
+#define REMCONABSOLUTEVOLUMEAPITARGET_H
+
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+
+_LIT(KAbsoluteVolumeTargetPanicName, "AbsoluteVolumeTarget");
+enum TAbsoluteVolumeTargetPanics
+    {
+    ETargetInvalidMaxVolume = 0,
+    ETargetVolumeBeyondMaxVolume = 1,
+    };
+
+class MRemConAbsoluteVolumeTargetObserver;
+
+/**
+Client-instantiable type supporting sending absolute volume API responses for
+Set Absolute Volume and Register Absolute Volume Change Notification. This API
+should be used in preference to the extapi.
+*/
+NONSHARABLE_CLASS(CRemConAbsoluteVolumeTarget) : public CRemConInterfaceBase,
+                                                 public MRemConInterfaceIf2
+	{
+public:
+	IMPORT_C static CRemConAbsoluteVolumeTarget* NewL(
+			CRemConInterfaceSelector& aInterfaceSelector, 
+			MRemConAbsoluteVolumeTargetObserver& aObserver,
+			TUint32 aVolume, 
+			TUint32 aMaxVolume);
+	
+	IMPORT_C ~CRemConAbsoluteVolumeTarget();
+
+public:
+	IMPORT_C void SetAbsoluteVolumeResponse(TUint32 aVolume, 
+			TInt aErr);
+	
+	IMPORT_C void AbsoluteVolumeChanged(TUint32 aVolume);
+	
+private:
+    CRemConAbsoluteVolumeTarget(CRemConInterfaceSelector& aInterfaceSelector,
+    		MRemConAbsoluteVolumeTargetObserver& aObserver,
+    		TUint32 aVolume, 
+    		TUint32 aMaxVolume);
+
+	void ConstructL();
+
+private: // From CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // From MRemConInterfaceIf2
+	void MrcibNewMessage(TUint aOperationId, 
+			const TDesC8& aData, 
+			TRemConMessageSubType aMsgSubType);
+
+private: // Utility Funtions
+	void SendError(TInt aError, TUint aOperationId);
+	void SendNotificationResponse(TRemConMessageSubType aMsgSubType);
+	void ProcessGetStatus();
+	void ProcessGetStatusAndBeginObserving();
+	void ProcessSetAbsoluteVolume(const TDesC8& aData);
+
+private: // Unowned
+    MRemConAbsoluteVolumeTargetObserver& iObserver;
+
+private: // Owned
+	// ETrue indicates a request for absolute volume change notification has 
+	// been received.
+	TBool                     iAbsoluteVolumeNotificationRequest;
+	RBuf8                     iOutBuf;
+	TUint32                   iClientVolume;
+	TUint32                   iClientMaxVolume;
+	};
+#endif // ABSOLUTEVOLUMEAPITARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeapitargetobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,50 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONABSOLUTEVOLUMEAPITARGETOBSERVER_H
+#define REMCONABSOLUTEVOLUMEAPITARGETOBSERVER_H
+
+#include <e32base.h>
+
+/**
+Clients must implement this interface in order to instantiate objects of type 
+CRemConAbsoluteVolumeTarget. This interface passes incoming commands from 
+RemCon to the client.
+*/
+NONSHARABLE_CLASS(MRemConAbsoluteVolumeTargetObserver)
+	{
+public:
+    /** 
+	This is called when the controller wishes to set absolute volume on the 
+	client. Response must be provided by the client by calling 
+	CRemConAbsoluteVolumeTarget::SetAbsoluteVolumeResponse()
+	
+	@see CRemConAbsoluteVolumeTarget::SetAbsoluteVolumeResponse()
+	@param aVolume The relative volume.
+	@param aMaxVolume The maximum volume against which aVolume is relative.
+	*/
+	virtual void MrcavtoSetAbsoluteVolumeRequest(TUint32 aVolume, 
+			TUint32 aMaxVolume) = 0;
+	};
+
+#endif // REMCONABSOLUTEVOLUMEAPITARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/public/absolutevolumeutils.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,62 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef ABSOLUTEVOLUMEUTILS_H_
+#define ABSOLUTEVOLUMEUTILS_H_
+
+#include <e32base.h>
+#include <s32mem.h>
+
+class RRemConAbsoluteVolume
+	{
+public:
+    virtual void ReadL(const TDesC8& aData) = 0;
+    virtual void WriteL(TDes8& aOutData) = 0;
+	IMPORT_C void Close();
+	
+public:
+	TUint32  iVolume;
+	TUint32  iMaxVolume;	
+	
+protected:
+	RDesWriteStream    iStream;
+	RDesReadStream     iReadStream;
+	};
+
+class RRemConAbsoluteVolumeRequest : public RRemConAbsoluteVolume
+	{
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+
+class RRemConAbsoluteVolumeResponse : public RRemConAbsoluteVolume
+	{
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+public:
+	TInt32   iError;
+	};
+
+#endif /*ABSOLUTEVOLUMEUTILS_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/src/absolutevolumeapicontroller.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,478 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <e32def.h>
+#include <absolutevolumeapicontroller.h>
+#include <absolutevolumeapicontrollerobserver.h>
+#include <remconinterfaceselector.h>
+#include "absolutevolumesender.h"
+#include <absolutevolumeutils.h>
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCONABSOLUTEVOLUME);
+#endif
+
+#ifdef _DEBUG
+_LIT(KAbsoluteVolumeControllerFaultName, "AbsVolFault");
+// The panic codes associated with category KAbsoluteVolumeControllerFaultName are line numbers in this file.
+#endif
+
+/**
+Allocates and constructs a new CRemConAbsoluteVolumeController object
+
+@param aInterfaceSelector The interface selector. The client must have 
+       created one of these first.
+@param aObserver The observer. The client must have implemented the observer,
+       owned by the client.
+@param aMaxVolume The client maximum volume.
+@return A new CRemConAbsoluteVolumeController, owned by the interface selector
+@panic AbsoluteVolumeController 0 if aMaxVolume is zero.
+*/
+EXPORT_C 
+CRemConAbsoluteVolumeController* CRemConAbsoluteVolumeController::NewL(
+		CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConAbsoluteVolumeControllerObserver& aObserver,
+		TUint32 aMaxVolume)
+	{
+	LOG_STATIC_FUNC
+	
+	__ASSERT_ALWAYS(aMaxVolume > 0, 
+				User::Panic(KAbsoluteVolumeControllerPanicName, 
+						EControllerInvalidMaxVolume)
+				);
+				
+	CRemConAbsoluteVolumeController* self = 
+	new(ELeave) CRemConAbsoluteVolumeController(aInterfaceSelector, 
+			aObserver, aMaxVolume);
+	
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+/** 
+Constructor.
+
+@param aInterfaceSelector The interface selector.
+@param aObserver The observer.
+*/
+CRemConAbsoluteVolumeController::CRemConAbsoluteVolumeController(
+		CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConAbsoluteVolumeControllerObserver& aObserver,
+		TUint32 aMaxVolume)
+:	CRemConInterfaceBase(TUid::Uid(KRemConAbsoluteVolumeControllerApiUid), 
+		KAbsoluteVolumeResponseDataSize,
+		aInterfaceSelector,
+		ERemConClientTypeController),
+    iObserver(aObserver),
+    iClientMaxVolume(aMaxVolume),
+	iNotificationRequested(EFalse),
+	iAbsVolRequest(ENotInUse),
+	iNotifyRequest(ENotInUse)
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C CRemConAbsoluteVolumeController::~CRemConAbsoluteVolumeController()
+    {
+	LOG_FUNC
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+	
+	delete iAbsVolSender;
+    }
+
+void CRemConAbsoluteVolumeController::ConstructL()
+	{
+	LOG_FUNC
+	
+	iAbsVolSender = CAbsVolSender::NewL(InterfaceSelector(), *this);
+	BaseConstructL();
+	}
+
+/**
+Sets an absolute volume on the target device,
+Any responses will be returned via the observer interface.
+
+@pre The send of any previous SetAbsoluteVolume command has completed.
+@param aStatus Indicates the completion of the send request.  The client must
+			   not block execution by using User::WaitForRequest to await 
+			   completion of this send.
+@param aVolume The relative volume against the client max volume.
+@param aNumRemotes The number of remotes to which the command was sent.
+@panic AbsoluteVolumeController 1, if aVolume greater than the client 
+       max volume.
+*/
+EXPORT_C void CRemConAbsoluteVolumeController::SetAbsoluteVolume(
+		TRequestStatus& aStatus, 
+		TUint32 aVolume, 
+		TUint& aNumRemotes)
+	{
+	LOG_FUNC
+	LOG1(_L8("\taVolume = %d"), aVolume);
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+	
+	__ASSERT_ALWAYS(aVolume <= iClientMaxVolume, 
+			User::Panic(KAbsoluteVolumeControllerPanicName, 
+					EControllerVolumeBeyondMaxVolume)
+			);
+	__ASSERT_DEBUG(iAbsVolRequest == ENotInUse, User::Panic(KAbsoluteVolumeControllerPanicName, 
+				EMultipleSetAbsoluteVolumes));
+	
+	RRemConAbsoluteVolumeRequest setAbsVol;
+	setAbsVol.iVolume = aVolume;
+	setAbsVol.iMaxVolume = iClientMaxVolume;
+	TRAPD(err, setAbsVol.WriteL(iSetData));
+	if (err == KErrNone)
+		{
+		// Store the client's info so we can complete their request later
+		aStatus = KRequestPending;
+		iAbsVolRequest = EPending;
+		__ASSERT_DEBUG(iClientStatus == NULL, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__));
+		iClientStatus = &aStatus;
+		__ASSERT_DEBUG(iClientNumRemotes == NULL, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__));
+		iClientNumRemotes = &aNumRemotes;
+		KickOffSendIfNeeded();
+		}
+	else
+		{
+		iObserver.MrcavcoSetAbsoluteVolumeResponse(0, 0, err);
+		}
+	}
+
+EXPORT_C void CRemConAbsoluteVolumeController::CancelSetAbsoluteVolume()
+	{
+	LOG_FUNC
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+	
+	switch ( iAbsVolRequest )
+		{
+	case ENotInUse:
+		// Nothing to do.
+		break;
+	case ESending:
+		iAbsVolSender->Cancel();
+		SetAbsoluteVolumeSendComplete(KErrCancel);
+		break;
+	case EPending:
+		SetAbsoluteVolumeSendComplete(KErrCancel);
+		break;
+	default:
+		__ASSERT_DEBUG(EFalse, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__));
+		break;
+		}
+	}
+
+/**
+Requests notification when the volume on the target device changes,
+Any responses will be returned via the observer interface.
+
+Volume changes will continue to be provided until either the 
+CancelAbsoluteVolumeNotification function is called, or MrcavcoCurrentVolume
+is called on the client with an error.
+
+@see MRemConAbsoluteVolumeControllerObserver::MrcavcoCurrentVolume
+@see CRemConAbsoluteVolumeController::CancelAbsoluteVolumeNotification
+@pre The client is not currently registered to receive absolute volume notifications.
+*/
+EXPORT_C 
+void CRemConAbsoluteVolumeController::RegisterAbsoluteVolumeNotification()
+	{
+	LOG_FUNC
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+	
+	// The request is outstanding, so not allowed to register again.
+	__ASSERT_DEBUG(!iNotificationRequested, User::Panic(KAbsoluteVolumeControllerPanicName, EAbsoluteVolumeNotificationAlreadyRegistered));
+	__ASSERT_DEBUG(iNotifyRequest == ENotInUse, User::Panic(KAbsoluteVolumeControllerPanicName, EMultipleNotifies));
+	
+	RRemConAbsoluteVolumeRequest absVol;
+	TRAPD(err, absVol.WriteL(iNotifyData));
+	if (err == KErrNone)
+		{
+		iNotifyRequest = EPending;
+		iNotificationRequested = ETrue;
+		KickOffSendIfNeeded();
+		}
+	else
+		{
+		iObserver.MrcavcoAbsoluteVolumeNotificationError();
+		}
+	}
+
+/**
+Called by the client to tell the controller that the client doesn't wish to 
+receicve the volume change notification
+until the client re-register again.
+*/
+EXPORT_C 
+void CRemConAbsoluteVolumeController::CancelAbsoluteVolumeNotification()
+	{
+	LOG_FUNC
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+	
+	if ( iNotifyRequest == ESending )
+		{
+		iAbsVolSender->Cancel();
+		}
+	
+	iNotificationRequested = EFalse;
+	RegisterNotifySendComplete();
+	}
+
+TAny* CRemConAbsoluteVolumeController::GetInterfaceIf(TUid aUid)
+    {
+	LOG_FUNC
+	
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf2) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf2*>(this)
+			);
+		}
+	
+	return ret;
+    }
+
+void CRemConAbsoluteVolumeController::MrcibNewMessage(TUint aOperationId, 
+		const TDesC8& aData, 
+		TRemConMessageSubType aMessageSubType)
+	{
+	LOG_FUNC
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+	
+	switch (aOperationId)
+	    {
+	case KRemConAbsoluteVolumeNotification:
+		HandleNotify(aData, aMessageSubType);
+	    break;
+	case KRemConSetAbsoluteVolume:
+    	HandleSetAbsoluteVolumeResponse(aData);
+	    break;
+	default:	   
+	    break;
+	    }
+	}
+
+/** 
+Process the 'volume changed notification response'
+
+@param aData The response data.
+@param aMessageSubType The RemCon submessage type.
+*/
+void CRemConAbsoluteVolumeController::HandleNotify(const TDesC8& aData,
+		TRemConMessageSubType aMessageSubType)
+    {
+	LOG_FUNC
+	
+    TInt err = KErrNone;
+    
+    if(iNotificationRequested)
+    	{
+	    RRemConAbsoluteVolumeResponse absVol;
+	    TRAP(err, absVol.ReadL(aData))
+	    if (err == KErrNone)
+	    	{
+	    	if (absVol.iError == KErrNone)
+	    		{
+	    		switch ( aMessageSubType )
+	    	        {
+	    	    case ERemConNotifyResponseInterim:
+	    	    	{
+	    	    	VolumeUpdate(absVol.iVolume, absVol.iMaxVolume);
+		    	    break;
+	    	    	}	    	    
+	    	    case ERemConNotifyResponseChanged:
+		    		{
+	    	    	VolumeUpdate(absVol.iVolume, absVol.iMaxVolume);
+
+		    		// Register notification again.
+		    		iNotificationRequested = EFalse;
+		    		RegisterAbsoluteVolumeNotification();
+		    	    break;
+		    		}	    			
+	    	    default:    	    
+	    	        break;
+	    	        }//switch
+	    		}
+	    	else //Error response
+	    		{
+	    		iNotificationRequested = EFalse;
+	    		iObserver.MrcavcoAbsoluteVolumeNotificationError();
+	    		}
+	    	}
+	    else
+	    	{
+    		iNotificationRequested = EFalse;
+    		iObserver.MrcavcoAbsoluteVolumeNotificationError();
+	    	}
+    	}
+    }
+
+/** 
+Process the 'set absolute volume response'
+@param aData The response data.
+*/
+void CRemConAbsoluteVolumeController::HandleSetAbsoluteVolumeResponse( 
+		const TDesC8& aData )
+    {
+	LOG_FUNC
+	
+    TInt err = KErrNone;
+    RRemConAbsoluteVolumeResponse absVol;
+    TRAP(err, absVol.ReadL(aData))
+    if (err == KErrNone)
+    	{
+    	iCurrentVolume = absVol.iVolume;
+    	iCurrentMaxVolume = absVol.iMaxVolume;
+    	iObserver.MrcavcoSetAbsoluteVolumeResponse(absVol.iVolume, 
+    			absVol.iMaxVolume,
+    			absVol.iError);
+    	}
+    else
+    	{
+    	iObserver.MrcavcoSetAbsoluteVolumeResponse(0, 
+    			0,
+    			err);
+    	}
+    }
+
+void CRemConAbsoluteVolumeController::MavsoSendComplete(TInt aResult)
+	{
+	LOG_FUNC
+	LOG1(_L8("\taResult = %d"), aResult);
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+	
+	if ( iAbsVolRequest == ESending )
+		{
+		__ASSERT_DEBUG(iNotifyRequest != ESending, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__));
+		SetAbsoluteVolumeSendComplete(aResult);
+		}
+	else if ( iNotifyRequest == ESending )
+		{
+		// This updates our own state and kicks off any pending send. The 
+		// later client upcall (if there was an error) gives them a chance 
+		// to make further calls on us.
+		RegisterNotifySendComplete();
+
+		if(aResult != KErrNone)
+			{
+			iNotificationRequested = EFalse;
+			iObserver.MrcavcoAbsoluteVolumeNotificationError();
+			}
+		}
+	else
+		{
+		// Send complete with no send outstanding.
+		__ASSERT_DEBUG(EFalse, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__));
+		}
+	}
+
+void CRemConAbsoluteVolumeController::KickOffSendIfNeeded()
+	{
+	LOG_FUNC
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+	
+	if ( iAbsVolRequest == ESending || iNotifyRequest == ESending )
+		{
+		// Any pending send will be kicked off when current send completes and this function is called again.
+		return;
+		}
+		
+	if ( iAbsVolRequest == EPending )
+		{
+		SendSetAbsoluteVolume();
+		}
+	else if ( iNotifyRequest == EPending )
+		{
+		SendNotify();
+		}
+	}
+
+void CRemConAbsoluteVolumeController::SetAbsoluteVolumeSendComplete(TInt aResult)
+	{
+	LOG_FUNC
+	LOG1(_L8("\taResult = %d"), aResult);
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+	
+	__ASSERT_DEBUG(iClientStatus, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__));
+	User::RequestComplete(iClientStatus, aResult);
+	iClientStatus = NULL;
+	iClientNumRemotes = NULL;
+	iSetData.SetLength(0);
+	__ASSERT_DEBUG(iAbsVolRequest != ENotInUse, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__));
+	iAbsVolRequest = ENotInUse;
+	
+	KickOffSendIfNeeded();
+	}
+
+void CRemConAbsoluteVolumeController::RegisterNotifySendComplete()
+	{
+	LOG_FUNC
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+
+	iNotifyData.SetLength(0);
+	// This method doesn't actually complete a client request so we don't bother asserting state.
+	iNotifyRequest = ENotInUse;
+	
+	KickOffSendIfNeeded();
+	}
+
+void CRemConAbsoluteVolumeController::VolumeUpdate(TUint32 aVolume, TUint32 aMaxVolume)
+	{
+	LOG_FUNC
+	LOG2(_L8("\taVolume = %d, aMaxVolume = %d"), aVolume, aMaxVolume);
+	
+	// Only update the client if the volume has changed
+    if (aVolume != iCurrentVolume || aMaxVolume != iCurrentMaxVolume)
+	    {
+	    iCurrentVolume = aVolume; //store the new value
+	    iCurrentMaxVolume = aMaxVolume;
+	    
+	    iObserver.MrcavcoCurrentVolume(aVolume,
+	    		aMaxVolume,
+	    		KErrNone);
+	    }
+	}
+
+void CRemConAbsoluteVolumeController::SendSetAbsoluteVolume()
+	{
+	LOG_FUNC
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+	
+	__ASSERT_DEBUG(iClientNumRemotes, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__));
+	iAbsVolSender->SendSetAbsoluteVolume(*iClientNumRemotes, iSetData);
+	__ASSERT_DEBUG(iAbsVolRequest == EPending, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__));
+	iAbsVolRequest = ESending;
+	}
+
+void CRemConAbsoluteVolumeController::SendNotify()
+	{
+	LOG_FUNC
+	LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest);
+	
+	iAbsVolSender->SendNotify(iNotifyData);
+	__ASSERT_DEBUG(iNotifyRequest == EPending, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__));
+	iNotifyRequest = ESending;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/src/absolutevolumeapitarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,324 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <absolutevolumeapitarget.h>
+#include <absolutevolumeapitargetobserver.h>
+#include <remconinterfaceselector.h>
+#include <absolutevolumeapi.h>
+#include <absolutevolumeutils.h>
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCONABSOLUTEVOLUME);
+_LIT8(KLogFormat, "Operation Id = 0x%x, Data Lengh = %d");
+_LIT8(KLogNewL, "CRemConAbsoluteVolumeTarget::NewL");
+#endif
+
+/**
+Allocates and constructs a new CRemConAbsoluteVolumeTarget object
+
+@param aInterfaceSelector The interface selector. The client must have 
+       created one of these first.
+@param aObserver The observer through which the client will receive absolute
+       volume commands from M class MRemConAbsoluteVolumeTargetObserver.
+@param aVolume The initial relative volume on the client.
+@param aMaxVolume The client maximum volume against which aVolume is relative.
+@return A new CRemConAbsoluteVolumeTarget, owned by the interface selector.
+@panic AbsoluteVolumeTarget 0 if aMaxVolume is zero
+       AbsoluteVolumeTarget 1 if aVolume greater than aMaxVolume
+       
+*/
+EXPORT_C CRemConAbsoluteVolumeTarget* CRemConAbsoluteVolumeTarget::NewL(
+		CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConAbsoluteVolumeTargetObserver& aObserver,
+		TUint32 aVolume, 
+		TUint32 aMaxVolume)
+	{
+	LOG(KLogNewL);
+	
+	__ASSERT_ALWAYS(aMaxVolume > 0, 
+			User::Panic(KAbsoluteVolumeTargetPanicName, 
+					ETargetInvalidMaxVolume)
+			);
+	__ASSERT_ALWAYS(aVolume <= aMaxVolume, 
+			User::Panic(KAbsoluteVolumeTargetPanicName, 
+					ETargetVolumeBeyondMaxVolume)
+			);
+	
+	CRemConAbsoluteVolumeTarget* self = 
+	new(ELeave) CRemConAbsoluteVolumeTarget(aInterfaceSelector, 
+			aObserver, aVolume, aMaxVolume);
+	
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+/** 
+Constructor.
+@param aInterfaceSelector The interface selector.
+@param aObserver The observer of this interface.
+@param aVolume The initial relative volume on the client
+@param aMaxVolume The maximum volume on the client against which 
+       aVolume is relative.
+*/
+CRemConAbsoluteVolumeTarget::CRemConAbsoluteVolumeTarget(
+		CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConAbsoluteVolumeTargetObserver& aObserver,
+		TUint32 aVolume, 
+		TUint32 aMaxVolume)
+:	CRemConInterfaceBase(TUid::Uid(KRemConAbsoluteVolumeTargetApiUid),
+		KAbsoluteVolumeRequestDataSize, 
+		aInterfaceSelector,
+		ERemConClientTypeTarget), 
+	iObserver(aObserver),
+	iAbsoluteVolumeNotificationRequest(EFalse),
+	iClientVolume(aVolume),
+	iClientMaxVolume(aMaxVolume)
+	{
+	}
+	
+void CRemConAbsoluteVolumeTarget::ConstructL()
+	{
+	iOutBuf.CreateL(KAbsoluteVolumeResponseDataSize);
+
+	//Mandate the following features supported.
+	RRemConInterfaceFeatures features;
+	User::LeaveIfError(features.Open());
+	CleanupClosePushL(features);
+	features.AddOperationL(KRemConSetAbsoluteVolume);
+	
+	BaseConstructL(features);
+	CleanupStack::PopAndDestroy(&features);
+	}
+
+EXPORT_C CRemConAbsoluteVolumeTarget::~CRemConAbsoluteVolumeTarget()
+	{
+	iOutBuf.Close();
+	}
+
+TAny* CRemConAbsoluteVolumeTarget::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf2) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf2*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+/** 
+Called by the client in response to a MrcavtoSetAbsoluteVolume() call.
+
+@param aVolume The relative volume against the client maximum volume.  
+@param aErr The error code.
+     - KErrNone if the client has changed its absolute volume.
+     - System wide error code otherwise.
+@panic AbsoluteVolumeTarget 1, if volume is greater than max volume.
+*/
+EXPORT_C void CRemConAbsoluteVolumeTarget::SetAbsoluteVolumeResponse(
+		TUint32 aVolume, 
+		TInt aErr)
+	{
+	__ASSERT_ALWAYS(aVolume <= iClientMaxVolume, 
+			User::Panic(KAbsoluteVolumeTargetPanicName, 
+					ETargetVolumeBeyondMaxVolume)
+			);
+	
+	RRemConAbsoluteVolumeResponse response;
+	response.iError = KErrNone;
+	response.iVolume = aVolume;
+	response.iMaxVolume = iClientMaxVolume;
+	TRAPD(error, response.WriteL(iOutBuf));
+	if (error != KErrNone)
+		{
+		SendError(KErrAbsoluteVolumeInternalError, KRemConSetAbsoluteVolume);
+		return;
+		}
+	
+	if (aErr == KErrNone)
+		{
+		// send the response back to the CT
+		error = InterfaceSelector().SendUnreliable(
+				TUid::Uid(KRemConAbsoluteVolumeTargetApiUid),
+				KRemConSetAbsoluteVolume, ERemConResponse, iOutBuf );
+		}
+	else
+		{
+		SendError(KErrAbsoluteVolumeInternalError, KRemConSetAbsoluteVolume);
+		}
+	}
+
+/** 
+Must be called each time the volume changes on the client.
+
+It is used to inform the controller if it has requested updates on the client
+volume change.
+
+@param aVolume The relative volume against the client maximum volume. 
+@panic AbsoluteVolume 1, if volume greater than the client max volume.
+*/
+EXPORT_C void CRemConAbsoluteVolumeTarget::AbsoluteVolumeChanged(
+		TUint32 aVolume)
+	{
+	__ASSERT_ALWAYS(aVolume <= iClientMaxVolume, 
+			User::Panic(KAbsoluteVolumeTargetPanicName, 
+					ETargetVolumeBeyondMaxVolume)
+			);
+	
+	if (aVolume != iClientVolume)
+		{
+		// Records the current volume each time
+		// when the client absolute volume is changed
+		iClientVolume = aVolume;
+		
+		if (iAbsoluteVolumeNotificationRequest)
+			{
+			iAbsoluteVolumeNotificationRequest = EFalse;
+			SendNotificationResponse(ERemConNotifyResponseChanged);
+			}
+		}
+	}
+
+// From MRemConInterfaceIf
+void CRemConAbsoluteVolumeTarget::SendError(TInt aError, TUint aOperationId)
+	{
+	TInt error = KErrNone;
+	RRemConAbsoluteVolumeResponse errRsp;
+	errRsp.iError = aError;
+	TRAP(error, errRsp.WriteL(iOutBuf));
+	if (error == KErrNone)
+		{
+		InterfaceSelector().SendUnreliable(
+				TUid::Uid(KRemConAbsoluteVolumeTargetApiUid),
+				aOperationId, ERemConResponse, iOutBuf);
+		}
+	}
+
+void CRemConAbsoluteVolumeTarget::MrcibNewMessage(TUint aOperationId, 
+		const TDesC8& aData, 
+		TRemConMessageSubType aMsgSubType)
+	{
+	LOG_FUNC
+	LOG2(KLogFormat, aOperationId, aData.Length());
+
+	switch(aOperationId)
+		{
+	case KRemConSetAbsoluteVolume:
+		{
+		ProcessSetAbsoluteVolume(aData);
+		break;
+		}
+	case KRemConAbsoluteVolumeNotification:
+		{
+		// register for Notifications
+		if (aMsgSubType == ERemConNotifyCommandAwaitingInterim)
+			{
+			ProcessGetStatusAndBeginObserving();
+			}
+		else if (aMsgSubType == ERemConNotifyCommandAwaitingChanged)
+			{
+			ProcessGetStatus();
+			}
+	 	break;
+		}
+	default:
+		break; 
+		};
+	}
+
+/**
+Processes the request for setting absolute volume.
+
+@param aData The absolute volume data to be setted.
+*/
+void CRemConAbsoluteVolumeTarget::ProcessSetAbsoluteVolume(
+		const TDesC8& aData)
+	{	
+	TInt error;
+	RRemConAbsoluteVolumeRequest request;
+	TRAP(error, request.ReadL(aData));
+	if ( error == KErrNone)
+		{
+		iObserver.MrcavtoSetAbsoluteVolumeRequest(request.iVolume, 
+				request.iMaxVolume);
+		}
+	else
+		{
+		SendError(KErrAbsoluteVolumeInternalError, KRemConSetAbsoluteVolume);
+		}
+	}
+
+/**
+Processes the request for notify command waiting interim.
+*/
+void CRemConAbsoluteVolumeTarget::ProcessGetStatusAndBeginObserving()
+	{
+	//Flag is ETure to indicate the request for absolute volume change 
+	//notification has been received.
+	iAbsoluteVolumeNotificationRequest = ETrue;
+		
+	//send the interim response with the current absolute volume.
+	SendNotificationResponse(ERemConNotifyResponseInterim);
+	}
+
+/**
+Processes the request for notify command waiting changed.
+*/
+void CRemConAbsoluteVolumeTarget::ProcessGetStatus()
+	{
+	// send the current value
+	SendNotificationResponse(ERemConNotifyResponseChanged);
+	}
+
+/**
+Sends absolute volume interim or change response according to the message 
+type aMsgSubType
+
+@param aMsgSubType The remcon submessage type.
+*/
+void CRemConAbsoluteVolumeTarget::SendNotificationResponse(
+		TRemConMessageSubType aMsgSubType)
+	{
+	LOG_FUNC
+
+	TInt error = 0;
+	RRemConAbsoluteVolumeResponse response;
+	response.iError = KErrNone;
+	response.iVolume = iClientVolume;
+	response.iMaxVolume = iClientMaxVolume;
+	TRAP(error, response.WriteL(iOutBuf));
+	if (error == KErrNone)
+		{
+		error = InterfaceSelector().SendUnreliable(
+				TUid::Uid(KRemConAbsoluteVolumeTargetApiUid),
+				KRemConAbsoluteVolumeNotification, 
+				ERemConResponse, 
+				aMsgSubType,
+				iOutBuf);
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/src/absolutevolumesender.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,90 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "absolutevolumesender.h"
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCONABSOLUTEVOLUME);
+#endif
+
+CAbsVolSender* CAbsVolSender::NewL(CRemConInterfaceSelector& aIfSel, MAbsVolSenderObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+	return new(ELeave)CAbsVolSender(aIfSel, aObserver);
+	}
+
+CAbsVolSender::CAbsVolSender(CRemConInterfaceSelector& aIfSel, MAbsVolSenderObserver& aObserver)
+	: CActive(EPriorityStandard), iIfSel(aIfSel), iObserver(aObserver)
+	{
+	LOG_FUNC
+	CActiveScheduler::Add(this);
+	}
+
+CAbsVolSender::~CAbsVolSender()
+	{
+	LOG_FUNC
+	Cancel();
+	}
+
+void CAbsVolSender::RunL()
+	{
+	LOG_LINE
+	LOG_FUNC
+	iObserver.MavsoSendComplete(iStatus.Int());
+	}
+
+void CAbsVolSender::DoCancel()
+	{
+	LOG_FUNC
+	LOG1(_L8("\tiSendingNotify = %d"), iSendingNotify);
+	
+	if(iSendingNotify)
+		{
+		iIfSel.SendCancel(ERemConNotifyCommand);
+		}
+	else
+		{
+		iIfSel.SendCancel(ERemConCommand);
+		}
+	}
+
+void CAbsVolSender::SendNotify(const TDesC8& aData)
+	{
+	LOG_FUNC
+	iIfSel.SendNotify(iStatus, 
+			TUid::Uid(KRemConAbsoluteVolumeControllerApiUid),
+			KRemConAbsoluteVolumeNotification,
+			ERemConNotifyCommand,
+			ERemConNotifyCommandAwaitingInterim,
+			aData);
+	iSendingNotify = ETrue;
+	
+	SetActive();
+	}
+
+void CAbsVolSender::SendSetAbsoluteVolume(TUint& aNumRemotes, const TDesC8& aData)
+	{
+	LOG_FUNC
+	iIfSel.Send(iStatus, 
+			TUid::Uid(KRemConAbsoluteVolumeControllerApiUid), 
+			KRemConSetAbsoluteVolume,
+			aNumRemotes,
+			ERemConCommand,
+			aData);
+	iSendingNotify = EFalse;
+	
+	SetActive();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/absolutevolumeapi/src/absolutevolumeutils.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,79 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#include <absolutevolumeutils.h>
+
+EXPORT_C
+void RRemConAbsoluteVolume::Close()
+	{
+	iStream.Close();
+	iReadStream.Close();
+	}
+
+EXPORT_C 
+void RRemConAbsoluteVolumeRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iVolume = iReadStream.ReadUint32L();
+	iMaxVolume = iReadStream.ReadUint32L();
+	iReadStream.ReadUint32L();
+	iReadStream.Close();
+	}
+
+EXPORT_C
+void RRemConAbsoluteVolumeRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	iStream.WriteUint32L(iVolume);
+	iStream.WriteUint32L(iMaxVolume);
+	iStream.WriteUint32L(NULL);
+	iStream.CommitL();
+	}
+
+EXPORT_C
+void RRemConAbsoluteVolumeResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iError = iReadStream.ReadInt32L();
+	if (iError == KErrNone)
+	    {
+	    iVolume = iReadStream.ReadUint32L();
+	    iMaxVolume = iReadStream.ReadUint32L();
+	    }
+	iReadStream.Close();
+	}
+
+EXPORT_C
+void RRemConAbsoluteVolumeResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	iStream.WriteInt32L(iError);
+	if (KErrNone == iError)
+		{
+		iStream.WriteUint32L(iVolume);
+		iStream.WriteUint32L(iMaxVolume);
+		}
+	iStream.CommitL();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avc/avc.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,43 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// avc.dll. AV/C 
+// 
+//
+
+/**
+ @file
+*/
+
+TARGET        avc.dll
+CAPABILITY    All -Tcb
+TARGETTYPE    dll
+
+UID           0x1000008d 0x10207ea6
+VENDORID      0x70000001
+
+DEFFILE	      avc.def
+
+SOURCEPATH    .
+SOURCE        avcframe.cpp 
+
+USERINCLUDE   .
+
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+LIBRARY       euser.lib
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avc/avcframe.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,523 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#include <bluetooth/logger.h>
+#include <avcframe.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_FRAME);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("avctpframe");
+#endif
+
+/** Constructor.
+
+@param aFrameType ECommand if this is a command, EResponse
+				  if it's a response.
+@internalComponent
+@released	
+*/
+CAVCFrame::CAVCFrame(AVC::TFrameType aFrameType)
+	: iFrameType(aFrameType)
+	{
+	LOG_FUNC
+	}
+
+/** Destructor.
+
+@publishedPartner
+@released
+*/
+EXPORT_C CAVCFrame::~CAVCFrame()
+	{
+	LOG_FUNC
+	iBuffer.Close();
+	}
+
+/** Factory function.
+
+This overload should be called when an AV/C frame is
+to be constructed, that is it is probably an outgoing frame.
+
+@param aFrameType ECommand if this is a command, EResponse
+				  if it's a response.
+@param aType The AV/C CType for this frame.
+@param aSubunitType The AV/C subunit type for this frame.
+@param aSubunitId The AV/C subunit id for this frame.
+@return A fully constructed CAVCFrame.
+@leave System wide error code.
+@publishedPartner
+@released
+*/
+EXPORT_C CAVCFrame* CAVCFrame::NewL(AVC::TFrameType aFrameType, 
+	AVC::TCType aType, 
+	AVC::TSubunitType aSubunitType, 
+	AVC::TSubunitID aSubunitID)
+	{
+	CAVCFrame* frame = new(ELeave)CAVCFrame(aFrameType);
+	CleanupStack::PushL(frame);
+	frame->ConstructL(aType, aSubunitType, aSubunitID);
+	CleanupStack::Pop(frame);
+	return frame;
+	}
+
+/** Factory function.
+
+This overload should be used when a data buffer should
+be parsed as an AV/C frame, that is it is probably an 
+incoming frame.
+
+@param aBuffer A buffer to be parsed as an AV/C frame.
+@param aFrameType ECommand if this is a command, EResponse
+				  if it's a response.
+@return A fully constructed CAVCFrame.
+@leave System wide error code.				  
+@publishedPartner
+@released
+*/
+EXPORT_C CAVCFrame* CAVCFrame::NewL(const TDesC8& aBuffer, AVC::TFrameType aFrameType)
+	{
+	CAVCFrame* frame = new(ELeave)CAVCFrame(aFrameType);
+	CleanupStack::PushL(frame);
+	frame->ConstructL(aBuffer);
+	CleanupStack::Pop(frame);
+	return frame;
+	}
+	
+/** Second phase construction.
+
+This overload is used when an AV/C frame is
+to be constructed, that is it is probably an outgoing frame.
+
+@param aType The AV/C CType for this frame.
+@param aSubunitType The AV/C subunit type for this frame.
+@param aSubunitId The AV/C subunit id for this frame.
+@return A fully constructed CAVCFrame.
+@leave System wide error code.
+@internalComponent
+@released
+*/
+void CAVCFrame::ConstructL(AVC::TCType aType, AVC::TSubunitType aSubunitType, AVC::TSubunitID aSubunitID)
+	{
+	iBuffer.CreateL(KAVCFrameMaxLength);
+	iBuffer.Zero();
+	iBuffer.Append(TChar(aType));
+
+	TInt subType	= aSubunitType;
+	TInt subID		= aSubunitID;
+
+	if (subType > AVC::ETypeExtended2)
+		{
+		iSubunitTypeExtensionBytes = 1;
+		iBuffer.Append(TChar(AVC::ETypeExtended1 << 3));
+		subType -= 0x100;
+
+		while (subType > 0x100)
+			{
+			iBuffer.Append(TChar(AVC::ETypeExtended2));
+			subType -= 0x100;
+			}
+
+		iBuffer.Append(TChar(subType));
+		}
+	else
+		{
+		iBuffer.Append(TChar(subType << 3));
+		}
+
+	if (subID > AVC::EIDExtended2)
+		{
+		iSubunitIDExtensionBytes = 1;
+		iBuffer[1] |= AVC::EIDExtended1;
+		subID -= 0x100;
+
+		while (subID > 0x100)
+			{
+			iBuffer.Append(TChar(AVC::EIDExtended2));
+			subID -= 0x100;
+			}
+
+		iBuffer.Append(TChar(subID));
+		}
+	else
+		{
+		iBuffer[1] |= subID;
+		}
+	}
+
+/** Second phase construction.
+
+This overload is used when a data buffer should
+be parsed as an AV/C frame, that is it is probably an 
+incoming frame.
+
+For details of parsing refer to the AV/C digital
+interface command set specification.
+
+@param aBuffer A buffer to be parsed as an AV/C frame.
+@return A fully constructed CAVCFrame.
+@leave System wide error code.	
+@publishedPartner
+@released
+*/	
+void CAVCFrame::ConstructL(const TDesC8& aBuffer)
+	{
+	iBuffer.CreateL(aBuffer);
+	FindExtensionL(iBuffer, iSubunitTypeExtensionBytes, iSubunitIDExtensionBytes);
+	}
+
+/** Gets the AV/C frame type.
+
+@return ECommand if this is a command, EResponse if this
+		is a response.
+@publishedPartner
+@released
+*/
+EXPORT_C AVC::TFrameType CAVCFrame::FrameType() const
+	{
+	return iFrameType;
+	}
+
+/** Gets the AV/C frame type.
+
+@param aFrame The frame to get the frame type for.
+@return ECommand if this is a command, EResponse if this
+		is a response.
+@publishedPartner
+@released
+*/	
+EXPORT_C AVC::TFrameType CAVCFrame::FrameType(const TDesC8& aFrame)
+	{
+	AVC::TFrameType frameType = AVC::ECommand;
+	
+	if( aFrame[0] > KAVCCommandMaxRangeLength )  
+		{
+			frameType = AVC::EResponse;
+		}
+	return frameType;	
+	}
+
+/** Set the AV/C frame type for this frame.
+
+@param The frame type to set.
+@publishedPartner
+@released
+*/	
+EXPORT_C void CAVCFrame::SetFrameType(AVC::TFrameType aFrameType)
+	{
+	iFrameType = aFrameType;
+	}
+
+/** Get the AV/C CType for this frame.
+
+@return The AV/C CType for this frame.
+@publishedPartner
+@released
+*/
+EXPORT_C AVC::TCType CAVCFrame::Type() const
+	{
+	return static_cast<AVC::TCType>(iBuffer[0]);
+	}
+
+/** Set the AV/C CType for this frame.
+
+@param aType The AV/C CType to set.
+@publishedPartner
+@released
+*/	
+EXPORT_C void CAVCFrame::SetType(AVC::TCType aType)
+	{
+	iBuffer[0] = aType;
+	}
+
+/** Get the AV/C subunit type for this frame.
+
+@return The AV/C subunit type for this frame.
+@publishedPartner
+@released
+*/
+EXPORT_C AVC::TSubunitType CAVCFrame::SubunitType() const
+	{
+	if (iSubunitTypeExtensionBytes == 0)
+		{
+		return static_cast<AVC::TSubunitType>((iBuffer[1] & KAVCSubunitTypeMask) >> 3);
+		}
+
+	return static_cast<AVC::TSubunitType>(iBuffer[1 + iSubunitTypeExtensionBytes] + (iSubunitTypeExtensionBytes * 0x100));
+	}
+
+/** Get the AV/C subunit id for this frame.
+
+@return The AV/C subunit id for this frame.
+@publishedPartner
+@released
+*/
+EXPORT_C AVC::TSubunitID CAVCFrame::SubunitID() const
+	{
+	if (iSubunitIDExtensionBytes == 0)
+		{
+		return static_cast<AVC::TSubunitID>(iBuffer[1] & KAVCSubunitIDMask);
+		}
+
+	return static_cast<AVC::TSubunitID>(iBuffer[1 + iSubunitTypeExtensionBytes + iSubunitIDExtensionBytes] + (iSubunitIDExtensionBytes * 0x100));
+	}
+
+/** Find extension bytes for the frame.
+
+@param aBuffer buffer to be used.
+@return True if its a valid frame.
+@leave System wide error code.
+@internalComponent
+@released
+*/
+/* static */ void CAVCFrame::FindExtensionL(const TDesC8& aBuffer, TInt& aSubunitTypeExtensionBytes, TInt& aSubunitIDExtensionBytes)
+	{
+	TInt minLength = KAVCFrameHeaderLength;
+	if(aBuffer.Length() < minLength)
+		{
+		User::Leave(KErrCorrupt);
+		}
+	
+	if (static_cast<AVC::TSubunitType>((aBuffer[1] & KAVCSubunitTypeMask) >> 3) == AVC::ETypeExtended1)
+		{
+		aSubunitTypeExtensionBytes++;
+		minLength++;
+
+		while (aBuffer[1 + aSubunitTypeExtensionBytes] == AVC::ETypeExtended2)
+			{
+			if(aBuffer.Length() < minLength)
+				{
+				User::Leave(KErrCorrupt);
+				}
+			
+			aSubunitTypeExtensionBytes++;
+			minLength++;
+			}
+		}
+
+	if (static_cast<AVC::TSubunitID>(aBuffer[1] & KAVCSubunitIDMask) == AVC::EIDExtended1)
+		{
+		aSubunitIDExtensionBytes++;
+		minLength++;
+
+		while (aBuffer[1 + aSubunitIDExtensionBytes] == AVC::EIDExtended1)
+			{
+			if(aBuffer.Length() < minLength)
+				{
+				User::Leave(KErrCorrupt);
+				}
+			
+			aSubunitIDExtensionBytes++;
+			minLength++;
+			}
+		}
+		
+	//Ensure frame is a valid length i.e. the Opcode() method can be safely called.
+	if(aBuffer.Length() < minLength)
+		{
+		User::Leave(KErrCorrupt);
+		}	
+	}
+
+/** Get the AV/C opcode for this frame.
+
+@param aBuffer buffer to search.
+@return The AV/C opcode for this frame.
+@leave System wide error code.
+@internalComponent
+@released
+*/
+/* static */ EXPORT_C AVC::TOpcode CAVCFrame::OpcodeL(const TDesC8& aBuffer)
+	{
+	TInt subunitTypeExtensionBytes=0;
+	TInt subunitIDExtensionBytes=0;
+	
+	FindExtensionL(aBuffer, subunitTypeExtensionBytes, subunitIDExtensionBytes);
+	return static_cast<AVC::TOpcode> (aBuffer[KAVCFrameHeaderLength + subunitTypeExtensionBytes + subunitIDExtensionBytes - 1]);
+	}
+
+/** Get the AV/C opcode for this frame.
+
+@return The AV/C opcode for this frame.
+@publishedPartner
+@released
+*/
+EXPORT_C TUint8 CAVCFrame::Opcode() const
+	{
+	return iBuffer[KAVCFrameHeaderLength + iSubunitTypeExtensionBytes + iSubunitIDExtensionBytes - 1];
+	}
+
+/** Get the AV/C OperationId for this frame.
+
+This is only valid for passthrough commands.
+
+@param aOpId On return, the AV/C opcode for this frame.
+@return KErrNotSupported if this is not a passthrough command,
+		KErrCorrupt if this passthrough command does not contain a OpId,
+		KErrNone otherwise.
+@publishedPartner
+@released
+*/	
+EXPORT_C TInt CAVCFrame::OperationId(TUint8& aOpId) const
+	{
+	TInt err = KErrNotSupported;
+	
+	if(Opcode() == AVC::EPassThrough)
+		{
+		if(DataLength())
+			{
+			aOpId = (iBuffer[iSubunitTypeExtensionBytes + iSubunitIDExtensionBytes + KAVCFrameHeaderLength]) & 0x7f;
+			err = KErrNone;			
+			}
+		else
+			{
+			err = KErrCorrupt;
+			}
+		}
+		
+	return err;
+	}
+
+/** Get the AV/C button action for this frame.
+
+This is only valid for passthrough commands.
+
+@param aOpId On return, the AV/C button action for this frame.
+@return KErrNotSupported if this is not a passthrough command,
+		KErrCorrupt if this passthrough command does not contain a button action,
+		KErrNone otherwise.
+@publishedPartner
+@released
+*/	
+EXPORT_C TInt CAVCFrame::ButtonAct(AVCPanel::TButtonAction& aButtonAction) const
+	{
+	TInt err = KErrNotSupported;
+	
+	if(Opcode() == AVC::EPassThrough)
+		{
+		if(DataLength())
+			{
+			aButtonAction = (((iBuffer[iSubunitTypeExtensionBytes + iSubunitIDExtensionBytes + KAVCFrameHeaderLength]) & 0x80) == AVCPanel::EButtonRelease) ? AVCPanel::EButtonRelease : AVCPanel::EButtonPress;
+			err = KErrNone;	
+			}
+		else
+			{
+			err = KErrCorrupt;
+			}
+		}
+	return err;
+	}
+
+/** Retrieve data from the AV/C frame.
+
+@param aIndex The offset of the data element within the data segment of the frame
+@return The data element at aIndex.
+@panic If aIndex is outside the frame. DataLength() should be used to check the length of the data segment before using the [] operator.
+@publishedPartner
+@released
+*/
+EXPORT_C const TUint8& CAVCFrame::operator[](TInt aIndex) const
+	{
+	return iBuffer[aIndex + iSubunitTypeExtensionBytes + iSubunitIDExtensionBytes + KAVCFrameHeaderLength];
+	}
+
+/** Retrieve the entire AV/C frame.
+
+@return The AV/C frame.
+@publishedPartner
+@released
+*/
+EXPORT_C const TDesC8& CAVCFrame::Data() const
+	{
+	return iBuffer;
+	}
+
+/** Append data to the AV/C frame.
+
+@param aDes The data to be appended.
+@publishedPartner
+@released
+*/
+EXPORT_C void CAVCFrame::Append(const TDesC8& aDes)
+	{
+	iBuffer.Append(aDes);
+	}
+
+/** Append data to the AV/C frame.
+
+@param aChar The data to be appended.
+@publishedPartner
+@released
+*/
+EXPORT_C void CAVCFrame::Append(TChar aChar)
+	{
+	iBuffer.Append(aChar);
+	}
+
+/** Return the length of the data in the AV/C frame
+
+@return The length of the data in the AV/C frame
+@publishedPartner
+@released
+*/
+EXPORT_C TInt CAVCFrame::DataLength() const
+	{
+	return (iBuffer.Length() - iSubunitTypeExtensionBytes - iSubunitIDExtensionBytes - KAVCFrameHeaderLength);
+	}
+
+EXPORT_C CAVCFrame* CAVCVendorDependentResponse::NewL(TUint aVendorID)
+	{
+	using namespace AVC;
+	CAVCFrame* frame = CAVCFrame::NewL(EResponse,
+										ENotImplemented, //client can override
+										EPanel,
+										EID0);
+	// stupid frames don't know about themselves so we construct in derived classes
+	// first opcode  - base class REALLY ought to have opcode setter
+	frame->Append(0); //opcode for VD frame
+	// second vendor
+	frame->Append(aVendorID>>16);	
+	frame->Append(aVendorID>>8);	
+	frame->Append(aVendorID);	
+	return frame;
+	}
+
+EXPORT_C TPtrC8 CAVCVendorDependentCommand::GetPayloadAndVID(const CAVCFrame& aFrame, TUint& aVID)
+	{
+	ASSERT_DEBUG(aFrame.Opcode()==AVC::EVendorDependent); //opcode
+	aVID = (aFrame.operator[](0)<<16) | 
+			(aFrame.operator[](1)<<8) |
+			(aFrame.operator[](2));
+
+	return (aFrame.Data().Right(aFrame.DataLength()-KAVCVendorIdLength));
+	}
+
+EXPORT_C TPtrC8 CAVCVendorUniquePassthroughCommand::GetPayloadAndVID(const CAVCFrame& aFrame, TUint& aVID)
+	{
+	ASSERT_DEBUG(aFrame.Opcode()==AVC::EPassThrough); //opcode
+	aVID = (aFrame.operator[](2)<<16) | 
+			(aFrame.operator[](3)<<8) |
+			(aFrame.operator[](4));
+
+	return (aFrame.Data().Right(aFrame.DataLength()-KAVCVendorIdLength-2));
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avc/avcframe.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,540 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVCFRAME_H
+#define AVCFRAME_H
+
+/**
+@file
+@released
+@publishedPartner
+*/
+
+#include <avcpanel.h>
+#include <e32base.h>
+
+static const TInt	KAVCFrameMaxLength			= 0x200;
+static const TInt	KAVCFrameHeaderLength		= 0x3;
+static const TInt	KAVCPassthroughFrameLength	= 0x5;
+static const TUint8	KAVCCommandTypeMask			= 0x0f;
+static const TUint8	KAVCResponseTypeMask		= 0x0f;
+static const TUint8	KAVCSubunitTypeMask			= 0xf8;
+static const TUint8	KAVCSubunitIDMask			= 0x07;
+static const TUint8	KAVCCommandMaxRangeLength	= 0x7;  
+
+static const TUint KAVCVendorUniquePassthroughHeader = 7;
+static const TUint KAVCVendorIdBaseOffset = 5;
+static const TUint KAVCVendorIdLength = 3;
+
+static const TInt KAVCMaxVendorDependentPayload = KAVCFrameMaxLength-KAVCFrameHeaderLength-KAVCVendorIdLength;
+
+namespace AVC
+	{
+	enum TFrameType
+		{
+		ECommand,
+		EResponse
+		};
+	/**
+	As per section 7.3.1, AV/C Digital Interface Command Set General Specification v4.0
+	As per section 7.3.2, AV/C Digital Interface Command Set General Specification v4.0
+	*/
+	enum TCType
+		{
+		EControl			= 0x0,
+		EStatus				= 0x1,
+		ESpecificEnquiry	= 0x2,
+		ENotify				= 0x3,
+		EGeneralEnquiry		= 0x4,
+		EReserved1			= 0x5,
+		EReserved2			= 0x6,
+		EReserved3			= 0x7,
+		ENotImplemented		= 0x8,
+		EAccepted			= 0x9,
+		ERejected			= 0xa,
+		EInTransition		= 0xb,
+		EImplemented		= 0xc,
+		EStable				= 0xc,	// NB: EImplemented and EStable are the same!
+		EChanged			= 0xd,
+		EReserved4			= 0xe,
+		EInterim			= 0xf
+		};
+	/**
+	As per sections 7.3.4.1 and 7.3.4.3, AV/C Digital Interface Command Set General Specification v4.0
+
+	Extended subunit types should be coded as 0xXYY in this enumeration where
+	X is the nth extension and YY is the type number.  e.g. 0x101 would correspond
+	to example 3 in table 7.9 and 0x201 would correspond to example 4.
+	*/		
+	enum TSubunitType
+		{
+		EMonitor			= 0x00,
+		EAudio				= 0x01,
+		EPrinter			= 0x02,
+		EDisc				= 0x03,
+		ETape				= 0x04,
+		ETuner				= 0x05,
+		ECA					= 0x06,
+		ECamera				= 0x07,
+		EPanel				= 0x09,
+		EBulletinBoard		= 0x0a,
+		ECameraStorage		= 0x0b,
+		EVendorUnique		= 0x1c,
+		ETypeExtended1		= 0x1e,
+		EUnit				= 0x1f,
+		ETypeExtended2		= 0xff
+		};
+	/**
+	As per sections 7.3.4.1 and 7.3.4.3, AV/C Digital Interface Command Set General Specification v4.0
+
+	Extended subunit IDs should be coded as 0xXYY in this enumeration where
+	X is the nth extension and YY is the ID number.  e.g. 0x102 would correspond
+	to example 2 in table 7.10 and 0x201 would correspond to example 3.
+	*/	
+	enum TSubunitID
+		{
+		EID0				= 0x00,
+		EID1				= 0x01,
+		EID2				= 0x02,
+		EID3				= 0x04,
+		EIDExtended1		= 0x05,
+		EIgnore				= 0x07,
+		EIDExtended2		= 0xff
+		};
+	/**
+	As per section 10.1.2, AV/C Digital Interface Command Set General Specification v4.0
+
+	AV/C unit source plug addresses
+	*/	
+	enum TUnitInputPlug
+		{
+		ESerialIsochronousInput0	= 0x00,
+		ESerialIsochronousInput1	= 0x01,
+		ESerialIsochronousInput2	= 0x02,
+		ESerialIsochronousInput3	= 0x03,
+		ESerialIsochronousInput4	= 0x04,
+		ESerialIsochronousInput5	= 0x05,
+		ESerialIsochronousInput6	= 0x06,
+		ESerialIsochronousInput7	= 0x07,
+		ESerialIsochronousInput8	= 0x08,
+		ESerialIsochronousInput9	= 0x09,
+		ESerialIsochronousInput10	= 0x0a,
+		ESerialIsochronousInput11	= 0x0b,
+		ESerialIsochronousInput12	= 0x0c,
+		ESerialIsochronousInput13	= 0x0d,
+		ESerialIsochronousInput14	= 0x0e,
+		ESerialIsochronousInput15	= 0x0f,
+		ESerialIsochronousInput16	= 0x10,
+		ESerialIsochronousInput17	= 0x11,
+		ESerialIsochronousInput18	= 0x12,
+		ESerialIsochronousInput19	= 0x13,
+		ESerialIsochronousInput20	= 0x14,
+		ESerialIsochronousInput21	= 0x15,
+		ESerialIsochronousInput22	= 0x16,
+		ESerialIsochronousInput23	= 0x17,
+		ESerialIsochronousInput24	= 0x18,
+		ESerialIsochronousInput25	= 0x19,
+		ESerialIsochronousInput26	= 0x1a,
+		ESerialIsochronousInput27	= 0x1b,
+		ESerialIsochronousInput28	= 0x1c,
+		ESerialIsochronousInput29	= 0x1d,
+		ESerialIsochronousInput30	= 0x1e,
+		EAnySerialIsochronousInput	= 0x7f,
+		EExternalInput0				= 0x80,
+		EExternalInput1				= 0x81,
+		EExternalInput2				= 0x82,
+		EExternalInput3				= 0x83,
+		EExternalInput4				= 0x84,
+		EExternalInput5				= 0x85,
+		EExternalInput6				= 0x86,
+		EExternalInput7				= 0x87,
+		EExternalInput8				= 0x88,
+		EExternalInput9				= 0x89,
+		EExternalInput10			= 0x8a,
+		EExternalInput11			= 0x8b,
+		EExternalInput12			= 0x8c,
+		EExternalInput13			= 0x8d,
+		EExternalInput14			= 0x8e,
+		EExternalInput15			= 0x8f,
+		EExternalInput16			= 0x90,
+		EExternalInput17			= 0x91,
+		EExternalInput18			= 0x92,
+		EExternalInput19			= 0x93,
+		EExternalInput20			= 0x94,
+		EExternalInput21			= 0x95,
+		EExternalInput22			= 0x96,
+		EExternalInput23			= 0x97,
+		EExternalInput24			= 0x98,
+		EExternalInput25			= 0x99,
+		EExternalInput26			= 0x9a,
+		EExternalInput27			= 0x9b,
+		EExternalInput28			= 0x9c,
+		EExternalInput29			= 0x9d,
+		EExternalInput30			= 0x9e,
+		ESerialAsynchronousInput0	= 0xa0,
+		ESerialAsynchronousInput1	= 0xa1,
+		ESerialAsynchronousInput2	= 0xa2,
+		ESerialAsynchronousInput3	= 0xa3,
+		ESerialAsynchronousInput4	= 0xa4,
+		ESerialAsynchronousInput5	= 0xa5,
+		ESerialAsynchronousInput6	= 0xa6,
+		ESerialAsynchronousInput7	= 0xa7,
+		ESerialAsynchronousInput8	= 0xa8,
+		ESerialAsynchronousInput9	= 0xa9,
+		ESerialAsynchronousInput10	= 0xaa,
+		ESerialAsynchronousInput11	= 0xab,
+		ESerialAsynchronousInput12	= 0xac,
+		ESerialAsynchronousInput13	= 0xad,
+		ESerialAsynchronousInput14	= 0xae,
+		ESerialAsynchronousInput15	= 0xaf,
+		ESerialAsynchronousInput16	= 0xb0,
+		ESerialAsynchronousInput17	= 0xb1,
+		ESerialAsynchronousInput18	= 0xb2,
+		ESerialAsynchronousInput19	= 0xb3,
+		ESerialAsynchronousInput20	= 0xb4,
+		ESerialAsynchronousInput21	= 0xb5,
+		ESerialAsynchronousInput22	= 0xb6,
+		ESerialAsynchronousInput23	= 0xb7,
+		ESerialAsynchronousInput24	= 0xb8,
+		ESerialAsynchronousInput25	= 0xb9,
+		ESerialAsynchronousInput26	= 0xba,
+		ESerialAsynchronousInput27	= 0xbb,
+		ESerialAsynchronousInput28	= 0xbc,
+		ESerialAsynchronousInput29	= 0xbd,
+		ESerialAsynchronousInput30	= 0xbe,
+		EAnySerialAsynchronousInput	= 0xbf,
+		EInvalidInput				= 0xfe,
+		EAnyExternalInput			= 0xff
+		};
+	/**
+	As per section 10.1.2, AV/C Digital Interface Command Set General Specification v4.0
+
+	AV/C unit destination plug addresses	
+	*/	
+	enum TUnitOutputPlug
+		{
+		ESerialIsochronousOutput0	= 0x00,
+		ESerialIsochronousOutput1	= 0x01,
+		ESerialIsochronousOutput2	= 0x02,
+		ESerialIsochronousOutput3	= 0x03,
+		ESerialIsochronousOutput4	= 0x04,
+		ESerialIsochronousOutput5	= 0x05,
+		ESerialIsochronousOutput6	= 0x06,
+		ESerialIsochronousOutput7	= 0x07,
+		ESerialIsochronousOutput8	= 0x08,
+		ESerialIsochronousOutput9	= 0x09,
+		ESerialIsochronousOutput10	= 0x0a,
+		ESerialIsochronousOutput11	= 0x0b,
+		ESerialIsochronousOutput12	= 0x0c,
+		ESerialIsochronousOutput13	= 0x0d,
+		ESerialIsochronousOutput14	= 0x0e,
+		ESerialIsochronousOutput15	= 0x0f,
+		ESerialIsochronousOutput16	= 0x10,
+		ESerialIsochronousOutput17	= 0x11,
+		ESerialIsochronousOutput18	= 0x12,
+		ESerialIsochronousOutput19	= 0x13,
+		ESerialIsochronousOutput20	= 0x14,
+		ESerialIsochronousOutput21	= 0x15,
+		ESerialIsochronousOutput22	= 0x16,
+		ESerialIsochronousOutput23	= 0x17,
+		ESerialIsochronousOutput24	= 0x18,
+		ESerialIsochronousOutput25	= 0x19,
+		ESerialIsochronousOutput26	= 0x1a,
+		ESerialIsochronousOutput27	= 0x1b,
+		ESerialIsochronousOutput28	= 0x1c,
+		ESerialIsochronousOutput29	= 0x1d,
+		ESerialIsochronousOutput30	= 0x1e,
+		EAnySerialIsochronousOutput	= 0x7f,
+		EExternalOutput0			= 0x80,
+		EExternalOutput1			= 0x81,
+		EExternalOutput2			= 0x82,
+		EExternalOutput3			= 0x83,
+		EExternalOutput4			= 0x84,
+		EExternalOutput5			= 0x85,
+		EExternalOutput6			= 0x86,
+		EExternalOutput7			= 0x87,
+		EExternalOutput8			= 0x88,
+		EExternalOutput9			= 0x89,
+		EExternalOutput10			= 0x8a,
+		EExternalOutput11			= 0x8b,
+		EExternalOutput12			= 0x8c,
+		EExternalOutput13			= 0x8d,
+		EExternalOutput14			= 0x8e,
+		EExternalOutput15			= 0x8f,
+		EExternalOutput16			= 0x90,
+		EExternalOutput17			= 0x91,
+		EExternalOutput18			= 0x92,
+		EExternalOutput19			= 0x93,
+		EExternalOutput20			= 0x94,
+		EExternalOutput21			= 0x95,
+		EExternalOutput22			= 0x96,
+		EExternalOutput23			= 0x97,
+		EExternalOutput24			= 0x98,
+		EExternalOutput25			= 0x99,
+		EExternalOutput26			= 0x9a,
+		EExternalOutput27			= 0x9b,
+		EExternalOutput28			= 0x9c,
+		EExternalOutput29			= 0x9d,
+		EExternalOutput30			= 0x9e,
+		ESerialAsynchronousOutput0	= 0xa0,
+		ESerialAsynchronousOutput1	= 0xa1,
+		ESerialAsynchronousOutput2	= 0xa2,
+		ESerialAsynchronousOutput3	= 0xa3,
+		ESerialAsynchronousOutput4	= 0xa4,
+		ESerialAsynchronousOutput5	= 0xa5,
+		ESerialAsynchronousOutput6	= 0xa6,
+		ESerialAsynchronousOutput7	= 0xa7,
+		ESerialAsynchronousOutput8	= 0xa8,
+		ESerialAsynchronousOutput9	= 0xa9,
+		ESerialAsynchronousOutput10	= 0xaa,
+		ESerialAsynchronousOutput11	= 0xab,
+		ESerialAsynchronousOutput12	= 0xac,
+		ESerialAsynchronousOutput13	= 0xad,
+		ESerialAsynchronousOutput14	= 0xae,
+		ESerialAsynchronousOutput15	= 0xaf,
+		ESerialAsynchronousOutput16	= 0xb0,
+		ESerialAsynchronousOutput17	= 0xb1,
+		ESerialAsynchronousOutput18	= 0xb2,
+		ESerialAsynchronousOutput19	= 0xb3,
+		ESerialAsynchronousOutput20	= 0xb4,
+		ESerialAsynchronousOutput21	= 0xb5,
+		ESerialAsynchronousOutput22	= 0xb6,
+		ESerialAsynchronousOutput23	= 0xb7,
+		ESerialAsynchronousOutput24	= 0xb8,
+		ESerialAsynchronousOutput25	= 0xb9,
+		ESerialAsynchronousOutput26	= 0xba,
+		ESerialAsynchronousOutput27	= 0xbb,
+		ESerialAsynchronousOutput28	= 0xbc,
+		ESerialAsynchronousOutput29	= 0xbd,
+		ESerialAsynchronousOutput30	= 0xbe,
+		EAnySerialAsynchronousOutput= 0xbf,
+		EMultipleOutputs			= 0xfd,
+		EInvalidOutput				= 0xfe,
+		EAnyExternalOutput			= 0xff
+		};
+	/**
+	As per section 10.2.3, AV/C Digital Interface Command Set General Specification v4.0
+
+	AV/C subunit source plug addresses 
+	subunit does not have to implement any subunit plug if it does not send or receive any signals		
+	*/
+	enum TSubunitSourcePlug
+		{
+		ESource0			= 0x00,
+		ESource1			= 0x01,
+		ESource2			= 0x02,
+		ESource3			= 0x03,
+		ESource4			= 0x04,
+		ESource5			= 0x05,
+		ESource6			= 0x06,
+		ESource7			= 0x07,
+		ESource8			= 0x08,
+		ESource9			= 0x09,
+		ESource10			= 0x0a,
+		ESource11			= 0x0b,
+		ESource12			= 0x0c,
+		ESource13			= 0x0d,
+		ESource14			= 0x0e,
+		ESource15			= 0x0f,
+		ESource16			= 0x10,
+		ESource17			= 0x11,
+		ESource18			= 0x12,
+		ESource19			= 0x13,
+		ESource20			= 0x14,
+		ESource21			= 0x15,
+		ESource22			= 0x16,
+		ESource23			= 0x17,
+		ESource24			= 0x18,
+		ESource25			= 0x19,
+		ESource26			= 0x1a,
+		ESource27			= 0x1b,
+		ESource28			= 0x1c,
+		ESource29			= 0x1d,
+		ESource30			= 0x1e,
+		EInvalidSource		= 0xfe,
+		EAnySource			= 0xff
+		};
+	/**
+	As per section 10.2.3, AV/C Digital Interface Command Set General Specification v4.0
+
+	AV/C subunit destination plug		
+	subunit does not have to implement any subunit plug if it does not send or receive any signals	
+	*/
+	enum TSubunitDestinationPlug
+		{
+		EDestination0			= 0x00,
+		EDestination1			= 0x01,
+		EDestination2			= 0x02,
+		EDestination3			= 0x03,
+		EDestination4			= 0x04,
+		EDestination5			= 0x05,
+		EDestination6			= 0x06,
+		EDestination7			= 0x07,
+		EDestination8			= 0x08,
+		EDestination9			= 0x09,
+		EDestination10			= 0x0a,
+		EDestination11			= 0x0b,
+		EDestination12			= 0x0c,
+		EDestination13			= 0x0d,
+		EDestination14			= 0x0e,
+		EDestination15			= 0x0f,
+		EDestination16			= 0x10,
+		EDestination17			= 0x11,
+		EDestination18			= 0x12,
+		EDestination19			= 0x13,
+		EDestination20			= 0x14,
+		EDestination21			= 0x15,
+		EDestination22			= 0x16,
+		EDestination23			= 0x17,
+		EDestination24			= 0x18,
+		EDestination25			= 0x19,
+		EDestination26			= 0x1a,
+		EDestination27			= 0x1b,
+		EDestination28			= 0x1c,
+		EDestination29			= 0x1d,
+		EDestination30			= 0x1e,
+		EMultipleDestinations	= 0xfe,
+		EInvalidDestination		= 0xfe,
+		EAnyDestination			= 0xff
+		};
+	/**
+	As per sections 11 and 12, AV/C Digital Interface Command Set General Specification v4.0
+	Other commands are defined by the various subunit specifications		
+	*/
+	enum TOpcode
+		{
+		EPower						= 0xb2,
+		EUnitInfo					= 0x30,
+		ESubunitInfo				= 0x31,
+		EReserve					= 0x01,
+		EVersion					= 0xb0,
+		EVendorDependent			= 0x00,
+		EPlugInfo					= 0x02,
+		EChannelUsage				= 0x12, 
+		EConnect					= 0x24,
+		EConnectAV					= 0x20,
+		EConnections				= 0x22,
+		EDigitalInput				= 0x11,
+		EDigitalOutput				= 0x10,
+		EDisconnect					= 0x25,
+		EDisconnectAV				= 0x21,
+		EInputPlugSignalFormat		= 0x19,
+		EOutputPlugSignalFormat		= 0x18,
+		EPassThrough				= 0x7c
+		};
+	
+	enum TPacketType
+		{
+		EASingle      = 0x00,
+		EStart        = 0x01,
+		EContinue     = 0x10,
+		EEnd          = 0x11,
+		};
+	
+		typedef TUint TAVCVendorId;
+	}
+
+/**
+AVC frame creation and utilities.
+@released
+@publishedPartner
+*/
+NONSHARABLE_CLASS(CAVCFrame) : public CBase
+	{
+public:
+	
+	// Construction / destruction
+	// TBH this acts as a factory now and could (eventually!) return a derived class
+	// the caller could check by calling Opcode
+	// at the moment we are going to use the derived classes just for outbound responses
+	IMPORT_C static CAVCFrame* NewL(AVC::TFrameType aFrameType, 
+		AVC::TCType aType, 
+		AVC::TSubunitType aSubunitType, 
+		AVC::TSubunitID aSubunitID);
+		
+	IMPORT_C static CAVCFrame* NewL(const TDesC8& aBuffer, AVC::TFrameType aType);
+	
+	IMPORT_C virtual ~CAVCFrame();
+
+	// Utility
+	IMPORT_C AVC::TFrameType FrameType() const;
+	IMPORT_C static AVC::TFrameType FrameType(const TDesC8& aFrame);
+	IMPORT_C void SetFrameType(AVC::TFrameType aFrameType);
+	
+	IMPORT_C AVC::TCType Type() const;
+	IMPORT_C void SetType(AVC::TCType aType);
+	
+	IMPORT_C AVC::TSubunitType SubunitType() const;
+	IMPORT_C AVC::TSubunitID SubunitID() const;
+	IMPORT_C TUint8 Opcode() const;
+	IMPORT_C TInt OperationId(TUint8& aOpId) const;
+	IMPORT_C TInt ButtonAct(AVCPanel::TButtonAction& aButtonAction) const;
+	
+	IMPORT_C const TUint8& operator[](TInt aIndex) const;
+	IMPORT_C const TDesC8& Data() const;
+	
+	IMPORT_C void Append(const TDesC8& aDes);
+	IMPORT_C void Append(TChar aChar);
+	IMPORT_C TInt DataLength() const;
+	
+	IMPORT_C static AVC::TOpcode OpcodeL(const TDesC8& aBuffer);
+
+private:
+	CAVCFrame(AVC::TFrameType aFrameType);
+	
+	void ConstructL(AVC::TCType aType, 
+		AVC::TSubunitType aSubunitType, 
+		AVC::TSubunitID aSubunitID);
+	void ConstructL(const TDesC8& aBuffer);
+	static void FindExtensionL(const TDesC8& aBuffer, TInt& aSubunitTypeExtensionBytes, TInt& aSubunitIDExtensionBytes);
+
+private:
+	RBuf8			iBuffer;
+
+	AVC::TFrameType	iFrameType;
+	TInt			iSubunitTypeExtensionBytes;
+	TInt			iSubunitIDExtensionBytes;
+	};
+
+
+// Factory pattern stuff - these are useful to do donkey work,
+// but have existing clients treat them as the base class
+
+class CAVCVendorDependentResponse			// codescanner::missingcclass
+	{
+public:
+	IMPORT_C static CAVCFrame* NewL(TUint aVendorId);
+	};
+
+class CAVCPassthroughCommand				// codescanner::missingcclass
+	{
+public:
+	};
+
+// likely not have newl because dont allocate on parse pattern
+class CAVCVendorDependentCommand			// codescanner::missingcclass
+	{
+public:
+	IMPORT_C static TPtrC8 GetPayloadAndVID(const CAVCFrame& aFrame, TUint& aVID);
+	};
+	
+// likely not have newl because dont allocate on parse pattern
+class CAVCVendorUniquePassthroughCommand	// codescanner::missingcclass
+	{
+public:
+	IMPORT_C static TPtrC8 GetPayloadAndVID(const CAVCFrame& aFrame, TUint& aVID);
+	};
+
+#endif // AVCFRAME_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avc/avcpanel.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,96 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVCPANEL_H
+#define AVCPANEL_H
+
+/**
+@file
+@publishedPartner
+@released
+*/
+
+namespace AVCPanel
+	{
+	enum TOperationId
+		{
+		ESelect				= 0x00,
+		EUp					= 0x01,
+		EDown				= 0x02,
+		ELeft				= 0x03,
+		ERight				= 0x04,
+		ERightUp			= 0x05,
+		ERightDown			= 0x06,
+		ELeftUp				= 0x07,
+		ELeftDown			= 0x08,
+		ERootMenu			= 0x09,
+		ESetupMenu			= 0x0a,
+		EContentsMenu		= 0x0b,
+		EFavoriteMenu		= 0x0c,
+		EExit				= 0x0d,
+		E0					= 0x20,
+		E1					= 0x21,
+		E2					= 0x22,
+		E3					= 0x23,
+		E4					= 0x24,
+		E5					= 0x25,
+		E6					= 0x26,
+		E7					= 0x27,
+		E8					= 0x28,
+		E9					= 0x29,
+		EDot				= 0x2a,
+		EEnter				= 0x2b,
+		EClear				= 0x2c,
+		EChannelUp			= 0x30,
+		EChannelDown		= 0x31,
+		EPreviousChannel	= 0x32,
+		ESoundSelect		= 0x33,
+		EInputSelect		= 0x34,
+		EDisplayInformation	= 0x35,
+		EHelp				= 0x36,
+		EPageUp				= 0x37,
+		EPageDown			= 0x38,
+		EPower				= 0x40,
+		EVolumeUp			= 0x41,
+		EVolumeDown			= 0x42,	
+		EMute				= 0x43,	
+		EPlay				= 0x44,
+		EStop				= 0x45,
+		EPause				= 0x46,
+		ERecord				= 0x47,
+		ERewind				= 0x48,
+		EFastForward		= 0x49,
+		EEject				= 0x4a,
+		EForward			= 0x4b,
+		EBackward			= 0x4c,
+		EAngle				= 0x50,
+		ESubpicture			= 0x51,
+		EF1					= 0x71,
+		EF2					= 0x72,
+		EF3					= 0x73,
+		EF4					= 0x74,
+		EF5					= 0x75,
+		EVendorUnique		= 0x7e
+		};
+				
+	enum TButtonAction
+		{
+		EButtonPress = 0x0 << 7,
+		EButtonRelease = 0x1 << 7,
+		EButtonUnknown = 0x0 << 7  // Default to push
+		};
+	}
+
+#endif // AVCPANEL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avc/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,26 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_EXPORTS
+avcframe.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(avcframe.h)
+avcpanel.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(avcpanel.h)
+
+PRJ_MMPFILES
+avc.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avrcpipc/bwins/avrcpipcu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,115 @@
+EXPORTS
+	?Close@REAResponse@@QAEXXZ @ 1 NONAME ; void REAResponse::Close(void)
+	?Close@RItem@@QAEXXZ @ 2 NONAME ; void RItem::Close(void)
+	?Close@RRemConGetCapabilitiesResponse@@QAEXXZ @ 3 NONAME ; void RRemConGetCapabilitiesResponse::Close(void)
+	?Close@RRemConGetElementAttributesRequest@@QAEXXZ @ 4 NONAME ; void RRemConGetElementAttributesRequest::Close(void)
+	?Close@RRemConGetElementAttributesResponse@@QAEXXZ @ 5 NONAME ; void RRemConGetElementAttributesResponse::Close(void)
+	?Close@RRemConGetFolderItemsRequest@@QAEXXZ @ 6 NONAME ; void RRemConGetFolderItemsRequest::Close(void)
+	?Close@RRemConGetFolderItemsResponse@@QAEXXZ @ 7 NONAME ; void RRemConGetFolderItemsResponse::Close(void)
+	?Close@RRemConGetItemAttributesRequest@@QAEXXZ @ 8 NONAME ; void RRemConGetItemAttributesRequest::Close(void)
+	?Close@RRemConGetItemAttributesResponse@@QAEXXZ @ 9 NONAME ; void RRemConGetItemAttributesResponse::Close(void)
+	?Close@RRemConGetPlayerApplicationTextResponse@@QAEXXZ @ 10 NONAME ; void RRemConGetPlayerApplicationTextResponse::Close(void)
+	?Close@RRemConPlayerAttributeIdsAndValues@@QAEXXZ @ 11 NONAME ; void RRemConPlayerAttributeIdsAndValues::Close(void)
+	?Close@RRemConPlayerListOfAttributes@@QAEXXZ @ 12 NONAME ; void RRemConPlayerListOfAttributes::Close(void)
+	?Close@RRemConSearchRequest@@QAEXXZ @ 13 NONAME ; void RRemConSearchRequest::Close(void)
+	?Close@RAvrcpGetFolderItemsResponse@@QAEXXZ @ 14 NONAME ; void RAvrcpGetFolderItemsResponse::Close(void)
+	?WriteL@RRemConPlayerInformation32BitResponse@@UAEXAAVTDes8@@@Z @ 15 NONAME ; void RRemConPlayerInformation32BitResponse::WriteL(class TDes8 &)
+	?WriteL@RRemConPlayerInformation8BitResponse@@UAEXAAVTDes8@@@Z @ 16 NONAME ; void RRemConPlayerInformation8BitResponse::WriteL(class TDes8 &)
+	?WriteL@RRemConPlayerInformationGetPlayStatusResponse@@UAEXAAVTDes8@@@Z @ 17 NONAME ; void RRemConPlayerInformationGetPlayStatusResponse::WriteL(class TDes8 &)
+	?ReadL@RRemConSearchRequest@@UAEXABVTDesC8@@@Z @ 18 NONAME ; void RRemConSearchRequest::ReadL(class TDesC8 const &)
+	?ReadL@RRemConGetElementAttributesResponse@@UAEXABVTDesC8@@@Z @ 19 NONAME ; void RRemConGetElementAttributesResponse::ReadL(class TDesC8 const &)
+	?Size@RRemConGetElementAttributesResponse@@QAEHXZ @ 20 NONAME ; int RRemConGetElementAttributesResponse::Size(void)
+	?Size@RMediaPlayerItem@@QAEHXZ @ 21 NONAME ; int RMediaPlayerItem::Size(void)
+	?Size@RRemConGetFolderItemsResponse@@QAEHXZ @ 22 NONAME ; int RRemConGetFolderItemsResponse::Size(void)
+	?WriteL@RRemConGetCapabilitiesResponse@@UAEXAAVTDes8@@@Z @ 23 NONAME ; void RRemConGetCapabilitiesResponse::WriteL(class TDes8 &)
+	?WriteL@RRemConGetFolderItemsResponse@@UAEXAAVTDes8@@@Z @ 24 NONAME ; void RRemConGetFolderItemsResponse::WriteL(class TDes8 &)
+	?WriteL@RRemConGetElementAttributesResponse@@UAEXAAVTDes8@@@Z @ 25 NONAME ; void RRemConGetElementAttributesResponse::WriteL(class TDes8 &)
+	?CopyAttributes@RRemConGetFolderItemsRequest@@QAEHAAV?$RArray@W4TMediaAttributeId@@@@@Z @ 26 NONAME ; int RRemConGetFolderItemsRequest::CopyAttributes(class RArray<enum TMediaAttributeId> &)
+	?WriteL@RRemConPlayerListOfAttributes@@UAEXAAVTDes8@@@Z @ 27 NONAME ; void RRemConPlayerListOfAttributes::WriteL(class TDes8 &)
+	?WriteL@RAvrcpIPCError@@UAEXAAVTDes8@@@Z @ 28 NONAME ; void RAvrcpIPCError::WriteL(class TDes8 &)
+	?WriteL@RAvrcpGetFolderItemsRequest@@UAEXAAVTDes8@@@Z @ 29 NONAME ; void RAvrcpGetFolderItemsRequest::WriteL(class TDes8 &)
+	?ReadL@RRemConPlayerAttributeIdsAndValues@@UAEXABVTDesC8@@@Z @ 30 NONAME ; void RRemConPlayerAttributeIdsAndValues::ReadL(class TDesC8 const &)
+	?CopyItems@RRemConGetFolderItemsResponse@@QAEHABV?$TArray@VTRemConItem@@@@@Z @ 31 NONAME ; int RRemConGetFolderItemsResponse::CopyItems(class TArray<class TRemConItem> const &)
+	?Remove@TRemConMessageQueue@@QAEXAAVCRemConQueuedMessage@@@Z @ 32 NONAME ; void TRemConMessageQueue::Remove(class CRemConQueuedMessage &)
+	?Find@TRemConMessageQueue@@QAEPBVCRemConQueuedMessage@@VTUid@@H@Z @ 33 NONAME ; class CRemConQueuedMessage const * TRemConMessageQueue::Find(class TUid, int)
+	?Close@RMediaPlayerItem@@QAEXXZ @ 34 NONAME ; void RMediaPlayerItem::Close(void)
+	?NewL@CRemConQueuedMessage@@SAPAV1@VTUid@@ABVTDesC8@@H@Z @ 35 NONAME ; class CRemConQueuedMessage * CRemConQueuedMessage::NewL(class TUid, class TDesC8 const &, int)
+	?WriteL@RRemConChangePathResponse@@UAEXAAVTDes8@@@Z @ 36 NONAME ; void RRemConChangePathResponse::WriteL(class TDes8 &)
+	?ReadL@RAvrcpSetAddressedPlayerResponse@@UAEXABVTDesC8@@@Z @ 37 NONAME ; void RAvrcpSetAddressedPlayerResponse::ReadL(class TDesC8 const &)
+	?WriteL@RRemConUidsChangedResponse@@UAEXAAVTDes8@@@Z @ 38 NONAME ; void RRemConUidsChangedResponse::WriteL(class TDes8 &)
+	?WriteL@RRemConGetFolderItemsRequest@@UAEXAAVTDes8@@@Z @ 39 NONAME ; void RRemConGetFolderItemsRequest::WriteL(class TDes8 &)
+	?WriteL@RAvrcpGetFolderItemsResponse@@UAEXAAVTDes8@@@Z @ 40 NONAME ; void RAvrcpGetFolderItemsResponse::WriteL(class TDes8 &)
+	?ReadL@RAvrcpGetFolderItemsResponse@@UAEXABVTDesC8@@@Z @ 41 NONAME ; void RAvrcpGetFolderItemsResponse::ReadL(class TDesC8 const &)
+	?ReadL@RAvrcpGetFolderItemsRequest@@UAEXABVTDesC8@@@Z @ 42 NONAME ; void RAvrcpGetFolderItemsRequest::ReadL(class TDesC8 const &)
+	?ReadL@RRemConNowPlayingResponse@@UAEXABVTDesC8@@@Z @ 43 NONAME ; void RRemConNowPlayingResponse::ReadL(class TDesC8 const &)
+	?IsEmpty@TRemConMessageQueue@@QAEHXZ @ 44 NONAME ; int TRemConMessageQueue::IsEmpty(void)
+	?SymbianErrToStatus@RAvrcpIPC@@SAEH@Z @ 45 NONAME ; unsigned char RAvrcpIPC::SymbianErrToStatus(int)
+	?First@TRemConMessageQueue@@QBEPAVCRemConQueuedMessage@@XZ @ 46 NONAME ; class CRemConQueuedMessage * TRemConMessageQueue::First(void) const
+	?Reset@TRemConMessageQueue@@QAEXXZ @ 47 NONAME ; void TRemConMessageQueue::Reset(void)
+	?WriteL@RAvrcpSetAddressedPlayerResponse@@UAEXAAVTDes8@@@Z @ 48 NONAME ; void RAvrcpSetAddressedPlayerResponse::WriteL(class TDes8 &)
+	?ReadL@RRemConMediaErrorResponse@@UAEXABVTDesC8@@@Z @ 49 NONAME ; void RRemConMediaErrorResponse::ReadL(class TDesC8 const &)
+	?SymbianErrorCheck@RAvrcpIPC@@SAHH@Z @ 50 NONAME ; int RAvrcpIPC::SymbianErrorCheck(int)
+	?GetEventIdFromIPCOperationId@RAvrcpIPC@@SA?AW4TRegisterNotificationEvent@@H@Z @ 51 NONAME ; enum TRegisterNotificationEvent RAvrcpIPC::GetEventIdFromIPCOperationId(int)
+	?WriteL@RRemConSetBrowsedPlayerRequest@@UAEXAAVTDes8@@@Z @ 52 NONAME ; void RRemConSetBrowsedPlayerRequest::WriteL(class TDes8 &)
+	?WriteL@RRemConGetElementAttributesRequest@@UAEXAAVTDes8@@@Z @ 53 NONAME ; void RRemConGetElementAttributesRequest::WriteL(class TDes8 &)
+	?AddLast@TRemConMessageQueue@@QAEXAAVCRemConQueuedMessage@@@Z @ 54 NONAME ; void TRemConMessageQueue::AddLast(class CRemConQueuedMessage &)
+	?WriteL@RRemConGetPathResponse@@UAEXAAVTDes8@@@Z @ 55 NONAME ; void RRemConGetPathResponse::WriteL(class TDes8 &)
+	?Size@RRemConGetItemAttributesResponse@@QAEHXZ @ 56 NONAME ; int RRemConGetItemAttributesResponse::Size(void)
+	?ReadL@RRemConNowPlayingRequest@@UAEXABVTDesC8@@@Z @ 57 NONAME ; void RRemConNowPlayingRequest::ReadL(class TDesC8 const &)
+	?ReadL@RAvrcpSetAddressedPlayerRequest@@UAEXABVTDesC8@@@Z @ 58 NONAME ; void RAvrcpSetAddressedPlayerRequest::ReadL(class TDesC8 const &)
+	?WriteL@RRemConPlayerInformation64BitResponse@@UAEXAAVTDes8@@@Z @ 59 NONAME ; void RRemConPlayerInformation64BitResponse::WriteL(class TDes8 &)
+	?WriteL@RRemConSearchResponse@@UAEXAAVTDes8@@@Z @ 60 NONAME ; void RRemConSearchResponse::WriteL(class TDes8 &)
+	?ReadL@RRemConPlayerInformation64BitResponse@@UAEXABVTDesC8@@@Z @ 61 NONAME ; void RRemConPlayerInformation64BitResponse::ReadL(class TDesC8 const &)
+	?ReadL@RRemConPlayerInformation8BitResponse@@UAEXABVTDesC8@@@Z @ 62 NONAME ; void RRemConPlayerInformation8BitResponse::ReadL(class TDesC8 const &)
+	?WriteL@RRemConNowPlayingRequest@@UAEXAAVTDes8@@@Z @ 63 NONAME ; void RRemConNowPlayingRequest::WriteL(class TDes8 &)
+	?Size@RRemConGetPlayerApplicationTextResponse@@QAEHXZ @ 64 NONAME ; int RRemConGetPlayerApplicationTextResponse::Size(void)
+	?ReadL@RRemConPlayerListOfAttributes@@UAEXABVTDesC8@@@Z @ 65 NONAME ; void RRemConPlayerListOfAttributes::ReadL(class TDesC8 const &)
+	?WriteL@RRemConPlayerAttributeIdsAndValues@@UAEXAAVTDes8@@@Z @ 66 NONAME ; void RRemConPlayerAttributeIdsAndValues::WriteL(class TDes8 &)
+	?Size@RItem@@QAEHXZ @ 67 NONAME ; int RItem::Size(void)
+	?WriteL@RRemConGetItemAttributesRequest@@UAEXAAVTDes8@@@Z @ 68 NONAME ; void RRemConGetItemAttributesRequest::WriteL(class TDes8 &)
+	?WriteL@RRemConChangePathRequest@@UAEXAAVTDes8@@@Z @ 69 NONAME ; void RRemConChangePathRequest::WriteL(class TDes8 &)
+	?WriteL@RRemConGetItemAttributesResponse@@UAEXAAVTDes8@@@Z @ 70 NONAME ; void RRemConGetItemAttributesResponse::WriteL(class TDes8 &)
+	?Size@RRemConSearchRequest@@QAEHXZ @ 71 NONAME ; int RRemConSearchRequest::Size(void)
+	?ReadL@RAvrcpAddressedPlayerNotificationResponse@@UAEXABVTDesC8@@@Z @ 72 NONAME ; void RAvrcpAddressedPlayerNotificationResponse::ReadL(class TDesC8 const &)
+	?RequestNextItem@RRemConGetFolderItemsResponse@@QAEHAAHAAVRBuf8@@G@Z @ 73 NONAME ; int RRemConGetFolderItemsResponse::RequestNextItem(int &, class RBuf8 &, unsigned short)
+	?ReadL@RRemConPlayerInformation32BitResponse@@UAEXABVTDesC8@@@Z @ 74 NONAME ; void RRemConPlayerInformation32BitResponse::ReadL(class TDesC8 const &)
+	?Size@RRemConGetPathResponse@@QAEHXZ @ 75 NONAME ; int RRemConGetPathResponse::Size(void)
+	??0TRemConMessageQueue@@QAE@XZ @ 76 NONAME ; TRemConMessageQueue::TRemConMessageQueue(void)
+	?ReadL@RRemConGetItemAttributesRequest@@UAEXABVTDesC8@@@Z @ 77 NONAME ; void RRemConGetItemAttributesRequest::ReadL(class TDesC8 const &)
+	?ReadL@RRemConGetItemAttributesResponse@@UAEXABVTDesC8@@@Z @ 78 NONAME ; void RRemConGetItemAttributesResponse::ReadL(class TDesC8 const &)
+	?ReadL@RRemConGetPlayerApplicationTextResponse@@UAEXABVTDesC8@@@Z @ 79 NONAME ; void RRemConGetPlayerApplicationTextResponse::ReadL(class TDesC8 const &)
+	?SetIPCOperationIdFromEventId@RAvrcpIPC@@SAHW4TRegisterNotificationEvent@@@Z @ 80 NONAME ; int RAvrcpIPC::SetIPCOperationIdFromEventId(enum TRegisterNotificationEvent)
+	?Data@CRemConQueuedMessage@@QAEABVTDesC8@@XZ @ 81 NONAME ; class TDesC8 const & CRemConQueuedMessage::Data(void)
+	?WriteL@RRemConNowPlayingResponse@@UAEXAAVTDes8@@@Z @ 82 NONAME ; void RRemConNowPlayingResponse::WriteL(class TDes8 &)
+	?ReadL@RRemConPlayerInformationGetPlayStatusResponse@@UAEXABVTDesC8@@@Z @ 83 NONAME ; void RRemConPlayerInformationGetPlayStatusResponse::ReadL(class TDesC8 const &)
+	?ReadL@RRemConGetFolderItemsRequest@@UAEXABVTDesC8@@@Z @ 84 NONAME ; void RRemConGetFolderItemsRequest::ReadL(class TDesC8 const &)
+	?Close@RSettingWithCharset@@QAEXXZ @ 85 NONAME ; void RSettingWithCharset::Close(void)
+	?ReadL@RAvrcpIPCError@@UAEXABVTDesC8@@@Z @ 86 NONAME ; void RAvrcpIPCError::ReadL(class TDesC8 const &)
+	?WriteL@RRemConMediaErrorResponse@@UAEXAAVTDes8@@@Z @ 87 NONAME ; void RRemConMediaErrorResponse::WriteL(class TDes8 &)
+	?ReadL@RRemConGetPathResponse@@UAEXABVTDesC8@@@Z @ 88 NONAME ; void RRemConGetPathResponse::ReadL(class TDesC8 const &)
+	?ReadL@RRemConSearchResponse@@UAEXABVTDesC8@@@Z @ 89 NONAME ; void RRemConSearchResponse::ReadL(class TDesC8 const &)
+	?ReadL@RRemConSetBrowsedPlayerRequest@@UAEXABVTDesC8@@@Z @ 90 NONAME ; void RRemConSetBrowsedPlayerRequest::ReadL(class TDesC8 const &)
+	?ReadL@RRemConChangePathResponse@@UAEXABVTDesC8@@@Z @ 91 NONAME ; void RRemConChangePathResponse::ReadL(class TDesC8 const &)
+	?ReadL@RRemConGetCapabilitiesResponse@@UAEXABVTDesC8@@@Z @ 92 NONAME ; void RRemConGetCapabilitiesResponse::ReadL(class TDesC8 const &)
+	?ReadL@RRemConUidsChangedResponse@@UAEXABVTDesC8@@@Z @ 93 NONAME ; void RRemConUidsChangedResponse::ReadL(class TDesC8 const &)
+	?GetPDUIdFromIPCOperationId@RAvrcpIPC@@SA?AW4TMetadataTransferPDU@@H@Z @ 94 NONAME ; enum TMetadataTransferPDU RAvrcpIPC::GetPDUIdFromIPCOperationId(int)
+	?Size@RAvrcpGetFolderItemsResponse@@QAEHXZ @ 95 NONAME ; int RAvrcpGetFolderItemsResponse::Size(void)
+	?ReadL@RRemConChangePathRequest@@UAEXABVTDesC8@@@Z @ 96 NONAME ; void RRemConChangePathRequest::ReadL(class TDesC8 const &)
+	?ReadL@RRemConGetFolderItemsResponse@@UAEXABVTDesC8@@@Z @ 97 NONAME ; void RRemConGetFolderItemsResponse::ReadL(class TDesC8 const &)
+	?Close@RRemConGetPathResponse@@QAEXXZ @ 98 NONAME ; void RRemConGetPathResponse::Close(void)
+	?ReadL@RRemConGetElementAttributesRequest@@UAEXABVTDesC8@@@Z @ 99 NONAME ; void RRemConGetElementAttributesRequest::ReadL(class TDesC8 const &)
+	??1CRemConQueuedMessage@@UAE@XZ @ 100 NONAME ; CRemConQueuedMessage::~CRemConQueuedMessage(void)
+	?WriteL@RRemConSearchRequest@@UAEXAAVTDes8@@@Z @ 101 NONAME ; void RRemConSearchRequest::WriteL(class TDes8 &)
+	?WriteL@RRemConGetPlayerApplicationTextResponse@@UAEXAAVTDes8@@@Z @ 102 NONAME ; void RRemConGetPlayerApplicationTextResponse::WriteL(class TDes8 &)
+	?WriteL@RAvrcpAddressedPlayerNotificationResponse@@UAEXAAVTDes8@@@Z @ 103 NONAME ; void RAvrcpAddressedPlayerNotificationResponse::WriteL(class TDes8 &)
+	?WriteL@RAvrcpSetAddressedPlayerRequest@@UAEXAAVTDes8@@@Z @ 104 NONAME ; void RAvrcpSetAddressedPlayerRequest::WriteL(class TDes8 &)
+	?Close@RAvrcpGetFolderItemsRequest@@QAEXXZ @ 105 NONAME ; void RAvrcpGetFolderItemsRequest::Close(void)
+	?ReadL@RRemConUidsChangedRequest@@UAEXABVTDesC8@@@Z @ 106 NONAME ; void RRemConUidsChangedRequest::ReadL(class TDesC8 const &)
+	?WriteL@RRemConUidsChangedRequest@@UAEXAAVTDes8@@@Z @ 107 NONAME ; void RRemConUidsChangedRequest::WriteL(class TDes8 &)
+	?WriteL@RAvrcpUidCounterNotificationResponse@@UAEXAAVTDes8@@@Z @ 108 NONAME ; void RAvrcpUidCounterNotificationResponse::WriteL(class TDes8 &)
+	?ReadL@RAvrcpUidCounterNotificationResponse@@UAEXABVTDesC8@@@Z @ 109 NONAME ; void RAvrcpUidCounterNotificationResponse::ReadL(class TDesC8 const &)
+	?WriteL@RRemConPlayerInformationGetPlayStatusUpdateRequest@@UAEXAAVTDes8@@@Z @ 110 NONAME ; void RRemConPlayerInformationGetPlayStatusUpdateRequest::WriteL(class TDes8 &)
+	?ReadL@RRemConPlayerInformationGetPlayStatusUpdateResponse@@UAEXABVTDesC8@@@Z @ 111 NONAME ; void RRemConPlayerInformationGetPlayStatusUpdateResponse::ReadL(class TDesC8 const &)
+	?ReadL@RRemConPlayerInformationGetPlayStatusUpdateRequest@@UAEXABVTDesC8@@@Z @ 112 NONAME ; void RRemConPlayerInformationGetPlayStatusUpdateRequest::ReadL(class TDesC8 const &)
+	?WriteL@RRemConPlayerInformationGetPlayStatusUpdateResponse@@UAEXAAVTDes8@@@Z @ 113 NONAME ; void RRemConPlayerInformationGetPlayStatusUpdateResponse::WriteL(class TDes8 &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avrcpipc/eabi/avrcpipcu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,186 @@
+EXPORTS
+	_ZN11REAResponse5CloseEv @ 1 NONAME
+	_ZN14RAvrcpIPCError5ReadLERK6TDesC8 @ 2 NONAME
+	_ZN14RAvrcpIPCError6WriteLER5TDes8 @ 3 NONAME
+	_ZN16RMediaPlayerItem4SizeEv @ 4 NONAME
+	_ZN16RMediaPlayerItem5CloseEv @ 5 NONAME
+	_ZN19RSettingWithCharset5CloseEv @ 6 NONAME
+	_ZN19TRemConMessageQueue4FindE4TUidi @ 7 NONAME
+	_ZN19TRemConMessageQueue5ResetEv @ 8 NONAME
+	_ZN19TRemConMessageQueue6RemoveER20CRemConQueuedMessage @ 9 NONAME
+	_ZN19TRemConMessageQueue7AddLastER20CRemConQueuedMessage @ 10 NONAME
+	_ZN19TRemConMessageQueue7IsEmptyEv @ 11 NONAME
+	_ZN19TRemConMessageQueueC1Ev @ 12 NONAME
+	_ZN19TRemConMessageQueueC2Ev @ 13 NONAME
+	_ZN20CRemConQueuedMessage4DataEv @ 14 NONAME
+	_ZN20CRemConQueuedMessage4NewLE4TUidRK6TDesC8i @ 15 NONAME
+	_ZN20CRemConQueuedMessageD0Ev @ 16 NONAME
+	_ZN20CRemConQueuedMessageD1Ev @ 17 NONAME
+	_ZN20CRemConQueuedMessageD2Ev @ 18 NONAME
+	_ZN20RRemConSearchRequest4SizeEv @ 19 NONAME
+	_ZN20RRemConSearchRequest5CloseEv @ 20 NONAME
+	_ZN20RRemConSearchRequest5ReadLERK6TDesC8 @ 21 NONAME
+	_ZN20RRemConSearchRequest6WriteLER5TDes8 @ 22 NONAME
+	_ZN21RRemConSearchResponse5ReadLERK6TDesC8 @ 23 NONAME
+	_ZN21RRemConSearchResponse6WriteLER5TDes8 @ 24 NONAME
+	_ZN22RRemConGetPathResponse4SizeEv @ 25 NONAME
+	_ZN22RRemConGetPathResponse5CloseEv @ 26 NONAME
+	_ZN22RRemConGetPathResponse5ReadLERK6TDesC8 @ 27 NONAME
+	_ZN22RRemConGetPathResponse6WriteLER5TDes8 @ 28 NONAME
+	_ZN24RRemConChangePathRequest5ReadLERK6TDesC8 @ 29 NONAME
+	_ZN24RRemConChangePathRequest6WriteLER5TDes8 @ 30 NONAME
+	_ZN24RRemConNowPlayingRequest5ReadLERK6TDesC8 @ 31 NONAME
+	_ZN24RRemConNowPlayingRequest6WriteLER5TDes8 @ 32 NONAME
+	_ZN25RRemConChangePathResponse5ReadLERK6TDesC8 @ 33 NONAME
+	_ZN25RRemConChangePathResponse6WriteLER5TDes8 @ 34 NONAME
+	_ZN25RRemConMediaErrorResponse5ReadLERK6TDesC8 @ 35 NONAME
+	_ZN25RRemConMediaErrorResponse6WriteLER5TDes8 @ 36 NONAME
+	_ZN25RRemConNowPlayingResponse5ReadLERK6TDesC8 @ 37 NONAME
+	_ZN25RRemConNowPlayingResponse6WriteLER5TDes8 @ 38 NONAME
+	_ZN25RRemConUidsChangedRequest5ReadLERK6TDesC8 @ 39 NONAME
+	_ZN25RRemConUidsChangedRequest6WriteLER5TDes8 @ 40 NONAME
+	_ZN26RRemConUidsChangedResponse5ReadLERK6TDesC8 @ 41 NONAME
+	_ZN26RRemConUidsChangedResponse6WriteLER5TDes8 @ 42 NONAME
+	_ZN27RAvrcpGetFolderItemsRequest5CloseEv @ 43 NONAME
+	_ZN27RAvrcpGetFolderItemsRequest5ReadLERK6TDesC8 @ 44 NONAME
+	_ZN27RAvrcpGetFolderItemsRequest6WriteLER5TDes8 @ 45 NONAME
+	_ZN28RAvrcpGetFolderItemsResponse4SizeEv @ 46 NONAME
+	_ZN28RAvrcpGetFolderItemsResponse5CloseEv @ 47 NONAME
+	_ZN28RAvrcpGetFolderItemsResponse5ReadLERK6TDesC8 @ 48 NONAME
+	_ZN28RAvrcpGetFolderItemsResponse6WriteLER5TDes8 @ 49 NONAME
+	_ZN28RRemConGetFolderItemsRequest14CopyAttributesER6RArrayI17TMediaAttributeIdE @ 50 NONAME
+	_ZN28RRemConGetFolderItemsRequest5CloseEv @ 51 NONAME
+	_ZN28RRemConGetFolderItemsRequest5ReadLERK6TDesC8 @ 52 NONAME
+	_ZN28RRemConGetFolderItemsRequest6WriteLER5TDes8 @ 53 NONAME
+	_ZN29RRemConGetFolderItemsResponse15RequestNextItemERiR5RBuf8t @ 54 NONAME
+	_ZN29RRemConGetFolderItemsResponse4SizeEv @ 55 NONAME
+	_ZN29RRemConGetFolderItemsResponse5CloseEv @ 56 NONAME
+	_ZN29RRemConGetFolderItemsResponse5ReadLERK6TDesC8 @ 57 NONAME
+	_ZN29RRemConGetFolderItemsResponse6WriteLER5TDes8 @ 58 NONAME
+	_ZN29RRemConGetFolderItemsResponse9CopyItemsERK6TArrayI11TRemConItemE @ 59 NONAME
+	_ZN29RRemConPlayerListOfAttributes5CloseEv @ 60 NONAME
+	_ZN29RRemConPlayerListOfAttributes5ReadLERK6TDesC8 @ 61 NONAME
+	_ZN29RRemConPlayerListOfAttributes6WriteLER5TDes8 @ 62 NONAME
+	_ZN30RRemConGetCapabilitiesResponse5CloseEv @ 63 NONAME
+	_ZN30RRemConGetCapabilitiesResponse5ReadLERK6TDesC8 @ 64 NONAME
+	_ZN30RRemConGetCapabilitiesResponse6WriteLER5TDes8 @ 65 NONAME
+	_ZN30RRemConSetBrowsedPlayerRequest5ReadLERK6TDesC8 @ 66 NONAME
+	_ZN30RRemConSetBrowsedPlayerRequest6WriteLER5TDes8 @ 67 NONAME
+	_ZN31RAvrcpSetAddressedPlayerRequest5ReadLERK6TDesC8 @ 68 NONAME
+	_ZN31RAvrcpSetAddressedPlayerRequest6WriteLER5TDes8 @ 69 NONAME
+	_ZN31RRemConGetItemAttributesRequest5CloseEv @ 70 NONAME
+	_ZN31RRemConGetItemAttributesRequest5ReadLERK6TDesC8 @ 71 NONAME
+	_ZN31RRemConGetItemAttributesRequest6WriteLER5TDes8 @ 72 NONAME
+	_ZN32RAvrcpSetAddressedPlayerResponse5ReadLERK6TDesC8 @ 73 NONAME
+	_ZN32RAvrcpSetAddressedPlayerResponse6WriteLER5TDes8 @ 74 NONAME
+	_ZN32RRemConGetItemAttributesResponse4SizeEv @ 75 NONAME
+	_ZN32RRemConGetItemAttributesResponse5CloseEv @ 76 NONAME
+	_ZN32RRemConGetItemAttributesResponse5ReadLERK6TDesC8 @ 77 NONAME
+	_ZN32RRemConGetItemAttributesResponse6WriteLER5TDes8 @ 78 NONAME
+	_ZN34RRemConGetElementAttributesRequest5CloseEv @ 79 NONAME
+	_ZN34RRemConGetElementAttributesRequest5ReadLERK6TDesC8 @ 80 NONAME
+	_ZN34RRemConGetElementAttributesRequest6WriteLER5TDes8 @ 81 NONAME
+	_ZN34RRemConPlayerAttributeIdsAndValues5CloseEv @ 82 NONAME
+	_ZN34RRemConPlayerAttributeIdsAndValues5ReadLERK6TDesC8 @ 83 NONAME
+	_ZN34RRemConPlayerAttributeIdsAndValues6WriteLER5TDes8 @ 84 NONAME
+	_ZN35RRemConGetElementAttributesResponse4SizeEv @ 85 NONAME
+	_ZN35RRemConGetElementAttributesResponse5CloseEv @ 86 NONAME
+	_ZN35RRemConGetElementAttributesResponse5ReadLERK6TDesC8 @ 87 NONAME
+	_ZN35RRemConGetElementAttributesResponse6WriteLER5TDes8 @ 88 NONAME
+	_ZN36RRemConPlayerInformation8BitResponse5ReadLERK6TDesC8 @ 89 NONAME
+	_ZN36RRemConPlayerInformation8BitResponse6WriteLER5TDes8 @ 90 NONAME
+	_ZN37RRemConPlayerInformation32BitResponse5ReadLERK6TDesC8 @ 91 NONAME
+	_ZN37RRemConPlayerInformation32BitResponse6WriteLER5TDes8 @ 92 NONAME
+	_ZN37RRemConPlayerInformation64BitResponse5ReadLERK6TDesC8 @ 93 NONAME
+	_ZN37RRemConPlayerInformation64BitResponse6WriteLER5TDes8 @ 94 NONAME
+	_ZN39RRemConGetPlayerApplicationTextResponse4SizeEv @ 95 NONAME
+	_ZN39RRemConGetPlayerApplicationTextResponse5CloseEv @ 96 NONAME
+	_ZN39RRemConGetPlayerApplicationTextResponse5ReadLERK6TDesC8 @ 97 NONAME
+	_ZN39RRemConGetPlayerApplicationTextResponse6WriteLER5TDes8 @ 98 NONAME
+	_ZN41RAvrcpAddressedPlayerNotificationResponse5ReadLERK6TDesC8 @ 99 NONAME
+	_ZN41RAvrcpAddressedPlayerNotificationResponse6WriteLER5TDes8 @ 100 NONAME
+	_ZN45RRemConPlayerInformationGetPlayStatusResponse5ReadLERK6TDesC8 @ 101 NONAME
+	_ZN45RRemConPlayerInformationGetPlayStatusResponse6WriteLER5TDes8 @ 102 NONAME
+	_ZN5RItem4SizeEv @ 103 NONAME
+	_ZN5RItem5CloseEv @ 104 NONAME
+	_ZN9RAvrcpIPC17SymbianErrorCheckEi @ 105 NONAME
+	_ZN9RAvrcpIPC18SymbianErrToStatusEi @ 106 NONAME
+	_ZN9RAvrcpIPC26GetPDUIdFromIPCOperationIdEi @ 107 NONAME
+	_ZN9RAvrcpIPC28GetEventIdFromIPCOperationIdEi @ 108 NONAME
+	_ZN9RAvrcpIPC28SetIPCOperationIdFromEventIdE26TRegisterNotificationEvent @ 109 NONAME
+	_ZNK19TRemConMessageQueue5FirstEv @ 110 NONAME
+	_ZTI14RAvrcpIPCError @ 111 NONAME
+	_ZTI20RRemConSearchRequest @ 112 NONAME
+	_ZTI21RRemConSearchResponse @ 113 NONAME
+	_ZTI22RRemConGetPathResponse @ 114 NONAME
+	_ZTI24RRemConChangePathRequest @ 115 NONAME
+	_ZTI24RRemConNowPlayingRequest @ 116 NONAME
+	_ZTI25RRemConChangePathResponse @ 117 NONAME
+	_ZTI25RRemConMediaErrorResponse @ 118 NONAME
+	_ZTI25RRemConNowPlayingResponse @ 119 NONAME
+	_ZTI25RRemConUidsChangedRequest @ 120 NONAME
+	_ZTI26RRemConUidsChangedResponse @ 121 NONAME
+	_ZTI27RAvrcpGetFolderItemsRequest @ 122 NONAME
+	_ZTI28RAvrcpGetFolderItemsResponse @ 123 NONAME
+	_ZTI28RRemConGetFolderItemsRequest @ 124 NONAME
+	_ZTI29RRemConGetFolderItemsResponse @ 125 NONAME
+	_ZTI29RRemConPlayerListOfAttributes @ 126 NONAME
+	_ZTI30RRemConGetCapabilitiesResponse @ 127 NONAME
+	_ZTI30RRemConSetBrowsedPlayerRequest @ 128 NONAME
+	_ZTI31RAvrcpSetAddressedPlayerRequest @ 129 NONAME
+	_ZTI31RRemConGetItemAttributesRequest @ 130 NONAME
+	_ZTI32RAvrcpSetAddressedPlayerResponse @ 131 NONAME
+	_ZTI32RRemConGetItemAttributesResponse @ 132 NONAME
+	_ZTI34RRemConGetElementAttributesRequest @ 133 NONAME
+	_ZTI34RRemConPlayerAttributeIdsAndValues @ 134 NONAME
+	_ZTI35RRemConGetElementAttributesResponse @ 135 NONAME
+	_ZTI36RRemConPlayerInformation8BitResponse @ 136 NONAME
+	_ZTI37RRemConPlayerInformation32BitResponse @ 137 NONAME
+	_ZTI37RRemConPlayerInformation64BitResponse @ 138 NONAME
+	_ZTI39RRemConGetPlayerApplicationTextResponse @ 139 NONAME
+	_ZTI41RAvrcpAddressedPlayerNotificationResponse @ 140 NONAME
+	_ZTI45RRemConPlayerInformationGetPlayStatusResponse @ 141 NONAME
+	_ZTV14RAvrcpIPCError @ 142 NONAME
+	_ZTV20RRemConSearchRequest @ 143 NONAME
+	_ZTV21RRemConSearchResponse @ 144 NONAME
+	_ZTV22RRemConGetPathResponse @ 145 NONAME
+	_ZTV24RRemConChangePathRequest @ 146 NONAME
+	_ZTV24RRemConNowPlayingRequest @ 147 NONAME
+	_ZTV25RRemConChangePathResponse @ 148 NONAME
+	_ZTV25RRemConMediaErrorResponse @ 149 NONAME
+	_ZTV25RRemConNowPlayingResponse @ 150 NONAME
+	_ZTV25RRemConUidsChangedRequest @ 151 NONAME
+	_ZTV26RRemConUidsChangedResponse @ 152 NONAME
+	_ZTV27RAvrcpGetFolderItemsRequest @ 153 NONAME
+	_ZTV28RAvrcpGetFolderItemsResponse @ 154 NONAME
+	_ZTV28RRemConGetFolderItemsRequest @ 155 NONAME
+	_ZTV29RRemConGetFolderItemsResponse @ 156 NONAME
+	_ZTV29RRemConPlayerListOfAttributes @ 157 NONAME
+	_ZTV30RRemConGetCapabilitiesResponse @ 158 NONAME
+	_ZTV30RRemConSetBrowsedPlayerRequest @ 159 NONAME
+	_ZTV31RAvrcpSetAddressedPlayerRequest @ 160 NONAME
+	_ZTV31RRemConGetItemAttributesRequest @ 161 NONAME
+	_ZTV32RAvrcpSetAddressedPlayerResponse @ 162 NONAME
+	_ZTV32RRemConGetItemAttributesResponse @ 163 NONAME
+	_ZTV34RRemConGetElementAttributesRequest @ 164 NONAME
+	_ZTV34RRemConPlayerAttributeIdsAndValues @ 165 NONAME
+	_ZTV35RRemConGetElementAttributesResponse @ 166 NONAME
+	_ZTV36RRemConPlayerInformation8BitResponse @ 167 NONAME
+	_ZTV37RRemConPlayerInformation32BitResponse @ 168 NONAME
+	_ZTV37RRemConPlayerInformation64BitResponse @ 169 NONAME
+	_ZTV39RRemConGetPlayerApplicationTextResponse @ 170 NONAME
+	_ZTV41RAvrcpAddressedPlayerNotificationResponse @ 171 NONAME
+	_ZTV45RRemConPlayerInformationGetPlayStatusResponse @ 172 NONAME
+	_ZN36RAvrcpUidCounterNotificationResponse5ReadLERK6TDesC8 @ 173 NONAME
+	_ZN36RAvrcpUidCounterNotificationResponse6WriteLER5TDes8 @ 174 NONAME
+	_ZTI36RAvrcpUidCounterNotificationResponse @ 175 NONAME
+	_ZTV36RAvrcpUidCounterNotificationResponse @ 176 NONAME
+	_ZN50RRemConPlayerInformationGetPlayStatusUpdateRequest5ReadLERK6TDesC8 @ 177 NONAME
+	_ZN50RRemConPlayerInformationGetPlayStatusUpdateRequest6WriteLER5TDes8 @ 178 NONAME
+	_ZN51RRemConPlayerInformationGetPlayStatusUpdateResponse5ReadLERK6TDesC8 @ 179 NONAME
+	_ZN51RRemConPlayerInformationGetPlayStatusUpdateResponse6WriteLER5TDes8 @ 180 NONAME
+	_ZTI50RRemConPlayerInformationGetPlayStatusUpdateRequest @ 181 NONAME
+	_ZTI51RRemConPlayerInformationGetPlayStatusUpdateResponse @ 182 NONAME
+	_ZTV50RRemConPlayerInformationGetPlayStatusUpdateRequest @ 183 NONAME
+	_ZTV51RRemConPlayerInformationGetPlayStatusUpdateResponse @ 184 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avrcpipc/group/avrcpipc.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,50 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// avrcp.dll Shared code for IPC communication between the client API and remcon
+// side library.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET			avrcpipc.dll
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			ipc.cpp
+SOURCE			avrcpipc.cpp remconqueuemessage.cpp
+
+USERINCLUDE 	../inc
+USERINCLUDE 	../../common
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY			estor.lib 
+LIBRARY 		remconinterfacebase.lib
+LIBRARY			esock.lib
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avrcpipc/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,27 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+avrcpipc.mmp
+
+PRJ_EXPORTS
+../public/avrcpspec.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcon/avrcpspec.h)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avrcpipc/inc/avrcpipcutils.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,41 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPIPCUTILS_H
+#define AVRCPIPCUTILS_H
+
+_LIT(KAvrcpIpcPanicName, "AVRCP IPC");
+
+enum TAvrcpIpcPanic
+	{
+	EAvrcpIpcCommandDataTooLong = 0,
+	};
+
+class AvrcpIpcUtils
+	{
+public:
+	static void Panic(TAvrcpIpcPanic aPanic); // The macro is probably more useful so this can be removed
+	};
+
+/** Utility AVRCP panic function.
+
+@param aPanic The panic number.
+*/
+void AvrcpIpcUtils::Panic(TAvrcpIpcPanic aPanic)
+	{
+	User::Panic(KAvrcpIpcPanicName, aPanic);
+	}
+
+#endif //AVRCPIPCUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avrcpipc/public/avrcpspec.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,155 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef AVRCPSPEC_H
+#define AVRCPSPEC_H
+
+#include <e32base.h>
+
+// The IANA assigned MIB Enum for UTF8, defined at:
+//    http://www.iana.org/assignments/character-sets
+// and specified in the AVRCP 1.3 specification in
+// section 13, "References" as reference number 11.
+
+const TInt KUtf8MibEnum = 106;
+
+// The maximum absolute volume defined by the AVRCP 1.4 spcification
+// in section 6.13.1
+const TUint8 KAvrcpMaxAbsoluteVolume = 0x7F;
+
+// These PDU ids are defined by the AVRCP 1.3 specification
+// in sections 5.1, 5.2, 5.3 and 5.4.
+
+enum TMetadataTransferPDU
+	{
+	EGetCapabilities							= 0x10,
+	EListPlayerApplicationSettingAttributes		= 0x11,
+	EListPlayerApplicationSettingValues			= 0x12,
+	EGetCurrentPlayerApplicationSettingValue	= 0x13,
+	ESetPlayerApplicationSettingValue			= 0x14,
+	EGetPlayerApplicationSettingAttributeText	= 0x15,
+	EGetPlayerApplicationSettingValueText		= 0x16,
+	EInformDisplayableCharacterSet				= 0x17, // not implemented; always use UTF8
+	EInformBatteryStatusOfCT					= 0x18,
+	EGetElementAttributes						= 0x20,
+	EGetPlayStatus								= 0x30,
+	ERegisterNotification						= 0x31,
+	ERequestContinuingResponse					= 0x40,
+	EAbortContinuingResponse					= 0x41,
+	ESetAbsoluteVolume							= 0x50,
+	ESetAddressedPlayer							= 0x60,
+	EPlayItem									= 0x74,
+	EAddToNowPlaying							= 0x90,
+	
+	// Internal values
+	EGetPlayStatusUpdate						= 0xff,
+	};
+
+enum TMediaBrowsePDU
+	{
+	EMbSetBrowsedPlayer                           = 0x70,
+	EMbGetFolderItems                             = 0x71,
+	EMbChangePath                                 = 0x72,
+	EMbGetItemAttributes                          = 0x73,
+	EMbSearch                                     = 0x80,
+	};
+
+// These RegisterNotification (PDU 0x31) event ids are defined
+// in the AVRCP 1.3 specification in section 5.4.
+
+enum TRegisterNotificationEvent
+	{
+	ERegisterNotificationPlaybackStatusChanged	 		 = 0x1,
+	ERegisterNotificationTrackChanged					 = 0x2,
+	ERegisterNotificationTrackReachedEnd				 = 0x3,
+	ERegisterNotificationTrackReachedStart				 = 0x4,
+	ERegisterNotificationPlaybackPosChanged				 = 0x5,
+	ERegisterNotificationBatteryStatusChanged			 = 0x6,
+	ERegisterNotificationSystemStatusChanged_NotSupported= 0x7, // not supported
+	ERegisterNotificationPlayerApplicationSettingChanged = 0x8,
+	ERegisterNotificationNowPlayingContentChanged		 = 0x9,
+	ERegisterNotificationAvailablePlayersChanged		 = 0xa,
+	ERegisterNotificationAddressedPlayerChanged			 = 0xb,
+	ERegisterNotificationUidsChanged					 = 0xc,
+	ERegisterNotificationVolumeChanged					 = 0xd,
+	ERegisterNotificationReservedLast				 	 = 0xf,
+	};
+
+// These are the allowed values for GetCapabilities (PDU 0x10)
+// and are specified in the AVRCP 1.3 specification, section 5.1.1
+
+enum TGetCapabilityValues
+	{
+	ECapabilityIdCompanyID			= 2,
+	ECapabilityIdEventsSupported	= 3,
+	};
+
+// Pass Through command values for Group Navigation, as
+// defined in the AVRCP 1.3 specification, in section 4.7.9
+
+enum TGroupNavigationPassthroughOperationIds
+	{
+	ENextGroup				= 0x0,
+	EPreviousGroup			= 0x1,
+	};
+
+// Error numbers allocated to the AVRCP component, for use in
+// IPC communication between the client APIs and the AVRCP bearer
+
+const TInt KErrAvrcpBaseError                     = -6751;  // Base error number
+const TInt KErrAvrcpInvalidCType                  = KErrAvrcpBaseError - 1; // -6752
+const TInt KErrAvrcpInvalidOperationId            = KErrAvrcpBaseError - 2; // -6753
+const TInt KErrAvrcpMetadataInvalidCommand        = KErrAvrcpBaseError - 3; // -6754
+const TInt KErrAvrcpMetadataInvalidParameter      = KErrAvrcpBaseError - 4; // -6755
+const TInt KErrAvrcpMetadataParameterNotFound     = KErrAvrcpBaseError - 5; // -6756
+const TInt KErrAvrcpMetadataInternalError         = KErrAvrcpBaseError - 6; // -6757
+const TInt KErrAvrcpHandledInternallyRespondNow   = KErrAvrcpBaseError - 7; // -6758
+const TInt KErrAvrcpHandledInternallyInformRemCon = KErrAvrcpBaseError - 8; // -6759
+const TInt KErrAvrcpInternalCommand 				= KErrAvrcpBaseError - 9; // -6760
+const TInt KErrAvrcpFurtherProcessingRequired		= KErrAvrcpBaseError - 10; // -6791
+
+const TInt KErrAvrcpAirBase							= -6780;
+const TInt KErrAvrcpAirInvalidCommand 				= KErrAvrcpAirBase - 0;
+const TInt KErrAvrcpAirInvalidParameter 			= KErrAvrcpAirBase - 1;
+const TInt KErrAvrcpAirParameterNotFound 			= KErrAvrcpAirBase - 2;
+const TInt KErrAvrcpAirInternalError 				= KErrAvrcpAirBase - 3;
+const TInt KErrAvrcpAirSuccess 						= KErrAvrcpAirBase - 4;
+const TInt KErrAvrcpAirUidChanged 					= KErrAvrcpAirBase - 5;
+const TInt KErrAvrcpAirReserved 					= KErrAvrcpAirBase - 6;
+const TInt KErrAvrcpAirInvalidDirection 			= KErrAvrcpAirBase - 7;
+const TInt KErrAvrcpAirNotADirectory 				= KErrAvrcpAirBase - 8;
+const TInt KErrAvrcpAirDoesNotExist 				= KErrAvrcpAirBase - 9;
+const TInt KErrAvrcpAirInvalidScope 				= KErrAvrcpAirBase - 0xa;
+const TInt KErrAvrcpAirRangeOutOfBounds 			= KErrAvrcpAirBase - 0xb;
+const TInt KErrAvrcpAirUidIsADirectory 				= KErrAvrcpAirBase - 0xc;
+const TInt KErrAvrcpAirMediaInUse 					= KErrAvrcpAirBase - 0xd;
+const TInt KErrAvrcpAirNowPlayingListFull 			= KErrAvrcpAirBase - 0xe;
+const TInt KErrAvrcpAirSearchNotSupported 			= KErrAvrcpAirBase - 0xf;
+const TInt KErrAvrcpAirSearchInProgress 			= KErrAvrcpAirBase - 0x10;
+const TInt KErrAvrcpAirInvalidPlayerId 				= KErrAvrcpAirBase - 0x11;
+const TInt KErrAvrcpAirPlayerNotBrowesable 			= KErrAvrcpAirBase - 0x12;
+const TInt KErrAvrcpAirPlayerNotAddressed 			= KErrAvrcpAirBase - 0x13;
+const TInt KErrAvrcpAirNoValidSearchResults 		= KErrAvrcpAirBase - 0x14;
+const TInt KErrAvrcpAirNoAvailablePlayers 			= KErrAvrcpAirBase - 0x15;
+const TInt KErrAvrcpAirAddressedPlayerChanged 		= KErrAvrcpAirBase - 0x16;
+const TInt KErrAvrcpInvalidScope                    = KErrAvrcpAirBase - 0x17;
+
+#endif // AVRCPSPEC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avrcpipc/src/avrcpipc.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,161 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file contains structures shared by the AVRCP API with the AVRCP bearer.
+// 
+//
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#include <e32std.h>
+#include <remcon/avrcpspec.h>
+#include "avrcpipc.h"
+
+
+EXPORT_C TMetadataTransferPDU RAvrcpIPC::GetPDUIdFromIPCOperationId(TInt aOperationId)
+	{
+	// We send the PDU id through IPC to the playerinformationapi, mediainformationapi
+	// groupnavigationapi or batterystatusapi. However, PDU 0x31 (Register Notification
+	// also requires sending an event id. We encode this as the top byte, and the PDU
+	// id as the lower byte, so mask off the top-byte and return just the PDU id.
+	return static_cast<TMetadataTransferPDU>(aOperationId & 0x00FF);
+	}
+
+EXPORT_C TRegisterNotificationEvent RAvrcpIPC::GetEventIdFromIPCOperationId(TInt aOperationId)
+	{
+	// See the above comment in GetPDUIdFromIPCOperationId. This performs the opposite operation
+	return static_cast<TRegisterNotificationEvent>((aOperationId & 0xFF00) >> 8);
+	}
+
+EXPORT_C TInt RAvrcpIPC::SetIPCOperationIdFromEventId(TRegisterNotificationEvent aEventId)
+	{
+	// See the comment in GetPDUIdFromIPCOperationId. This sets the PDU id
+	// as the lower byte to RegisterNotification (0x31) and the eventId as
+	// the top byte.
+	return (ERegisterNotification + (aEventId << 8));
+	}
+
+// Big-endian methods; Symbian native methods are little-endian
+// This means that we can directly send these packets into the
+// wire in the bearer, since they're big-endian. We could have
+// used the BigEndian class, but that requires a dependency on
+// the esock.lib library, so do it ourselves.
+
+TUint8 RAvrcpIPC::Read8L()
+	{
+	return iReadStream.ReadUint8L();
+	}
+
+TUint16 RAvrcpIPC::Read16L()
+	{
+	TUint16 val = 0;
+	val  = (static_cast<TUint16>(iReadStream.ReadUint8L()) << 8);
+	val += iReadStream.ReadUint8L();
+	return val;
+	}
+
+TUint32 RAvrcpIPC::Read24L()
+	{
+	TUint32 val = 0;
+	val += (static_cast<TUint32>(iReadStream.ReadUint8L()) << 16);
+	val += (static_cast<TUint32>(iReadStream.ReadUint8L()) << 8);
+	val += iReadStream.ReadUint8L();
+	return val;
+	}
+
+TUint32 RAvrcpIPC::Read32L()
+	{
+	TUint32 val = 0;
+	val  = (static_cast<TUint32>(iReadStream.ReadUint8L()) << 24);
+	val += (static_cast<TUint32>(iReadStream.ReadUint8L()) << 16);
+	val += (static_cast<TUint32>(iReadStream.ReadUint8L()) << 8);
+	val += iReadStream.ReadUint8L();
+	return val;
+	}
+
+TUint64 RAvrcpIPC::Read64L()
+	{
+	TUint64 val;
+	val  = (static_cast<TUint64>(iReadStream.ReadUint8L()) << 56);
+	val += (static_cast<TUint64>(iReadStream.ReadUint8L()) << 48);
+	val += (static_cast<TUint64>(iReadStream.ReadUint8L()) << 40);
+	val += (static_cast<TUint64>(iReadStream.ReadUint8L()) << 32);
+	val += (static_cast<TUint64>(iReadStream.ReadUint8L()) << 24);
+	val += (static_cast<TUint64>(iReadStream.ReadUint8L()) << 16);
+	val += (static_cast<TUint64>(iReadStream.ReadUint8L()) << 8);
+	val += iReadStream.ReadUint8L();
+	return val;
+	}
+
+void RAvrcpIPC::Write8L(TUint8 aVal)
+	{
+	iStream.WriteUint8L(aVal);
+	}
+
+void RAvrcpIPC::Write16L(TUint16 aVal)
+	{
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 8));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal));
+	}
+
+void RAvrcpIPC::Write24L(TUint32 aVal)
+	{
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 16));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 8));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal));
+	}
+
+void RAvrcpIPC::Write32L(TUint32 aVal)
+	{
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 24));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 16));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 8));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal));
+	}
+
+void RAvrcpIPC::Write64L(TUint64 aVal)
+	{
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 56));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 48));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 40));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 32));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 24));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 16));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal >> 8));
+	iStream.WriteUint8L(static_cast<TUint8>(aVal));
+	}
+void RAvrcpIPC::Close()
+	{
+	iReadStream.Close();
+	iStream.Close();
+	}
+
+EXPORT_C void RAvrcpIPCError::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iError = Read32L();   // Read Big-Endian error code
+	iReadStream.Close();
+	}
+
+EXPORT_C void RAvrcpIPCError::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();      // Error code is always before any other data
+	iStream.Open(aOutData);
+	Write32L(iError);
+	iStream.CommitL();
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avrcpipc/src/ipc.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,1541 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/** 
+ @file
+ @internalTechnology
+ @released
+*/
+
+#include <e32debug.h>
+#include <remconmediaerror.h>
+#include "avrcpipcutils.h"
+#include "avrcpinternalinterface.h"
+#include "mediabrowse.h"
+#include "mediainformation.h"
+#include "nowplaying.h"
+#include "playerinformation.h"
+
+/*
+ * These methods are intended to provide structured IPC communication between
+ * the AVRCP bearer, and the client API DLLs. They are intended to be 'simple'
+ * classes, in which the basic operation are as follows:
+ *
+ *   reading: call ReadL(request) and pull information out of member variables
+ *   writing: put information into member variables, then call WriteL(request)
+ *
+ * The ReadL() and WriteL() methods effectively just serialize the information
+ * already stored in the member varables. However, they serialize in Big-Endian
+ * format, so that after calling WriteL() and then sending the response back to
+ * the AVRCP bearer via IPC, the bearer can just append the response straight
+ * into an AVC frame; no bit-twiddling is necessary.
+ *
+ * Therefore it is important that these classes _ALWAYS_ write in Big-Endian
+ * format, and write out responses that conform to the AVRCP specification for
+ * PDUs listed in sections 5.1 - 5.4 of the AVRCP 1.3 specification. The ReadL()
+ * operation is the inverse of the WriteL() operation and reads an AVRCP request
+ * in the format listed in the AVRCP specification.
+ *
+ * There's also a Size() method, which will return the size of the response
+ * before WriteL() is called. This is required particularly for responses with
+ * text strings so that the correct-sized buffer can be allocated, as these
+ * could be very large responses (theoretically up to 16 megabytes!) sent via
+ * IPC (just once) and then kept and fragmented in the AVRCP bearer. The Close()
+ * method frees up any memory allocated with these classes.
+ */
+
+
+// --------------------------------------------------------------------------------
+// Used for constructing PDU 0x30 responses
+
+EXPORT_C void RRemConPlayerInformationGetPlayStatusResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iTrackLength      = Read32L();
+	iPlayPos          = Read32L();
+	iStatus           = (MPlayerEventsObserver::TPlaybackStatus) Read8L();
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConPlayerInformationGetPlayStatusResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	Write32L(iTrackLength);
+	Write32L(iPlayPos);
+	Write8L(iStatus);
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for constructing PDU 0xff requests
+
+EXPORT_C void RRemConPlayerInformationGetPlayStatusUpdateRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iStatus           = (MPlayerEventsObserver::TPlaybackStatus) Read8L();
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConPlayerInformationGetPlayStatusUpdateRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write8L(iStatus);
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for constructing PDU 0xff responses
+
+EXPORT_C void RRemConPlayerInformationGetPlayStatusUpdateResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iStatus           = (MPlayerEventsObserver::TPlaybackStatus) Read8L();
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConPlayerInformationGetPlayStatusUpdateResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	Write8L(iStatus);
+	iStream.CommitL();
+	}
+// --------------------------------------------------------------------------------
+// Used for constructing PDU 0x15 and PDU 0x16 responses
+
+EXPORT_C void RRemConGetPlayerApplicationTextResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iNumberAttributes = Read8L();
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		RSettingWithCharset setting;
+		CleanupClosePushL(setting);
+		setting.iAttributeId = Read8L();
+		setting.iCharset     = Read16L();
+		setting.iStringLen   = Read8L();
+		setting.iString      = HBufC8::NewL(setting.iStringLen);
+		TPtr8 ptr            = setting.iString->Des();
+		iReadStream.ReadL(ptr);
+		iAttributes.AppendL(setting);
+		CleanupStack::Pop(&setting);
+		}
+	
+	}
+
+EXPORT_C void RRemConGetPlayerApplicationTextResponse::WriteL(TDes8& aOutData)
+	{
+	// The caller should have called Size() to pre-allocate enough buffer space
+	__ASSERT_DEBUG(aOutData.MaxLength() >= Size(), AvrcpIpcUtils::Panic(EAvrcpIpcCommandDataTooLong));
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	Write8L(iNumberAttributes);
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		Write8L(iAttributes[i].iAttributeId);
+		Write16L(iAttributes[i].iCharset);
+		Write8L(iAttributes[i].iStringLen);
+		iStream.WriteL(iAttributes[i].iString->Des());
+		}
+	iStream.CommitL();
+	}
+
+EXPORT_C TInt RRemConGetPlayerApplicationTextResponse::Size()
+	{
+	// Return the size that a buffer needs to be allocated to
+	// serialise the data encapsulated within this data structure.
+	
+	TInt size = 5; // 5 bytes: status code + number attributes
+	for (TInt i = 0; i < iNumberAttributes; i++)
+		{
+		size += 4;   // 4 bytes: attribute id + charset + stringlen
+		size += iAttributes[i].iString->Length();
+		}
+	return size;
+	}
+
+EXPORT_C void RRemConGetPlayerApplicationTextResponse::Close()
+	{
+	for (TInt i = 0; i < iAttributes.Count(); i++)
+		{
+		iAttributes[i].Close();
+		}
+	iAttributes.Close();
+	RAvrcpIPC::Close();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for constructing PDU 0x10 responses
+
+EXPORT_C void RRemConGetCapabilitiesResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iCapabilityId     = Read8L();
+	if (   iCapabilityId != ECapabilityIdCompanyID
+	    && iCapabilityId != ECapabilityIdEventsSupported)
+		{
+		iReadStream.Close();
+		User::Leave(KErrNotSupported);
+		}
+	
+	iCapabilityCount  = Read8L();
+	for (TInt i = 0; i < iCapabilityCount; i++ )
+		{
+		if (iCapabilityId == ECapabilityIdCompanyID)
+			{
+			iCapabilities.AppendL(Read24L());  // Read 3 bytes
+			}
+		else
+			{
+			iCapabilities.AppendL(Read8L());   // Read 1 byte
+			}
+		}
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConGetCapabilitiesResponse::WriteL(TDes8& aOutData)
+	{
+	if (   iCapabilityId != ECapabilityIdCompanyID
+	    && iCapabilityId != ECapabilityIdEventsSupported)
+		{
+		User::Leave(KErrNotSupported);
+		}
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	Write8L(iCapabilityId);
+	Write8L(iCapabilityCount);
+	for (TInt i = 0; i < iCapabilityCount; i++ )
+		{
+		if (iCapabilityId == ECapabilityIdCompanyID)
+			{
+			Write24L(iCapabilities[i]);  // Write 3 bytes
+			}
+		else
+			{
+			Write8L(iCapabilities[i]);   // Write 1 byte
+			}
+		}
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for constructing and parsing PDU 0x13 (response) and PDU 0x14 (request)
+
+EXPORT_C void RRemConPlayerAttributeIdsAndValues::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iNumberAttributes = Read8L();
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		TInt attributeId     = Read8L();
+		TInt attributeValue = Read8L();
+		iAttributeId.AppendL(attributeId);
+		iAttributeValue.AppendL(attributeValue);
+		}
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConPlayerAttributeIdsAndValues::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	Write8L(iNumberAttributes);
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		Write8L(iAttributeId[i]);
+		Write8L(iAttributeValue[i]);
+		}
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for constructing PDU 0x11 and PDU 0x12 responses
+
+EXPORT_C void RRemConPlayerListOfAttributes::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iNumberAttributes = Read8L();
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		TInt attribute = Read8L();
+		iAttributes.AppendL(attribute);
+		}
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConPlayerListOfAttributes::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	iAttributes.Sort();
+	Write32L(KErrNone);   // Successful operation
+	Write8L(iNumberAttributes);
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		Write8L(iAttributes[i]);
+		}
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for parsing PDU 0x20 requests
+
+EXPORT_C void RRemConGetElementAttributesRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iElement = Read64L();
+	iNumberAttributes = Read8L();
+	
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		TInt attribute = Read32L();
+		iAttributes.AppendL(attribute);
+		}
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConGetElementAttributesRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	iAttributes.Sort();
+	Write32L(KErrNone);   // Successful operation
+	
+	// 64 bits of data
+	Write64L(iElement);
+	Write8L(iNumberAttributes);
+
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		Write32L(iAttributes[i]);
+		}
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for PDU 0x20 responses
+
+EXPORT_C void RRemConGetElementAttributesResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iNumberAttributes = Read8L();
+	
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		REAResponse eattr;
+		CleanupClosePushL(eattr);
+		eattr.iAttributeId = Read32L();
+		eattr.iCharset     = Read16L();
+		eattr.iStringLen   = Read16L();
+		eattr.iString      = HBufC8::NewL(eattr.iStringLen);
+		TPtr8 ptr          = eattr.iString->Des();
+		iReadStream.ReadL(ptr);
+		iAttributes.AppendL(eattr);
+		CleanupStack::Pop(&eattr);
+		}
+	
+	}
+
+EXPORT_C void RRemConGetElementAttributesResponse::WriteL(TDes8& aOutData)
+	{
+	__ASSERT_DEBUG(aOutData.MaxLength() >= Size(), AvrcpIpcUtils::Panic(EAvrcpIpcCommandDataTooLong));
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	
+	Write8L(iNumberAttributes);
+
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		Write32L(iAttributes[i].iAttributeId);
+		Write16L(iAttributes[i].iCharset);
+		Write16L(iAttributes[i].iStringLen);
+		iStream.WriteL(iAttributes[i].iString->Des());
+		}
+	iStream.CommitL();
+	}
+
+EXPORT_C TInt RRemConGetElementAttributesResponse::Size()
+	{
+	// Return the size that a buffer needs to be allocated to
+	// serialise the data encapsulated within this data structure.
+	
+	TInt size = 5; // 5 bytes: status code + number attributes
+	for (TInt i = 0; i < iNumberAttributes; i++)
+		{
+		size += 4+2+2; // 8 bytes: attrId (4 bytes) + charset (2 bytes) + stringlen (2 bytes)
+		size += iAttributes[i].iString->Length();
+		}
+	return size;
+	}
+
+EXPORT_C void RRemConGetElementAttributesResponse::Close()
+	{
+	for (TInt i = 0; i < iAttributes.Count(); i++)
+		{
+		iAttributes[i].Close();
+		}
+	iAttributes.Close();
+	RAvrcpIPC::Close();
+	}
+
+// --------------------------------------------------------------------------------
+
+EXPORT_C void RRemConPlayerInformation8BitResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iValue = Read8L();
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConPlayerInformation8BitResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	
+	Write8L(iValue);
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+
+EXPORT_C void RRemConPlayerInformation32BitResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iValue = Read32L();
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConPlayerInformation32BitResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	
+	Write32L(iValue);
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+
+EXPORT_C void RRemConPlayerInformation64BitResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iValue = Read64L();
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConPlayerInformation64BitResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	
+	Write64L(iValue);
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+
+EXPORT_C void RSettingWithCharset::Close()
+	{
+	delete iString;
+	iString = NULL;
+	}
+
+EXPORT_C void REAResponse::Close()
+	{
+	delete iString;
+	iString = NULL;
+	}
+
+EXPORT_C void RRemConGetCapabilitiesResponse::Close()
+	{
+	iCapabilities.Close();
+	}
+
+EXPORT_C void RRemConPlayerListOfAttributes::Close()
+	{
+	iAttributes.Close();
+	}
+
+EXPORT_C void RRemConGetElementAttributesRequest::Close()
+	{
+	iAttributes.Close();
+	}
+
+EXPORT_C void RRemConPlayerAttributeIdsAndValues::Close()
+	{
+	iAttributeId.Close();
+	iAttributeValue.Close();
+	}
+
+EXPORT_C void RItem::Close()
+	{
+	delete iName;
+	for(TInt i = 0; i<iAttributes.Count(); i++)
+		{
+		iAttributes[i].Close();
+		}
+	}
+
+EXPORT_C TInt RItem::Size()
+	{
+	// Base size:
+	// type + length field + length
+	return 3 + iLength;
+	}
+
+EXPORT_C void RMediaPlayerItem::Close()
+	{
+	iName.Close();
+	}
+
+EXPORT_C TInt RMediaPlayerItem::Size()
+	{
+	// Base size:
+	// type + length field + length
+	return 3 + iLength;
+	}
+
+/**
+Parses PDU 0x74 and 0x90 requests.
+*/
+EXPORT_C void RRemConNowPlayingRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iScope = static_cast<TRemConFolderScope>(Read8L());
+	iElement = Read64L();
+	iUidCounter = Read16L();
+	}
+
+/**
+Constructs PDU 0x74 and 0x90 requests.
+*/
+EXPORT_C void RRemConNowPlayingRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	Write8L(iScope);
+	Write64L(iElement);
+	Write16L(iUidCounter);
+	iStream.CommitL();
+	}
+
+/**
+Parses PDU 0x74 and 0x90 responses
+*/
+EXPORT_C void RRemConNowPlayingResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iStatus = Read8L();
+	}
+
+/**
+Constructs PDU 0x74 and 0x90 responses.
+*/
+EXPORT_C void RRemConNowPlayingResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	if ((KErrAvrcpAirBase - KErrAvrcpAirSuccess) == iStatus)
+	    {
+	    Write32L(KErrNone);   // Successful operation
+	    Write8L(iStatus);
+	    }
+	else
+		{
+		Write32L(KErrAvrcpAirBase - iStatus);
+		}
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for parsing PDU 0x71 requests
+EXPORT_C void RRemConGetFolderItemsRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iScope = Read8L();
+	iStartItem = Read32L();
+	iEndItem = Read32L();
+	iNumberAttributes = Read8L();
+	
+	if (iNumberAttributes == 0)
+		{
+		// spec says this is a request for all attribs
+		// current spec has 7 specified (0x01 to 0x07)
+		for (TInt i = 1; i <= KMaxMediaAttributeValue; i++)
+			{
+			iAttributes.AppendL(i);
+			}
+		}
+	else if (iNumberAttributes == 0xff)
+		{
+		// No attributes requested
+		}
+	else
+		{
+		for (TInt i = 0; i < iNumberAttributes; i++ )
+			{
+			TInt attribute = Read32L();
+			if (attribute > 0 && attribute <= KMaxMediaAttributeValue )
+				{
+				iAttributes.AppendL(attribute);
+				}
+			}
+		}
+
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConGetFolderItemsRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	iAttributes.Sort();
+	Write32L(KErrNone);   // Successful operation
+	
+	Write8L(iScope);
+	Write32L(iStartItem);
+	Write32L(iEndItem);
+	Write8L(iNumberAttributes);
+
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		Write32L(iAttributes[i]);
+		}
+
+	iStream.CommitL();
+	}
+
+EXPORT_C void RRemConGetFolderItemsRequest::Close()
+	{
+	iAttributes.Close();
+	}
+
+EXPORT_C TInt RRemConGetFolderItemsRequest::CopyAttributes(RArray<TMediaAttributeId>& aOutAttributes)
+	{
+	TInt result = KErrNone;
+	TMediaAttributeId attributeId;
+	TInt attributeCount = iAttributes.Count();
+	for (TInt i = 0; i < attributeCount; i++)
+		{
+		attributeId = static_cast<TMediaAttributeId>(iAttributes[i]);
+		result = aOutAttributes.Append(attributeId);
+		if (result != KErrNone)
+			{
+			break;
+			}
+		}
+	return result;
+	}
+// --------------------------------------------------------------------------------
+// Used for PDU 0x71 responses
+
+EXPORT_C void RRemConGetFolderItemsResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iPduId = Read8L();
+	iParamLength = Read16L();
+	iStatus = Read8L();
+	iUidCounter = Read16L();
+	iNumberItems = Read16L();
+	
+	for(TInt i = 0; i < iNumberItems; i++)
+		{
+		ReadItemL();
+		}
+	
+	iReadStream.Close();
+	}
+
+void RRemConGetFolderItemsResponse::ReadItemL()
+	{
+	RItem item;
+	CleanupClosePushL(item);
+	
+	item.iType = static_cast<AvrcpBrowsing::TItemType>(Read8L());
+	item.iLength = Read16L();
+	item.iUid = Read64L();
+	
+	if(item.iType == AvrcpBrowsing::EFolderItem)
+		{
+		item.iFolderType = static_cast<AvrcpBrowsing::TFolderType>(Read8L());
+		item.iPlayable = Read8L();
+		}
+	else 
+		{
+		item.iMediaType = Read8L();
+		}
+	
+	item.iCharset = Read16L();
+	item.iNameLength = Read16L();
+	item.iName = HBufC8::NewL(item.iNameLength);
+	TPtr8 ptr = item.iName->Des();
+	iReadStream.ReadL(ptr);
+	
+	if(item.iType == AvrcpBrowsing::EMediaElement)
+		{
+		item.iNumberAttributes = Read32L();
+		
+		for (TInt i = 0; i < item.iNumberAttributes; i++ )
+			{
+			REAResponse eattr;
+			CleanupClosePushL(eattr);
+			
+			eattr.iAttributeId = Read32L();
+			eattr.iCharset     = Read16L();
+			eattr.iStringLen   = Read16L();
+			eattr.iString      = HBufC8::NewL(eattr.iStringLen);
+			TPtr8 ptr          = eattr.iString->Des();
+			iReadStream.ReadL(ptr);
+			
+			item.iAttributes.AppendL(eattr);
+			CleanupStack::Pop(&eattr);
+			}
+		}
+	
+	iItems.AppendL(item);
+	CleanupStack::Pop(&item);
+	}
+
+EXPORT_C void RRemConGetFolderItemsResponse::WriteL(TDes8& aOutData)
+	{
+	__ASSERT_DEBUG(aOutData.MaxLength() >= Size(), AvrcpIpcUtils::Panic(EAvrcpIpcCommandDataTooLong));
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	
+	Write8L(iPduId);
+	Write16L(iParamLength);
+	Write8L(iStatus);
+	
+	if(iStatus == 0x4)
+		{
+		Write16L(iUidCounter);
+		Write16L(iNumberItems);
+	
+		for (TInt i = 0; i < iNumberItems; i++ )
+			{
+			WriteItemL(i);
+			}
+		}
+	
+	iStream.CommitL();
+	}
+
+void RRemConGetFolderItemsResponse::WriteItemL(TInt aIndex)
+	{
+	RItem& item = iItems[aIndex];
+	
+	Write8L(item.iType);
+	Write16L(item.iLength);
+	Write64L(item.iUid);
+	
+	if(item.iType == AvrcpBrowsing::EFolderItem)
+		{
+		Write8L(item.iFolderType);
+		Write8L(item.iPlayable);
+		}
+	else
+		{
+		Write8L(item.iMediaType);
+		}
+	
+	Write16L(item.iCharset);
+	Write16L(item.iNameLength);
+	iStream.WriteL(item.iName->Des());
+	
+	if(item.iType == AvrcpBrowsing::EMediaElement)
+		{
+		Write8L(item.iNumberAttributes);
+		
+		for(TInt i = 0; i < item.iNumberAttributes; i++)
+			{
+			Write32L(item.iAttributes[i].iAttributeId);
+			Write16L(item.iAttributes[i].iCharset);
+			Write16L(item.iAttributes[i].iStringLen);
+			iStream.WriteL(item.iAttributes[i].iString->Des());
+			}
+		}
+	}
+
+EXPORT_C TInt RRemConGetFolderItemsResponse::Size()
+	{
+	// Return the size that a buffer needs to be allocated to
+	// serialise the data encapsulated within this data structure.
+	
+	// base size 
+	// pduid + paramlength + status + uidcount + number items
+	TInt size = KGetFolderItemsResponseBaseSize;
+	
+	for (TInt i = 0; i < iNumberItems; i++)
+		{
+		size += iItems[i].Size();
+		}
+	return size;
+	}
+
+EXPORT_C void RRemConGetFolderItemsResponse::Close()
+	{
+	for (TInt i = 0; i < iItems.Count(); i++)
+		{
+		iItems[i].Close();
+		}
+	iItems.Reset();
+	}
+
+EXPORT_C TInt RRemConGetFolderItemsResponse::CopyItems(
+		const TArray<TRemConItem>& aItems)
+	{
+	TInt err = KErrNone;
+	for(TInt i = 0; i < aItems.Count(); i++)
+		{
+		RItem item;
+		item.iName = NULL;
+		item.iUid = aItems[i].iUid;
+		item.iType = static_cast<AvrcpBrowsing::TItemType>(aItems[i].iType);
+		
+		err = iItems.Append(item);
+		if(err)
+			{
+			break;
+			}
+		}
+	return err;
+	}
+
+EXPORT_C TBool RRemConGetFolderItemsResponse::RequestNextItem(TInt& aError, 
+		RBuf8& aOutBuf, TUint16 aCookie)
+	{
+	aError = KErrNone;
+	// Work out if we have as many items as fit
+	TBool getMoreItems = ETrue;
+	iCurrentListingSize += (iCurrentItem + 1) ? iItems[iCurrentItem].Size() : 0;
+	if(iCurrentListingSize > iMaxResponse)
+		{
+		// We can't fit this item in the listing
+		iItems[iCurrentItem].Close();
+		getMoreItems = EFalse;
+		iItems.Remove(iCurrentItem);
+		}
+	
+	if(getMoreItems && ++iCurrentItem < iItems.Count())
+		{
+		return ETrue;
+		}
+	else
+		{
+		// We have all items, send the response
+		iNumberItems = iCurrentItem;
+		if(aOutBuf.Create(Size()) != KErrNone)
+			{
+			aError = KErrGeneral;
+			return EFalse;
+			}
+		
+		iPduId = AvrcpBrowsing::EGetFolderItems;
+		iStatus = KErrAvrcpAirBase - KErrAvrcpAirSuccess;//0x4
+		iUidCounter = aCookie;
+		TRAP(aError, WriteL(aOutBuf));
+		}
+	return EFalse;
+	}
+// --------------------------------------------------------------------------------
+// Used for parsing PDU 0x72 requests
+
+EXPORT_C void RRemConChangePathRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iUidCounter = Read16L();
+	iDirection = Read8L();
+	
+	if(iDirection == AvrcpBrowsing::KDown)
+		{
+		iElement = Read64L();
+		}
+
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConChangePathRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	
+	Write16L(iUidCounter);
+	Write8L(iDirection);
+	Write64L(iElement);
+
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for PDU 0x72 responses
+
+EXPORT_C void RRemConChangePathResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iStatus = Read8L();
+	iNumberItems = Read32L();
+	
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConChangePathResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	
+	Write8L(iPduId);
+	Write16L(iParamLength);
+	Write8L(iStatus);
+	
+	if(iStatus == 0x4)
+		{
+		Write32L(iNumberItems);
+		}
+		
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for parsing PDU 0x73 requests
+
+EXPORT_C void RRemConGetItemAttributesRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iScope = Read8L();
+	iElement = Read64L();
+	iUidCounter = Read16L();
+	iNumberAttributes = Read8L();
+	
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		TInt attribute = Read32L();
+		iAttributes.AppendL(attribute);
+		}
+	
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConGetItemAttributesRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	iAttributes.Sort();
+	Write32L(KErrNone);   // Successful operation
+	
+	Write8L(iScope);
+	// 64 bits of data
+	Write64L(iElement);
+	Write16L(iUidCounter);
+	Write8L(iNumberAttributes);
+
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		Write32L(iAttributes[i]);
+		}
+	iStream.CommitL();
+	}
+
+EXPORT_C void RRemConGetItemAttributesRequest::Close()
+	{
+	iAttributes.Close();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for PDU 0x73 responses
+
+EXPORT_C void RRemConGetItemAttributesResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iStatus = Read8L();
+	iNumberAttributes = Read8L();
+	
+	for (TInt i = 0; i < iNumberAttributes; i++ )
+		{
+		REAResponse eattr;
+		eattr.iAttributeId = Read32L();
+		eattr.iCharset     = Read16L();
+		eattr.iStringLen   = Read16L();
+		eattr.iString      = HBufC8::NewL(eattr.iStringLen);
+		TPtr8 ptr          = eattr.iString->Des();
+		iReadStream.ReadL(ptr);
+		iAttributes.AppendL(eattr);
+		}
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConGetItemAttributesResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	
+	Write8L(iPduId);
+	Write16L(iParamLength);
+	Write8L(iStatus);
+	
+	if(iStatus == 0x4)
+		{
+		Write8L(iNumberAttributes);
+	
+		for (TInt i = 0; i < iNumberAttributes; i++ )
+			{
+			Write32L(iAttributes[i].iAttributeId);
+			Write16L(iAttributes[i].iCharset);
+			Write16L(iAttributes[i].iStringLen);
+			iStream.WriteL(iAttributes[i].iString->Des());
+			}
+		}
+	iStream.CommitL();
+	}
+
+EXPORT_C TInt RRemConGetItemAttributesResponse::Size()
+	{
+	// Return the size that a buffer needs to be allocated to
+	// serialise the data encapsulated within this data structure.
+	
+	TInt size = 9; // 6 bytes: error + pduid + paramlength + status code + number attributes
+	for (TInt i = 0; i < iAttributes.Count(); i++)
+		{
+		size += 4+2+2; // 8 bytes: attrId (4 bytes) + charset (2 bytes) + stringlen (2 bytes)
+		size += iAttributes[i].iString->Length();
+		}
+	return size;
+	}
+
+EXPORT_C void RRemConGetItemAttributesResponse::Close()
+	{
+	for (TInt i = 0; i < iAttributes.Count(); i++)
+		{
+		iAttributes[i].Close();
+		}
+	iAttributes.Close();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for parsing PDU 0x80 requests
+
+EXPORT_C void RRemConSearchRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iCharset = Read16L();
+	iStringLen = Read16L();
+	
+	TInt dataLength = aData.Length();
+	TPtrC8 pString = aData.Right(dataLength - 2*sizeof(TUint16));
+	if (pString.Length() != iStringLen)
+		{
+		User::Leave(KErrArgument);
+		}
+	
+	RBuf8 searchBuf;
+	searchBuf.CreateL(iStringLen);
+	CleanupClosePushL(searchBuf);
+	
+	iReadStream.ReadL(searchBuf);
+	
+	CleanupStack::Pop(&searchBuf);
+	iSearchString.Assign(searchBuf);
+
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConSearchRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	
+	Write16L(iCharset);
+	Write16L(iStringLen);
+	WriteL(iSearchString);
+	
+	iStream.CommitL();
+	}
+
+EXPORT_C TInt RRemConSearchRequest::Size()
+	{
+	// Return the size that a buffer needs to be allocated to
+	// serialise the data encapsulated within this data structure.
+	TInt size = sizeof(iCharset) + sizeof(iStringLen) + iSearchString.Length(); 
+	
+	return size;
+	}
+
+EXPORT_C void RRemConSearchRequest::Close()
+	{
+	iSearchString.Close();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for PDU 0x80 responses
+
+EXPORT_C void RRemConSearchResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iStatus = Read8L();
+	iUidCounter = Read16L();
+	iNumberItems = Read32L();
+	
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConSearchResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	
+	Write8L(iPduId);
+	Write16L(iParamLength);
+	Write8L(iStatus);
+	
+	if(iStatus == 0x4)
+		{
+		Write16L(iUidCounter);
+		Write32L(iNumberItems);
+		}
+
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for parsing SetBrowsedPlayer requests
+
+EXPORT_C void RRemConSetBrowsedPlayerRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	// iMaxResponse is little endian
+	iMaxResponse = iReadStream.ReadInt32L();
+	iPlayerId = Read16L();
+	
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConSetBrowsedPlayerRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	
+	// Use little endian on iMaxResponse
+	iStream.WriteInt32L(iMaxResponse);
+	Write16L(iPlayerId);
+	
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for SetBrowsedPlayer responses
+
+EXPORT_C void RRemConGetPathResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iStatus = Read8L();
+	iUidCounter = Read16L();
+	iNumberItems = Read32L();
+	
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConGetPathResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	
+	Write8L(iPduId);
+	Write16L(iParamLength);
+	Write8L(iStatus);
+	
+	if(iStatus != 0x4)
+		{
+		iStream.CommitL();
+		return;
+		}
+    
+	// The depth is equal to the number of items in the array.
+	iFolderDepth = iPath.Count();
+	Write16L(iUidCounter);
+	Write32L(iNumberItems);
+	Write16L(KUtf8MibEnum);
+	Write8L(iFolderDepth);
+	
+	for(TInt i = 0; i < iFolderDepth; i++)
+		{
+		Write16L((iPath[i])->Length());
+		iStream.WriteL(*(iPath[i]));
+		}
+	
+	iStream.CommitL();
+	}
+
+EXPORT_C TInt RRemConGetPathResponse::Size()
+	{
+	// Return the size that a buffer needs to be allocated to
+	// serialise the data encapsulated within this data structure.
+	iFolderDepth = iPath.Count();
+	TInt size = 13 + (iFolderDepth*2);
+	
+	for(TInt i = 0; i < iFolderDepth; i++)
+		{
+		size += (iPath[i])->Length();
+		}
+	
+	return size;
+	}
+
+EXPORT_C void RRemConGetPathResponse::Close()
+	{
+	iPath.ResetAndDestroy();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for parsing SetAddressedPlayer requests
+
+EXPORT_C void RAvrcpSetAddressedPlayerRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iPlayerId = Read16L();
+	
+	iReadStream.Close();
+	}
+
+EXPORT_C void RAvrcpSetAddressedPlayerRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	
+	Write16L(iPlayerId);
+	
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for SetAddressedPlayer responses
+
+EXPORT_C void RAvrcpSetAddressedPlayerResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iStatus = Read8L();
+	
+	iReadStream.Close();
+	}
+
+EXPORT_C void RAvrcpSetAddressedPlayerResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	
+	Write32L(KErrNone);   // Successful operation
+	Write8L(iStatus);
+	
+	iStream.CommitL();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for parsing PDU 0x71 requests with media player list scope
+
+EXPORT_C void RAvrcpGetFolderItemsRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iScope = Read8L();
+	iStartItem = Read32L();
+	iEndItem = Read32L();
+	}
+
+EXPORT_C void RAvrcpGetFolderItemsRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	
+	Write8L(iScope);
+	Write32L(iStartItem);
+	Write32L(iEndItem);
+
+	iStream.CommitL();
+	}
+
+EXPORT_C void RAvrcpGetFolderItemsRequest::Close()
+	{
+	RAvrcpIPC::Close();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for PDU 0x71 responses with media player list scope
+
+EXPORT_C void RAvrcpGetFolderItemsResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	
+	iPduId = Read8L();
+	iParamLength = Read16L();
+	iStatus = Read8L();
+	iUidCounter = Read16L();
+	iNumberItems = Read16L();
+	
+	for(TInt i = 0; i < iNumberItems; i++)
+		{
+		ReadItemL();
+		}
+	
+	iReadStream.Close();
+	}
+
+void RAvrcpGetFolderItemsResponse::ReadItemL()
+	{
+	RMediaPlayerItem item;
+	CleanupClosePushL(item);
+	
+	item.iType = static_cast<AvrcpBrowsing::TItemType>(Read8L());
+	item.iLength = Read16L();
+	item.iPlayerId = Read16L();
+	
+	item.iPlayerType = Read8L();
+	item.iPlayerSubType = Read32L();
+	item.iPlayStatus = Read8L();
+	iReadStream.ReadL(item.iFeatureBitmask);
+	
+	item.iCharset = Read16L();
+	item.iNameLength = Read16L();
+	
+	item.iName.CreateL(item.iNameLength);
+	iReadStream.ReadL(item.iName);
+	
+	iItems.AppendL(item);
+	CleanupStack::Pop(&item);
+	}
+
+EXPORT_C void RAvrcpGetFolderItemsResponse::WriteL(TDes8& aOutData)
+	{
+	__ASSERT_DEBUG(aOutData.MaxLength() >= Size(), AvrcpIpcUtils::Panic(EAvrcpIpcCommandDataTooLong));
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	
+	Write8L(iPduId);
+	Write16L(iParamLength);
+	Write8L(iStatus);
+	
+	if(iStatus == 0x4)
+		{
+		Write16L(iUidCounter);
+		Write16L(iNumberItems);
+	
+		for (TInt i = 0; i < iNumberItems; i++ )
+			{
+			WriteItemL(i);
+			}
+		}
+	
+	iStream.CommitL();
+	}
+
+void RAvrcpGetFolderItemsResponse::WriteItemL(TInt aIndex)
+	{
+	RMediaPlayerItem& item = iItems[aIndex];
+	
+	Write8L(item.iType);
+	Write16L(item.iLength);
+	Write16L(item.iPlayerId);
+	
+	Write8L(item.iPlayerType);
+	Write32L(item.iPlayerSubType);
+	Write8L(item.iPlayStatus);
+	iStream.WriteL(item.iFeatureBitmask);
+	
+	Write16L(item.iCharset);
+	Write16L(item.iNameLength);
+	iStream.WriteL(item.iName);
+	}
+
+EXPORT_C TInt RAvrcpGetFolderItemsResponse::Size()
+	{
+	// Return the size that a buffer needs to be allocated to
+	// serialise the data encapsulated within this data structure.
+	
+	// base size 
+	// pduid + paramlength + status + uidcount + number items
+	TInt size = KGetFolderItemsResponseBaseSize;
+	
+	for (TInt i = 0; i < iNumberItems; i++)
+		{
+		size += iItems[i].Size();
+		}
+	return size;
+	}
+
+EXPORT_C void RAvrcpGetFolderItemsResponse::Close()
+	{
+	for (TInt i = 0; i < iNumberItems; i++)
+		{
+		iItems[i].Close();
+		}
+	iItems.Reset();
+	}
+
+// --------------------------------------------------------------------------------
+// Used for PDU 0x30 responses with event addressed player changed
+
+EXPORT_C void RAvrcpAddressedPlayerNotificationResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iPlayerId = Read16L();
+	iUidCounter = Read16L();
+	iReadStream.Close();
+	}
+
+EXPORT_C void RAvrcpAddressedPlayerNotificationResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	
+	Write16L(iPlayerId);
+	Write16L(iUidCounter);
+	iStream.CommitL();
+	}
+
+EXPORT_C void RAvrcpUidCounterNotificationResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iUidCounter = Read16L();
+	iReadStream.Close();
+	}
+
+EXPORT_C void RAvrcpUidCounterNotificationResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write32L(KErrNone);   // Successful operation
+	
+	Write16L(iUidCounter);
+	iStream.CommitL();
+	}
+
+EXPORT_C void RRemConMediaErrorResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iPduId = Read8L();
+	iLength = Read16L();
+	iStatus = Read8L();
+	iReadStream.Close();
+	}
+
+EXPORT_C void RRemConMediaErrorResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write8L(iPduId);
+	Write16L(KErrResponseParameterLength);
+	Write8L(iStatus);
+	iStream.CommitL();
+	}
+
+EXPORT_C TUint8 RAvrcpIPC::SymbianErrToStatus(TInt aErr)
+	{
+	return KErrAvrcpAirBase - SymbianErrorCheck(aErr);
+	}
+
+/**
+Ensure we get a known error.
+*/
+EXPORT_C TInt RAvrcpIPC::SymbianErrorCheck(TInt aError)
+	{
+	TInt error = aError;
+	
+	switch (error)
+		{
+		case KErrNone:
+			error = KErrAvrcpAirSuccess;
+			break;
+		case KErrAvrcpAirInvalidCommand:
+		case KErrAvrcpAirInvalidParameter:
+		case KErrAvrcpAirParameterNotFound:
+		case KErrAvrcpAirInternalError:
+		case KErrAvrcpAirSuccess:
+		case KErrAvrcpAirUidChanged:
+		case KErrAvrcpAirReserved:
+		case KErrAvrcpAirInvalidDirection:
+		case KErrAvrcpAirNotADirectory:
+		case KErrAvrcpAirDoesNotExist:
+		case KErrAvrcpAirInvalidScope:
+		case KErrAvrcpAirRangeOutOfBounds:
+		case KErrAvrcpAirUidIsADirectory:
+		case KErrAvrcpAirMediaInUse:
+		case KErrAvrcpAirNowPlayingListFull:
+		case KErrAvrcpAirSearchNotSupported:
+		case KErrAvrcpAirSearchInProgress:
+		case KErrAvrcpAirInvalidPlayerId:
+		case KErrAvrcpAirPlayerNotBrowesable:
+		case KErrAvrcpAirPlayerNotAddressed:
+		case KErrAvrcpAirNoValidSearchResults:
+		case KErrAvrcpAirNoAvailablePlayers:
+		case KErrAvrcpAirAddressedPlayerChanged:
+		case KErrAvrcpInvalidScope:
+			break;
+		default:
+			error = KErrAvrcpAirInternalError;
+		}
+	
+	return error;
+	}
+
+EXPORT_C void RRemConUidsChangedRequest::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iInitialUidCounter = Read16L();
+	}
+
+EXPORT_C void RRemConUidsChangedRequest::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write16L(iInitialUidCounter);
+	iStream.CommitL();
+	}
+
+EXPORT_C void RRemConUidsChangedResponse::ReadL(const TDesC8& aData)
+	{
+	iReadStream.Open(aData);
+	iUidCounter = Read16L();
+	}
+
+EXPORT_C void RRemConUidsChangedResponse::WriteL(TDes8& aOutData)
+	{
+	aOutData.Zero();
+	iStream.Open(aOutData);
+	Write16L(iUidCounter);
+	iStream.CommitL();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/avrcpipc/src/remconqueuemessage.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,128 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#include "remconqueuemessage.h"
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_BEARER);
+#endif
+
+EXPORT_C CRemConQueuedMessage* CRemConQueuedMessage::NewL(TUid aInterfaceUid
+		,const TDesC8& aData
+		,TInt aOperationId
+		)
+	{
+	LOG_STATIC_FUNC
+	CRemConQueuedMessage* self = new(ELeave) CRemConQueuedMessage(
+			aInterfaceUid
+			,aOperationId
+			);
+	
+	CleanupStack::PushL(self);
+	self->ConstructL(aData);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConQueuedMessage::CRemConQueuedMessage(TUid aInterfaceUid
+		,TInt aOperationId
+		)
+: iInterfaceUid(aInterfaceUid), iOperationId(aOperationId)
+	{
+	LOG_FUNC	
+	}
+
+void CRemConQueuedMessage::ConstructL(const TDesC8& aData)
+	{
+	iData.CreateL(aData);
+	}
+
+EXPORT_C CRemConQueuedMessage::~CRemConQueuedMessage()
+	{
+	LOG_FUNC
+	iData.Close();
+	}
+
+EXPORT_C const TDesC8& CRemConQueuedMessage::Data()
+	{
+	return iData;
+	}
+
+EXPORT_C const CRemConQueuedMessage* TRemConMessageQueue::Find(
+		TUid aInterfaceUid
+		,TInt aOperationId
+		)
+	{
+	CRemConQueuedMessage* request = NULL;
+	while (iIter)
+		{
+		request = iIter++;
+		if(request->iInterfaceUid == aInterfaceUid
+		   && request->iOperationId == aOperationId
+		   )
+			{
+			return request;
+			}
+		}
+				
+	return NULL;
+	}
+
+EXPORT_C TRemConMessageQueue::TRemConMessageQueue()
+    :iQueue(_FOFF(CRemConQueuedMessage, iLink))
+    , iIter(iQueue)
+	{
+	
+	}
+
+EXPORT_C void TRemConMessageQueue::Reset()
+	{
+	CRemConQueuedMessage* msg;
+	iIter.SetToFirst();
+	while (NULL != (msg = iIter++))
+		{
+		iQueue.Remove(*msg);
+		delete msg;
+		}
+	}
+
+EXPORT_C void TRemConMessageQueue::AddLast(CRemConQueuedMessage& aMsg)
+	{
+	iQueue.AddLast(aMsg);
+	}
+
+EXPORT_C TBool TRemConMessageQueue::IsEmpty()
+	{
+	return iQueue.IsEmpty();
+	}
+
+EXPORT_C CRemConQueuedMessage* TRemConMessageQueue::First() const
+    {
+    return iQueue.First();
+    }
+
+EXPORT_C void TRemConMessageQueue::Remove(CRemConQueuedMessage& aMsg)
+	{
+	iQueue.Remove(aMsg);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/batterystatusapi/bwins/remconbatterystatusapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	??1CRemConBatteryApiTarget@@UAE@XZ @1
+	?NewL@CRemConBatteryApiTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConBatteryTargetObserver@@@Z @2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/batterystatusapi/eabi/remconbatterystatusapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+	_ZN23CRemConBatteryApiTarget4NewLER24CRemConInterfaceSelectorR28MRemConBatteryTargetObserver @1 NONAME
+	_ZN23CRemConBatteryApiTargetD0Ev @2 NONAME
+	_ZN23CRemConBatteryApiTargetD1Ev @3 NONAME
+	_ZN23CRemConBatteryApiTargetD2Ev @4 NONAME
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/batterystatusapi/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,26 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconbatterystatusapi.mmp
+
+PRJ_EXPORTS
+../public/remconbatterytarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconbatterytarget.h)
+../public/remconbatterytargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconbatterytargetobserver.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/batterystatusapi/group/remconbatterystatusapi.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,49 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconbatterystatusapi.dll Remote Control Battery Status API - an outer-layer client side library.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET			remconbatterystatusapi.dll
+TARGETPATH		/system/libs
+
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			batterystatusapi.cpp
+
+USERINCLUDE ../../common
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		remconinterfacebase.lib
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/batterystatusapi/public/remconbatterytarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,81 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released  
+*/
+
+#ifndef REMCONBATTERYTARGET_H
+#define REMCONBATTERYTARGET_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+
+class MRemConBatteryTargetObserver;
+class MRemConCoreApiTargetObserver;
+class CRemConInterfaceSelector;
+
+/**
+Client-instantiable type supporting sending Battery Status responses.
+*/
+NONSHARABLE_CLASS(CRemConBatteryApiTarget) : public CRemConInterfaceBase, 
+								          		public MRemConInterfaceIf
+	{
+public:
+	/**
+	Factory function.
+	@see CRemConInterfaceSelector
+	@see MRemConBatteryTargetObserver
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@return A new CRemConBatteryApiTarget, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConBatteryApiTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConBatteryTargetObserver& aObserver);
+	
+	/** Destructor */
+	IMPORT_C ~CRemConBatteryApiTarget();
+
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	@param aObserver The observer of this interface.
+	*/
+	CRemConBatteryApiTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConBatteryTargetObserver& aObserver);
+
+	void ConstructL();
+
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+
+private: // unowned
+	MRemConBatteryTargetObserver& iObserver;
+
+private: // owned
+	CBufFlat*       iOutData;
+	
+	
+	};
+
+#endif // REMCONBATTERYTARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/batterystatusapi/public/remconbatterytargetobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,52 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONBATTERYTARGETOBSERVER_H
+#define REMCONBATTERYTARGETOBSERVER_H
+
+#include <e32base.h>
+
+enum TControllerBatteryStatus
+	{
+	ENormal     = 0,
+	EWarning    = 1,
+	ECritical   = 2,
+	EExternal   = 3,
+	EFullCharge = 4,
+	};
+
+/**
+Clients must implement this interface in order to instantiate objects of type 
+CRemConBatteryTarget. This interface passes incoming commands from RemCon to 
+the client. 
+*/
+class MRemConBatteryTargetObserver
+	{
+public:
+	/** 
+	A 'InformBatteryStatusOfCT' has been received.
+	@param aBatteryStatus The current battery status.
+	*/
+	virtual void MrcbstoBatteryStatus(TControllerBatteryStatus& aBatteryStatus) = 0;
+
+	};
+
+#endif // REMCONBATTERYSTATUSTARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/batterystatusapi/src/batterystatusapi.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,129 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <bluetooth/logger.h>
+#include <remconbatterytarget.h>
+#include <remconbatterytargetobserver.h>
+#include <remcon/avrcpspec.h>
+#include <remconinterfaceselector.h>
+
+#include "remconbattery.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_BATTERY_STATUS);
+#endif
+
+EXPORT_C CRemConBatteryApiTarget* CRemConBatteryApiTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConBatteryTargetObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConBatteryApiTarget* self = new(ELeave) CRemConBatteryApiTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConBatteryApiTarget::CRemConBatteryApiTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConBatteryTargetObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConBatteryApiUid), 
+						 KLengthBatteryStatusMsg, 
+						 aInterfaceSelector,
+						 ERemConClientTypeTarget), 
+	iObserver(aObserver)
+	{
+	}
+	
+void CRemConBatteryApiTarget::ConstructL()
+	{
+	// Create a output buffer (arbitrary value of 32 for granularity of buffer expansion)
+	iOutData = CBufFlat::NewL(32);
+
+	// allocate a output buffer big enough for a TRemConBatteryApiResponse  
+	iOutData->SetReserveL(sizeof(TPckg<TRemConBatteryApiResponse>)); //do this now for easier writing to buffer
+	BaseConstructL();
+	}
+	
+EXPORT_C CRemConBatteryApiTarget::~CRemConBatteryApiTarget()
+	{
+	delete iOutData;
+	}
+
+/** Gets a pointer to a specific interface version.
+@return A pointer to the interface, NULL if not supported.
+@internalComponent
+@released
+*/
+TAny* CRemConBatteryApiTarget::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+// from MRemConInterfaceIf
+void CRemConBatteryApiTarget::MrcibNewMessage(TUint /* aOperationId */, const TDesC8& aData)
+	{
+	// don't bother to log the operation ID as this was causing a build warning
+	LOG1(_L("\taInformBatteryStatusOfCT Data.Length = %d"), aData.Length());
+
+	TRemConBatteryApiResponse batteryApiResponse;
+	batteryApiResponse.iError = KErrNone;
+	iOutData->Reset();
+	
+	// check for malformed messages, there should be 1 byte of data
+	if ( aData.Length() == 1 )
+		{	
+		// check the battery status is validvalue to the client observer
+		if ( aData[0] <= EFullCharge )
+			{
+			TControllerBatteryStatus value = (TControllerBatteryStatus)aData[0];
+			iObserver.MrcbstoBatteryStatus(value);
+			}
+		else	
+			{
+			LOG(_L("\tMalformed message, data out range"));
+			batteryApiResponse.iError = KErrAvrcpMetadataInvalidParameter;
+			}
+		}
+	else
+		{
+		LOG(_L("\tMalformed message, data missing"));
+		batteryApiResponse.iError = KErrAvrcpMetadataParameterNotFound;
+		}
+
+	// send a response to remcon (if OOM silently drop message)
+	TRAPD(error, iOutData->ResizeL(sizeof(TRemConBatteryApiResponse)));
+	if (error == KErrNone)
+		{
+		iOutData->Write(0,TPckg<TRemConBatteryApiResponse>(batteryApiResponse));
+		InterfaceSelector().SendUnreliable(TUid::Uid(KRemConBatteryApiUid),
+												EInformBatteryStatusOfCT, ERemConResponse, iOutData->Ptr(0));
+		}
+	}
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,32 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "avrcpipc/group/bld.inf"
+#include "avc/bld.inf"
+#include "batterystatusapi/group/bld.inf"
+#include "groupnavigationapi/group/bld.inf"
+#include "mediainformationapi/group/bld.inf"
+#include "playerinformation/group/bld.inf"
+#include "mediabrowseapi/group/bld.inf"
+#include "nowplayingapi/group/bld.inf"
+#include "remconbeareravrcp/group/bld.inf"
+#include "statusclient/bld.inf"
+#include "statusconverter/bld.inf"
+#include "absolutevolumeapi/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/bluetooth_avrcp.history.xml	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<relnotes name="Bluetooth Profiles">
+  <purpose>
+    Audio/Video Remote Control Profile
+  </purpose>
+
+  <defect number="PDEF140783" title="No response to Get Play Status AVRCP Command" revision="049">
+    MetadataTransferCommands timer cancelled properly and put some delays in the ctrl scripts.
+  </defect>
+
+  <defect number="PDEF139836" title=".esk and .cmi files do not have header" revision="048">
+    Added copyright headers
+  </defect>
+  
+  <defect number="DEF137119" title="Invalid button action (222) produced on TG when Press, Press, release from CT" revision="047">
+    Set button action for all passthrough commands, including EVendorUnique ones.
+  </defect>
+
+  <defect number="DEF137114" title="In multi-players situation, RemconServer paniced with pass through commands" revision="046">
+    Fixed non-leavesafe automatic RArray.
+  </defect>
+
+  <defect number="DEF136258" title="SetRemoteAddressedClientNotCorrectlyCalled" revision="045">
+    Some refactoring of HandleSetAddressedPlayer method.
+  </defect>
+
+   <defect number="DEF134042" title="[upf32] AVRCP permits invalid battery status responses" revision="044">
+    Initialise CPlayerInfoTarget::iBatteryStatus to the best value that can be retrieved from hardware P &amp; S properties. Modify CPlayerInfoTarget::DoSetBatteryStatus() to filter out invalid values
+  </defect>
+
+  <defect number="PDEF136830" title="AVRCP command handling results in crash " revision="043">
+    Ignore passthrough responses.
+  </defect>
+
+  <defect number="DEF135356" title="[System Build]: Errors in GT stage due to Bluetooth AVRCP.txt" revision="042">
+    Add IMPORT_C to ~CRemConNowPlayingTargetBase.
+  </defect>
+
+  <defect number="DEF133268" title="[System Build]: Elf2e32: Warning in Bluetooth AVRCP on ARMV7 M04816 vFuture" revision="041">
+    Remove IMPORT_C from CPlayerApplicationSettings::NewL and NewLC.
+  </defect>
+
+  <defect number="DEF129356" title="[Coverity]-SYMBIAN.CLEANUP_STACK-bluetooth/latest/bluetooth/profiles" revision="040">
+    Fix to prevent memory leak in remconbeareravrcp caused when CAVCFrame* frame is allocated on the heap but Not deallocated when it goes out of scope.
+  </defect>
+
+  <defect number="DEF126570" title="SMP: Migrate remcon and avrcp to Bluetooth logger" revision="039">
+    Change all logging over to Bluetooth logger.
+  </defect>
+
+  <defect number="PDEF123229" title="[AVRCP1.0] Leave unsafety in CRemConAvrcpStatusConverter::SupportedInterface" revision="038">
+    Added a static function -OpcodeL- which checks the Descriptor against the given opcode.
+  </defect> 
+  
+  <defect number="DEF127107" title="[AVRCP 1.3] PLAYBACK_POS notify only being triggered when exceeding interval" revision="037">
+    Now its triggered if it exceed or equal the interval.
+  </defect>
+  
+  <defect number="DEF125857" title="[coverity] - EVALUATION_ORDER - bluetooth" revision="036">
+    Evaulation order clarified in avrcpoutgoingcommandhandler.cpp.
+  </defect>
+
+  <defect number="DEF123196" title="[AVRCP1.3] Leave unsafety in ipc.cpp" revision="035">
+    Placed the leaving function on cleaup stack to handle unsafe leave.
+  </defect>
+
+  <defect number="DEF124633" title="avrcp-settings is not easily localizable" revision="034">
+    Split avrcp-settings.rss into avrcp-setting.rss and avrcp-settings.rls
+  </defect>
+
+  <defect number="DEF123768" title="[upf30] Passthrough commands with the wrong subunit type should be rejected" revision="033">
+    The PASS THROUGH commands with a non PANEL subunit_type should have a NOT IMPLEMENTED response.
+  </defect>
+
+  <defect number="DEF121789" title="Invalid Player Application Attribute ID returns wrong error code" revision="032">
+    Modified the error code.
+  </defect>
+
+  <defect number="DEF124272" title="[upf30] AVRCP Notify commands should be rejected when a remote device disconnect" revision="031">
+    Notify remcon of commands that have expired when a remote device disconnects
+  </defect>
+
+  <defect number="DEF122718" title="PlaybackPos notification functionality does not match with specification" revision="030">
+   calculated the Play Back Interval value between current and when last notification was sent and if it greater then iPlayerIntervalInMilliseconds,then send notification i.e. sent notification even in rewound case.
+  </defect> 
+
+  <defect number="DEF123182" title="Leave unsafety in PlayerApplicationSettingsResourceInit" revision="029">
+    Handled the unsafe leave by placing the concerned values and valueTexts in function playerApplicationSettingsResourceInit::DefineAttributesL(..) on cleanupstack.
+  </defect> 
+
+  <defect number="PDEF124580" title="[AVRCP1.3]Leavescan error in CRcpCommand::ParseVendorUniquePassthroughCommand" revision="028">
+    Method renamed to show it can leave.
+  </defect> 
+
+  <defect number="DEF123193" title="[AVRCP1.3] Unsafe use of RArray in CPlayerInfoTarget::DoClearEvents" revision="027">
+    RArray replaced with a new class to store supported events in a bit mask. 
+  </defect> 
+
+  <defect number="DEF122655" title="Removing a supported event is not triggering a notify" revision="026">
+    RAvrcpIPC::SetIPCOperationIdFromEventId(aEvent) is called to populate the correct operation Id for senderror(). 
+  </defect>
+
+  <defect number="DEF123765" title="[upf30] Playback interval should be treated as seconds not milliseconds" revision="025">
+    Convert the playback interval to milliseconds. 
+  </defect>
+
+  <defect number="DEF121430" title="EVENT_PLAYBACK_POS_CHANGED not being notified correctly" revision="024">
+    Codes added to handle the processing of Changed Play Status,Changed Current Track and Reached end or beginning of track.
+  </defect> 
+
+  <defect number="DEF121649" title="AVCTP command causes RemConSrv to panic with User::21" revision="023">
+    RemCon bearer changes to prevent panic.
+  </defect>
+
+  <defect number="DEF123180" title="Leave unsafety in CPlayerApplicationSettings" revision="022">
+    CleanupStack::PushL and CleanupStack::Pop are used to avoid memory leak.
+  </defect>
+
+  <defect number="DEF123179" title="Automatic variable used in call to async API" revision="021">
+    Make numRemotes a member variable so it's guaranteed to be there whenever the server writes to it.
+  </defect>
+
+  <defect number="DEF120543" title="Bounds checking issues in AVRCP 1.3" revision="020">
+    Add the boundary check for the number of attribute and the value of an attribute
+  </defect>
+  
+  <defect number="DEF121598" title="SetPlayerApplicationSettingValue command does not trigger notify" revision="019">
+    Now sending the response for EVENT_PLAYER_APPLICATION_SETTING_CHANGED i.e. PDU14
+  </defect>
+
+  <defect number="DEF120240" title="Response to ListPlayerApplicationSettingValues incorrect if > 255 values defined" revision="018">
+    Add the boundary check for the numbers of player application setting values and value texts
+  </defect>
+
+  <defect number="DEF120173" title="GetCapabilites response is incorrect if more than 255 Company IDs added" revision="017">
+    MPlayerCapabilitiesObserver::AddCompanyId() now fails with KErrOverflow if 255 company IDs are already listed.
+  </defect>
+
+  <defect number="DEF119598" title="Production Code contains comments about TMT test code" revision="016">
+	Non relevant comments are removed.
+  </defect>
+  
+  <defect number="DEF115305" title="Odd memory allocation handling in avrcp and leave in non-leaving function" revision="015">
+    Leave in a non-leaving function now handled
+  </defect>
+
+  <defect number="DEF115279" title="Forced disconnection of controller by transport during a hold results USER 21" revision="014">
+    Force disconnections of controller by transport now handled correctly
+  </defect>
+
+  <defect number="DEF119174" title="RemoveEvent is returning the position of the event" revision="013">
+    Return value has been changed to KErrNone, instead of the position of the event
+  </defect>
+
+  <defect number="DEF119028" title="No API to get inbound MTU for AVDTP media socket" revision="012">
+   API added to get inbound MTU for AVDTP media socket
+  </defect>
+
+  <defect number="DEF118408" title="ListSettingAttributes will return error when 0 setting attributes defined" revision="011">
+    CPlayerInfoTarget::ProcessListPlayerApplicationAttributes does not return error when called without defined attributes.
+  </defect>
+
+  <defect number="DEF117473" title="Doxygen not correctly generated" revision="010">
+    Interface access tags corrected for AVRCP APIs.
+  </defect>
+
+  <defect number="DEF119085" title="Calling RemoveEvent on a pending notify panics with User-130" revision="009">
+    removing the event from the pending notification list, if RemoveEvent is called.
+  </defect>
+
+  <defect number="DEF116505" title="In-source documentation required for CAVCFrame" revision="008">
+    Appropriate level of Doxygen comments added
+  </defect>
+
+  <defect number="DEF116207" title="Filename Policy non-conformance generates build warnings" revision="007">
+   Unwanted system INC file path is removed from mmp file
+  </defect>
+
+  <defect number="PDEF115625" title="KeyRepeat KeyEvents from Prev/Next keys of bluetooth headset are still sent afte" revision="006">
+    Fixes key press problems
+  </defect>
+  
+  
+  <defect number="DEF108369" title="[upf27]AVRCP uses wrong identifier when handling incoming commands" revision="005">
+    Changed the function call to get the Transaction ID 
+  </defect>
+
+  <defect number="DEF101319" title="Filename case check failures in source build and test" revision="004">
+    Corrected filenames to enable building of Symbian OS in Linux
+  </defect>
+
+  <defect number="DEF101501" title="CAvCFrame fails to retrieve the correct frame type for Vendor dependent commands" revision="003">
+    Fixing CAVCFrame::FrameType(const TDesC8&amp; aFrame) API so that it returns the type of the frame. This change has required a BR.
+  </defect>
+
+  <defect number="DEF097970" title="AVRCP sets message type to 'Command' when it should be 'Response'" revision="002">
+    AVRCP now sets message type to Response in CRcpCommand::ProcessOutgoingResponse.
+  </defect>
+
+  <defect number="PDEF100693" title="Memory leak in AVRCP" revision="001">
+    Handling memory leaks in AVRCP
+  </defect>
+</relnotes>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/bluetooth_avrcp.mrp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,25 @@
+# Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+component	bluetooth_avrcp
+source		\sf\os\bt\remotecontrol\avrcp
+
+binary		\sf\os\bt\remotecontrol\avrcp	all
+exports		\sf\os\bt\remotecontrol\avrcp
+notes_source	\component_defs\release.src
+
+
+ipr E 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/bwins/avcU.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,24 @@
+EXPORTS
+	??1CAVCFrame@@UAE@XZ @ 1 NONAME ; CAVCFrame::~CAVCFrame(void)
+	??ACAVCFrame@@QBEABEH@Z @ 2 NONAME ; unsigned char const & CAVCFrame::operator[](int) const
+	?Append@CAVCFrame@@QAEXABVTDesC8@@@Z @ 3 NONAME ; void CAVCFrame::Append(class TDesC8 const &)
+	?Append@CAVCFrame@@QAEXVTChar@@@Z @ 4 NONAME ; void CAVCFrame::Append(class TChar)
+	?ButtonAct@CAVCFrame@@QBEHAAW4TButtonAction@AVCPanel@@@Z @ 5 NONAME ; int CAVCFrame::ButtonAct(enum AVCPanel::TButtonAction &) const
+	?Data@CAVCFrame@@QBEABVTDesC8@@XZ @ 6 NONAME ; class TDesC8 const & CAVCFrame::Data(void) const
+	?FrameType@CAVCFrame@@QBE?AW4TFrameType@AVC@@XZ @ 7 NONAME ; enum AVC::TFrameType CAVCFrame::FrameType(void) const
+	?FrameType@CAVCFrame@@SA?AW4TFrameType@AVC@@ABVTDesC8@@@Z @ 8 NONAME ; enum AVC::TFrameType CAVCFrame::FrameType(class TDesC8 const &)
+	?NewL@CAVCFrame@@SAPAV1@ABVTDesC8@@W4TFrameType@AVC@@@Z @ 9 NONAME ; class CAVCFrame * CAVCFrame::NewL(class TDesC8 const &, enum AVC::TFrameType)
+	?NewL@CAVCFrame@@SAPAV1@W4TFrameType@AVC@@W4TCType@3@W4TSubunitType@3@W4TSubunitID@3@@Z @ 10 NONAME ; class CAVCFrame * CAVCFrame::NewL(enum AVC::TFrameType, enum AVC::TCType, enum AVC::TSubunitType, enum AVC::TSubunitID)
+	?Opcode@CAVCFrame@@QBEEXZ @ 11 NONAME ; unsigned char CAVCFrame::Opcode(void) const
+	?OperationId@CAVCFrame@@QBEHAAE@Z @ 12 NONAME ; int CAVCFrame::OperationId(unsigned char &) const
+	?SetFrameType@CAVCFrame@@QAEXW4TFrameType@AVC@@@Z @ 13 NONAME ; void CAVCFrame::SetFrameType(enum AVC::TFrameType)
+	?SetType@CAVCFrame@@QAEXW4TCType@AVC@@@Z @ 14 NONAME ; void CAVCFrame::SetType(enum AVC::TCType)
+	?SubunitID@CAVCFrame@@QBE?AW4TSubunitID@AVC@@XZ @ 15 NONAME ; enum AVC::TSubunitID CAVCFrame::SubunitID(void) const
+	?SubunitType@CAVCFrame@@QBE?AW4TSubunitType@AVC@@XZ @ 16 NONAME ; enum AVC::TSubunitType CAVCFrame::SubunitType(void) const
+	?Type@CAVCFrame@@QBE?AW4TCType@AVC@@XZ @ 17 NONAME ; enum AVC::TCType CAVCFrame::Type(void) const
+	?DataLength@CAVCFrame@@QBEHXZ @ 18 NONAME ; int CAVCFrame::DataLength(void) const
+	?GetPayloadAndVID@CAVCVendorDependentCommand@@SA?AVTPtrC8@@ABVCAVCFrame@@AAI@Z @19
+	?GetPayloadAndVID@CAVCVendorUniquePassthroughCommand@@SA?AVTPtrC8@@ABVCAVCFrame@@AAI@Z @20
+	?NewL@CAVCPassthroughResponse@@SAPAVCAVCFrame@@XZ @21 ABSENT
+	?NewL@CAVCVendorDependentResponse@@SAPAVCAVCFrame@@I@Z @22
+	?OpcodeL@CAVCFrame@@SA?AW4TOpcode@AVC@@ABVTDesC8@@@Z @ 23 NONAME ; enum AVC::TOpcode CAVCFrame::OpcodeL(class TDesC8 const &)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/bwins/remconstatusapiU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,7 @@
+EXPORTS
+	??1CRemConStatusApiController@@UAE@XZ @ 1 NONAME ; CRemConStatusApiController::~CRemConStatusApiController(void)
+	?Mrcsaco_ExtensionInterfaceL@MRemConStatusApiControllerObserver@@UAEXVTUid@@AAPAX@Z @ 2 NONAME ; void MRemConStatusApiControllerObserver::Mrcsaco_ExtensionInterfaceL(class TUid, void * &)
+	?NewL@CRemConStatusApiController@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConStatusApiControllerObserver@@@Z @ 3 NONAME ; class CRemConStatusApiController * CRemConStatusApiController::NewL(class CRemConInterfaceSelector &, class MRemConStatusApiControllerObserver &)
+	?SubunitInfo@CRemConStatusApiController@@QAEXAAVTRequestStatus@@AAI@Z @ 4 NONAME ; void CRemConStatusApiController::SubunitInfo(class TRequestStatus &, unsigned int &)
+	?UnitInfo@CRemConStatusApiController@@QAEXAAVTRequestStatus@@AAI@Z @ 5 NONAME ; void CRemConStatusApiController::UnitInfo(class TRequestStatus &, unsigned int &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/common/avrcpinternalinterface.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,155 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPINTERNALINTERFACE_H
+#define AVRCPINTERNALINTERFACE_H
+
+/**
+@file
+@internalTechnology
+@prototype
+*/
+
+#include <e32base.h>
+#include "avrcpipc.h"
+#include "browsingframe.h"
+
+const TInt KUidAvrcpInternalInterface = 0x10285eef;
+
+enum TAvrcpInternalInterfaceOperationId
+	{
+	EAvrcpInternalGetFolderItems = 0x0,
+	EAvrcpInternalAvailablePlayersNotification = 0xa31,
+	EAvrcpInternalAddressedPlayerNotification = 0xb31,
+	EAvrcpInternalUidChangedNotification = 0xc31,
+	EAvrcpInternalSetAddressedPlayer = 0x60,
+	};
+
+const TInt KSetAddressedPlayerResponseSize = 8;
+const TInt KRegisterNotificationEmptyResponseSize = 4;
+const TInt KRegisterNotificationAddressedPlayerResponseSize = 8;
+const TInt KRegisterNotificationUidChangedResponseSize = 6;
+const TUint16 KMediaPlayerListUidCounter = 0;
+
+class RMediaPlayerItem
+	{
+public:
+	IMPORT_C void Close();
+	IMPORT_C TInt Size();
+	
+public:
+	AvrcpBrowsing::TItemType	iType;
+	TUint16						iLength;
+	TUint16						iPlayerId;
+	
+	TUint8						iPlayerType;
+	TUint32						iPlayerSubType;
+	TUint8						iPlayStatus;
+	TBuf8<16>					iFeatureBitmask;
+	
+	TUint16						iCharset;
+	TUint16						iNameLength;
+	RBuf8						iName;
+	};
+
+//--------------------------------------------------
+// SetAddressedPlayer 0x60
+//--------------------------------------------------
+class RAvrcpSetAddressedPlayerRequest : public RAvrcpIPC
+	{
+public:
+	TUint16	iPlayerId;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+
+class RAvrcpSetAddressedPlayerResponse : public RAvrcpIPC
+	{
+public:
+	TUint8					iStatus;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+
+//--------------------------------------------------
+// GetFolderItems Media Player Scope 0x71
+//--------------------------------------------------
+class RAvrcpGetFolderItemsRequest : public RAvrcpIPC
+	{
+public:
+	AvrcpBrowsing::TScope	iScope;
+	TUint					iStartItem;
+	TUint					iEndItem;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C void Close();
+	};
+
+class RAvrcpGetFolderItemsResponse : public RAvrcpIPC
+	{
+public:
+	TUint8					iPduId;
+	TUint16					iParamLength;
+	TUint8					iStatus;
+	TUint16					iUidCounter;
+	TUint16 				iNumberItems;
+	RArray<RMediaPlayerItem>	iItems;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C TInt Size();
+	IMPORT_C void Close();
+	
+private:
+	void ReadItemL();
+	void WriteItemL(TInt aIndex);
+	};
+
+//--------------------------------------------------
+// Register Notification Addressed Player
+//--------------------------------------------------
+class RAvrcpAddressedPlayerNotificationResponse : public RAvrcpIPC
+	{
+public:
+	TUint16		iPlayerId;
+	TUint16		iUidCounter;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8&);
+	};
+
+//--------------------------------------------------
+// Register Notification Uid Counter
+//--------------------------------------------------
+class RAvrcpUidCounterNotificationResponse : public RAvrcpIPC
+	{
+public:
+	TUint16		iUidCounter;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8&);
+	};
+
+
+#endif //AVRCPINTERNALINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/common/avrcpipc.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,74 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file contains structures shared by the AVRCP API with the AVRCP bearer.
+// 
+//
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef AVRCPIPC_H
+#define AVRCPIPC_H
+
+#include <s32mem.h>
+#include <remcon/avrcpspec.h>
+
+// Structure of commands for AVRCP player information requests via IPC
+class RAvrcpIPC
+{
+public:
+	IMPORT_C static TMetadataTransferPDU GetPDUIdFromIPCOperationId(TInt aOperationId);
+	IMPORT_C static TRegisterNotificationEvent GetEventIdFromIPCOperationId(TInt aOperationId);
+	IMPORT_C static TInt SetIPCOperationIdFromEventId(TRegisterNotificationEvent aEventId);
+	IMPORT_C static TUint8 SymbianErrToStatus(TInt aErr);
+    IMPORT_C static TInt SymbianErrorCheck(TInt aError);
+	
+public:
+	virtual void ReadL(const TDesC8& aData) = 0;
+	virtual void WriteL(TDes8& aOutData) = 0;
+	
+protected:
+	// Big-endian methods; Symbian native methods are little-endian
+	TUint8  Read8L();
+	TUint16 Read16L();
+	TUint32 Read32L();
+	TUint32 Read24L();   // Required for PDU 0x10
+	TUint64 Read64L();
+	void Write8L(TUint8 aVal);
+	void Write16L(TUint16 aVal);
+	void Write24L(TUint32 aVal); // Required for PDU 0x10
+	void Write32L(TUint32 aVal);
+	void Write64L(TUint64 aVal);
+	void Close();
+
+public:
+	RDesWriteStream iStream;
+	RDesReadStream iReadStream;
+};
+
+const TUint8 KLengthErrorResponse = 4;               // 4 bytes for errors returned via IPC
+class RAvrcpIPCError : public RAvrcpIPC
+{
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	
+public:
+	TInt iError;
+};
+
+#endif // AVRCPIPC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/common/browsingframe.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,95 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// browisngframe.h
+//
+
+#ifndef BROWSINGFRAME_H
+#define BROWSINGFRAME_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <e32base.h>
+
+const TInt KUidCounter = 0;
+
+namespace AvrcpBrowsing
+	{
+const TInt KHeaderLength = 3;
+typedef TUint8 TPduId;	
+typedef TUint8 TScope;
+typedef TUint8 TDirection;
+typedef TUint8 TPlayable;
+typedef TUint8 TMediaType;
+
+const TScope KMediaPlayerScope = 0x0;
+const TScope KVirtualFilesystemScope = 0x1;
+const TScope KSearchScope = 0x2;
+const TScope KNowPlayingScope = 0x3;
+
+const TDirection KUp = 0x00;
+const TDirection KDown = 0x01;
+
+const TPlayable KPlayable = 1;
+const TPlayable KNotPlayable = 0;
+const TPlayable KPlayableReserved = 2;
+
+const TMediaType KAudio = 0;
+const TMediaType KVideo = 1;
+const TMediaType KMediaTypeReserved = 2;
+
+enum TPdu
+	{
+	ESetBrowsedPlayer = 0x70,
+	EGetFolderItems = 0x71,
+	EChangePath = 0x72,
+	EGetItemAttributes = 0x73, 
+	ESearch = 0x80,
+	EGeneralReject = 0xa0,
+	};
+
+enum TItemType
+	{
+	EMediaPlayer = 0x01,
+	EFolderItem = 0x02,
+	EMediaElement = 0x03,
+	};
+
+enum TFolderType
+	{
+	EMixed = 0,
+	ETitles = 1,
+	EAlbums = 2,
+	EArtists = 3,
+	EGenres = 4,
+	EPlaylists = 5,
+	EYears = 6,
+	EFolderTypeReserved = 7,
+	};
+
+class BrowsingFrame
+	{
+public:
+	static void VerifyFrameL(const TDesC8& aFrame);
+	static TPduId PduId(const TDesC8& aFrame);
+	static TInt ParamLength(const TDesC8& aFrame);
+	static void Payload(const TDesC8& aFrame, TPtrC8& aPayload);
+	};
+
+	} // end namespace BrowsingFrame
+
+#endif //BROWSINGFRAME_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/common/mediabrowse.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,315 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef MEDIABROWSE_H
+#define MEDIABROWSE_H
+
+#include <e32base.h>
+#include <remconmediainformationtargetobserver.h>
+#include <remconmediabrowsetypes.h>
+#include "avrcpipc.h"
+#include "browsingframe.h"
+#include "mediainformation.h"
+
+//-------------------------------------------------------------------------- 
+// Interface Data
+//--------------------------------------------------------------------------
+
+enum TRemConMediaBrowseOperationId
+	{
+	EGetFolderItemsOperationId,
+	EChangePathOperationId,
+	EGetItemAttributesOperationId,
+	ESearchOperationId,
+	ESetMaxResponseOperationId,
+	ESetBrowsedPlayerOperationId,
+	EUIDPersistency,
+	EMediaLibraryStateCookieUpdateOperationId,
+	};
+
+/**
+ * The UID identifying the RemCon NowPlaying interface.
+ */
+const TInt KRemConMediaBrowseApiUid = 0x10285bbb;
+
+// identifier (8bytes) NumAttributes (1) AttributeID (max is 4*7) = 37 + UID Counter + scope
+const TInt KMaxLengthMediaBrowseMsg = 400;
+
+//PDU ID(1 byte) + Parameter length(2 bytes) + Status(1 byte), 
+//the total of which is 4 bytes
+const TInt KBrowseResponseBaseLength = 4;
+
+//KBrowseResponseBaseLength(4 bytes) + UID Counter(2 bytes) + Number of Items(2 bytes)
+//the total of which is 8
+const TInt KGetFolderItemsResponseBaseSize = 8;
+
+//UID 8 + FolderType 1 + Is Playable 1 + Character set ID 2 + Name length 2
+const TInt KFolderItemBaseLength = 14;
+
+//UID 8 + Type 1 + Character Set 2 + Name Length 2 + Number of attributes 1 
+const TInt KMediaElementItemBaseLength = 14;
+
+//ID 4 + Character Set 2 + Length filed 2
+const TInt KAttributeBaseLength = 8;
+
+//Status 1
+const TInt KErrResponseParameterLength = 1;
+
+/**
+This is the max length of a response used in media browse API for fix-length responses. 
+For the response which have a fix-length the Search(PDU 0x80) has the maximum response 
+which is KBrowseResponseBaseLength(4 bytes)+ UID Counter(2 bytes) + Number of Items(4 bytes) 
+the total of which is 10
+*/
+const TInt KMediaBrowseOutBufMaxLength = 10;
+
+class RItem
+	{
+public:
+	IMPORT_C void Close();
+	IMPORT_C TInt Size();
+	
+public:
+	AvrcpBrowsing::TItemType	iType;
+	TUint16						iLength;
+	TUint64						iUid;
+	
+	TUint16						iCharset;
+	TUint16						iNameLength;
+	HBufC8*						iName;
+	
+	// Folder attributes
+	AvrcpBrowsing::TFolderType	iFolderType;
+	AvrcpBrowsing::TPlayable	iPlayable;
+	
+	// Media element attributes
+	AvrcpBrowsing::TMediaType	iMediaType;
+	TInt						iNumberAttributes;
+	RArray<REAResponse>			iAttributes;
+	};
+
+//--------------------------------------------------
+// GetFolderItems 0x71
+//--------------------------------------------------
+class RRemConGetFolderItemsRequest : public RAvrcpIPC
+	{
+public:
+	AvrcpBrowsing::TScope	iScope;
+	TUint					iStartItem;
+	TUint					iEndItem;
+	TInt 					iNumberAttributes;
+	RArray<TInt>			iAttributes;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C void Close();
+	IMPORT_C TInt CopyAttributes(RArray<TMediaAttributeId>& aOutAttributes);
+	};
+
+class RRemConGetFolderItemsResponse : public RAvrcpIPC
+	{
+public:
+	TUint8					iPduId;
+	TUint16					iParamLength;
+	TUint8					iStatus;
+	TUint16					iUidCounter;
+	TUint16 				iNumberItems;
+	RArray<RItem>			iItems;
+	
+	TInt 						iMaxResponse;		
+	TInt 						iCurrentItem;
+	TInt 						iCurrentListingSize;
+	
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C TInt Size();
+	IMPORT_C void Close();
+	IMPORT_C TInt CopyItems(const TArray<TRemConItem>& aItems);
+	IMPORT_C TBool RequestNextItem(TInt& aError, RBuf8& aOutBuf, TUint16 aCookie);
+	
+private:
+	void ReadItemL();
+	void WriteItemL(TInt aIndex);
+	};
+
+//--------------------------------------------------
+// ChangePath 0x72
+//--------------------------------------------------
+class RRemConChangePathRequest : public RAvrcpIPC
+	{
+public:
+	TUint16 					iUidCounter;
+	AvrcpBrowsing::TDirection	iDirection;
+	TUint64 					iElement;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+
+
+class RRemConChangePathResponse : public RAvrcpIPC
+	{
+public:
+	TUint8					iPduId;
+	TUint16					iParamLength;
+	TUint8					iStatus;
+	TInt 					iNumberItems;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+
+//--------------------------------------------------
+// GetItemAttributes 0x73
+//--------------------------------------------------
+class RRemConGetItemAttributesRequest : public RAvrcpIPC
+	{
+public:
+	AvrcpBrowsing::TScope	iScope;
+	TUint64 				iElement;
+	TUint16					iUidCounter;
+	TInt 					iNumberAttributes;
+	RArray<TInt>			iAttributes;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C void Close();
+	};
+
+
+class RRemConGetItemAttributesResponse : public RAvrcpIPC
+	{
+public:
+	TUint8					iPduId;
+	TUint16					iParamLength;
+	TUint8					iStatus;
+	TInt 					iNumberAttributes;
+	RArray<REAResponse>		iAttributes;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C TInt Size();
+	IMPORT_C void Close();
+	};
+
+//--------------------------------------------------
+// Search 0x80
+//--------------------------------------------------
+class RRemConSearchRequest : public RAvrcpIPC
+	{
+public:
+	TUint16 iCharset;
+	TUint16 iStringLen;
+	RBuf8 iSearchString;
+ 
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C TInt Size();
+	IMPORT_C void Close();
+	};
+
+class RRemConSearchResponse : public RAvrcpIPC
+	{
+public:
+	TUint8					iPduId;
+	TUint16					iParamLength;
+	TUint8					iStatus;
+	TUint16					iUidCounter;
+	TUint					iNumberItems;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+
+//--------------------------------------------------
+// SetBrowsedPlayer
+//--------------------------------------------------
+class RRemConSetBrowsedPlayerRequest : public RAvrcpIPC
+	{
+public:
+	TInt 	iMaxResponse;
+	TUint16 iPlayerId;
+	
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+
+class RRemConGetPathResponse : public RAvrcpIPC
+	{
+public:
+	TUint8					iPduId;
+	TUint16					iParamLength;
+	TUint8					iStatus;
+	TUint16					iUidCounter;
+	TUint					iNumberItems;
+	TUint16					iCharset;
+	TUint8					iFolderDepth;
+	RPointerArray<HBufC8>	iPath;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C TInt Size();
+	IMPORT_C void Close();
+	};
+
+class RRemConMediaErrorResponse : public RAvrcpIPC
+	{
+public:
+	TUint8  iPduId;
+	TUint16 iLength;
+	TUint8 	iStatus;
+	
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+
+class RRemConUidsChangedRequest : public RAvrcpIPC
+	{
+public:
+	TUint16	iInitialUidCounter;
+	
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+
+class RRemConUidsChangedResponse : public RAvrcpIPC
+	{
+public:
+	TUint16      iUidCounter;
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+#endif //MEDIABROWSE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/common/mediainformation.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,79 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef REMCONMEDIAINFORMATION_H
+#define REMCONMEDIAINFORMATION_H
+
+#include "avrcpipc.h"
+
+//-------------------------------------------------------------------------- 
+// Interface Data
+//--------------------------------------------------------------------------
+
+/**
+ * The UID identifying the RemCon MediaInformation interface.
+ */
+const TInt KRemConMediaInformationApiUid = 0x10285B20;
+
+// identifier (8bytes) NumAttributes (1) AttributeID (max is 4*7) = 37
+const TInt KMaxLengthMediaInformationMsg = 37;
+const TInt KMaxMediaAttributeValue = 7;
+
+class RRemConGetElementAttributesRequest : public RAvrcpIPC
+	{
+public:
+	TUint64 				iElement;
+	TInt 					iNumberAttributes;
+	RArray<TInt>			iAttributes;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C void Close();
+	};
+
+
+class REAResponse
+	{
+public:
+	IMPORT_C void Close();
+public:
+	TInt    iAttributeId;
+	TUint16 iCharset;
+	TUint16 iStringLen;
+	HBufC8* iString;
+	};
+
+
+class RRemConGetElementAttributesResponse : public RAvrcpIPC
+	{
+public:
+	TInt 					iNumberAttributes;
+	RArray<REAResponse>		iAttributes;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C TInt Size();
+	IMPORT_C void Close();
+	};
+
+#endif // REMCONMEDIAINFORMATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/common/nowplaying.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,63 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef NOWPLAYING_H
+#define NOWPLAYING_H
+
+#include <e32base.h>
+#include <remconmediabrowsetypes.h>
+#include "avrcpipc.h"
+
+//The UID identifying the RemCon NowPlaying interface.
+const TInt KRemConNowPlayingApiUid = 0x10285bbc;
+
+/**
+This is the maximum length of a request that can be received
+Play Item(0x74) and AddToNowPlaying(0x90) have the largest possible request
+which is Scope (1 byte) + UID (8 bytes) + UID Counter (2 bytes) 
+the total of which is 11
+*/
+const TInt KMaxLengthNowPlayingMsg = 11;
+
+
+class RRemConNowPlayingRequest : public RAvrcpIPC
+	{
+public:
+	TRemConFolderScope iScope;
+	TUint64 iElement;
+	TUint16 iUidCounter;
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+
+class RRemConNowPlayingResponse : public RAvrcpIPC
+	{
+public:
+	TUint8 iStatus;
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	};
+
+#endif //NOWPLAYING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/common/playerinformation.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,172 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// playerinformation.h This file contains structures shared by the AVRCP API with the AVRCP bearer.
+// 
+//
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef REMCONPLAYERINFORMATION_H
+#define REMCONPLAYERINFORMATION_H
+
+#include "playerinformationtarget.h"
+#include "avrcpipc.h"
+#include <avcframe.h>
+
+/**
+ * The UID identifying the RemCon PlayerInformation interface.
+ */
+const TInt KRemConPlayerInformationUid = 0x10285B21;
+
+// The Bluetooth SIG registered VendorId, see table 4.7
+const AVC::TAVCVendorId KBluetoothSIGVendorId = 0x001958;
+
+// This is the maximum length of a request that can be received
+// GetElementAttributes (PDU 0x20) has the largest possible request
+// which is identifier (8 bytes) + numAttr (1 byte) + attributes
+// (255 * 4 bytes) the total of which is 1029 bytes.
+const TInt KMaxLengthPlayerInformationMsg = 1029;
+
+
+// Used by PDU 0x11 and PDU 0x12
+class RRemConPlayerListOfAttributes : public RAvrcpIPC
+{
+public:
+	TInt			iNumberAttributes;
+	RArray<TInt>	iAttributes;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C void Close();
+};
+
+// Used by PDU 0x13 (response) and PDU 0x14 (request)
+class RRemConPlayerAttributeIdsAndValues : public RAvrcpIPC
+{
+public:
+	TInt			iNumberAttributes;
+	RArray<TInt>	iAttributeId;
+	RArray<TInt>	iAttributeValue;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C void Close();
+};
+
+class RSettingWithCharset
+	{
+public:
+	IMPORT_C void Close();
+	
+public:
+	TInt	iAttributeId;
+	TUint16	iCharset;
+	TInt	iStringLen;
+	HBufC8*	iString;
+};
+
+// Used by PDU 0x15 and PDU 0x16
+class RRemConGetPlayerApplicationTextResponse  : public RAvrcpIPC
+{
+public:
+	TInt						iNumberAttributes;
+	RArray<RSettingWithCharset>	iAttributes;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C void Close();
+	IMPORT_C TInt Size();
+};
+
+// Used by PDU 0x10
+class RRemConGetCapabilitiesResponse : public RAvrcpIPC
+{
+public:
+	TUint16			iCapabilityId;
+	TUint16			iCapabilityCount;
+	RArray<TUint32>	iCapabilities;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8& aOutData);
+	IMPORT_C void Close();
+};
+
+// Used by PDU 0x30
+class RRemConPlayerInformationGetPlayStatusResponse : public RAvrcpIPC
+	{
+public:
+	TUint			iPlayPos;
+	TUint			iTrackLength;
+	MPlayerEventsObserver::TPlaybackStatus	iStatus;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8&);
+	};
+
+// Used by PDU 0xff
+class RRemConPlayerInformationGetPlayStatusUpdateRequest : public RAvrcpIPC
+	{
+public:
+	MPlayerEventsObserver::TPlaybackStatus	iStatus;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8&);
+	};
+
+// Used by PDU 0xff
+class RRemConPlayerInformationGetPlayStatusUpdateResponse : public RAvrcpIPC
+	{
+public:
+	MPlayerEventsObserver::TPlaybackStatus	iStatus;
+
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8&);
+	};
+
+class RRemConPlayerInformation8BitResponse : public RAvrcpIPC
+	{
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8&);
+	TUint8			iValue;
+	};
+
+class RRemConPlayerInformation32BitResponse : public RAvrcpIPC
+	{
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8&);
+	TInt			iValue;
+	};
+
+class RRemConPlayerInformation64BitResponse : public RAvrcpIPC
+	{
+public:
+	IMPORT_C void ReadL(const TDesC8& aData);
+	IMPORT_C void WriteL(TDes8&);
+	TUint64			iValue;
+	};
+
+#endif // REMCONPLAYERINFORMATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/common/remconbattery.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,45 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalTechnology
+*/
+
+#ifndef REMCONBATTERY_H
+#define REMCONBATTERY_H
+
+#include <e32base.h>
+
+
+//-------------------------------------------------------------------------- 
+// Interface Data
+//--------------------------------------------------------------------------
+
+/**
+The UID identifying this outer-layer RemCon interface.
+*/
+const TInt KRemConBatteryApiUid = 0x10285AE7;
+
+struct TRemConBatteryApiResponse
+	{
+	// Error code 
+	TInt	iError;
+	};
+
+const TInt KLengthBatteryStatusMsg = 1;
+	
+
+#endif // REMCONBATTERY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/common/remcongroupnavigation.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,43 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalTechnology
+*/
+
+#ifndef REMCONGROUPNAVIGATION_H
+#define REMCONGROUPNAVIGATION_H
+
+#include <e32base.h>
+
+//-------------------------------------------------------------------------- 
+// Interface Data
+//--------------------------------------------------------------------------
+
+/**
+The UID identifying the RemCon Group Navigation interface.
+*/
+const TInt KRemConGroupNavigationApiUid = 0x10285B01;
+
+const TInt KMaxSizeRemConGroupNavigationMsg =1;
+	
+struct TRemConGroupNavigationResponse
+	{
+	// Error code 
+	TInt	iError;
+	};
+
+#endif // REMCONGROUPNAVIGATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/common/remconqueuemessage.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,82 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef REMCONQUEUEMESSAGE_H_
+#define REMCONQUEUEMESSAGE_H_
+
+#include <e32base.h>
+
+class CRemConQueuedMessage;
+
+/**
+A queue for RemCon request command messages. 
+*/
+NONSHARABLE_CLASS(TRemConMessageQueue)
+	{
+public:
+	IMPORT_C TRemConMessageQueue();
+	IMPORT_C void Reset();
+	IMPORT_C void AddLast(CRemConQueuedMessage& aMsg);
+	IMPORT_C TBool IsEmpty();
+	IMPORT_C CRemConQueuedMessage* First() const;
+	IMPORT_C void Remove(CRemConQueuedMessage& aMsg);
+	IMPORT_C const CRemConQueuedMessage* Find(TUid aInterfaceUid
+				,TInt aOperationId
+				);
+private:
+	TSglQue<CRemConQueuedMessage> iQueue;
+	TSglQueIter<CRemConQueuedMessage> iIter;
+	};
+
+/**
+A data encapsulation class for a request.
+
+The object contains the data of the request and the type of the request, which
+will be put in a queue.
+*/
+NONSHARABLE_CLASS(CRemConQueuedMessage) : public CBase
+	{
+public:
+	IMPORT_C static CRemConQueuedMessage* NewL(TUid aInterfaceUid
+			,const TDesC8& aData
+			,TInt aOperationId
+			);
+	
+	IMPORT_C ~CRemConQueuedMessage();	
+	IMPORT_C const TDesC8& Data();
+	
+private:
+	CRemConQueuedMessage(TUid aInterfaceUid, TInt aOperationId);
+	void ConstructL(const TDesC8& aData);
+	
+public:
+	TSglQueLink                       iLink;
+	TUid                              iInterfaceUid;
+	TInt                              iOperationId;
+	
+private:
+	RBuf8                             iData;
+	};
+
+
+#endif /*REMCONQUEUEMESSAGE_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/common/remconstatusapi.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,106 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#ifndef REMCONSTATUSAPI_H
+#define REMCONSTATUSAPI_H
+
+#include <e32base.h>
+
+const TUint KRemConStatusApiMaxOperationSpecificDataSize = 10;
+
+//-------------------------------------------------------------------------- 
+// Unit info response data format
+//--------------------------------------------------------------------------
+
+/** Length of the VendorId field in bytes. */
+const TUint KRemConStatusApiVendorIdLength = 3;
+
+/** Offset for VendorId field */
+const TUint KRemConStatusApiVendorIdOffset = 0; 
+
+/** Length of the Unit field in bytes. */
+const TUint KRemConStatusApiUnitLength = 1;
+
+/** Offset for Unit field */
+const TUint KRemConStatusApiUnitOffset = KRemConStatusApiVendorIdLength;
+
+/** Length of the Unit type field in bytes. */
+const TUint KRemConStatusApiUnitTypeLength = 1;
+
+/** Offset for Unit type field */
+const TUint KRemConStatusApiUnitTypeOffset = KRemConStatusApiVendorIdLength + KRemConStatusApiUnitLength;
+
+/** Length of the Extended Unit type field in bytes. */
+const TUint KRemConStatusApiExtendedUnitTypeLength = 2;
+
+/** Offset for Extended Unit type field.
+
+This data is only valid if Unit type is 0x1e.
+The second byte is only valid if the first byte is 0xff.
+See AV/C general specification for details.
+*/
+const TUint KRemConStatusApiExtendedUnitTypeOffset = 
+	KRemConStatusApiVendorIdLength + KRemConStatusApiUnitLength +KRemConStatusApiUnitTypeLength;
+
+//-------------------------------------------------------------------------- 
+// SubUnit info response data format
+//--------------------------------------------------------------------------
+
+/** Length of the page field in bytes. */
+const TUint KRemConStatusApiPageLength = 1;
+
+/** Offset for page field */
+const TUint KRemConStatusApiPageOffset = 0; 
+
+/** Length of the extension field in bytes. */
+const TUint KRemConStatusApiExtensionLength = 1;
+
+/** Offset for extension field */
+const TUint KRemConStatusApiExtensionOffset = KRemConStatusApiPageLength; 
+
+/** Length of the page data field in bytes. 
+
+This is defined as being all data from KRemConStatusApiPageDataOffset
+to the end of the response data.
+*/
+
+/** Offset for page data field */
+const TUint KRemConStatusApiPageDataOffset = KRemConStatusApiPageLength + KRemConStatusApiExtensionLength; 
+
+//-------------------------------------------------------------------------- 
+// Interface Data
+//--------------------------------------------------------------------------
+
+/**
+The UID identifying this outer-layer RemCon interface.
+*/
+const TInt KRemConStatusApiUid = 0x10207ea5;
+
+/**
+Operation ids belonging to the Status API.
+*/
+enum TRemConStatusApiOperationId
+	{
+	ERemConStatusApiUnitInfo					= 0x00,
+	ERemConStatusApiSubunitInfo					= 0x01,
+	};
+
+#endif // REMCONSTATUSAPI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/eabi/avcU.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,26 @@
+EXPORTS
+	_ZN9CAVCFrame12SetFrameTypeEN3AVC10TFrameTypeE @ 1 NONAME
+	_ZN9CAVCFrame4NewLEN3AVC10TFrameTypeENS0_6TCTypeENS0_12TSubunitTypeENS0_10TSubunitIDE @ 2 NONAME
+	_ZN9CAVCFrame4NewLERK6TDesC8N3AVC10TFrameTypeE @ 3 NONAME
+	_ZN9CAVCFrame6AppendE5TChar @ 4 NONAME
+	_ZN9CAVCFrame6AppendERK6TDesC8 @ 5 NONAME
+	_ZN9CAVCFrame7SetTypeEN3AVC6TCTypeE @ 6 NONAME
+	_ZN9CAVCFrame9FrameTypeERK6TDesC8 @ 7 NONAME
+	_ZN9CAVCFrameD0Ev @ 8 NONAME
+	_ZN9CAVCFrameD1Ev @ 9 NONAME
+	_ZN9CAVCFrameD2Ev @ 10 NONAME
+	_ZNK9CAVCFrame11OperationIdERh @ 11 NONAME
+	_ZNK9CAVCFrame11SubunitTypeEv @ 12 NONAME
+	_ZNK9CAVCFrame4DataEv @ 13 NONAME
+	_ZNK9CAVCFrame4TypeEv @ 14 NONAME
+	_ZNK9CAVCFrame6OpcodeEv @ 15 NONAME
+	_ZNK9CAVCFrame9ButtonActERN8AVCPanel13TButtonActionE @ 16 NONAME
+	_ZNK9CAVCFrame9FrameTypeEv @ 17 NONAME
+	_ZNK9CAVCFrame9SubunitIDEv @ 18 NONAME
+	_ZNK9CAVCFrameixEi @ 19 NONAME
+	_ZNK9CAVCFrame10DataLengthEv @ 20 NONAME
+	_ZN23CAVCPassthroughResponse4NewLEv @21 NONAME ABSENT
+	_ZN26CAVCVendorDependentCommand16GetPayloadAndVIDERK9CAVCFrameRj @22 NONAME
+	_ZN27CAVCVendorDependentResponse4NewLEj @23 NONAME
+	_ZN34CAVCVendorUniquePassthroughCommand16GetPayloadAndVIDERK9CAVCFrameRj @24 NONAME
+	_ZN9CAVCFrame7OpcodeLERK6TDesC8 @ 25 NONAME
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/eabi/remconstatusapiU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,11 @@
+EXPORTS
+	_ZN26CRemConStatusApiController11SubunitInfoER14TRequestStatusRj @ 1 NONAME
+	_ZN26CRemConStatusApiController4NewLER24CRemConInterfaceSelectorR34MRemConStatusApiControllerObserver @ 2 NONAME
+	_ZN26CRemConStatusApiController8UnitInfoER14TRequestStatusRj @ 3 NONAME
+	_ZN26CRemConStatusApiControllerD0Ev @ 4 NONAME
+	_ZN26CRemConStatusApiControllerD1Ev @ 5 NONAME
+	_ZN26CRemConStatusApiControllerD2Ev @ 6 NONAME
+	_ZN34MRemConStatusApiControllerObserver27Mrcsaco_ExtensionInterfaceLE4TUidRPv @ 7 NONAME
+	_ZTI34MRemConStatusApiControllerObserver @ 8 NONAME ; #<TI>#
+	_ZTV34MRemConStatusApiControllerObserver @ 9 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/groupnavigationapi/bwins/remcongroupnavigationapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+	??1CRemConGroupNavigationApiTarget@@UAE@XZ @ 1  NONAME ; CRemConGroupNavigationApiTarget::~CRemConGroupNavigationApiTarget(void)
+	?NewL@CRemConGroupNavigationApiTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConGroupNavigationTargetObserver@@@Z @ 2  NONAME ; class CRemConGroupNavigationApiTarget * CRemConGroupNavigationApiTarget::NewL(class CRemConInterfaceSelector &, class MRemConGroupNavigationTargetObserver &)
+	?NextGroupResponse@CRemConGroupNavigationApiTarget@@QAEXAAPAVTRequestStatus@@H@Z @ 3  NONAME ; void CRemConGroupNavigationApiTarget::NextGroupResponse(class TRequestStatus * &, int)
+	?PreviousGroupResponse@CRemConGroupNavigationApiTarget@@QAEXAAPAVTRequestStatus@@H@Z @ 4  NONAME ; void CRemConGroupNavigationApiTarget::PreviousGroupResponse(class TRequestStatus * &, int)
+	?NewL@CRemConGroupNavigationApiTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConGroupNavigationTargetObserver@@HH@Z @ 5 NONAME ; class CRemConGroupNavigationApiTarget * CRemConGroupNavigationApiTarget::NewL(class CRemConInterfaceSelector &, class MRemConGroupNavigationTargetObserver &, int, int)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/groupnavigationapi/eabi/remcongroupnavigationapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,9 @@
+EXPORTS
+	_ZN31CRemConGroupNavigationApiTarget17NextGroupResponseERP14TRequestStatusi @ 1 NONAME
+	_ZN31CRemConGroupNavigationApiTarget21PreviousGroupResponseERP14TRequestStatusi @ 2 NONAME
+	_ZN31CRemConGroupNavigationApiTarget4NewLER24CRemConInterfaceSelectorR36MRemConGroupNavigationTargetObserver @ 3 NONAME
+	_ZN31CRemConGroupNavigationApiTargetD0Ev @ 4 NONAME
+	_ZN31CRemConGroupNavigationApiTargetD1Ev @ 5 NONAME
+	_ZN31CRemConGroupNavigationApiTargetD2Ev @ 6 NONAME
+	_ZN31CRemConGroupNavigationApiTarget4NewLER24CRemConInterfaceSelectorR36MRemConGroupNavigationTargetObserverii @ 7 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/groupnavigationapi/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,26 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remcongroupnavigationapi.mmp
+
+PRJ_EXPORTS
+../public/remcongroupnavigationtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcongroupnavigationtarget.h)
+../public/remcongroupnavigationtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcongroupnavigationtargetobserver.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/groupnavigationapi/group/remcongroupnavigationapi.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,50 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remcongroupnavigationapi.dll Remote Control Group Navigation API - an outer-layer client side library.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET			remcongroupnavigationapi.dll
+TARGETPATH		/system/libs
+
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			groupnavigationapi.cpp
+
+USERINCLUDE		../../common
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		remconinterfacebase.lib
+LIBRARY			estor.lib 
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/groupnavigationapi/public/remcongroupnavigationtarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,116 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONGROUPNAVIGATIONTARGET_H
+#define REMCONGROUPNAVIGATIONTARGET_H
+
+#include <e32base.h>
+#include <s32mem.h>
+#include <remconcoreapi.h>
+#include <remcon/avrcpspec.h>
+
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+
+class MRemConGroupNavigationTargetObserver;
+class CRemConInterfaceSelector;
+
+/**
+Client-instantiable type supporting sending Battery Status responses.
+*/
+NONSHARABLE_CLASS(CRemConGroupNavigationApiTarget) : public CRemConInterfaceBase, 
+								          		public MRemConInterfaceIf
+	{
+public:
+	/**
+	Factory function.
+	@see CRemConInterfaceSelector
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@return A new CRemConGroupNavigationApiTarget, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConGroupNavigationApiTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConGroupNavigationTargetObserver& aObserver);
+	/**
+	Factory function.
+	@see CRemConInterfaceSelector
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@param aNextGroupSupported Whether the Client support the next Group functionality.
+	@param aPreviousGroupSupported Whether the Client support the previous Group functionality.
+	@return A new CRemConGroupNavigationApiTarget, owned by the interface selector.
+		*/
+	IMPORT_C static CRemConGroupNavigationApiTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+			MRemConGroupNavigationTargetObserver& aObserver, TBool aNextGroupSupported, TBool aPreviousGroupSupported);
+	
+	/** Destructor */
+	IMPORT_C ~CRemConGroupNavigationApiTarget();
+
+public:
+	/** Send a 'next group' response.
+	Called by the client after receiving a MRemConGroupNavigationTargetObserver::MrcgntoNextGroup().
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	aStatus may be NULL if no completion indication required.
+	@param aError The response error.
+	*/
+	IMPORT_C void NextGroupResponse(TRequestStatus*& aStatus, TInt aError);
+
+	/** Send a 'previous group' response.
+	Called by the client after receiving a MRemConGroupNavigationTargetObserver::MrcgntoPreviousGroup().
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	aStatus may be NULL if no completion indication required.
+	@param aError The response error.
+	*/
+	IMPORT_C void PreviousGroupResponse(TRequestStatus*& aStatus, TInt aError);
+
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	@param aObserver The observer of this interface.
+	*/
+	CRemConGroupNavigationApiTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConGroupNavigationTargetObserver& aObserver);
+
+	void SendGroupResponse(TGroupNavigationPassthroughOperationIds aId, TRequestStatus*& aStatus, TInt aError);
+
+	void ConstructL();
+
+	void ConstructL(TBool aNextGroupSupported, TBool aPreviousGroupSupported);
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+
+private: // unowned
+	MRemConGroupNavigationTargetObserver& iObserver;
+
+private: // owned
+	CBufFlat*		iOutData;
+	TPtr8			iPtr;
+	RBufWriteStream iStream;
+	TUint 			iNumRemotes;
+	};
+
+#endif // REMCONGROUPNAVIGATIONTARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/groupnavigationapi/public/remcongroupnavigationtargetobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,52 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONGROUPNAVIGATIONTARGETOBSERVER_H
+#define REMCONGROUPNAVIGATIONTARGETOBSERVER_H
+
+#include <e32base.h>
+#include <remconcoreapi.h>
+
+/**
+Clients must implement this interface in order to instantiate objects of type 
+CRemConGroupNavigation. This interface passes incoming commands from RemCon to 
+the client. 
+*/
+class MRemConGroupNavigationTargetObserver
+	{
+public:
+	/** 
+	A 'Next Group' has been received.
+	@see TRemConCoreApiButtonAction
+	@param aButtonAct The button action associated with the command.
+	*/
+	virtual void MrcgntoNextGroup(TRemConCoreApiButtonAction aButtonAct) = 0;
+	
+	/** 
+	A 'Previous Group' has been received.
+	@see TRemConCoreApiButtonAction
+	@param aButtonAct The button action associated with the command.
+	*/
+	virtual void MrcgntoPreviousGroup(TRemConCoreApiButtonAction aButtonAct) =0;
+
+	};
+
+#endif // REMCONGROUPNAVIGATIONTARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/groupnavigationapi/src/groupnavigationapi.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,194 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <bluetooth/logger.h>
+#include <remcongroupnavigationtarget.h>
+#include <remcongroupnavigationtargetobserver.h>
+
+#include <remconinterfaceselector.h>
+
+#include <avcframe.h>
+
+#include "remcongroupnavigation.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_GROUP_NAVIGATION);
+#endif
+
+EXPORT_C CRemConGroupNavigationApiTarget* CRemConGroupNavigationApiTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConGroupNavigationTargetObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConGroupNavigationApiTarget* self = new(ELeave) CRemConGroupNavigationApiTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+EXPORT_C CRemConGroupNavigationApiTarget* CRemConGroupNavigationApiTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConGroupNavigationTargetObserver& aObserver,TBool aNextGroupSupported, TBool aPreviousGroupSupported)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConGroupNavigationApiTarget* self = new(ELeave) CRemConGroupNavigationApiTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->ConstructL(aNextGroupSupported,aPreviousGroupSupported);
+	CleanupStack::Pop(self);
+	return self;
+	}
+CRemConGroupNavigationApiTarget::CRemConGroupNavigationApiTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConGroupNavigationTargetObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConGroupNavigationApiUid), 
+						 KMaxSizeRemConGroupNavigationMsg, 
+						 aInterfaceSelector,
+						 ERemConClientTypeTarget), 
+	iObserver(aObserver), iPtr(0,0,0)
+	{
+	}
+	
+void CRemConGroupNavigationApiTarget::ConstructL()
+	{
+	// Create a output buffer (arbitrary value of 32 for granularity of buffer expansion)
+	iOutData = CBufFlat::NewL(32);
+	iOutData->SetReserveL(sizeof(TPckg<TRemConGroupNavigationResponse>)); 
+	BaseConstructL();
+	}
+void CRemConGroupNavigationApiTarget::ConstructL(TBool aNextGroupSupported, TBool aPreviousGroupSupported)
+	{
+	// Create a output buffer (arbitrary value of 32 for granularity of buffer expansion)
+	iOutData = CBufFlat::NewL(32);
+	iOutData->SetReserveL(sizeof(TPckg<TRemConGroupNavigationResponse>));
+	
+	RRemConInterfaceFeatures features;
+	User::LeaveIfError(features.Open());
+	CleanupClosePushL(features);
+	
+	if(aNextGroupSupported)
+		{
+		features.AddOperationL(ENextGroup);
+		}
+	
+	if(aPreviousGroupSupported)
+		{
+		features.AddOperationL(EPreviousGroup);
+		}
+	
+	BaseConstructL(features);
+	CleanupStack::PopAndDestroy(&features);
+	}
+	
+
+/** Destructor.
+
+@publishedAll
+@released
+*/
+EXPORT_C CRemConGroupNavigationApiTarget::~CRemConGroupNavigationApiTarget()
+	{
+	delete iOutData;
+	iStream.Close();
+	}
+
+/** Gets a pointer to a specific interface version.
+
+@return A pointer to the interface, NULL if not supported.
+@internalComponent
+@released
+*/
+TAny* CRemConGroupNavigationApiTarget::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+EXPORT_C void CRemConGroupNavigationApiTarget::NextGroupResponse(TRequestStatus*& aStatus, TInt aError)
+	{
+	SendGroupResponse(ENextGroup, aStatus, aError);
+	}
+
+EXPORT_C void CRemConGroupNavigationApiTarget::PreviousGroupResponse(TRequestStatus*& aStatus, TInt aError)
+	{
+	SendGroupResponse(EPreviousGroup, aStatus, aError);
+	}
+
+void CRemConGroupNavigationApiTarget::SendGroupResponse(TGroupNavigationPassthroughOperationIds aId, TRequestStatus*& aStatus, TInt aError)
+	{
+	// format data to be sent
+  	TRAPD(error, iOutData->ResizeL(sizeof(TRemConGroupNavigationResponse)));
+  	if (error != KErrNone)
+  		{
+  		// if this fails, then silently drop response
+  		return;
+  		}
+  		
+	TRemConGroupNavigationResponse response;
+	response.iError = aError;
+	iOutData->Write(0,TPckg<TRemConGroupNavigationResponse>(response));
+	iPtr.Set(iOutData->Ptr(0));
+
+	// if a TRequestStatus has been supplied
+	if (aStatus)
+		{
+		InterfaceSelector().Send(*aStatus, TUid::Uid(KRemConGroupNavigationApiUid), aId, iNumRemotes, ERemConResponse, iPtr);
+		}
+	else
+		{
+		InterfaceSelector().SendUnreliable(TUid::Uid(KRemConGroupNavigationApiUid), aId, ERemConResponse, iPtr);
+		}
+	}
+
+// from MRemConInterfaceIf
+void CRemConGroupNavigationApiTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData)
+	{
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	LOG1(_L("\taData.Length = %d"), aData.Length());
+
+	/* Decode the get GroupNavigation message */
+	TGroupNavigationPassthroughOperationIds currentOp = static_cast<TGroupNavigationPassthroughOperationIds>(aOperationId);
+  	TRemConCoreApiButtonAction button = static_cast<TRemConCoreApiButtonAction>(aData.Ptr()[0]);
+
+	switch (currentOp)
+		{
+		case ENextGroup:
+			{
+			iObserver.MrcgntoNextGroup( button );
+			break;
+			}
+		case EPreviousGroup:
+			{
+			iObserver.MrcgntoPreviousGroup( button );
+			break;
+			}		
+		default:
+			break;
+
+		}
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/bwins/remconmediabrowseapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,24 @@
+EXPORTS
+	?MrcdumlbFolderListing@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXABV?$TArray@VTRemConItem@@@@I@Z @ 1 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderListing(class TArray<class TRemConItem> const &, unsigned int)
+	?MrcdamlbMediaLibraryStateChange@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXG@Z @ 2 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbMediaLibraryStateChange(unsigned short)
+	?MrcdumlbSearchResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXIH@Z @ 3 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbSearchResult(unsigned int, int)
+	?MrcdumlbMediaElementItemResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXAB_KABVTDesC8@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 4 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbMediaElementItemResult(unsigned long long const &, class TDesC8 const &, unsigned char, class TArray<class TMediaElementAttribute> const &, int)
+	?MrcdumlbMediaLibraryStateChange@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXXZ @ 5 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbMediaLibraryStateChange(void)
+	?MrcdamlbMediaElementItemResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXAB_KABVTDesC8@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 6 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbMediaElementItemResult(unsigned long long const &, class TDesC8 const &, unsigned char, class TArray<class TMediaElementAttribute> const &, int)
+	?MrcdunpbFolderListing@MRemConDatabaseUnawareNowPlayingBrowse@@QAEXABV?$TArray@VTRemConItem@@@@I@Z @ 7 NONAME ; void MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbFolderListing(class TArray<class TRemConItem> const &, unsigned int)
+	?MrcdumlbGetPathResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXIH@Z @ 8 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbGetPathResult(unsigned int, int)
+	?MrcdumlbFolderUpResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXIH@Z @ 9 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderUpResult(unsigned int, int)
+	?MrcdamlbFolderDownResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXIH@Z @ 10 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderDownResult(unsigned int, int)
+	?MrcdumlbFolderDownResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXIH@Z @ 11 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderDownResult(unsigned int, int)
+	?MrcdamlbFolderItemResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXAB_KABVTDesC8@@W4TFolderItemType@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 12 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderItemResult(unsigned long long const &, class TDesC8 const &, enum TFolderItemType, unsigned char, class TArray<class TMediaElementAttribute> const &, int)
+	?MrcdumlbFolderItemResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXAB_KABVTDesC8@@W4TFolderItemType@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 13 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderItemResult(unsigned long long const &, class TDesC8 const &, enum TFolderItemType, unsigned char, class TArray<class TMediaElementAttribute> const &, int)
+	?MrcdamlbFolderListing@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXABV?$TArray@VTRemConItem@@@@GI@Z @ 14 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderListing(class TArray<class TRemConItem> const &, unsigned short, unsigned int)
+	?MrcdamlbGetPathResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXIGH@Z @ 15 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbGetPathResult(unsigned int, unsigned short, int)
+	?MrcdamlbSearchResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXIGH@Z @ 16 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbSearchResult(unsigned int, unsigned short, int)
+	?MrcdanpbFolderListing@MRemConDatabaseAwareNowPlayingBrowse@@QAEXABV?$TArray@VTRemConItem@@@@GI@Z @ 17 NONAME ; void MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbFolderListing(class TArray<class TRemConItem> const &, unsigned short, unsigned int)
+	?MrcdamlbFolderUpResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXIH@Z @ 18 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderUpResult(unsigned int, int)
+	?MrcdunpbMediaElementItemResult@MRemConDatabaseUnawareNowPlayingBrowse@@QAEXAB_KABVTDesC8@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 19 NONAME ; void MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbMediaElementItemResult(unsigned long long const &, class TDesC8 const &, unsigned char, class TArray<class TMediaElementAttribute> const &, int)
+	?NewL@CRemConDatabaseUnawareMediaBrowseTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConDatabaseUnawareMediaLibraryBrowseObserver@@AAVMRemConDatabaseUnawareNowPlayingBrowseObserver@@HAAPAVMRemConDatabaseUnawareMediaLibraryBrowse@@AAPAVMRemConDatabaseUnawareNowPlayingBrowse@@@Z @ 20 NONAME ; class CRemConDatabaseUnawareMediaBrowseTarget * CRemConDatabaseUnawareMediaBrowseTarget::NewL(class CRemConInterfaceSelector &, class MRemConDatabaseUnawareMediaLibraryBrowseObserver &, class MRemConDatabaseUnawareNowPlayingBrowseObserver &, int, class MRemConDatabaseUnawareMediaLibraryBrowse * &, class MRemConDatabaseUnawareNowPlayingBrowse * &)
+	?NewL@CRemConDatabaseAwareMediaBrowseTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConDatabaseAwareMediaLibraryBrowseObserver@@AAVMRemConDatabaseAwareNowPlayingBrowseObserver@@HAAPAVMRemConDatabaseAwareMediaLibraryBrowse@@AAPAVMRemConDatabaseAwareNowPlayingBrowse@@G@Z @ 21 NONAME ; class CRemConDatabaseAwareMediaBrowseTarget * CRemConDatabaseAwareMediaBrowseTarget::NewL(class CRemConInterfaceSelector &, class MRemConDatabaseAwareMediaLibraryBrowseObserver &, class MRemConDatabaseAwareNowPlayingBrowseObserver &, int, class MRemConDatabaseAwareMediaLibraryBrowse * &, class MRemConDatabaseAwareNowPlayingBrowse * &, unsigned short)
+	?MrcdanpbMediaElementItemResult@MRemConDatabaseAwareNowPlayingBrowse@@QAEXAB_KABVTDesC8@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 22 NONAME ; void MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbMediaElementItemResult(unsigned long long const &, class TDesC8 const &, unsigned char, class TArray<class TMediaElementAttribute> const &, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/eabi/remconmediabrowseapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,24 @@
+EXPORTS
+	_ZN36MRemConDatabaseAwareNowPlayingBrowse21MrcdanpbFolderListingERK6TArrayI11TRemConItemEtj @ 1 NONAME
+	_ZN36MRemConDatabaseAwareNowPlayingBrowse30MrcdanpbMediaElementItemResultERKyRK6TDesC8hRK6TArrayI22TMediaElementAttributeEi @ 2 NONAME
+	_ZN37CRemConDatabaseAwareMediaBrowseTarget4NewLER24CRemConInterfaceSelectorR46MRemConDatabaseAwareMediaLibraryBrowseObserverR44MRemConDatabaseAwareNowPlayingBrowseObserveriRP38MRemConDatabaseAwareMediaLibraryBrowseRP36MRemConDatabaseAwareNowPlayingBrowset @ 3 NONAME
+	_ZN38MRemConDatabaseAwareMediaLibraryBrowse20MrcdamlbSearchResultEjti @ 4 NONAME
+	_ZN38MRemConDatabaseAwareMediaLibraryBrowse21MrcdamlbFolderListingERK6TArrayI11TRemConItemEtj @ 5 NONAME
+	_ZN38MRemConDatabaseAwareMediaLibraryBrowse21MrcdamlbGetPathResultEjti @ 6 NONAME
+	_ZN38MRemConDatabaseAwareMediaLibraryBrowse22MrcdamlbFolderUpResultEji @ 7 NONAME
+	_ZN38MRemConDatabaseAwareMediaLibraryBrowse24MrcdamlbFolderDownResultEji @ 8 NONAME
+	_ZN38MRemConDatabaseAwareMediaLibraryBrowse24MrcdamlbFolderItemResultERKyRK6TDesC815TFolderItemTypehRK6TArrayI22TMediaElementAttributeEi @ 9 NONAME
+	_ZN38MRemConDatabaseAwareMediaLibraryBrowse30MrcdamlbMediaElementItemResultERKyRK6TDesC8hRK6TArrayI22TMediaElementAttributeEi @ 10 NONAME
+	_ZN38MRemConDatabaseAwareMediaLibraryBrowse31MrcdamlbMediaLibraryStateChangeEt @ 11 NONAME
+	_ZN38MRemConDatabaseUnawareNowPlayingBrowse21MrcdunpbFolderListingERK6TArrayI11TRemConItemEj @ 12 NONAME
+	_ZN38MRemConDatabaseUnawareNowPlayingBrowse30MrcdunpbMediaElementItemResultERKyRK6TDesC8hRK6TArrayI22TMediaElementAttributeEi @ 13 NONAME
+	_ZN39CRemConDatabaseUnawareMediaBrowseTarget4NewLER24CRemConInterfaceSelectorR48MRemConDatabaseUnawareMediaLibraryBrowseObserverR46MRemConDatabaseUnawareNowPlayingBrowseObserveriRP40MRemConDatabaseUnawareMediaLibraryBrowseRP38MRemConDatabaseUnawareNowPlayingBrowse @ 14 NONAME
+	_ZN40MRemConDatabaseUnawareMediaLibraryBrowse20MrcdumlbSearchResultEji @ 15 NONAME
+	_ZN40MRemConDatabaseUnawareMediaLibraryBrowse21MrcdumlbFolderListingERK6TArrayI11TRemConItemEj @ 16 NONAME
+	_ZN40MRemConDatabaseUnawareMediaLibraryBrowse21MrcdumlbGetPathResultEji @ 17 NONAME
+	_ZN40MRemConDatabaseUnawareMediaLibraryBrowse22MrcdumlbFolderUpResultEji @ 18 NONAME
+	_ZN40MRemConDatabaseUnawareMediaLibraryBrowse24MrcdumlbFolderDownResultEji @ 19 NONAME
+	_ZN40MRemConDatabaseUnawareMediaLibraryBrowse24MrcdumlbFolderItemResultERKyRK6TDesC815TFolderItemTypehRK6TArrayI22TMediaElementAttributeEi @ 20 NONAME
+	_ZN40MRemConDatabaseUnawareMediaLibraryBrowse30MrcdumlbMediaElementItemResultERKyRK6TDesC8hRK6TArrayI22TMediaElementAttributeEi @ 21 NONAME
+	_ZN40MRemConDatabaseUnawareMediaLibraryBrowse31MrcdumlbMediaLibraryStateChangeEv @ 22 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,44 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconmediabrowseapi.mmp
+
+PRJ_EXPORTS
+../public/remcondatabaseawaremediabrowsetarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawaremediabrowsetarget.h)
+../public/remcondatabaseawaremedialibrarybrowse.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawaremedialibrarybrowse.h)
+../public/remcondatabaseawaremedialibrarybrowseobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawaremedialibrarybrowseobserver.h)
+../public/remcondatabaseawarenowplayingbrowse.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawarenowplayingbrowse.h)
+../public/remcondatabaseawarenowplayingbrowseobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawarenowplayingbrowseobserver.h)
+
+../public/remcondatabaseunawaremediabrowsetarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawaremediabrowsetarget.h)
+../public/remcondatabaseunawaremedialibrarybrowse.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawaremedialibrarybrowse.h)
+../public/remcondatabaseunawaremedialibrarybrowseobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawaremedialibrarybrowseobserver.h)
+../public/remcondatabaseunawarenowplayingbrowse.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingbrowse.h)
+../public/remcondatabaseunawarenowplayingbrowseobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingbrowseobserver.h)
+
+../public/remconmediaerror.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediaerror.h)
+../public/remconmediabrowsetypes.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediabrowsetypes.h)
+../public/remconmediabrowsepanic.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediabrowsepanic.h)
+
+../public/remconmediabrowsetargetbase.h	SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(remcon/remconmediabrowsetargetbase.h)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/group/remconmediabrowseapi.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,66 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconmediainformationapi.dll Remote Control Media Information API - an outer-layer client side library.
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET			remconmediabrowseapi.dll
+TARGETPATH		/system/libs
+
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x10285bbb
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+
+SOURCE          remcondatabaseawaremediabrowsetarget.cpp 
+SOURCE          remcondatabaseawaremedialibrarybrowse.cpp 
+SOURCE          remcondatabaseawarenowplayingbrowse.cpp 
+
+SOURCE          remcondatabaseunawaremediabrowsetarget.cpp 
+SOURCE          remcondatabaseunawaremedialibrarybrowse.cpp 
+SOURCE          remcondatabaseunawarenowplayingbrowse.cpp 
+
+SOURCE          remconmediabrowsetargetbase.cpp 
+SOURCE			remconmediabrowseutils.cpp
+
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+USERINCLUDE		../inc
+USERINCLUDE		../../common
+
+LIBRARY 		euser.lib
+LIBRARY 		remconinterfacebase.lib
+LIBRARY 		avrcpipc.lib
+LIBRARY			estor.lib 
+LIBRARY			remconmediainformationapi.lib
+
+#include <bluetooth/btlogger.mmh>
+#include <comms-infras/commsdebugutility.mmh>
+
+UNPAGED
+
+SMPSAFE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/inc/remconmediabrowsefault.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,50 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#ifndef REMCONMEDIABROWSEFAULT_H
+#define REMCONMEDIABROWSEFAULT_H
+
+#include <e32base.h>
+
+_LIT(KMediaBrowseFaultName, "RcMbFault");
+
+enum TRemConMediaBrowseFault
+	{
+	EInvalidEventId = 0,
+	EUnexpectedNextMessageCallback = 1,
+	EResultErrorCodeMismatch = 2,
+	EUnexpectedOperationId = 3,
+	ERequestWithoutMaxResponseBeingSet = 4,
+	// The cookie update request is only generated by the
+	// bearer and so should always be correctly formatted
+	EBadlyFormattedMediaLibraryStateCookieUpdate = 5,
+	ENonZeroMediaLibraryStateCookie = 6,
+	};
+
+class MediaBrowseFault
+	{
+public:
+	static void Fault(TRemConMediaBrowseFault aFault);
+	};
+
+#endif //REMCONMEDIABROWSEFAULT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseawaremediabrowsetarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,102 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONDATABASEAWAREMEDIABROWSETARGET_H
+#define REMCONDATABASEAWAREMEDIABROWSETARGET_H
+
+#include <e32base.h>
+#include <remcondatabaseawaremedialibrarybrowse.h>
+#include <remcondatabaseawaremedialibrarybrowseobserver.h>
+#include <remcondatabaseawarenowplayingbrowse.h>
+#include <remcondatabaseawarenowplayingbrowseobserver.h>
+#include <remcon/remconmediabrowsetargetbase.h>
+
+NONSHARABLE_CLASS(CRemConDatabaseAwareMediaBrowseTarget) : public CRemConMediaBrowseTargetBase,
+	private MRemConDatabaseAwareMediaLibraryBrowse, private MRemConDatabaseAwareNowPlayingBrowse
+	{
+public:
+	IMPORT_C static CRemConDatabaseAwareMediaBrowseTarget* NewL(
+			CRemConInterfaceSelector& aInterfaceSelector,
+			MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, 
+			MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver,
+			TBool aSearchSupported, 
+			MRemConDatabaseAwareMediaLibraryBrowse*& aMlInterface, 
+			MRemConDatabaseAwareNowPlayingBrowse*& aNpInterface,
+			TUint16 aMediaLibraryStateCookie);
+	virtual ~CRemConDatabaseAwareMediaBrowseTarget();
+	
+private:
+	// from MRemConDatabaseAwareMediaLibraryBrowse
+	virtual void MrcdamlbDoFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint16 aMediaLibraryStateCookie, 
+			TUint aResult);
+	
+	virtual void MrcdamlbDoFolderUpResult(TUint aItemCount, TInt aResult);
+	virtual void MrcdamlbDoFolderDownResult(TUint aItemCount, TInt aResult);
+	
+	virtual void MrcdamlbDoGetPathResult(TUint aItemCount, 
+			TUint16 aMediaLibraryStateCookie, 
+			TInt aResult);
+	
+	virtual void MrcdamlbDoSearchResult(TUint aNumberItemsFound,
+			TUint16 aMediaLibraryStateCookie, 
+			TInt aResult);
+	
+	virtual void MrcdamlbDoMediaLibraryStateChange(TUint16 aMediaLibraryStateCookie);
+	
+	virtual void MrcdamlbDoFolderItemResult(const TRemConItemUid& aFolderID,
+			const TDesC8& aFolderName, 
+			TFolderItemType aFolderType, 
+			TFolderItemPlayable aPlayable,
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+	virtual void MrcdamlbDoMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+	// from MRemConDatabaseAwareNowPlayingBrowse
+	virtual void MrcdanpbDoFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint16 aMediaLibraryStateCookie, 
+			TUint aResult);
+		
+	virtual void MrcdanpbDoMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+private:
+	CRemConDatabaseAwareMediaBrowseTarget(
+			CRemConInterfaceSelector& aInterfaceSelector, 
+			MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, 
+			MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver, 
+			MRemConDatabaseAwareMediaLibraryBrowse*& aMlInterface, 
+			MRemConDatabaseAwareNowPlayingBrowse*& aNpInterface,
+			TUint16 aMediaLibraryStateCookie);
+	void ConstructL(TBool aSearchSupported);
+	};
+
+#endif //REMCONDATABASEAWAREMEDIABROWSETARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseawaremedialibrarybrowse.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,95 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <e32base.h>
+#include <remconmediabrowsetypes.h>
+
+#ifndef REMCONDATABASEAWAREMEDIALIBRARYBROWSE_H
+#define REMCONDATABASEAWAREMEDIALIBRARYBROWSE_H
+
+NONSHARABLE_CLASS(MRemConDatabaseAwareMediaLibraryBrowse)
+	{
+public:
+	IMPORT_C void MrcdamlbFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint16 aMediaLibraryStateCookie, 
+			TUint aResult);
+	
+	IMPORT_C void MrcdamlbFolderUpResult(TUint aItemCount, TInt aResult);
+	IMPORT_C void MrcdamlbFolderDownResult(TUint aItemCount, TInt aResult);
+	
+	IMPORT_C void MrcdamlbGetPathResult(TUint aItemCount, 
+			TUint16 aMediaLibraryStateCookie, 
+			TInt aResult);
+	
+	IMPORT_C void MrcdamlbSearchResult(TUint aNumberItemsFound,
+			TUint16 aMediaLibraryStateCookie, 
+			TInt aResult);
+	
+	IMPORT_C void MrcdamlbMediaLibraryStateChange(TUint16 aMediaLibraryStateCookie);
+	
+	IMPORT_C void MrcdamlbFolderItemResult(const TRemConItemUid& aFolderID,
+			const TDesC8& aFolderName, 
+			TFolderItemType aFolderType, 
+			TFolderItemPlayable aPlayable,
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+	IMPORT_C void MrcdamlbMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+private:
+	virtual void MrcdamlbDoFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint16 aMediaLibraryStateCookie, 
+			TUint aResult) = 0;
+	
+	virtual void MrcdamlbDoFolderUpResult(TUint aItemCount, TInt aResult) = 0;
+	virtual void MrcdamlbDoFolderDownResult(TUint aItemCount, TInt aResult) = 0;
+	
+	virtual void MrcdamlbDoGetPathResult(TUint aItemCount, 
+			TUint16 aMediaLibraryStateCookie, 
+			TInt aResult) = 0;
+	
+	virtual void MrcdamlbDoSearchResult(TUint aNumberItemsFound,
+			TUint16 aMediaLibraryStateCookie, 
+			TInt aResult) = 0;
+	
+	virtual void MrcdamlbDoMediaLibraryStateChange(TUint16 aMediaLibraryStateCookie) = 0;
+	
+	virtual void MrcdamlbDoFolderItemResult(const TRemConItemUid& aFolderID,
+			const TDesC8& aFolderName, 
+			TFolderItemType aFolderType, 
+			TFolderItemPlayable aPlayable,
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult) = 0;
+	
+	virtual void MrcdamlbDoMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult) = 0;
+	};
+
+#endif // REMCONDATABASEAWAREMEDIALIBRARYBROWSE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseawaremedialibrarybrowseobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,174 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <e32base.h>
+#include <remconmediabrowsetypes.h>
+
+#ifndef REMCONDATABASEAWAREMEDIALIBRARYBROWSEOBSERVER_H
+#define REMCONDATABASEAWAREMEDIALIBRARYBROWSEOBSERVER_H
+
+NONSHARABLE_CLASS(MRemConDatabaseAwareMediaLibraryBrowseObserver)
+	{
+public:
+	/**
+	This requests a list of the items present in a folder.  No metadata is 
+	requested, that can be retrieved separately on a per item basis. 
+	 
+	The result should be returned via a call to
+	MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderListing(). And 
+	the ordering should be as shown locally, but should list folders before
+	media element items.
+	
+	@param aScope The scope in which the folder listing is made. 
+	       This indicates which listing should be returned. If the scope is 
+	       EBrowseFolder then the contents of the current browsed folder 
+	       should be returned. If it is the ESearchResultFolder scope then 
+	       the contents of the folder populated by the last search should be 
+	       returned.
+	
+	@param aStartItem The offset into the folder listing of the first item to 
+	       retrieve. If there is no media available at this offset the error 
+	       KErrMediaBrowseInvalidOffset should be returned via the result call
+	       to MrcdamlbFolderListing().
+	
+	@param aEndItem The offset into the folder listing of the final item to
+	       retrieve. If this is beyond the end of the folder listing then the 
+	       items from the aStartItem offset to the end of the listing should 
+	       be returned via the result call to MrcdamlbFolderListing().
+	*/
+	virtual void MrcdamlboGetFolderListing(TRemConFolderScope aScope,
+			TUint aStartItem, 
+			TUint aEndItem) = 0;
+	
+	/**
+	Requests a specific item which may be a folder item or a media element 
+	item. 
+	
+	If it returns KErrNone the client must return the metadata for the 
+	requested item through the response function either
+	MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderItemResult() 
+	or 
+	MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbMediaElementItemResult() 
+	according to the item type which is a folder item or media element item. 
+	If it is unable to process this call then it can return error but not
+	call the response function.
+	
+	@param aScope The scope in which the item is present.  If the scope is 
+	       EBrowseFolder then the item is present in the media library's 
+	       virtual filesystem. If it is the ESearchResultFolder scope then the
+	       item is present in the current set of search results.
+	
+	@param aItemId The UID for the requested Item.
+	
+	@param aIter An iterator for TMediaAttributeIds containing a list of 
+	       TMediaAttributeIds requested by the controller. It is intended for
+	       the media element item, so omit it if the item is a folder item.
+	
+	@param aMediaLibraryStateCookie The cookie which the remote device 
+	       believes refers to the current state of the media library.  If this
+	       does not match the current state according to the client then the 
+	       client shall call 
+	       MrcdamlbFolderItemResult() or MrcdamlbMediaElementItemResult() to
+	       return the error KErrInvalidMediaLibraryStateCookie according it 
+	       is a folder item or a media element item.
+	@return The call back result.
+	      - KErrNone If success.
+	      - The appropriate error code.
+	*/
+	virtual TInt MrcdamlboGetItem(TRemConFolderScope aScope,
+			const TRemConItemUid& aItemId, 
+			TMediaAttributeIter& aIter, 
+			TUint16 aMediaLibraryStateCookie) = 0;
+	
+	/**
+	This requests that the current position within the folder heirarchy is 
+	moved to the next folder up.
+	
+	The result of this operation must be returned via a call to 
+	MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderUpResult.
+	
+	@param aMediaLibraryStateCookie The cookie which the remote device 
+	       believes refers to the current state of the media library.  If this
+	       does not match the current state according to the client then the 
+	       client should call 
+	       MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderUpResult with 
+	       the error KErrInvalidMediaLibraryStateCookie.
+	 */
+	virtual void MrcdamlboFolderUp(TUint16 aMediaLibraryStateCookie) = 0;
+	
+	/**
+	This requests that the current position within the folder hierarchy is 
+	moved to the child folder of the current folder specified by aFolder.
+	 
+	The result of this operation must be returned via a call to 
+	MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderDownResult.
+	 
+	@param aFolder The child folder to change into.
+	
+	@param aMediaLibraryStateCookie The cookie which the remote device 
+	       believes refers to the current state of the media library. If this
+	       does not match the current state according to the client then the 
+	       client should call 
+	       MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderDownResult()
+	       with the error KErrInvalidMediaLibraryStateCookie.
+	*/
+	virtual void MrcdamlboFolderDown(const TRemConItemUid& aFolder,
+			TUint16 aMediaLibraryStateCookie) = 0;
+	
+	/**
+	This requests the current path. 
+	
+	The client is responsible for appending items to the array then call 
+	MrcdamlbGetPathResult() when completed. Once the item is appended in the 
+	array the ownership of the item is taken so the client should keep the 
+	item valid and never destroy the item. If the client can append the items 
+	successfully then it should return a result via MrcdamlbGetPathResult(). 
+	If the client appends some items to the array but then fails to append all
+	the items then it should return an error via MrcdamlbGetPathResult().
+	
+	@see MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbGetPathResult()
+	 
+	@param aPath The current path. 
+	       Each entry in the array in one level of the path.  For example the 
+	       path /A/B/C would be provided as:
+	       aPath[0] 'A'
+	       aPath[1] 'B'
+	       aPath[2] 'C'
+	       All string are in UTF-8.
+	*/
+	virtual void MrcdamlboGetPath(RPointerArray<HBufC8>& aPath) = 0;
+	
+	/**
+	Perform a search in the current location for items 
+	matching the search string.
+	
+	@param aSearch The string to search on in UTF-8. The client can use it until 
+	         the client has called MrcdamlbSearchResult().
+	
+	@see MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbSearchResult()
+	*/
+	virtual void MrcdamlboSearch(const TDesC8& aSearch) = 0;
+	};
+
+
+#endif // REMCONDATABASEAWAREMEDIALIBRARYBROWSEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseawarenowplayingbrowse.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,56 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <e32base.h>
+#include <remconmediabrowsetypes.h>
+
+#ifndef REMCONDATABASEAWARENOWPLAYINGBROWSE_H
+#define REMCONDATABASEAWARENOWPLAYINGBROWSE_H
+
+NONSHARABLE_CLASS(MRemConDatabaseAwareNowPlayingBrowse)
+	{
+public:
+	IMPORT_C void MrcdanpbFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint16 aMediaLibraryStateCookie, 
+			TUint aResult);
+			
+	IMPORT_C void MrcdanpbMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+private:
+	virtual void MrcdanpbDoFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint16 aMediaLibraryStateCookie, 
+			TUint aResult) = 0;
+		
+	virtual void MrcdanpbDoMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult) = 0;
+	};
+
+#endif //REMCONDATABASEAWARENOWPLAYINGBROWSE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseawarenowplayingbrowseobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,87 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONDATABASEAWARENOWPLAYINGBROWSEOBSERVER_H
+#define REMCONDATABASEAWARENOWPLAYINGBROWSEOBSERVER_H
+
+NONSHARABLE_CLASS(MRemConDatabaseAwareNowPlayingBrowseObserver)
+	{
+public:
+	/**
+	Requests a listing of the items present in the Now Playing folder. If the 
+	media player does not natively support a Now Plyaing folder the client
+	shall return a listing of one item which is the currently playing media 
+	element.
+	
+	No metadata is requested, that can be retrieved separately on a per item 
+	basis. Trying this out for now as it fits in with the existing metadata 
+	attribute collection, and means that we would also separate out the 
+	listing from the metadata. This means that we can retrieve a NowPlaying 
+	list and then request the metadata from the observer.
+	
+	The result shall be returned via a call to 
+	MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbFolderListing() 
+	
+	@param aStartItem The offset into the folder listing of the first item to 
+	       retrieve. If there is no media available at this offset the error 
+	       KErrMediaBrowseInvalidOffset shall be returned via the result call
+	       to MrcdanpbFolderListing().
+	
+	@param aEndItem The offset into the folder listing of the final item to 
+	       retrieve. If this is beyond the end of the folder listing then the 
+	       items from the aStartItem offset to the end of the listing shall 
+	       be returned via the result call to MrcdanpbFolderListing().
+	*/
+	virtual void MrcdanpboGetFolderListing(TUint aStartItem, 
+			TUint aEndItem) = 0;
+	
+	/**
+	Requests a set of metadata corresponding to a specific media element item. 
+	 
+	The client must return the metadata for the requested item via using 
+	MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbMediaElementItemResult() if
+	it returns KErrNone, if it is unable to to process this call then it can
+	return error but not call the response function
+	MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbMediaElementItemResult().
+	
+	@param aItemId The UID for the requested media element item.
+	
+	@param aIter An iterator for TMediaAttributeIds containing a list of 
+	       TMediaAttributeIds requested by the controller.
+			    
+	@param aMediaLibraryStateCookie The cookie which the remote device 
+	       believes refers to the current state of the media library. If this 
+	       does not match the current state according to the client then the 
+	       client should call MrcdanpbMediaElementItemResult() with the error 
+	       KErrInvalidMediaLibraryStateCookie.
+	       
+	@return The call back result.
+	      - KErrNone If success.
+	      - The appropriate error code.
+	*/
+	virtual TInt MrcdanpboGetItem(const TRemConItemUid& aItemId, 
+			TMediaAttributeIter& aIter, 
+			TUint16 aMediaLibraryStateCookie) = 0;
+	};
+
+#endif //REMCONDATABASEAWARENOWPLAYINGBROWSEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseunawaremediabrowsetarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,98 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONDATABASEUNAWAREMEDIABROWSETARGET_H
+#define REMCONDATABASEUNAWAREMEDIABROWSETARGET_H
+
+#include <e32base.h>
+#include <remcondatabaseunawaremedialibrarybrowse.h>
+#include <remcondatabaseunawaremedialibrarybrowseobserver.h>
+#include <remcondatabaseunawarenowplayingbrowse.h>
+#include <remcondatabaseunawarenowplayingbrowseobserver.h>
+#include <remcon/remconmediabrowsetargetbase.h>
+
+NONSHARABLE_CLASS(CRemConDatabaseUnawareMediaBrowseTarget) : public CRemConMediaBrowseTargetBase,
+private MRemConDatabaseUnawareMediaLibraryBrowse, private MRemConDatabaseUnawareNowPlayingBrowse
+	{
+public:
+	IMPORT_C static CRemConDatabaseUnawareMediaBrowseTarget* NewL(
+			CRemConInterfaceSelector& aInterfaceSelector, 
+			MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, 
+			MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver,
+			TBool aSearchSupported, 
+			MRemConDatabaseUnawareMediaLibraryBrowse*& aMlInterface, 
+			MRemConDatabaseUnawareNowPlayingBrowse*& aNpInterface);
+	
+	virtual ~CRemConDatabaseUnawareMediaBrowseTarget();
+
+private:
+	// from MRemConDatabaseUnawareMediaLibraryBrowse
+	virtual void MrcdumlbDoFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint aResult);
+	
+	virtual void MrcdumlbDoFolderUpResult(TUint aItemCount, TInt aResult);
+	virtual void MrcdumlbDoFolderDownResult(TUint aItemCount, TInt aResult);
+	
+	virtual void MrcdumlbDoGetPathResult(TUint aItemCount,  
+			TInt aResult);
+	
+	virtual void MrcdumlbDoSearchResult(TUint aNumberItemsFound,
+			TInt aResult);
+	
+	virtual void MrcdumlbDoMediaLibraryStateChange();
+	
+	virtual void MrcdumlbDoFolderItemResult(const TRemConItemUid& aFolderID,
+			const TDesC8& aFolderName, 
+			TFolderItemType aFolderType, 
+			TFolderItemPlayable aPlayable,
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+	virtual void MrcdumlbDoMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+	// from MRemConDatabaseUnawareNowPlayingBrowse
+	virtual void MrcdunpbDoFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint aResult);
+		
+	virtual void MrcdunpbDoMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+private:
+	CRemConDatabaseUnawareMediaBrowseTarget(
+			CRemConInterfaceSelector& aInterfaceSelector, 
+			MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, 
+			MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver, 
+			MRemConDatabaseUnawareMediaLibraryBrowse*& aMlInterface, 
+			MRemConDatabaseUnawareNowPlayingBrowse*& aNpInterface);
+	
+	void ConstructL(TBool aSearchSupported);
+	};
+
+#endif //REMCONDATABASEUNAWAREMEDIABROWSETARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseunawaremedialibrarybrowse.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,90 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <e32base.h>
+#include <remconmediabrowsetypes.h>
+
+#ifndef REMCONDATABASEUNAWAREMEDIALIBRARYBROWSE_H
+#define REMCONDATABASEUNAWAREMEDIALIBRARYBROWSE_H
+
+NONSHARABLE_CLASS(MRemConDatabaseUnawareMediaLibraryBrowse)
+	{
+public:
+	IMPORT_C void MrcdumlbFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint aResult);
+	
+	IMPORT_C void MrcdumlbFolderUpResult(TUint aItemCount, TInt aResult);
+	IMPORT_C void MrcdumlbFolderDownResult(TUint aItemCount, TInt aResult);
+	
+	IMPORT_C void MrcdumlbGetPathResult(TUint aItemCount, 
+			TInt aResult);
+	
+	IMPORT_C void MrcdumlbSearchResult(TUint aNumberItemsFound,
+			TInt aResult);
+	
+	IMPORT_C void MrcdumlbMediaLibraryStateChange();
+	
+	IMPORT_C void MrcdumlbFolderItemResult(const TRemConItemUid& aFolderID,
+			const TDesC8& aFolderName, 
+			TFolderItemType aFolderType, 
+			TFolderItemPlayable aPlayable,
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+	IMPORT_C void MrcdumlbMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+private:
+	virtual void MrcdumlbDoFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint aResult) = 0;
+	
+	virtual void MrcdumlbDoFolderUpResult(TUint aItemCount, TInt aResult) = 0;
+	virtual void MrcdumlbDoFolderDownResult(TUint aItemCount, TInt aResult) = 0;
+	
+	virtual void MrcdumlbDoGetPathResult(TUint aItemCount,  
+			TInt aResult) = 0;
+	
+	virtual void MrcdumlbDoSearchResult(TUint aNumberItemsFound,
+			TInt aResult) = 0;
+	
+	virtual void MrcdumlbDoMediaLibraryStateChange() = 0;
+	
+	virtual void MrcdumlbDoFolderItemResult(const TRemConItemUid& aFolderID,
+			const TDesC8& aFolderName, 
+			TFolderItemType aFolderType, 
+			TFolderItemPlayable aPlayable,
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult) = 0;
+	
+	virtual void MrcdumlbDoMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult) = 0;
+	};
+
+#endif //REMCONDATABASEUNAWAREMEDIALIBRARYBROWSE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseunawaremedialibrarybrowseobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,147 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONDATABASEUNAWAREMEDIALIBRARYBROWSEOBSERVER_H
+#define REMCONDATABASEUNAWAREMEDIALIBRARYBROWSEOBSERVER_H
+
+NONSHARABLE_CLASS(MRemConDatabaseUnawareMediaLibraryBrowseObserver)
+	{
+public:
+	/**
+	This requests a list of the items present in a folder.  No metadata is 
+	requested, that can be retrieved separately on a per item basis.  
+	
+	The result should be returned via a call to
+	MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderListing(). And 
+	the ordering should be as shown locally, but should list folders before
+	media element items.
+	
+	@param aScope The scope in which the folder listing is made. 
+	       This indicates which listing should be returned. If the scope is 
+	       EBrowseFolder then the contents of the current browsed 
+	       folder should be returned. If it is the ESearchResultFolder scope 
+	       then the contents of the folder populated by the last search 
+	       should be returned.
+	
+	@param aStartItem The offset into the folder listing of the first item to 
+	       retrieve. If there is no media available at this offset the error 
+	       KErrMediaBrowseInvalidOffset should be returned via the result call
+	       to MrcdumlbFolderListing().
+	
+	@param aEndItem The offset into the folder listing of the final item to
+	       retrieve. If this is beyond the end of the folder listing then the 
+	       items from the aStartItem offset to the end of the listing should 
+	       be returned via the result call to MrcdumlbFolderListing().
+	*/
+	virtual void MrcdumlboGetFolderListing(TRemConFolderScope aScope,
+			TUint aStartItem, 
+			TUint aEndItem) = 0;
+	
+	/**
+	Requests a specific item which may be a folder item or a media element 
+	item. 
+	
+	If it returns KErrNone the client must return the metadata for the 
+	requested item through the response function either
+	MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderItemResult() 
+	or 
+	MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbMediaElementItemResult()
+	according to the item type which is a folder item or media element item.
+	If it is unable to process this call then it can return error but not
+	call the response function.
+	
+	@param aScope The scope in which the item is present.  If the scope is 
+	       EBrowseFolder then the item is present in the media library's 
+	       virtual filesystem. If it is the ESearchResultFolder scope then the
+	       item is present in the current set of search results.
+	
+	@param aItemId The UID for the requested Item.
+	
+	@param aIter An iterator for TMediaAttributeIds containing a list of 
+	       TMediaAttributeIds requested by the controller. It is intended for
+	       the media element item, so omit it if the item is a folder item.
+
+	@return The call back result.
+	      - KErrNone If success.
+	      - The appropriate error code.
+    */
+	virtual TInt MrcdumlboGetItem(TRemConFolderScope aScope,
+			const TRemConItemUid& aItemId, 
+			TMediaAttributeIter& aIter) = 0;
+	
+	/**
+	This requests that the current position within the folder heirarchy is 
+	moved to the next folder up.
+	
+	The result of this operation must be returned via a call to 
+	MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderUpResult().
+	*/
+	virtual void MrcdumlboFolderUp() = 0;
+	
+	/**
+	This requests that the current position within the folder hierarchy is 
+	moved to the child folder of the current folder specified by aFolder.
+	 
+	The result of this operation must be returned via a call to 
+	MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderDownResult().
+	 
+	@param aFolder The child folder to change into.
+	*/
+	virtual void MrcdumlboFolderDown(const TRemConItemUid& aFolder) = 0;
+	
+	/**
+	This requests the current path. 
+	
+	The client is responsible for appending items to the array then call 
+	MrcdumlbGetPathResult() when completed. Once the item is appended in the 
+	array the ownership of the item is taken so the client should keep the 
+	item valid and never destroy the item. If the client can append the items 
+	successfully then it must return a result via MrcdumlbGetPathResult(). 
+	If the client appends some items to the array but then fails to append all
+	the items then it must return an error via MrcdumlbGetPathResult().
+	
+	@see MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbGetPathResult()
+	 
+	@param aPath The current path. 
+	       Each entry in the array in one level of the path.  For example the 
+	       path /A/B/C would be provided as:
+	       aPath[0] 'A'
+	       aPath[1] 'B'
+	       aPath[2] 'C'
+	       All string are in UTF-8.
+	*/
+	virtual void MrcdumlboGetPath(RPointerArray<HBufC8>& aPath) = 0;
+	
+	/**
+	Perform a search in the current location for items 
+	matching the search string.
+	
+	@param aSearch The string to search on in UTF-8. The client can use it until 
+	         the client has called MrcdumlbSearchResult().
+	
+	@see MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbSearchResult()
+	*/
+	virtual void MrcdumlboSearch(const TDesC8& aSearch) = 0;
+	};
+
+#endif //REMCONDATABASEUNAWAREMEDIALIBRARYBROWSEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseunawarenowplayingbrowse.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,54 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <e32base.h>
+#include <remconmediabrowsetypes.h>
+
+#ifndef REMCONDATABASEUNAWARENOWPLAYINGBROWSE_H
+#define REMCONDATABASEUNAWARENOWPLAYINGBROWSE_H
+
+NONSHARABLE_CLASS(MRemConDatabaseUnawareNowPlayingBrowse)
+	{
+public:
+	IMPORT_C void MrcdunpbFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint aResult);
+			
+	IMPORT_C void MrcdunpbMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+private:
+	virtual void MrcdunpbDoFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint aResult) = 0;
+		
+	virtual void MrcdunpbDoMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult) = 0;
+	};
+
+#endif //REMCONDATABASEUNAWARENOWPLAYINGBROWSE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remcondatabaseunawarenowplayingbrowseobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,80 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONDATABASEUNAWARENOWPLAYINGBROWSEOBSERVER_H
+#define REMCONDATABASEUNAWARENOWPLAYINGBROWSEOBSERVER_H
+
+NONSHARABLE_CLASS(MRemConDatabaseUnawareNowPlayingBrowseObserver)
+	{
+public:
+	/**
+	Requests a listing of the items present in the Now Playing folder. If the 
+	media player does not natively support a Now Plyaing folder the client
+	shall return a listing of one item which is the currently playing media 
+	element.
+	
+	No metadata is requested, that can be retrieved separately on a per item 
+	basis. Trying this out for now as it fits in with the existing metadata 
+	attribute collection, and means that we would also separate out the 
+	listing from the metadata. This means that we can retrieve a NowPlaying 
+	list and then request the metadata from the observer.
+	
+	The result should be returned via a call to 
+	MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbFolderListing().
+	
+	@param aStartItem The offset into the folder listing of the first item to 
+	       retrieve. If there is no media available at this offset the error 
+	       KErrMediaBrowseInvalidOffset should be returned via the result call
+	       to MrcdunpbFolderListing().
+	
+	@param aEndItem The offset into the folder listing of the final item to 
+	       retrieve. If this is beyond the end of the folder listing then the 
+	       items from the aStartItem offset to the end of the listing should 
+	       be returned via the result call to MrcdunpbFolderListing().
+	*/
+	virtual void MrcdunpboGetFolderListing(TUint aStartItem, 
+			TUint aEndItem) = 0;
+	
+	/**
+	Requests a set of metadata corresponding to a specific media element item. 
+	 
+	The client must return the metadata for the requested item via using 
+	MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbMediaElementItemResult()
+	if it returns KErrNone, if it is unable to process this call then it can
+	return error but not call the response function 
+	MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbMediaElementItemResult(). 
+	
+	@param aItemId The UID for the requested media element item.
+	
+	@param aIter An iterator for TMediaAttributeIds containing a list of 
+	       TMediaAttributeIds requested by the controller.
+			    
+	@return The call back result.
+	      - KErrNone If success.
+	      - The appropriate error code.
+	*/
+	virtual TInt MrcdunpboGetItem(const TRemConItemUid& aItemId, 
+			TMediaAttributeIter& aIter) = 0;
+	};
+
+#endif //REMCONDATABASEUNAWARENOWPLAYINGBROWSEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remconmediabrowsepanic.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,51 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONMEDIABROWSEPANIC_H
+#define REMCONMEDIABROWSEPANIC_H
+
+#include <e32base.h>
+
+_LIT(KMediaBrowsePanicName, "RcMediaBrowse");
+
+enum TRemConMediaBrowsePanic
+	{
+	EFolderListingProvidedTwice = 0,
+	EFolderItemResultWithoutRequest = 1,
+	EInvalidFolderType = 2,
+	EInvalidPlayableValue = 3,
+	EInvalidMediaType = 4,
+	EMediaElementItemResultWithoutRequest = 5,
+	ESearchResultWithoutRequest = 6,
+	/** The value of the media library state cookie must not be zero. */
+	EZeroMediaLibraryStateCookie = 7,
+	EUnexpectedNullMemberField = 8,
+	};
+
+class MediaBrowsePanic
+	{
+public:
+	static void Panic(TRemConMediaBrowsePanic aPanic);
+	};
+
+#endif //REMCONMEDIABROWSEPANIC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remconmediabrowsetargetbase.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,217 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONMEDIABROWSETARGETBASE_H
+#define REMCONMEDIABROWSETARGETBASE_H
+
+#include <remcondatabaseawaremedialibrarybrowseobserver.h>
+#include <remcondatabaseawarenowplayingbrowseobserver.h>
+#include <remcondatabaseunawaremedialibrarybrowseobserver.h>
+#include <remcondatabaseunawarenowplayingbrowseobserver.h>
+#include <remconmediabrowsetypes.h>
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+
+class RRemConGetFolderItemsResponse;
+class RRemConGetItemAttributesResponse;
+class RRemConGetPathResponse;
+class TRemConMessageQueue;
+/**
+This interface enables the client to present a heirarchical view
+of the local media library for browsing by a remote entity.
+
+The view is a virtual filesystem and does not need to correspond
+directly to any structure on local storage.  It could for example
+map onto a database of media content.
+
+Each item in the media library is identified by a UID.  At a 
+minimum this must uniquely identify an element within a folder.
+For clients that support it the UID can be persistant accross
+the entire virtual filesystem.  In this case a media library
+state cookie is used to ensure that that state is consistent
+between the client and the remote device. 
+
+This interface does not have NewL()/NewLC, so the client should 
+use the object CRemConDatabaseAwareMediaBrowseTarget or 
+CRemConDatabaseUnawareMediaBrowseTarget to use its exported functions.
+
+This class is only to be used by classes currently derived from it.
+
+@see CRemConDatabaseAwareMediaBrowseTarget
+@see CRemConDatabaseUnawareMediaBrowseTarget
+*/
+NONSHARABLE_CLASS(CRemConMediaBrowseTargetBase) : public CRemConInterfaceBase, public MRemConInterfaceIf
+	{
+protected:
+	CRemConMediaBrowseTargetBase(CRemConInterfaceSelector& aInterfaceSelector, 
+			MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, 
+			MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver,
+			TUint16 aMediaLibraryStateCookie);
+
+	CRemConMediaBrowseTargetBase(CRemConInterfaceSelector& aInterfaceSelector, 
+			MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, 
+			MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver);
+	
+	virtual ~CRemConMediaBrowseTargetBase();
+	
+	virtual void BaseConstructL(TBool aSearchSupported);
+	
+	void DoFolderListing(const TArray<TRemConItem>& aFolderListing, 
+			TUint16 aMediaLibraryStateCookie, 
+			TInt aResult);
+	
+	void DoFolderUpResult(TUint aItemCount, TInt aResult);
+	void DoFolderDownResult(TUint aItemCount, TInt aResult);
+	
+	void DoGetPathResult(TUint aItemCount, 
+			TUint16 aMediaLibraryStateCookie, 
+			TInt aResult);
+	
+	void DoSearchResult(TUint aNumberItemsFound,
+			TUint16 aMediaLibraryStateCookie, 
+			TInt aResult);
+	
+	void DoMediaLibraryStateChange(TUint16 aMediaLibraryStateCookie);
+	
+	void DoFolderItemResult(const TRemConItemUid& aFolderID,
+			const TDesC8& aFolderName, 
+			TFolderItemType aFolderType, 
+			TFolderItemPlayable aPlayable,
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+	void DoMediaElementItemResult(const TRemConItemUid& aMediaID, 
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	
+private: // From CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // From MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId,
+			const TDesC8& aData);
+	
+private: // Utility
+	void ProcessGetFolderItems(const TDesC8& aData);
+	void ProcessChangePath(const TDesC8& aData);
+	void ProcessGetItemAttributes(const TDesC8& aData);
+	void ProcessSearch(const TDesC8& aData);
+	void ProcessGetPath(const TDesC8& aData);
+	void ProcessMediaLibraryStateCookieUpdate(const TDesC8& aData);
+	
+	void SendGetItemAttributesResponse(TInt aResult, const TDesC8& aData);
+	void SendGetFolderItemsResponse(TInt aResult, const TDesC8& aData);
+	void SendChangePathResponse(TUint aItemCount, TInt aResult);
+	void SendInternalNotificationResponse(TRemConMessageSubType aMsgSubType);
+	void SendNotificationResponse(TRemConMessageSubType aMsgSubType);
+	void SendSearchResponse(TInt aResult, TUint aNumberItemsFound, TUint16 aMediaLibraryStateCookie);
+	void SendMediaLibraryStateCookieUpdateResponse(TUint16 aMediaLibraryStateCookie);
+	
+	static TInt NextMessageCb(TAny* aThis);
+	void DoNextMessage();
+	
+	static TInt NextItemCallBack(TAny* aThis);
+	void RequestNextItem();
+	void DoItemComplete(TInt aResult);
+	
+	void SendError(TUint8 aPduId, 
+			TUint aOperationId, 
+			TInt aError);
+	
+	// Used for Gia
+	TInt ItemAttributesResult(const TArray<TMediaElementAttribute>& aAttributes);
+	TInt DoAttributeValue(TMediaAttributeId aAttributeId, const TDesC8& aAttributeData);
+	void DoAllAttributesCompleted(TInt aResult);
+	
+	void AddToOperationQueue(TUint8 aPduId, 
+			TInt aOperationId, 
+			const TDesC8& aData);
+	TInt ParseGetItemAttributesRequest(const TDesC8& aData,
+			TRemConFolderScope& aScope,
+			TRemConItemUid& aItemUid,
+			TUint16& aMediaLibraryStateCookie);
+	void ProcessMediaElementItemResult(const TRemConItemUid& aMediaID,
+			const TDesC8& aMediaName, 
+			TMediaItemType aMediaType, 
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+	void ProcessFolderItemResult(const TRemConItemUid& aFolderID,
+			const TDesC8& aFolderName, 
+			TFolderItemType aFolderType, 
+			TFolderItemPlayable aPlayable,
+			TInt aResult);
+	void ProcessGetItemAttributesResult(
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult);
+
+	inline TBool DatabaseAware() const;
+
+private:
+	// Unowned
+	CRemConInterfaceSelector& 							iInterfaceSelector;
+	
+	MRemConDatabaseAwareMediaLibraryBrowseObserver*		iRcdamlbo;
+	MRemConDatabaseUnawareMediaLibraryBrowseObserver*	iRcdumlbo;
+	
+	MRemConDatabaseAwareNowPlayingBrowseObserver*		iRcdanpbo;
+	MRemConDatabaseUnawareNowPlayingBrowseObserver*		iRcdunpbo;
+	
+	// Owned
+	CAsyncCallBack*										iNextMessageCallBack;
+	CAsyncCallBack*										iNextItemCallBack;
+	
+	RBuf8												iOutBuf;
+	
+	TUint16												iMediaLibraryStateCookie;
+	
+	TBool												iInProgress; // used internally to see if any operation is in progress
+	TRemConMessageQueue*                     			iMsgQueue; // used to queue messages if another operation is in progress
+	
+	RArray<TMediaAttributeId>							iMediaAttributeIds; // used for Gfl and Gia to store requested attributes
+	TMediaAttributeIter									iAttributeIterator; // provided to the client on requesting item attributes for Gfl and Gia
+	
+	RArray<TMediaAttributeId>							iNullArray; 
+	TMediaAttributeIter									iNullIterator; // Used for getting a folder item to perform a folder listing
+	
+	TBool												iGetFolderListing; // used to check Gfl is in progress 
+	RRemConGetFolderItemsResponse*						iGflResponse; // used to build up Gfl response from client
+	TRemConFolderScope									iScope; // stored for use in async callbacks to get folder items
+
+	TBool												iGetItemAttributes;	// used to check Gia is in progress
+	TBool												iSetAttributeValue; // used to check that client has set response if it returns KErrNone
+	RRemConGetItemAttributesResponse*					iGiaResponse; // used to build up Gia response from client
+	
+	TBool												iSearchSupported;
+	TBool												iSearchInProgress; // used to check Search is in progress
+	RBuf8												iSearchString; // used to store search string until request is complete
+	
+	RRemConGetPathResponse*      						iGetPathResponse; // used to build up get path response 
+	
+	TBool												iMlscUpdatePending;
+	TUint16												iLastMlscUpdate;
+	};
+
+#endif // REMCONMEDIABROWSETARGETBASE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remconmediabrowsetypes.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,118 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONMEDIABROWSETYPES_H
+#define REMCONMEDIABROWSETYPES_H
+
+#include <e32base.h>
+#include <remconmediaattributeid.h>
+
+/**
+Defines a type representing a UID which is 8 octet and uniquely identifys 
+a folder or media element in the media library.
+*/
+typedef TUint64 TRemConItemUid;
+
+/**
+Defines item types to indicate the item is a folder item or media item.
+*/
+enum TRemConItemType
+	{
+	ERemConFolderItem = 2,
+	ERemConMediaItem = 3,
+	};
+
+class TRemConItem
+	{
+public:
+	TRemConItemUid iUid;
+	TRemConItemType iType;
+	};
+
+/**
+Defines a type which indicates whether a folder item is playable.
+*/
+typedef TUint8 TFolderItemPlayable;
+
+/**
+Defines a type to indicate a media item type.
+*/
+typedef TUint8 TMediaItemType;
+
+const TFolderItemPlayable KFolderNotPlayable = 0;
+const TFolderItemPlayable KFolderPlayable = 1;
+
+const TMediaItemType KMediaAudio = 0;
+const TMediaItemType KMediaVideo = 1;
+
+enum TFolderItemType
+	{
+	EFolderMixed = 0,
+	EFolderTitles = 1,
+	EFolderAlbums = 2,
+	EFolderArtists = 3,
+	EFolderGenres = 4,
+	EFolderPlaylists = 5,
+	EFolderYears = 6,
+	};
+
+/**
+Defines folder scopes in which media content navigaition  may take place.
+*/
+enum TRemConFolderScope
+	{
+	/**
+	Applicable in browsed player.
+	Valid browseable items are foler item and media element item.
+	*/
+	EBrowseFolder         = 0x1,
+	
+	/**
+	Applicable in browsed player.
+	Valid browseable items are media element items.
+	*/
+	ESearchResultFolder   = 0x2,
+	
+	/**
+	Applicable in addressed player.
+	Valid browseable items are media element items.
+	*/
+	ENowPlayingFolder     = 0x3
+	};
+
+/**
+A data container of a media element attribute.
+
+*/
+class TMediaElementAttribute
+	{
+public:
+	TMediaAttributeId     iAttributeId;
+	
+	/**
+	The value of the attribute in UTF-8.
+	*/
+	HBufC8*               iString;
+	};
+
+#endif //REMCONMEDIABROWSETYPES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/public/remconmediaerror.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,97 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONMEDIAERROR_H_
+#define REMCONMEDIAERROR_H_
+
+#include <e32base.h>
+
+const TInt KErrRemConMediaBase                     = -6780;
+
+/**
+Invalid media library state cookie.
+
+This error only occurs in the database aware clients.
+*/
+const TInt KErrInvalidMediaLibraryStateCookie     = KErrRemConMediaBase - 0x5;
+
+/**
+The direction parameter is invalid
+
+@see MrcdamlbFolderDownResult()
+@see MrcdumlbFolderDownResult()
+*/
+const TInt KErrMediaBrowseInvalidDirection        = KErrRemConMediaBase - 0x7;
+
+/**
+The UID provided does not refer to a folder item
+
+@see MrcdamlbFolderDownResult()
+@see MrcdumlbFolderDownResult()
+*/
+const TInt KErrMediaBrowseNotADirectory           = KErrRemConMediaBase - 0x8;
+
+/**
+The UID provided does not refer to any currently valid item
+
+@see MrcdamlbFolderDownResult()
+@see MrcdumlbFolderDownResult()
+@see MrcdamlbFolderItemResult()
+@see MrcdumlbFolderItemResult()
+@see MrcdamlbMediaElementItemResult()
+@see MrcdumlbMediaElementItemResult()
+@see MrcdanpbMediaElementItemResult()
+@see MrcdunpbMediaElementItemResult()
+*/
+const TInt KErrInvalidUid                        = KErrRemConMediaBase - 0x9;
+
+/**
+The start of range provided is not valid
+
+@see MrcdamlbFolderListing()
+@see MrcdumlbFolderListing()
+@see MrcdanpbFolderListing()
+@see MrcdunpbFolderListing()
+*/
+const TInt KErrMediaBrowseInvalidOffset           = KErrRemConMediaBase - 0xb;
+
+/**
+The UID provided refers to a directory 
+which cannot be handled by this media player.
+
+*/
+const TInt KErrNowPlayingUidIsADirectory          = KErrRemConMediaBase - 0xc;
+
+/**
+The media is not able to be used for this operation at this time
+
+*/
+const TInt KErrNowPlayingMediaInUse               = KErrRemConMediaBase - 0xd;
+
+/**
+No more items can be added to the now playing list because it is full
+
+*/
+const TInt KErrNowPlayingListFull                 = KErrRemConMediaBase - 0xe;
+
+#endif /*REMCONMEDIAERROR_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseawaremediabrowsetarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,145 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <remcondatabaseawaremediabrowsetarget.h>
+
+EXPORT_C CRemConDatabaseAwareMediaBrowseTarget* CRemConDatabaseAwareMediaBrowseTarget::NewL(
+		CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, 
+		MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver,
+		TBool aSearchSupported, 
+		MRemConDatabaseAwareMediaLibraryBrowse*& aMlInterface, 
+		MRemConDatabaseAwareNowPlayingBrowse*& aNpInterface,
+		TUint16 aMediaLibraryStateCookie)
+	{
+	CRemConDatabaseAwareMediaBrowseTarget* self = new(ELeave)CRemConDatabaseAwareMediaBrowseTarget(
+			aInterfaceSelector, aMlObserver, aNpObserver, aMlInterface, aNpInterface, aMediaLibraryStateCookie);
+	CleanupStack::PushL(self);
+	self->ConstructL(aSearchSupported);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConDatabaseAwareMediaBrowseTarget::CRemConDatabaseAwareMediaBrowseTarget(
+		CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, 
+		MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver, 
+		MRemConDatabaseAwareMediaLibraryBrowse*& aMlInterface, 
+		MRemConDatabaseAwareNowPlayingBrowse*& aNpInterface,
+		TUint16 aMediaLibraryStateCookie)
+	: CRemConMediaBrowseTargetBase(aInterfaceSelector, aMlObserver, aNpObserver, aMediaLibraryStateCookie)
+	{
+	aMlInterface = static_cast<MRemConDatabaseAwareMediaLibraryBrowse*>(this);
+	aNpInterface = static_cast<MRemConDatabaseAwareNowPlayingBrowse*>(this);
+	}
+
+void CRemConDatabaseAwareMediaBrowseTarget::ConstructL(
+		TBool aSearchSupported)
+	{
+	BaseConstructL(aSearchSupported);
+	}
+
+CRemConDatabaseAwareMediaBrowseTarget::~CRemConDatabaseAwareMediaBrowseTarget()
+	{
+	}
+	
+void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoFolderListing(
+		const TArray<TRemConItem>& aFolderListing, 
+		TUint16 aMediaLibraryStateCookie, 
+		TUint aResult)
+	{
+	DoFolderListing(aFolderListing, aMediaLibraryStateCookie, aResult);
+	}
+
+void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoFolderUpResult(
+		TUint aItemCount, TInt aResult)
+	{
+	DoFolderUpResult(aItemCount, aResult);
+	}
+
+void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoFolderDownResult(
+		TUint aItemCount, TInt aResult)
+	{
+	DoFolderDownResult(aItemCount, aResult);
+	}
+
+void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoGetPathResult(
+		TUint aItemCount, 
+		TUint16 aMediaLibraryStateCookie, 
+		TInt aResult)
+	{
+	DoGetPathResult(aItemCount, aMediaLibraryStateCookie, aResult);
+	}
+
+void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoSearchResult(
+		TUint aNumberItemsFound,
+		TUint16 aMediaLibraryStateCookie, 
+		TInt aResult)
+	{
+	DoSearchResult(aNumberItemsFound, aMediaLibraryStateCookie, aResult);
+	}
+
+void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoMediaLibraryStateChange(
+		TUint16 aMediaLibraryStateCookie)
+	{
+	DoMediaLibraryStateChange(aMediaLibraryStateCookie);
+	}
+
+void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoFolderItemResult(
+		const TRemConItemUid& aFolderID,
+		const TDesC8& aFolderName, 
+		TFolderItemType aFolderType, 
+		TFolderItemPlayable aPlayable,
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	DoFolderItemResult(aFolderID,aFolderName, aFolderType, aPlayable, aAttributes, aResult);
+	}
+
+void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoMediaElementItemResult(
+		const TRemConItemUid& aMediaID, 
+		const TDesC8& aMediaName, 
+		TMediaItemType aMediaType, 
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	DoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult);
+	}
+
+void CRemConDatabaseAwareMediaBrowseTarget::MrcdanpbDoFolderListing(
+		const TArray<TRemConItem>& aFolderListing, 
+		TUint16 aMediaLibraryStateCookie, 
+		TUint aResult)
+	{
+	DoFolderListing(aFolderListing, aMediaLibraryStateCookie, aResult);
+	}
+
+void CRemConDatabaseAwareMediaBrowseTarget::MrcdanpbDoMediaElementItemResult(
+		const TRemConItemUid& aMediaID, 
+		const TDesC8& aMediaName, 
+		TMediaItemType aMediaType, 
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	DoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseawaremedialibrarybrowse.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,205 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <remcondatabaseawaremedialibrarybrowse.h>
+
+/** 
+Called by the client in response to a MrcdamlboGetFolderListing() call.
+
+@param aFolderListing A listing of the items that are 
+       in the range requested by the MrcdamlboGetFolderListing() call.
+
+@param aMediaLibraryStateCookie The current value of the state cookie.
+
+@param aResult The result of the MrcdamlboGetFolderListing() operation.
+     - KErrNone if the operation was successful.
+     - KErrMediaBrowseInvalidOffset if there is no media available at the 
+       offset of the start item, i.e. the start of range provided via 
+       MrcdamlboGetFolderListing() is not valid.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderListing(
+		const TArray<TRemConItem>& aFolderListing, 
+		TUint16 aMediaLibraryStateCookie, 
+		TUint aResult)
+	{
+	MrcdamlbDoFolderListing(aFolderListing, aMediaLibraryStateCookie, aResult);
+	}
+
+/** 
+Called by the client in response to a MrcdamlboFolderUp call.
+
+@param aItemCount The number of items present in this folder.
+@param aResult The result of the MrcdamlboFolderUp operation.  
+     - KErrNone if the operation was successful.
+     - KErrInvalidMediaLibraryStateCookie if the media library state cookie 
+       provided does not match the client's state cookie
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderUpResult(
+		TUint aItemCount, TInt aResult)
+	{
+	MrcdamlbDoFolderUpResult(aItemCount, aResult);
+	}
+
+/** 
+Called by the client in response to a MrcdamlboFolderDown() call.
+
+@param aItemCount The number of items present in this folder.
+
+@param aResult The result of the MrcdamlboFolderDown() operation
+     - KErrNone if the operation was successful.
+     - KErrInvalidMediaLibraryStateCookie if the media library state cookie 
+       provided does not match the client's state cookie
+     - KErrMediaBrowseInvalidDirection if the folder provided is not a valid 
+       folder e.g. path A/B/C, the current dirctory is B, and the param 
+       provided with MrcdamlboFolderDown()is A, obviously you can not change 
+       folder down to A, so A is invalid.
+     - KErrMediaBrowseNotADirectory if the UID provided does not refer to a 
+       folder item, e.g. it is a media element.
+     - KErrInvalidUid if the UID provided is invalid.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderDownResult(
+		TUint aItemCount, TInt aResult)
+	{
+	MrcdamlbDoFolderDownResult(aItemCount, aResult);
+	}
+
+/** 
+Called by the client in response to a MrcdamlboGetPath() call.
+
+@param aItemCount The number of items present in this folder.
+
+@param aMediaLibraryStateCookie The current value of the state cookie.
+
+@param aResult The result of the MrcdamlboGetPath() operation
+     - KErrNone if the operation is successful.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbGetPathResult(
+		TUint aItemCount, 
+		TUint16 aMediaLibraryStateCookie, 
+		TInt aResult)
+	{
+	MrcdamlbDoGetPathResult(aItemCount, aMediaLibraryStateCookie, aResult);
+	}
+
+/** 
+Called by the client in response to a MrcdamlboSearch() call to indicate
+that a search has completed.
+ 
+@param aNumberItemsFound The number of items found by the search.
+@param aMediaLibraryStateCookie The current of the state cookie.
+@param aResult The result of the search.  
+     - KErrNone if the search completed successfully
+     - System wide error otherwise.
+*/
+EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbSearchResult(
+		TUint aNumberItemsFound,
+		TUint16 aMediaLibraryStateCookie, 
+		TInt aResult)
+	{
+	MrcdamlbDoSearchResult(aNumberItemsFound, aMediaLibraryStateCookie, aResult);
+	}
+
+/** 
+Called by the client in the case that the state of the media library has
+changed.  This means that the media library state cookie provided prior to 
+this call by the client may no longer be valid.  Typical causes for this 
+would be items added or removed from the media library.
+ 
+This function shall be called by any client any time it believes that media 
+library state cookie has ceased to be valid, for example if the current 
+directory is on removable media, and that media has been removed.  
+That includes clients that are only able to offer state cookie that are 
+limited to one directory.  
+ 
+@param aMediaLibraryStateCookie The current value of the state cookie which 
+       enables state mismatches between the client and the remote controller 
+       device to be detected.
+*/
+EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbMediaLibraryStateChange(
+		TUint16 aMediaLibraryStateCookie)
+	{
+	MrcdamlbDoMediaLibraryStateChange(aMediaLibraryStateCookie);
+	}
+
+/**
+Called by the client in response to MrcdamlboGetItem() call in the case the
+requested item is a folder item.
+
+@param aFolderID The folder UID.
+@param aFolderName The folder name. Takes a copy of it.
+@param aFolderType The folder type.
+@param aPlayable Indicaties whether the folder is playable
+     - KFolderNotPlayable the folder can not be played
+     - KFolderPlayable the folder can be played
+@param aAttributes The attributes of the folder item requested by 
+       MrcdamlboGetItem()
+@param aResult The result of the MrcdamlboGetItem() operation.
+     - KErrNone if the operation was successful.
+     - KErrInvalidMediaLibraryStateCookie if the media library state cookie 
+       provided does not match the client's state cookie.
+     - KErrInvalidUid if the uid of the item requested is invalid, 
+       e.g. the client removed the item before the request 
+       MrcdamlboGetItem() coming.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderItemResult(
+		const TRemConItemUid& aFolderID,
+		const TDesC8& aFolderName, 
+		TFolderItemType aFolderType, 
+		TFolderItemPlayable aPlayable,
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	MrcdamlbDoFolderItemResult(aFolderID, aFolderName, aFolderType, aPlayable, aAttributes, aResult);
+	}
+
+/**
+Called by the client in response to MrcdamlboGetItem() call in the case the
+requested item is a media element item.
+
+@param aMediaID The media element UID.
+@param aMediaName The media name. Takes a copy of it.
+@param aMediaType The media type.
+@param aAttributes The attributes list. Takes a copy of it.
+@param aResult The result of the MrcdamlboGetItem() operation.
+     - KErrNone if the operation was successful.
+     - KErrInvalidMediaLibraryStateCookie if the media library state cookie 
+       provided does not match the client's state cookie.
+     - KErrInvalidUid if the uid of the item requested is invalid, 
+       e.g. the client removed the item before the request 
+       MrcdamlboGetItem() coming.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbMediaElementItemResult(
+		const TRemConItemUid& aMediaID, 
+		const TDesC8& aMediaName, 
+		TMediaItemType aMediaType, 
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	MrcdamlbDoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes,aResult);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseawarenowplayingbrowse.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,74 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <remcondatabaseawarenowplayingbrowse.h>
+
+/** 
+Called by the client in response to a MrcdanpboGetFolderListing() call.
+
+@param aFolderListing A listing of the items that are 
+       in the range requested by the MrcdanpboGetFolderListing() call. If the
+       media player does not natively support a Now Playing folder the listing
+       will only contain one item which is the currently playing media element
+       
+@param aMediaLibraryStateCookie The current value of the state cookie.
+@param aResult The result of the MrcdanpboGetFolderListing() operation.
+     - KErrNone if the operation was successful.
+     - KErrMediaBrowseInvalidOffset if there is no media available at the 
+       offset of the start item, i.e. the start of range provided via 
+       MrcdanpboGetFolderListing() is not valid. 
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbFolderListing(
+		const TArray<TRemConItem>& aFolderListing, 
+		TUint16 aMediaLibraryStateCookie, 
+		TUint aResult)
+	{
+	MrcdanpbDoFolderListing(aFolderListing, aMediaLibraryStateCookie, aResult);
+	}
+
+/**
+Called by the client in response to MrcdanpboGetItem() call 
+
+@param aMediaID The media element UID.
+@param aMediaName The media name. Takes a copy of it.
+@param aMediaType The media type.
+@param aAttributes The attributes list. Takes a copy of it.
+@param aResult The result of the MrcdanpboGetItem() operation.
+     - KErrNone if the operation was successful.
+     - KErrInvalidMediaLibraryStateCookie if the media library state cookie 
+       does not match the client's state cookie.
+     - KErrInvalidUid if the uid of the item requested is invalid, 
+       e.g. the client removed the item before the request 
+       MrcdanpboGetItem() coming.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbMediaElementItemResult(
+		const TRemConItemUid& aMediaID, 
+		const TDesC8& aMediaName, 
+		TMediaItemType aMediaType, 
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	MrcdanpbDoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseunawaremediabrowsetarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,139 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <remcondatabaseunawaremediabrowsetarget.h>
+
+EXPORT_C CRemConDatabaseUnawareMediaBrowseTarget* CRemConDatabaseUnawareMediaBrowseTarget::NewL(
+		CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, 
+		MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver,
+		TBool aSearchSupported, 
+		MRemConDatabaseUnawareMediaLibraryBrowse*& aMlInterface, 
+		MRemConDatabaseUnawareNowPlayingBrowse*& aNpInterface)
+	{
+	CRemConDatabaseUnawareMediaBrowseTarget* self = new(ELeave)CRemConDatabaseUnawareMediaBrowseTarget(
+			aInterfaceSelector, aMlObserver, aNpObserver, aMlInterface, aNpInterface);
+	CleanupStack::PushL(self);
+	self->ConstructL(aSearchSupported);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConDatabaseUnawareMediaBrowseTarget::CRemConDatabaseUnawareMediaBrowseTarget(
+		CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, 
+		MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver, 
+		MRemConDatabaseUnawareMediaLibraryBrowse*& aMlInterface, 
+		MRemConDatabaseUnawareNowPlayingBrowse*& aNpInterface)
+	: CRemConMediaBrowseTargetBase(aInterfaceSelector, aMlObserver, aNpObserver)
+	{
+	aMlInterface = this;
+	aNpInterface = this;
+	}
+
+void CRemConDatabaseUnawareMediaBrowseTarget::ConstructL(
+		TBool aSearchSupported)
+	{
+	BaseConstructL(aSearchSupported);
+	}
+
+CRemConDatabaseUnawareMediaBrowseTarget::~CRemConDatabaseUnawareMediaBrowseTarget()
+	{
+	}
+	
+void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoFolderListing(
+		const TArray<TRemConItem>& aFolderListing, 
+		TUint aResult)
+	{
+	DoFolderListing(aFolderListing, 0, aResult);
+	}
+
+void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoFolderUpResult(
+		TUint aItemCount, TInt aResult)
+	{
+	DoFolderUpResult(aItemCount, aResult);
+	}
+
+void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoFolderDownResult(
+		TUint aItemCount, TInt aResult)
+	{
+	DoFolderDownResult(aItemCount, aResult);
+	}
+
+void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoGetPathResult(
+		TUint aItemCount,  
+		TInt aResult)
+	{
+	DoGetPathResult(aItemCount, 0, aResult);
+	}
+
+void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoSearchResult(
+		TUint aNumberItemsFound,
+		TInt aResult)
+	{
+	DoSearchResult(aNumberItemsFound, 0, aResult);
+	}
+
+void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoMediaLibraryStateChange()
+	{
+	DoMediaLibraryStateChange(0);
+	}
+
+void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoFolderItemResult(
+		const TRemConItemUid& aFolderID,
+		const TDesC8& aFolderName, 
+		TFolderItemType aFolderType, 
+		TFolderItemPlayable aPlayable,
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	DoFolderItemResult(aFolderID,aFolderName, aFolderType, aPlayable, aAttributes, aResult);
+	}
+
+void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoMediaElementItemResult(
+		const TRemConItemUid& aMediaID, 
+		const TDesC8& aMediaName, 
+		TMediaItemType aMediaType, 
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	DoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult);
+	}
+
+void CRemConDatabaseUnawareMediaBrowseTarget::MrcdunpbDoFolderListing(
+		const TArray<TRemConItem>& aFolderListing, 
+		TUint aResult)
+	{
+	DoFolderListing(aFolderListing, 0, aResult);
+	}
+
+void CRemConDatabaseUnawareMediaBrowseTarget::MrcdunpbDoMediaElementItemResult(
+		const TRemConItemUid& aMediaID, 
+		const TDesC8& aMediaName, 
+		TMediaItemType aMediaType, 
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	DoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseunawaremedialibrarybrowse.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,176 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <remcondatabaseunawaremedialibrarybrowse.h>
+
+/** 
+Called by the client in response to a MrcdumlboGetFolderListing() call.
+
+@param aFolderListing A listing of the items that are 
+       in the range requested by the MrcdumlboGetFolderListing() call.
+
+@param aResult The result of the MrcdumlboGetFolderListing() operation.
+     - KErrNone if the operation was successful.
+     - KErrMediaBrowseInvalidOffset if there is no media available at the 
+       offset of the start item, i.e. the start of range provided via 
+       MrcdumlboGetFolderListing() is not valid.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderListing(
+		const TArray<TRemConItem>& aFolderListing, 
+		TUint aResult)
+	{
+	MrcdumlbDoFolderListing(aFolderListing, aResult);
+	}
+
+/** 
+Called by the client in response to a MrcdumlboFolderUp call.
+
+@param aItemCount The number of items present in this folder.
+@param aResult The result of the MrcdumlboFolderUp operation.  
+     - KErrNone if the operation was successful.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderUpResult(
+		TUint aItemCount, TInt aResult)
+	{
+	MrcdumlbDoFolderUpResult(aItemCount, aResult);
+	}
+
+/** 
+Called by the client in response to a MrcdumlboFolderDown() call.
+
+@param aItemCount The number of items present in this folder.
+
+@param aResult The result of the MrcdumlboFolderDown() operation
+     - KErrNone if the operation was successful.
+     - KErrMediaBrowseInvalidDirection if the folder provided is not a valid 
+       folder e.g. path A/B/C, the current dirctory is B, and the param 
+       provided with MrcdumlboFolderDown()is A, obviously you can not change 
+       folder down to A, so A is invalid.
+     - KErrMediaBrowseNotADirectory if the UID provided does not refer to a 
+       folder item, e.g. it is a media element.
+     - KErrInvalidUid if the UID provided is invalid.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderDownResult(
+		TUint aItemCount, TInt aResult)
+	{
+	MrcdumlbDoFolderDownResult(aItemCount, aResult);
+	}
+
+/** 
+Called by the client in response to a MrcdumlboGetPath() call.
+
+@param aItemCount The number of items present in this folder.
+
+@param aResult The result of the MrcdumlboGetPath() operation
+     - KErrNone if the operation is successful.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbGetPathResult(
+		TUint aItemCount, 
+		TInt aResult)
+	{
+	MrcdumlbDoGetPathResult(aItemCount, aResult);
+	}
+
+/** 
+Called by the client in response to a MrcdumlboSearch() call to indicate
+that a search has completed.
+ 
+@param aNumberItemsFound The number of items found by the search.
+@param aResult The result of the search.  
+     - KErrNone if the search completed successfully
+     - System wide error otherwise.
+*/
+EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbSearchResult(
+		TUint aNumberItemsFound,
+		TInt aResult)
+	{
+	MrcdumlbDoSearchResult(aNumberItemsFound, aResult);
+	}
+
+/** 
+Called by the client to indicate changes to the media database in the client.
+*/
+EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbMediaLibraryStateChange()
+	{
+	MrcdumlbDoMediaLibraryStateChange();
+	}
+
+/**
+Called by the client in response to MrcdumlboGetItem() call in the case the
+requested item is a folder item.
+
+@param aFolderID The folder UID.
+@param aFolderName The folder name. Takes a copy of it.
+@param aFolderType The folder type.
+@param aPlayable Indicaties whether the folder is playable
+     - KFolderNotPlayable the folder can not be played
+     - KFolderPlayable the folder can be played
+@param aAttributes The attributes of the folder item requested by 
+       MrcdumlboGetItem()
+@param aResult The result of the MrcdumlboGetItem() operation.
+     - KErrNone if the operation was successful.
+     - KErrInvalidUid if the uid of the item requested is invalid, 
+       e.g. the client removed the item before the request 
+       MrcdumlboGetItem() coming.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderItemResult(
+		const TRemConItemUid& aFolderID,
+		const TDesC8& aFolderName, 
+		TFolderItemType aFolderType, 
+		TFolderItemPlayable aPlayable,
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	MrcdumlbDoFolderItemResult(aFolderID, aFolderName, aFolderType, aPlayable, aAttributes, aResult);
+	}
+
+/**
+Called by the client in response to MrcdumlboGetItem() call in the case the
+requested item is a media element item.
+
+@param aMediaID The media element UID.
+@param aMediaName The media name. Takes a copy of it.
+@param aMediaType The media type.
+@param aAttributes The attributes list. Takes a copy of it.
+@param aResult The result of the MrcdumlboGetItem() operation.
+     - KErrNone if the operation was successful.
+     - KErrInvalidUid if the uid of the item requested is invalid, 
+       e.g. the client removed the item before the request 
+       MrcdumlboGetItem() coming.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbMediaElementItemResult(
+		const TRemConItemUid& aMediaID, 
+		const TDesC8& aMediaName, 
+		TMediaItemType aMediaType, 
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	MrcdumlbDoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/src/remcondatabaseunawarenowplayingbrowse.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,70 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <remcondatabaseunawarenowplayingbrowse.h>
+
+/** 
+Called by the client in response to a MrcdunpboGetFolderListing() call.
+
+@param aFolderListing A listing of the items that are 
+       in the range requested by the MrcdunpboGetFolderListing() call. If the
+       media player does not natively support a Now Playing folder the listing
+       will only contain one item which is the currently playing media element
+
+@param aResult The result of the MrcdunpboGetFolderListing() operation.
+     - KErrNone if the operation was successful.
+     - KErrMediaBrowseInvalidOffset if there is no media available at the 
+       offset of the start item, that is the start of range provided via 
+       MrcnptoGetFolderListing() is not valid.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbFolderListing(
+		const TArray<TRemConItem>& aFolderListing,  
+		TUint aResult)
+	{
+	MrcdunpbDoFolderListing(aFolderListing, aResult);
+	}
+
+/**
+Called by the client in response to MrcdunpboGetItem() call 
+
+@param aMediaID The media element UID.
+@param aMediaName The media name. Takes a copy of it.
+@param aMediaType The media type.
+@param aAttributes The attributes list. Takes a copy of it.
+@param aResult The result of the MrcdunpboGetItem() operation.
+     - KErrNone if the operation was successful.
+     - KErrInvalidUid if the uid of the item requested is invalid, 
+       e.g. the client removed the item before the request 
+       MrcdunpboGetItem() coming.
+     - System wide error code otherwise.
+*/
+EXPORT_C void MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbMediaElementItemResult(
+		const TRemConItemUid& aMediaID, 
+		const TDesC8& aMediaName, 
+		TMediaItemType aMediaType, 
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	MrcdunpbDoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/src/remconmediabrowsetargetbase.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,1295 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <remcon/remconmediabrowsetargetbase.h>
+#include <remconmediainformationtargetobserver.h>
+#include <remconinterfaceselector.h>
+#include <remconmediabrowsepanic.h>
+#include <bluetooth/logger.h>
+#include "mediabrowse.h"
+#include "remconmediabrowsefault.h"
+#include "remconqueuemessage.h"
+
+const TInt KDatabaseUnawareUidCounter = 0;
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCONMEDIABROWSEAPI);
+_LIT8(KLogFormat, "Operation Id = 0x%x, Data Lengh = %d");
+#endif
+//=========================================================================================
+// Construction/Destruction
+//=========================================================================================
+CRemConMediaBrowseTargetBase::CRemConMediaBrowseTargetBase(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, 
+		MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver,
+		TUint16 aMediaLibraryStateCookie)
+	: CRemConInterfaceBase(TUid::Uid(KRemConMediaBrowseApiUid),
+			KMaxLengthMediaBrowseMsg,
+			aInterfaceSelector,
+			ERemConClientTypeTarget),
+	iInterfaceSelector(aInterfaceSelector),
+	iRcdamlbo(&aMlObserver),
+	iRcdanpbo(&aNpObserver),
+	iMediaLibraryStateCookie(aMediaLibraryStateCookie),
+	iAttributeIterator(iMediaAttributeIds),
+	iNullIterator(iNullArray),
+	iSearchInProgress(EFalse),
+	iLastMlscUpdate(aMediaLibraryStateCookie)
+	{
+	}
+
+CRemConMediaBrowseTargetBase::CRemConMediaBrowseTargetBase(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, 
+		MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver)
+	: CRemConInterfaceBase(TUid::Uid(KRemConMediaBrowseApiUid),
+			KMaxLengthMediaBrowseMsg,
+			aInterfaceSelector,
+			ERemConClientTypeTarget),
+	iInterfaceSelector(aInterfaceSelector),
+	iRcdumlbo(&aMlObserver),
+	iRcdunpbo(&aNpObserver),
+	iAttributeIterator(iMediaAttributeIds),
+	iNullIterator(iNullArray),
+	iSearchInProgress(EFalse)
+	{
+	}
+
+CRemConMediaBrowseTargetBase::~CRemConMediaBrowseTargetBase()		// codescanner::destructor
+	{
+	iMediaAttributeIds.Close();
+	iNullArray.Close();
+	iOutBuf.Close();
+	iSearchString.Close();
+
+	// iGetPathResponse, iGiaResponse and iGflResponse are instantiated in CRemConMediaBrowseTargetBase::BaseConstructL() and
+	// so should have the same lifetime as this CRemConMediaBrowseTargetBase instance
+	__ASSERT_DEBUG(iGetPathResponse && iGiaResponse && iGflResponse, MediaBrowsePanic::Panic(EUnexpectedNullMemberField));
+	iGetPathResponse->Close();
+	iGiaResponse->Close();
+	iGflResponse->Close();
+	delete iGetPathResponse;
+	delete iGiaResponse;
+	delete iGflResponse;
+	
+	if (iNextMessageCallBack)
+		{
+		iNextMessageCallBack->Cancel();
+		delete iNextMessageCallBack;
+		}
+	if (iNextItemCallBack)
+		{
+		iNextItemCallBack->Cancel();
+		delete iNextItemCallBack;
+		}
+	
+	iMsgQueue->Reset();
+	delete iMsgQueue;
+	}
+
+void CRemConMediaBrowseTargetBase::BaseConstructL(TBool aSearchSupported)
+	{
+	iMsgQueue = new(ELeave)TRemConMessageQueue();
+
+	iGetPathResponse = new(ELeave)RRemConGetPathResponse();
+	iGiaResponse = new(ELeave)RRemConGetItemAttributesResponse();
+	iGflResponse = new(ELeave)RRemConGetFolderItemsResponse();
+
+	TCallBack cb(&NextMessageCb, this);
+	iNextMessageCallBack = new(ELeave)CAsyncCallBack(cb, CActive::EPriorityStandard);
+	
+	TCallBack itemCallBack(&NextItemCallBack, this);
+	iNextItemCallBack = new(ELeave)CAsyncCallBack(itemCallBack, CActive::EPriorityStandard);
+	
+	RRemConInterfaceFeatures features;
+	User::LeaveIfError(features.Open());
+	CleanupClosePushL(features);
+
+	if(aSearchSupported)
+		{
+		features.AddOperationL(ESearchOperationId);
+		iSearchSupported = ETrue;
+		}
+	
+	if(DatabaseAware())
+		{
+		features.AddOperationL(EUIDPersistency);
+		}
+	
+	//Mandate the following operationIds to be supported in the client
+	features.AddOperationL(EGetFolderItemsOperationId);
+	features.AddOperationL(EChangePathOperationId);
+	features.AddOperationL(EGetItemAttributesOperationId);
+	features.AddOperationL(ESetBrowsedPlayerOperationId);
+	
+	iOutBuf.CreateL(KMediaBrowseOutBufMaxLength);
+	
+	CRemConInterfaceBase::BaseConstructL(features, ETrue); // it's true, this interface is a bulk interface
+	CleanupStack::PopAndDestroy(&features);
+	}
+	
+//=========================================================================================
+// RemCon interface stuff, called from interface selector
+//=========================================================================================
+
+/** 
+@internalComponent
+@released
+
+Gets a pointer to a specific interface version.
+
+@return A pointer to the interface, NULL if not supported.
+*/
+TAny* CRemConMediaBrowseTargetBase::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+void CRemConMediaBrowseTargetBase::MrcibNewMessage(TUint aOperationId,
+			const TDesC8& aData)
+	{
+	LOG_FUNC
+	LOG2(KLogFormat, aOperationId, aData.Length());
+
+	TMetadataTransferPDU currentOp = RAvrcpIPC::GetPDUIdFromIPCOperationId(aOperationId);
+	switch(currentOp)
+		{
+	case EGetFolderItemsOperationId:
+		AddToOperationQueue(EMbGetFolderItems, 
+							EGetFolderItemsOperationId, aData);
+		if (!iMsgQueue->IsEmpty() && !iInProgress && !iMsgQueue->Find(
+			      TUid::Uid(KRemConMediaBrowseApiUid)
+				 ,EGetFolderItemsOperationId))
+			{
+			iNextMessageCallBack->CallBack();
+			}
+		break;
+	case EChangePathOperationId:
+		ProcessChangePath(aData);
+		break;
+	case EGetItemAttributesOperationId:
+		{
+		AddToOperationQueue(EMbGetItemAttributes, 
+							EGetItemAttributesOperationId, aData);
+		if (!iMsgQueue->IsEmpty() && !iInProgress && !iMsgQueue->Find(
+					      TUid::Uid(KRemConMediaBrowseApiUid)
+						 ,EGetItemAttributesOperationId))
+					{
+					iNextMessageCallBack->CallBack();
+					}
+		break;
+		}
+	case ESearchOperationId:
+		ProcessSearch(aData);
+		break;
+	case ESetBrowsedPlayerOperationId:
+		ProcessGetPath(aData);
+		break;	
+	case EMediaLibraryStateCookieUpdateOperationId:
+		ProcessMediaLibraryStateCookieUpdate(aData);
+		break;
+	default:
+		__ASSERT_DEBUG(EFalse, MediaBrowseFault::Fault(EUnexpectedOperationId));
+		break; 
+		};
+	}
+
+//=========================================================================================
+// Browse Interface functions, called from derived classes
+//=========================================================================================
+void CRemConMediaBrowseTargetBase::DoFolderListing(const TArray<TRemConItem>& aFolderListing, 
+		TUint16 aMediaLibraryStateCookie, 
+		TInt aResult)
+	{
+	if (aResult != KErrNone)
+		{
+		SendGetFolderItemsResponse(aResult, KNullDesC8);
+		return;
+		}	
+	
+	// If asserted here, means the client calls the interface FolderListing() 
+	// more than once corresponding to the only once call 
+	// MrcmbtoGetFolderListing()
+	__ASSERT_DEBUG(iGflResponse->iItems.Count() == 0, MediaBrowsePanic::Panic(EFolderListingProvidedTwice));
+	
+	// Store clients state cookie to pass it back when requesting each item. 
+	// This will ensure that we don't miss state change during the course of 
+	// the non-atomic GetFolderListing operation
+	iGflResponse->iUidCounter = aMediaLibraryStateCookie;
+	
+	// Store these UIDs, then ask for info about them
+	if (iGflResponse->CopyItems(aFolderListing) != KErrNone)
+		{
+		SendGetFolderItemsResponse(KErrAvrcpAirInternalError, KNullDesC8);
+		return;
+		}
+	
+	iGflResponse->iCurrentListingSize = KGetFolderItemsResponseBaseSize;
+	iGflResponse->iCurrentItem = -1;
+	RequestNextItem();
+	}
+
+void CRemConMediaBrowseTargetBase::DoFolderUpResult(TUint aItemCount, TInt aResult)
+	{
+	SendChangePathResponse(aItemCount, aResult);
+	}
+
+void CRemConMediaBrowseTargetBase::DoFolderDownResult(TUint aItemCount, TInt aResult)
+	{
+	SendChangePathResponse(aItemCount, aResult);
+	}
+
+void CRemConMediaBrowseTargetBase::DoGetPathResult(TUint aItemCount, 
+		TUint16 aMediaLibraryStateCookie, 
+		TInt aResult)
+	{
+	if (aResult != KErrNone)
+		{
+		iGetPathResponse->Close();
+		return SendError(EMbSetBrowsedPlayer,
+				ESetBrowsedPlayerOperationId, aResult);
+		}
+	
+	// Store the current UIDs counter.
+	iMediaLibraryStateCookie = aMediaLibraryStateCookie;
+	
+	TInt status = KErrAvrcpAirBase - KErrAvrcpAirSuccess;
+	iGetPathResponse->iStatus = status;
+	iGetPathResponse->iUidCounter = aMediaLibraryStateCookie;
+	iGetPathResponse->iNumberItems = aItemCount;
+	
+	RBuf8 responseBuf;
+	TInt error = responseBuf.Create(iGetPathResponse->Size());
+	if (error != KErrNone)
+		{
+		iGetPathResponse->Close();
+		return SendError(EMbSetBrowsedPlayer, 
+				ESetBrowsedPlayerOperationId, KErrAvrcpAirInternalError);
+		}
+	
+	iGetPathResponse->iPduId = AvrcpBrowsing::ESetBrowsedPlayer;
+	TRAP(error, iGetPathResponse->WriteL(responseBuf));
+	if (error == KErrNone)
+		{
+		// Send the response back to the CT
+		error = InterfaceSelector().SendBulkUnreliable(
+				TUid::Uid(KRemConMediaBrowseApiUid),
+				ESetBrowsedPlayerOperationId, responseBuf );
+		}
+	
+	iGetPathResponse->Close();
+	responseBuf.Close();
+	}
+
+void CRemConMediaBrowseTargetBase::DoSearchResult(TUint aNumberItemsFound,
+		TUint16 aMediaLibraryStateCookie, 
+		TInt aResult)
+	{
+	// GetFoldItems should in progress When this interface is called.
+	__ASSERT_DEBUG(iSearchInProgress, MediaBrowsePanic::Panic(ESearchResultWithoutRequest));
+
+	SendSearchResponse(aResult, aNumberItemsFound, aMediaLibraryStateCookie);
+	}
+
+void CRemConMediaBrowseTargetBase::DoMediaLibraryStateChange(TUint16 aMediaLibraryStateCookie)
+	{
+	if(DatabaseAware())
+		{
+		__ASSERT_DEBUG(aMediaLibraryStateCookie != KDatabaseUnawareUidCounter, MediaBrowsePanic::Panic(EZeroMediaLibraryStateCookie));
+		
+		// For database aware players we need to update if we have a pending update and
+		// the new value is different to what we last 
+		if(iMlscUpdatePending && (aMediaLibraryStateCookie != iLastMlscUpdate))
+			{
+			// Send update with new value
+			SendMediaLibraryStateCookieUpdateResponse(aMediaLibraryStateCookie);
+			}	
+		
+		// Always store the last value here.  When we are asked for an update
+		// we will be provided with the value the update should be relative 
+		// to, so we will compare to this. 
+		iLastMlscUpdate = aMediaLibraryStateCookie;
+		}
+	else
+		{
+		__ASSERT_DEBUG(aMediaLibraryStateCookie == KDatabaseUnawareUidCounter, MediaBrowseFault::Fault(ENonZeroMediaLibraryStateCookie));
+		
+		if(iMlscUpdatePending)
+			{
+			SendMediaLibraryStateCookieUpdateResponse(aMediaLibraryStateCookie);
+			}
+		else
+			{
+			// For database aware clients the value can never change.  Indicate that
+			// the client has informed us of the state change by incrementing our
+			// update value so that we know there's been a change.  The value doesn't
+			// matter, we just have to make it something other than zero.
+			iLastMlscUpdate = 1;
+			}
+		}
+	}
+
+void CRemConMediaBrowseTargetBase::DoFolderItemResult(const TRemConItemUid& aFolderID,
+		const TDesC8& aFolderName, 
+		TFolderItemType aFolderType, 
+		TFolderItemPlayable aPlayable,
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	// GetFolderItems should in progress When this interface is called.
+	__ASSERT_DEBUG(iGetFolderListing || iGetItemAttributes, MediaBrowsePanic::Panic(EFolderItemResultWithoutRequest));
+
+	if(iGetFolderListing)
+		{
+		ProcessFolderItemResult(aFolderID, aFolderName, aFolderType, aPlayable, aResult);
+		}
+	
+	if (iGetItemAttributes)
+		{
+		ProcessGetItemAttributesResult(aAttributes, aResult);
+		}
+	}
+
+void CRemConMediaBrowseTargetBase::DoMediaElementItemResult(const TRemConItemUid& aMediaID, 
+		const TDesC8& aMediaName, 
+		TMediaItemType aMediaType, 
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	__ASSERT_DEBUG((iGetFolderListing || iGetItemAttributes), MediaBrowsePanic::Panic(EMediaElementItemResultWithoutRequest));
+
+	if (iGetFolderListing)
+		{
+		ProcessMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult);
+		}
+	
+	if (iGetItemAttributes)
+		{
+		ProcessGetItemAttributesResult(aAttributes, aResult);
+		}		
+	}
+
+//=========================================================================================
+// Utility functions, called internally
+//=========================================================================================
+
+void CRemConMediaBrowseTargetBase::ProcessMediaLibraryStateCookieUpdate(const TDesC8& aData)
+	{
+	// Try to read the incoming request
+	RRemConUidsChangedRequest request;
+	TRAPD(error, request.ReadL(aData));
+	__ASSERT_DEBUG(error == KErrNone, MediaBrowseFault::Fault(EBadlyFormattedMediaLibraryStateCookieUpdate));
+	static_cast<void>(error == error); // stops compiler warnings (assert above indicates design contract).
+
+	if(request.iInitialUidCounter != iLastMlscUpdate)
+		{
+		// The client has updated the uid counter since the bearer
+		// last asked.  Tell it the new value.  The Send..Response 
+		// function deals with all the state management necessary,
+		// including whether we are database aware or unaware
+		SendMediaLibraryStateCookieUpdateResponse(iLastMlscUpdate);
+		}
+	else
+		{
+		// Bearer still up to date.  Remember that it's waiting for
+		// an update.
+		iMlscUpdatePending = ETrue;
+		}
+	}
+
+void CRemConMediaBrowseTargetBase::ProcessGetItemAttributes(const TDesC8& aData)
+	{
+	TRemConFolderScope scope;
+	TRemConItemUid item;
+	TUint16 uidCounter;
+	TInt err = ParseGetItemAttributesRequest(aData, scope, item, uidCounter);
+	if (err != KErrNone)
+	    {
+	    SendGetItemAttributesResponse(err, KNullDesC8);
+	    return;
+	    }
+	
+	iAttributeIterator.Start();	
+	iInProgress = ETrue;
+	iGetItemAttributes = ETrue;	
+	TInt result = KErrNone;
+	if(scope == ENowPlayingFolder)
+		{
+		if (!DatabaseAware() && (0 == uidCounter))//Database UnAware
+			{
+			result = iRcdunpbo->MrcdunpboGetItem(item, iAttributeIterator);
+			}
+		else if (DatabaseAware() && (uidCounter > 0))
+			{
+			result = iRcdanpbo->MrcdanpboGetItem(item, iAttributeIterator, uidCounter);
+			}
+		else
+			{
+			result = KErrAvrcpAirInvalidParameter;
+			}
+		}
+	else
+		{
+		if (!DatabaseAware() && (0 == uidCounter))//Database UnAware
+			{
+			result = iRcdumlbo->MrcdumlboGetItem(scope, item, iAttributeIterator);
+			}
+		else if (DatabaseAware() && (uidCounter > 0))
+			{
+			result = iRcdamlbo->MrcdamlboGetItem(scope, item, iAttributeIterator, 
+					                     uidCounter);
+			}
+		else
+			{
+			result = KErrAvrcpAirInvalidParameter;
+			}
+		}
+	
+	// The call back function returns error.
+	if (result != KErrNone)
+		{
+		SendGetItemAttributesResponse(result, KNullDesC8);
+		}
+	}
+
+void CRemConMediaBrowseTargetBase::SendGetItemAttributesResponse(TInt aResult, const TDesC8& aData)
+	{
+	if(aResult != KErrNone)
+		{
+		SendError(EMbGetItemAttributes, EGetItemAttributesOperationId, aResult);
+		}
+	else
+		{
+		InterfaceSelector().SendBulkUnreliable(
+				TUid::Uid(KRemConMediaBrowseApiUid),
+				EGetItemAttributesOperationId, aData);
+		}
+	
+	iInProgress = EFalse;
+	iGetItemAttributes = EFalse;
+	iMediaAttributeIds.Reset();
+	iGiaResponse->Close();
+	
+	if (!iMsgQueue->IsEmpty())
+		{
+		iNextMessageCallBack->CallBack();
+		}
+	}
+
+void CRemConMediaBrowseTargetBase::ProcessChangePath(const TDesC8& aData)
+	{
+	// Try to read the incoming request
+	TInt error = KErrNone;
+	RRemConChangePathRequest request;
+	TRAP(error, request.ReadL(aData));
+
+	// Couldn't parse the request; tell them it was invalid
+	if (error != KErrNone)
+		{
+	    SendError(EMbChangePath, EChangePathOperationId, KErrAvrcpAirInvalidParameter);
+	    return;
+		}
+
+	if(request.iDirection == AvrcpBrowsing::KUp)
+		{
+		if (DatabaseAware() && (request.iUidCounter > 0))
+			{
+			iRcdamlbo->MrcdamlboFolderUp(request.iUidCounter);
+			}
+		else if (!DatabaseAware() && (0 == request.iUidCounter))
+			{
+			iRcdumlbo->MrcdumlboFolderUp();
+			}
+		else
+			{
+			SendError(EMbChangePath, EChangePathOperationId, KErrAvrcpAirInvalidParameter);
+			}
+		}
+	else if(request.iDirection == AvrcpBrowsing::KDown)
+		{
+		if (DatabaseAware() && (request.iUidCounter > 0))
+			{
+			iRcdamlbo->MrcdamlboFolderDown(request.iElement, request.iUidCounter);
+			}
+		else if (!DatabaseAware() && (0 == request.iUidCounter))
+			{
+			iRcdumlbo->MrcdumlboFolderDown(request.iElement);
+			}
+		else
+			{
+			SendError(EMbChangePath, EChangePathOperationId, KErrAvrcpAirInvalidParameter);
+			}
+		}
+	else
+		{
+		SendError(EMbChangePath, EChangePathOperationId, KErrAvrcpAirInvalidDirection);
+		}
+	}
+
+void CRemConMediaBrowseTargetBase::SendSearchResponse(TInt aResult, TUint aNumberItemsFound, TUint16 aMediaLibraryStateCookie)
+	{	
+	iSearchString.Close();
+	
+	// format the response in a RRemConSearchResponse
+	RRemConMediaErrorResponse errResponse;
+	RRemConSearchResponse response;
+	TInt symbianError = errResponse.SymbianErrorCheck(aResult);
+	
+	response.iStatus = errResponse.SymbianErrToStatus(symbianError);	
+	response.iPduId = AvrcpBrowsing::ESearch;//0x80
+	response.iUidCounter = aMediaLibraryStateCookie;
+	response.iNumberItems = aNumberItemsFound;
+	TRAPD(error, response.WriteL(iOutBuf));
+	if (error == KErrNone)
+		{
+		// send the response back to the CT
+		error = InterfaceSelector().SendBulkUnreliable(
+				TUid::Uid(KRemConMediaBrowseApiUid),
+				ESearchOperationId,  iOutBuf );
+		}
+	
+	//Search operatin complete.
+	iSearchInProgress = EFalse;
+	}
+
+void CRemConMediaBrowseTargetBase::ProcessSearch(const TDesC8& aData)
+	{
+	// Don't trouble the client with this if they've informed us they don't
+	// support it
+	if (!iSearchSupported)
+		{
+		return SendSearchResponse(KErrAvrcpAirSearchNotSupported, 0, 0);
+		}
+	
+	// We know a search operation is in progress
+	if (iSearchInProgress)
+		{
+		return SendSearchResponse(KErrAvrcpAirSearchInProgress, 0, 0);
+		}
+		
+	// Try to read the incoming request
+	TInt error = KErrNone;
+	RRemConSearchRequest request;
+	TRAP(error, request.ReadL(aData));
+
+	// Couldn't parse the request; tell them it was invalid
+	if (error != KErrNone)
+		{
+		error = (error == KErrNoMemory) ? 
+				KErrAvrcpAirInternalError : KErrAvrcpAirInvalidParameter;
+		
+		return SendSearchResponse(error, 0, 0);
+		}
+
+	// Check the character set
+	if (request.iCharset != KUtf8MibEnum)
+		{
+		iSearchInProgress = EFalse;
+		return SendSearchResponse(KErrAvrcpAirInvalidParameter, 0, 0);
+		}
+	
+	iSearchString.Close();
+	iSearchString.Assign(request.iSearchString);
+	//iSearchString has taken ownership of request's search string.
+	request.iSearchString.Assign(NULL);
+	
+	iSearchInProgress = ETrue;
+	
+	if(DatabaseAware())
+		{
+		iRcdamlbo->MrcdamlboSearch(iSearchString);
+		}
+	else
+		{
+		iRcdumlbo->MrcdumlboSearch(iSearchString);
+		}
+	
+	request.Close();
+	}
+
+void CRemConMediaBrowseTargetBase::ProcessGetPath(const TDesC8& aData)
+	{
+	iGflResponse->iMaxResponse = *(reinterpret_cast<const TInt*>(aData.Ptr()));
+
+	if(DatabaseAware())
+		{
+		iRcdamlbo->MrcdamlboGetPath(iGetPathResponse->iPath);
+		}
+	else
+		{
+		iRcdumlbo->MrcdumlboGetPath(iGetPathResponse->iPath);
+		}
+	}
+
+void CRemConMediaBrowseTargetBase::ProcessGetFolderItems(const TDesC8& aData)
+	{
+	// The bearer is responsible for ensuring we have been supplied with response
+	// max size before sending us any requests
+	__ASSERT_DEBUG(iGflResponse->iMaxResponse != 0, MediaBrowseFault::Fault(ERequestWithoutMaxResponseBeingSet));
+	
+	iInProgress = ETrue;
+	iGetFolderListing = ETrue;
+	
+	RRemConGetFolderItemsRequest request;
+	TRAPD(err, request.ReadL(aData));
+	if(err != KErrNone)
+		{
+		request.Close();
+		SendGetFolderItemsResponse(KErrAvrcpAirInvalidParameter, KNullDesC8);
+		return;
+		}
+	
+	if(request.iScope == AvrcpBrowsing::KSearchScope && !iSearchSupported)
+		{
+		request.Close();
+		SendGetFolderItemsResponse(KErrAvrcpAirSearchNotSupported, KNullDesC8);
+		return;
+		}
+	
+	if (request.CopyAttributes(iMediaAttributeIds) != KErrNone)
+		{
+		request.Close();
+		SendGetFolderItemsResponse(KErrAvrcpAirInternalError, KNullDesC8);
+		return;
+		}
+	iAttributeIterator.Start();
+
+	if(request.iScope == AvrcpBrowsing::KVirtualFilesystemScope)
+		{
+		iScope = EBrowseFolder;
+		}
+	else if(request.iScope == AvrcpBrowsing::KNowPlayingScope)
+		{
+		iScope = ENowPlayingFolder;
+		}
+	else if(request.iScope == AvrcpBrowsing::KSearchScope)
+		{
+		iScope = ESearchResultFolder;
+		}
+	else
+		{
+		request.Close();
+		SendGetFolderItemsResponse(KErrAvrcpAirInvalidScope, KNullDesC8);
+		return;
+		}
+	
+	if (request.iStartItem > request.iEndItem)
+		{
+		request.Close();
+		SendGetFolderItemsResponse(KErrAvrcpAirRangeOutOfBounds, KNullDesC8);
+		return;
+		}
+	
+	if(iScope == ENowPlayingFolder)
+		{
+		if(DatabaseAware())
+			{
+			iRcdanpbo->MrcdanpboGetFolderListing(request.iStartItem, request.iEndItem);
+			}
+		else
+			{
+			iRcdunpbo->MrcdunpboGetFolderListing(request.iStartItem, request.iEndItem);
+			}
+		}
+	else
+		{
+		if(DatabaseAware())
+			{
+			iRcdamlbo->MrcdamlboGetFolderListing(iScope,request.iStartItem, request.iEndItem);
+			}
+		else
+			{
+			iRcdumlbo->MrcdumlboGetFolderListing(iScope,request.iStartItem, request.iEndItem);
+			}
+		}
+	
+	request.Close();
+	}
+
+void CRemConMediaBrowseTargetBase::SendGetFolderItemsResponse(TInt aResult, const TDesC8& aData)
+	{
+	if(aResult != KErrNone)
+		{
+		SendError(EMbGetFolderItems, EGetFolderItemsOperationId, aResult);
+		}
+	else
+		{
+		InterfaceSelector().SendBulkUnreliable(
+				TUid::Uid(KRemConMediaBrowseApiUid),
+				EGetFolderItemsOperationId, aData);
+		}
+	
+	iInProgress = EFalse;
+	iGetFolderListing = EFalse;
+	iMediaAttributeIds.Reset();
+	iGflResponse->Close();
+	
+	iNextItemCallBack->Cancel();
+	
+	if (!iMsgQueue->IsEmpty())
+		{
+		iNextMessageCallBack->CallBack();
+		}
+	}
+
+TInt CRemConMediaBrowseTargetBase::NextMessageCb(TAny* aThis)
+	{
+	static_cast<CRemConMediaBrowseTargetBase*>(aThis)->DoNextMessage();
+	return KErrNone;
+	}
+
+void CRemConMediaBrowseTargetBase::DoNextMessage()
+	{
+	__ASSERT_DEBUG(!iMsgQueue->IsEmpty(), MediaBrowseFault::Fault(EUnexpectedNextMessageCallback));
+	CRemConQueuedMessage* msg = iMsgQueue->First();
+	iMsgQueue->Remove(*msg);
+	
+	switch (msg->iOperationId)
+		{
+		case EGetFolderItemsOperationId:
+			ProcessGetFolderItems(msg->Data());
+			break;
+		case EGetItemAttributesOperationId:
+			ProcessGetItemAttributes(msg->Data());
+			break;
+		default:
+			__ASSERT_DEBUG(EFalse, MediaBrowseFault::Fault(EUnexpectedNextMessageCallback));
+			break;
+		}
+	delete msg;
+	}
+
+void CRemConMediaBrowseTargetBase::SendMediaLibraryStateCookieUpdateResponse(TUint16 aMediaLibraryStateCookie)
+	{
+	LOG_FUNC
+	
+	TUint16 newValue = DatabaseAware() ? aMediaLibraryStateCookie : KDatabaseUnawareUidCounter;
+
+	TInt error = KErrNone;
+	RRemConUidsChangedResponse response;
+	response.iUidCounter = newValue;
+	TRAP(error, response.WriteL(iOutBuf));
+
+	if (error == KErrNone)
+		{
+		// send the response back to the CT
+		error = InterfaceSelector().SendBulkUnreliable(
+				TUid::Uid(KRemConMediaBrowseApiUid),
+				EMediaLibraryStateCookieUpdateOperationId, iOutBuf);
+		
+		iLastMlscUpdate = newValue;
+		iMlscUpdatePending = EFalse;
+		}
+	// otherwise we couldn't update the client.  Leave our state with the update
+	// pending then we'll try again next time the client tells us state has 
+	// changed.  
+	}
+
+void CRemConMediaBrowseTargetBase::SendChangePathResponse(TUint aItemCount, 
+		TInt aResult)
+	{
+	if (aResult != KErrNone)
+		{
+		return SendError(EMbChangePath, EChangePathOperationId, aResult);
+		}
+	
+	TInt error = KErrNone;
+
+	// Format the response in a RRemConChangePathResponse
+	RRemConChangePathResponse response;
+	response.iStatus = KErrAvrcpAirBase - KErrAvrcpAirSuccess;//0x4
+	response.iNumberItems = aItemCount;
+	
+	RBuf8 responseBuf;
+	error = responseBuf.Create(KMediaBrowseOutBufMaxLength);
+	if (error != KErrNone)
+		{
+		responseBuf.Close();
+		SendError(EMbChangePath, EChangePathOperationId, KErrAvrcpAirInternalError);
+		return;
+		}
+	
+	response.iPduId = AvrcpBrowsing::EChangePath;
+	TRAP(error, response.WriteL(responseBuf));
+	if (error == KErrNone)
+		{
+		// send the response back to the CT
+		error = InterfaceSelector().SendBulkUnreliable(
+				TUid::Uid(KRemConMediaBrowseApiUid),
+				EChangePathOperationId, responseBuf );
+		}
+	
+	responseBuf.Close();
+	}
+
+TInt CRemConMediaBrowseTargetBase::NextItemCallBack(TAny* aThis)
+	{
+	static_cast<CRemConMediaBrowseTargetBase*>(aThis)->RequestNextItem();
+	return KErrNone;
+	}
+
+void CRemConMediaBrowseTargetBase::RequestNextItem()
+	{
+	TInt err = KErrNone;
+	TInt result = KErrNone;
+	RBuf8 responseBuf;
+	
+	// If true, indicate that we have not got all the items requested, 
+	// so going on. 
+	// There are some array elements accessed by [] as follows without 
+	// checking range for it is done in RequestNextItem function.
+	if ( iGflResponse->RequestNextItem(err, responseBuf, 
+			iGflResponse->iUidCounter) )
+		{
+		TBool folderItem = EFalse;
+		if (AvrcpBrowsing::EFolderItem == iGflResponse->iItems[iGflResponse->iCurrentItem].iType)
+			{
+			folderItem = ETrue;
+			}
+		iAttributeIterator.Start();	
+		if(iScope == ENowPlayingFolder)
+			{
+			if(DatabaseAware())
+				{
+				result = iRcdanpbo->MrcdanpboGetItem(
+			    		iGflResponse->iItems[iGflResponse->iCurrentItem].iUid,
+			    		folderItem ? iNullIterator : iAttributeIterator,
+			    		iGflResponse->iUidCounter);
+				}
+			else
+				{
+				result = iRcdunpbo->MrcdunpboGetItem( 
+			    		iGflResponse->iItems[iGflResponse->iCurrentItem].iUid,
+			    		folderItem ? iNullIterator : iAttributeIterator);
+				}
+			}
+		else
+			{
+			if(DatabaseAware())
+				{
+				result = iRcdamlbo->MrcdamlboGetItem(iScope,
+			    		iGflResponse->iItems[iGflResponse->iCurrentItem].iUid,
+			    		folderItem ? iNullIterator : iAttributeIterator,
+			    		iGflResponse->iUidCounter);
+				}
+			else
+				{
+				result = iRcdumlbo->MrcdumlboGetItem(iScope, 
+			    		iGflResponse->iItems[iGflResponse->iCurrentItem].iUid,
+			    		folderItem ? iNullIterator : iAttributeIterator);
+				}
+			}
+		
+		// The call back function reutrns error.
+		if (result != KErrNone)
+			{
+			SendGetFolderItemsResponse(result, KNullDesC8);
+			}
+		}
+	// If comes here, indicate that we stop requesting the next item
+	// which means two possibilities:
+	// 1. Success: Have got all the items we want.
+	// 2. Error: Error occured internally.
+	else if ( err == KErrNone ) //Possibility 1.
+		{
+		SendGetFolderItemsResponse(KErrNone, responseBuf);
+		}
+	else // Possibility 2.
+		{
+		SendGetFolderItemsResponse(KErrAvrcpAirInternalError, KNullDesC8);
+		}
+	responseBuf.Close();
+	}
+
+void CRemConMediaBrowseTargetBase::DoItemComplete(TInt aResult)
+	{
+	if (aResult != KErrNone)
+		{
+		SendGetFolderItemsResponse(aResult, KNullDesC8);
+		}
+	else
+		{
+		// We have to put an async break in here - otherwise if large
+		// numbers of items are requested we could overflow the stack
+		iNextItemCallBack->CallBack();
+		}
+	}
+
+void CRemConMediaBrowseTargetBase::SendError(TUint8 aPduId, 
+		TUint aOperationId, 
+		TInt aError)
+	{
+	TInt error = KErrNone;
+	RRemConMediaErrorResponse response;
+	response.iPduId = aPduId;
+	response.iStatus = RAvrcpIPC::SymbianErrToStatus(aError);
+	TRAP(error, response.WriteL(iOutBuf));
+	if (error == KErrNone)
+		{
+		InterfaceSelector().SendBulkUnreliable(
+				TUid::Uid(KRemConMediaBrowseApiUid),
+				aOperationId, iOutBuf);
+		}
+	}
+
+/** 
+Sets an attribute value for the requested item.
+*/
+TInt CRemConMediaBrowseTargetBase::DoAttributeValue(
+		TMediaAttributeId aAttributeId, 
+		const TDesC8& aAttributeData )
+	{
+	iSetAttributeValue = ETrue;
+	
+	REAResponse resp;
+	resp.iAttributeId = aAttributeId;
+	resp.iCharset = KUtf8MibEnum;
+	resp.iStringLen = aAttributeData.Length();
+	resp.iString = aAttributeData.Alloc();
+	if (!resp.iString)
+		{
+		iSetAttributeValue = EFalse;
+		return KErrNoMemory;
+		}
+	TInt status = KErrNone;
+	if(iGiaResponse->Size() + resp.iStringLen < iGflResponse->iMaxResponse)
+		{
+		status = iGiaResponse->iAttributes.Append(resp);
+		if (status != KErrNone)
+			{
+			iSetAttributeValue = EFalse;
+			resp.Close();  // make sure heap string is de-allocated
+			}
+		}
+	
+	return status;
+	}
+
+/**
+Signals that all attributes requested has been supplied.
+*/
+ void CRemConMediaBrowseTargetBase::DoAllAttributesCompleted(TInt aResult)
+	{
+	TInt error = KErrNone;
+	__ASSERT_DEBUG(((aResult != KErrNone) || ((aResult == KErrNone) && iSetAttributeValue)),
+			MediaBrowseFault::Fault(EResultErrorCodeMismatch));
+	
+	if (aResult == KErrNone)
+		{
+		// Finalise response; update number of attributes returned
+		iGiaResponse->iNumberAttributes = iGiaResponse->iAttributes.Count();
+		}
+
+	// Allocate a buffer for the formatted message
+	RBuf8 messageBuffer;	
+	TInt bufferSize = 
+	(aResult == KErrNone) ? iGiaResponse->Size() : KBrowseResponseBaseLength;
+	
+	if ( messageBuffer.Create(bufferSize) != KErrNone )
+		{
+		SendGetItemAttributesResponse(KErrAvrcpAirInternalError, KNullDesC8);
+		}
+	else
+		{
+		// Send the result back to the CT
+		iGiaResponse->iPduId = AvrcpBrowsing::EGetItemAttributes; // 0x73
+		iGiaResponse->iStatus = RAvrcpIPC::SymbianErrToStatus(aResult);
+		
+		TRAP(error, iGiaResponse->WriteL(messageBuffer));
+		if (error == KErrNone)
+			{
+			SendGetItemAttributesResponse(KErrNone, messageBuffer);
+			}
+		else
+			{
+			SendGetItemAttributesResponse(KErrAvrcpAirInternalError, KNullDesC8);
+			}
+		}
+	messageBuffer.Close();
+	}
+
+TInt CRemConMediaBrowseTargetBase::ItemAttributesResult(
+		const TArray<TMediaElementAttribute>& aAttributes)
+	{
+	TInt error = KErrNone;
+	TMediaAttributeId attributeId;
+	for (TInt i = 0; i < aAttributes.Count(); i++)
+		{
+		// check that the values supplied were requested
+		attributeId = aAttributes[i].iAttributeId;
+		if ( KErrNotFound == iMediaAttributeIds.Find(attributeId) )
+			{
+			//Omit the invalid ones
+			continue;
+			}
+		
+		error = DoAttributeValue(attributeId, *aAttributes[i].iString);
+		if (error != KErrNone)
+			{
+			break;
+			}
+		}
+	
+	return error;
+	}
+
+void CRemConMediaBrowseTargetBase::AddToOperationQueue(TUint8 aPduId,
+		TInt aOperationId, 
+		const TDesC8& aData)
+	{
+	CRemConQueuedMessage* msg = NULL;
+	TRAPD(err, msg = CRemConQueuedMessage::NewL(
+			TUid::Uid(KRemConMediaBrowseApiUid), aData, aOperationId));			
+	if (err == KErrNone)
+		{
+		iMsgQueue->AddLast(*msg);
+		}
+	else
+		{
+		SendError(aPduId, aOperationId, KErrAvrcpAirInternalError);
+		}
+	}
+
+TInt CRemConMediaBrowseTargetBase::ParseGetItemAttributesRequest(
+		const TDesC8& aData,
+		TRemConFolderScope& aScope,
+		TRemConItemUid& aItemUid,
+		TUint16& aMediaLibraryStateCookie)
+	{
+	// Try to read the incoming request
+	TInt error = KErrNone;
+	RRemConGetItemAttributesRequest request;
+	TRAP(error, request.ReadL(aData));
+
+	// Couldn't parse the request;tell them it was invalid
+	// Specification says unique id must not be 0x0
+	if (error != KErrNone || request.iElement == 0)
+		{
+		request.Close();
+		return KErrAvrcpAirInvalidParameter;
+		}
+
+	if (request.iNumberAttributes == 0)
+		{
+		// spec says this is a request for all attribs
+		// current spec has 7 specified (0x01 to 0x07)
+		for (TInt i = 1; i <= KMediaAttributeNum; i++)
+			{
+			if (iMediaAttributeIds.Append(static_cast<TMediaAttributeId>(i))
+					!= KErrNone)
+				{
+				request.Close();
+				return KErrAvrcpAirInternalError;
+				}
+			}
+		}
+	else
+		{
+		// No need to check 
+		// request.iNumberAttributes == request.iAttributes.Count()
+		// as this must be correct or request.ReadL(aData) leaves
+		TUint8 value;
+		TMediaAttributeId attributeid;
+		for (TInt i = 0; i < request.iNumberAttributes; i++)
+			{
+			value = request.iAttributes[i];
+			if (value > 0 && value <= KMaxMediaAttributeValue )
+				{
+				attributeid = static_cast<TMediaAttributeId>(value);
+				if (iMediaAttributeIds.Append(attributeid) != KErrNone)
+					{
+					request.Close();
+					return KErrAvrcpAirInternalError;
+					}
+				}
+			}
+		}
+	// Check that some valid attribute ids have been found
+	if (iMediaAttributeIds.Count() == 0)
+		{
+		request.Close();
+		return KErrAvrcpAirInvalidParameter;
+		}
+		
+	if(request.iScope == AvrcpBrowsing::KSearchScope)
+		{
+		aScope = ESearchResultFolder;
+		}
+	else if(request.iScope == AvrcpBrowsing::KVirtualFilesystemScope)
+		{
+		aScope = EBrowseFolder;
+		}
+	else if (request.iScope == AvrcpBrowsing::KNowPlayingScope)
+		{
+		aScope = ENowPlayingFolder;
+		}
+	else
+		{
+		request.Close();
+		return KErrAvrcpAirInvalidScope;
+		}
+	
+	aItemUid = request.iElement;
+	aMediaLibraryStateCookie = request.iUidCounter;
+	
+	request.Close();
+	return KErrNone;
+	}
+
+void CRemConMediaBrowseTargetBase::ProcessMediaElementItemResult(
+		const TRemConItemUid& aMediaID, 
+		const TDesC8& aMediaName,
+		TMediaItemType aMediaType, 
+		const TArray<TMediaElementAttribute>& aAttributes,
+		TInt aResult)
+	{
+	TInt internalError = KErrNone;
+	if (aResult == KErrNone)
+		{
+		__ASSERT_DEBUG(aMediaType < AvrcpBrowsing::KMediaTypeReserved, MediaBrowsePanic::Panic(EInvalidMediaType));
+
+		RItem& item = iGflResponse->iItems[iGflResponse->iCurrentItem];
+		if (item.iUid == aMediaID)
+			{
+			item.iType = AvrcpBrowsing::EMediaElement;
+			item.iCharset = KUtf8MibEnum;
+			
+			item.iName = aMediaName.Alloc();		
+			internalError = (!item.iName) ? KErrNoMemory : internalError;
+			
+			if (internalError == KErrNone)
+				{
+				item.iNameLength = aMediaName.Length();
+				item.iMediaType = static_cast<AvrcpBrowsing::TFolderType>(aMediaType);
+				item.iNumberAttributes = aAttributes.Count();
+				item.iLength = KMediaElementItemBaseLength + item.iNameLength;
+				TInt attributeCount = aAttributes.Count();
+				REAResponse attribute;
+				for (TInt i = 0; i < attributeCount; i++)
+					{
+					// Check that the values supplied were requested
+					if (KErrNotFound == iMediaAttributeIds.Find(aAttributes[i].iAttributeId))
+						{
+						//Omit the invalid ones
+						continue;
+						}
+					
+					attribute.iAttributeId = aAttributes[i].iAttributeId;				
+					attribute.iString = aAttributes[i].iString->Alloc();
+					internalError = (!attribute.iString) ? KErrNoMemory : internalError;
+					if (internalError == KErrNone)
+						{
+						attribute.iCharset = KUtf8MibEnum;
+						attribute.iStringLen = attribute.iString->Length();
+						item.iAttributes.Append(attribute);
+						
+						item.iLength += 
+						KAttributeBaseLength + attribute.iString->Length();
+						}
+					else
+						{
+						//it's useless to continue as there is an allocation issue
+						break;
+						}
+					}
+				}
+			}
+		else
+			{
+			internalError = KErrArgument;
+			}
+		}
+	
+	aResult = 
+	(KErrNone == internalError)? aResult : KErrAvrcpAirInternalError;
+	
+	DoItemComplete(aResult);
+	}
+
+void CRemConMediaBrowseTargetBase::ProcessFolderItemResult(
+		const TRemConItemUid& aFolderID,
+		const TDesC8& aFolderName, 
+		TFolderItemType aFolderType, 
+		TFolderItemPlayable aPlayable,
+		TInt aResult)
+	{
+	TInt internalError = KErrNone;
+	if (aResult == KErrNone)
+	    {
+		__ASSERT_DEBUG(aFolderType < AvrcpBrowsing::EFolderTypeReserved, MediaBrowsePanic::Panic(EInvalidFolderType));
+		__ASSERT_DEBUG(aPlayable < AvrcpBrowsing::KPlayableReserved, MediaBrowsePanic::Panic(EInvalidPlayableValue));
+		
+		RItem& item = iGflResponse->iItems[iGflResponse->iCurrentItem];
+		if (item.iUid == aFolderID)
+			{
+			item.iType = AvrcpBrowsing::EFolderItem;
+			item.iCharset = KUtf8MibEnum;
+			
+			item.iName = aFolderName.Alloc();
+			internalError = (!item.iName) ? KErrNoMemory : internalError;
+					
+			item.iNameLength = aFolderName.Length();
+			
+			item.iFolderType = 
+			static_cast<AvrcpBrowsing::TFolderType>(aFolderType);
+			
+			item.iPlayable = aPlayable;
+			item.iLength = KFolderItemBaseLength + item.iNameLength;
+			}
+		else
+			{
+			internalError = KErrArgument;
+			}
+	    }
+			                        
+	aResult = (internalError == KErrNone) ? aResult : KErrAvrcpAirInternalError;
+	
+	DoItemComplete(aResult);
+	}
+
+void CRemConMediaBrowseTargetBase::ProcessGetItemAttributesResult(
+			const TArray<TMediaElementAttribute>& aAttributes,
+			TInt aResult)
+	{
+	TInt internalError = KErrNone;
+	if (aResult == KErrNone)
+	    {
+	    internalError = ItemAttributesResult(aAttributes);
+	    }				
+	
+	aResult =
+	(KErrNone == internalError)? aResult : KErrAvrcpAirInternalError;
+	
+	DoAllAttributesCompleted(aResult);
+	}
+
+inline TBool CRemConMediaBrowseTargetBase::DatabaseAware() const
+	{
+	return iRcdanpbo ? ETrue : EFalse;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediabrowseapi/src/remconmediabrowseutils.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,35 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <remconmediabrowsepanic.h>
+#include "remconmediabrowsefault.h"
+
+void MediaBrowsePanic::Panic(TRemConMediaBrowsePanic aPanic)
+	{
+	User::Panic(KMediaBrowsePanicName, aPanic);
+	}
+
+void MediaBrowseFault::Fault(TRemConMediaBrowseFault aFault)
+	{
+	User::Panic(KMediaBrowseFaultName, aFault);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediainformationapi/bwins/remconmediainformationapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,9 @@
+EXPORTS
+	??1CRemConMediaInformationTarget@@UAE@XZ @ 1 NONAME ; CRemConMediaInformationTarget::~CRemConMediaInformationTarget(void)
+	?AttributeValue@CRemConMediaInformationTarget@@QAEHW4TMediaAttributeId@@AAVTDesC8@@@Z @ 2 NONAME ; void CRemConMediaInformationTarget::AttributeValue(enum TMediaAttributeID, class TDesC8 &)
+	?Completed@CRemConMediaInformationTarget@@QAEXXZ @ 3 NONAME ; void CRemConMediaInformationTarget::Completed(void)
+	?NewL@CRemConMediaInformationTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConMediaInformationTargetObserver@@@Z @ 4 NONAME ; class CRemConMediaInformationTarget * CRemConMediaInformationTarget::NewL(class CRemConInterfaceSelector &, class MRemConMediaInformationTargetObserver &)
+	?Next@TMediaAttributeIter@@QAEHAAW4TMediaAttributeId@@@Z @ 5 NONAME
+	?Start@TMediaAttributeIter@@QAEXXZ @ 6 NONAME
+	??0TMediaAttributeIter@@QAE@AAV?$RArray@W4TMediaAttributeId@@@@@Z @ 7 NONAME ; TMediaAttributeIter::TMediaAttributeIter(class RArray<enum TMediaAttributeId> &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediainformationapi/eabi/remconmediainformationapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,12 @@
+EXPORTS
+	_ZN19TMediaAttributeIter4NextER17TMediaAttributeId @ 1 NONAME
+	_ZN19TMediaAttributeIter5StartEv @ 2 NONAME
+	_ZN29CRemConMediaInformationTarget4NewLER24CRemConInterfaceSelectorR37MRemConMediaInformationTargetObserver @ 3 NONAME
+	_ZN29CRemConMediaInformationTargetD0Ev @ 4 NONAME
+	_ZN29CRemConMediaInformationTargetD1Ev @ 5 NONAME
+	_ZN29CRemConMediaInformationTargetD2Ev @ 6 NONAME
+	_ZN29CRemConMediaInformationTarget14AttributeValueE17TMediaAttributeIdR6TDesC8 @ 7 NONAME
+	_ZN29CRemConMediaInformationTarget9CompletedEv @ 8 NONAME
+	_ZN19TMediaAttributeIterC1ER6RArrayI17TMediaAttributeIdE @ 9 NONAME
+	_ZN19TMediaAttributeIterC2ER6RArrayI17TMediaAttributeIdE @ 10 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediainformationapi/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,27 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconmediainformationapi.mmp
+
+PRJ_EXPORTS
+../public/remconmediainformationtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediainformationtarget.h)
+../public/remconmediainformationtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediainformationtargetobserver.h)
+../public/remconmediaattributeid.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediaattributeid.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediainformationapi/group/remconmediainformationapi.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,51 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconmediainformationapi.dll Remote Control Media Information API - an outer-layer client side library.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET			remconmediainformationapi.dll
+TARGETPATH		/system/libs
+
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			mediainformationapi.cpp
+
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+USERINCLUDE		../../common
+
+LIBRARY 		euser.lib
+LIBRARY 		remconinterfacebase.lib
+LIBRARY 		avrcpipc.lib
+LIBRARY			estor.lib 
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediainformationapi/public/remconmediaattributeid.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,59 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONMEDIAATTRIBUTEID_H_
+#define REMCONMEDIAATTRIBUTEID_H_
+
+#include <e32base.h>
+
+const TInt KMediaAttributeNum = 7;
+enum TMediaAttributeId
+	{
+	ETitleOfMedia 			=0x1,
+	ENameOfArtist			=0x2,
+	ENameOfAlbum			=0x3,
+	ETrackNumber			=0x4,		/* for example the CD track number */
+	ENumberOfTracks			=0x5,		/* for example the total track number of the CD */
+	EGenre					=0x6,
+	EPlayingTime			=0x7
+	};
+
+/**
+ * Provide an iterator wrapper class 
+ */
+class TMediaAttributeIter
+	{
+public:
+	/** 
+	@internalTechnology
+	*/
+	IMPORT_C TMediaAttributeIter(RArray<TMediaAttributeId>& aMediaAttributeIDs);
+	IMPORT_C void Start();
+	IMPORT_C TBool Next(TMediaAttributeId& aId);
+	
+private:
+	RArray<TMediaAttributeId>& iMediaAttributeIDs;
+	TInt iterator;
+	};
+
+#endif /*REMCONMEDIAATTRIBUTEID_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediainformationapi/public/remconmediainformationtarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,126 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONMEDIAINFORMATIONTARGET_H
+#define REMCONMEDIAINFORMATIONTARGET_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+#include <remconmediainformationtargetobserver.h>
+
+class CRemConInterfaceSelector;
+class RRemConGetElementAttributesResponse;
+
+NONSHARABLE_CLASS(CRemConMediaInformationQueuedMessage): public CBase
+	{
+public:
+	static CRemConMediaInformationQueuedMessage* NewL(const TDesC8& aData);
+	~CRemConMediaInformationQueuedMessage();
+	
+	const TDesC8& Data();
+private:
+	CRemConMediaInformationQueuedMessage();
+	void ConstructL(const TDesC8& aData);
+public:
+	TSglQueLink iLink;
+private:
+	RBuf8 iData;
+	};
+
+/**
+Client-instantiable type supporting sending media information.
+*/
+NONSHARABLE_CLASS(CRemConMediaInformationTarget) : public CRemConInterfaceBase, 
+								          		public MRemConInterfaceIf
+	{
+public:
+
+	/**
+	Factory function.
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@return A new CRemConMediaInformationTarget, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConMediaInformationTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConMediaInformationTargetObserver& aObserver);
+	
+	/** Destructor */
+	IMPORT_C ~CRemConMediaInformationTarget();
+
+public:
+	/** Called by the client in response to a MrcmitoGetCurrentlyPlayingMetadata() call.
+	Each call provides one of the attribute values requested.
+	This is repeatedly called until all attributes requested have been supplied and then followed by Completed().
+	@param aAttribute The ID of the attribute supplied.
+	@param aValue A reference to a descriptor containing the attribute data.  
+	This must be valid until Completed() has been called. 
+	@see MRemConMediaInformationTargetObserver::MrcmitoGetCurrentlyPlayingMetadata()
+	@see CRemConMediaInformationTarget::Completed()
+	*/
+	IMPORT_C TInt AttributeValue( TMediaAttributeId aAttributeId, TDesC8& aAttributeData);
+	
+	/** Signal that all attributes requested by MrcmitoGetCurrentlyPlayingMetadata() have been supplied
+	using the AttributeValue() method.
+	@see MRemConMediaInformationTargetObserver::MrcmitoGetCurrentlyPlayingMetadata()
+	@see CRemConMediaInformationTarget::AttributeValue()
+	*/
+	IMPORT_C void Completed();
+	
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	@param aObserver The observer of this interface.
+	*/
+	CRemConMediaInformationTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConMediaInformationTargetObserver& aObserver);
+
+	void ConstructL();
+
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+
+private: // utility
+	void SendError(TInt aError);
+	void ProcessMessage(const TDesC8& aData);
+	
+	static int NextMessageCb(TAny* aThis);
+	void DoNextMessage();
+private: // unowned
+	MRemConMediaInformationTargetObserver& iObserver;
+
+private: // owned
+	RRemConGetElementAttributesResponse* iResponse;
+
+	RArray<TMediaAttributeId>  	iMediaAttributeIDs;
+	TMediaAttributeIter 		iAttributeIterator;
+	TBool						iInProgress;
+	TSglQue<CRemConMediaInformationQueuedMessage> iMsgQueue;
+	
+	CAsyncCallBack* iNextMessageCallBack;
+	};
+
+#endif // REMCONMEDIAINFORMATIONTARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediainformationapi/public/remconmediainformationtargetobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,49 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONMEDIAINFORMATIONTARGETOBSERVER_H
+#define REMCONMEDIAINFORMATIONTARGETOBSERVER_H
+
+#include <e32base.h>
+#include <remconmediaattributeid.h>
+
+/**
+Clients must implement this interface in order to instantiate objects of type 
+CRemConMediaInformationTarget. This interface passes incoming commands from RemCon to 
+the client. 
+*/
+NONSHARABLE_CLASS(MRemConMediaInformationTargetObserver)
+	{
+public:
+
+	/**
+	For each element in aAttributeList for which the requested Metadata is available,
+	the client shall respond by calling CRemConMediaInformationTarget::AttributeValue(). 
+	After all attributes have been supplied the client shall call CRemConMediaInformationTarget::Completed().
+	@param aAttributeIter A CMediaAttributeIDs containing a list of TMediaAttributeIds requested by the controller
+	@see CRemConMediaInformationTarget::AttributeValue()
+	@see CRemConMediaInformationTarget::Completed()
+	*/
+	virtual void MrcmitoGetCurrentlyPlayingMetadata( TMediaAttributeIter& aAttributeIter ) = 0;
+
+	};
+
+#endif // REMCONMEDIAINFORMATIONTARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/mediainformationapi/src/mediainformationapi.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,371 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <bluetooth/logger.h>
+#include <remcon/avrcpspec.h>
+#include <remconmediainformationtarget.h>
+#include <remconmediainformationtargetobserver.h>
+#include <remconinterfaceselector.h>
+#include <avcframe.h>
+
+#include "mediainformation.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_MEDIA_INFO);
+#endif
+
+EXPORT_C CRemConMediaInformationTarget* CRemConMediaInformationTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConMediaInformationTargetObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConMediaInformationTarget* self = new(ELeave) CRemConMediaInformationTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConMediaInformationTarget::CRemConMediaInformationTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConMediaInformationTargetObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConMediaInformationApiUid), 
+						 KMaxLengthMediaInformationMsg, 
+						 aInterfaceSelector,
+						 ERemConClientTypeTarget), 
+	iObserver(aObserver),
+	iAttributeIterator(iMediaAttributeIDs),
+	iMsgQueue(_FOFF(CRemConMediaInformationQueuedMessage, iLink))
+	{
+	}
+	
+void CRemConMediaInformationTarget::ConstructL()
+	{
+	iResponse = new(ELeave)RRemConGetElementAttributesResponse();
+	TCallBack cb(&NextMessageCb, this);
+	iNextMessageCallBack = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard);
+	BaseConstructL();
+	}
+	
+
+/** Destructor.
+
+@publishedAll
+@released
+*/
+EXPORT_C CRemConMediaInformationTarget::~CRemConMediaInformationTarget()
+	{
+	iMediaAttributeIDs.Close();
+	iResponse->Close();
+	delete iResponse;
+	iNextMessageCallBack->Cancel();
+	delete iNextMessageCallBack;
+	TSglQueIter<CRemConMediaInformationQueuedMessage> iter(iMsgQueue);
+	CRemConMediaInformationQueuedMessage* msg;
+	iter.SetToFirst();
+	while ((msg = iter++) != NULL)
+		{
+		iMsgQueue.Remove(*msg);
+		delete msg;
+		}
+	}
+
+/** Gets a pointer to a specific interface version.
+
+@return A pointer to the interface, NULL if not supported.
+@internalComponent
+@released
+*/
+TAny* CRemConMediaInformationTarget::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+EXPORT_C TInt CRemConMediaInformationTarget::AttributeValue( TMediaAttributeId aAttributeId, TDesC8& aAttributeData )
+	{
+	// check that the values supplied were requested
+	if ( KErrNotFound == iMediaAttributeIDs.Find( aAttributeId ) )
+		{
+		return KErrNotFound;
+		}
+		
+	REAResponse resp;
+	resp.iAttributeId = aAttributeId;
+	resp.iCharset = KUtf8MibEnum;
+	resp.iStringLen = aAttributeData.Length();
+	resp.iString = aAttributeData.Alloc();
+	if (resp.iString == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TInt status = iResponse->iAttributes.Append(resp);
+	if (status != KErrNone)
+		{
+		resp.Close();  // make sure heap string is de-allocated
+		}
+	return status;
+	}
+
+// from MRemConInterfaceIf
+void CRemConMediaInformationTarget::SendError(TInt aError)
+	{
+	RBuf8 outBuf;
+	if (outBuf.Create(KAVCFrameMaxLength) != KErrNone)
+		{
+		// On OOM drop the message
+		return;
+		}
+	
+	TInt error = 0;
+	RAvrcpIPCError response;
+	response.iError = aError;
+	TRAP(error, response.WriteL(outBuf));   // Don't send error if OOM
+	if (error == KErrNone)
+		{
+		InterfaceSelector().SendUnreliable(TUid::Uid(KRemConMediaInformationApiUid),
+							EGetElementAttributes, ERemConResponse, outBuf);
+		}
+	outBuf.Close();
+	}
+
+// from MRemConInterfaceIf
+void CRemConMediaInformationTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData )
+	{
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	LOG1(_L("\taData.Length = %d"), aData.Length());
+
+	(void) aOperationId; // ignore warning about this variable being unused
+	
+	if (!iInProgress && iMsgQueue.IsEmpty())
+		{
+		ProcessMessage(aData);
+		}
+	else
+		{
+		CRemConMediaInformationQueuedMessage* msg = NULL;
+		TRAPD(err, msg = CRemConMediaInformationQueuedMessage::NewL(aData));
+		if (err == KErrNone)
+			{
+			iMsgQueue.AddLast(*msg);
+			}
+		}
+	}
+	
+void CRemConMediaInformationTarget::ProcessMessage(const TDesC8& aData)
+	{
+	iInProgress = ETrue;
+	// Try to read the incoming request
+	TInt error = KErrNone;
+	RRemConGetElementAttributesRequest request;
+	TRAP(error, request.ReadL(aData));
+
+	// Couldn't parse the request; tell them it was invalid
+	if (error != KErrNone)
+		{
+		request.Close();
+		return SendError(KErrAvrcpMetadataParameterNotFound);
+		}
+
+	// Specification section 5.3.1 (page 49) says unique id
+	// must be 0x0. All other values are currently reserved
+	if (request.iElement != 0)
+		{
+		request.Close();
+		return SendError(KErrAvrcpMetadataInvalidParameter);
+		}
+
+	// this may have been used by a previous GetElementAttributes, so
+	iMediaAttributeIDs.Reset();
+
+	if (request.iNumberAttributes == 0)
+		{
+		// spec says this is a request for all attribs
+		// current spec has 7 specified (0x01 to 0x07)
+		for (TInt i = 1; i <= 7; i++)
+			{
+			if (iMediaAttributeIDs.Append((TMediaAttributeId)i) != KErrNone)
+				{
+				request.Close();
+				return SendError(KErrAvrcpMetadataInternalError);
+				}
+			}
+		}
+	else
+		{
+		// No need to check request.iNumberAttributes == request.iAttributes.Count()
+		// as this must be correct or request.ReadL(aData) leaves
+		for (TInt i = 0; i < request.iNumberAttributes; i++)
+			{
+			TUint8 value = request.iAttributes[i];
+			if (value > 0 && value <= KMaxMediaAttributeValue )
+				{
+				if (iMediaAttributeIDs.Append((TMediaAttributeId)value) != KErrNone)
+					{
+						request.Close();
+						return SendError(KErrAvrcpMetadataInternalError);
+					}
+				}
+			}
+		}
+	request.Close();
+
+	// check that some valid attribute ids have been found
+	if (iMediaAttributeIDs.Count())
+		{
+		// if the client has not yet called Completed() on the last request
+		// clear the the attributes from the previous response
+		iResponse->Close();
+		
+		// reset the interator to the start, as it may have been used before
+		iAttributeIterator.Start();
+		
+		// call the client API to get the client value.
+		iObserver.MrcmitoGetCurrentlyPlayingMetadata(iAttributeIterator);
+		}
+	else
+		{
+		// no valid attribute ids found so return an error to bearer
+		SendError(KErrAvrcpMetadataParameterNotFound);
+		}
+	}
+
+// The client application has signaled that all attributes have been returned so 
+// response can now be sent
+EXPORT_C void CRemConMediaInformationTarget::Completed()
+	{
+	if (!iInProgress)
+		{
+		return;
+		}
+	// Finalise response; update number of attributes returned
+	iResponse->iNumberAttributes = iResponse->iAttributes.Count();
+
+	//Check the bound of the number of attributes, zero is not permitted
+	if (iResponse->iNumberAttributes == 0)
+		{
+		return SendError(KErrAvrcpMetadataInternalError);
+		}
+	
+	// Allocate a buffer for the formatted message
+	RBuf8 messageBuffer;
+	if ( messageBuffer.Create(iResponse->Size()) != KErrNone )
+		{
+		// On OOM drop the message
+		iResponse->Close();
+		return;
+		}
+		
+	// send the result back to the CT
+	TInt error = KErrNone;
+	TRAP(error, iResponse->WriteL(messageBuffer));
+	if (error == KErrNone)
+		{
+		InterfaceSelector().SendUnreliable(TUid::Uid(KRemConMediaInformationApiUid),
+								EGetElementAttributes, ERemConResponse, messageBuffer);
+		}
+	
+	// Make sure attribute list is reset for next time
+	iResponse->Close();
+	messageBuffer.Close();
+	
+	iInProgress = EFalse;
+	if (!iMsgQueue.IsEmpty())
+		{
+		iNextMessageCallBack->CallBack();
+		}
+	
+	}
+
+int CRemConMediaInformationTarget::NextMessageCb(TAny* aThis)
+	{
+	static_cast<CRemConMediaInformationTarget*>(aThis)->DoNextMessage();
+	return KErrNone;
+	}
+
+void CRemConMediaInformationTarget::DoNextMessage()
+	{
+	CRemConMediaInformationQueuedMessage* msg = iMsgQueue.First();
+	iMsgQueue.Remove(*msg);
+	ProcessMessage(msg->Data());
+	delete msg;
+	}
+
+EXPORT_C TMediaAttributeIter::TMediaAttributeIter(RArray<TMediaAttributeId>& aMediaAttributeIDs) :
+    iMediaAttributeIDs(aMediaAttributeIDs),
+    iterator(0)
+	{
+	}
+
+EXPORT_C void TMediaAttributeIter::Start()
+	{
+	iterator = 0;
+	}
+
+EXPORT_C TBool TMediaAttributeIter::Next(TMediaAttributeId& aId)
+	{
+	TInt count = iMediaAttributeIDs.Count();
+	if (iterator > count - 1)
+		{
+		return EFalse;
+		}
+	aId = iMediaAttributeIDs[iterator];
+	iterator++;
+	return ETrue;
+	}
+
+CRemConMediaInformationQueuedMessage* CRemConMediaInformationQueuedMessage::NewL(const TDesC8& aData)
+	{
+	CRemConMediaInformationQueuedMessage* self = new (ELeave) CRemConMediaInformationQueuedMessage();
+	CleanupStack::PushL(self);
+	self->ConstructL(aData);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConMediaInformationQueuedMessage::CRemConMediaInformationQueuedMessage()
+	{
+	
+	}
+
+void CRemConMediaInformationQueuedMessage::ConstructL(const TDesC8& aData)
+	{
+	iData.CreateL(aData);
+	}
+
+CRemConMediaInformationQueuedMessage::~CRemConMediaInformationQueuedMessage()
+	{
+	iData.Close();
+	}
+
+const TDesC8& CRemConMediaInformationQueuedMessage::Data()
+	{
+	return iData;
+	}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/bwins/remconnowplayingapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,8 @@
+EXPORTS
+	??1CRemConNowPlayingTargetBase@@MAE@XZ @ 1 NONAME ; CRemConNowPlayingTargetBase::~CRemConNowPlayingTargetBase(void)
+	?NowPlayingContentChanged@CRemConNowPlayingTargetBase@@QAEXXZ @ 2 NONAME ; void CRemConNowPlayingTargetBase::NowPlayingContentChanged(void)
+	?NewL@CRemConDatabaseAwareNowPlayingTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConDatabaseAwareNowPlayingTargetObserver@@@Z @ 3 NONAME ; class CRemConDatabaseAwareNowPlayingTarget * CRemConDatabaseAwareNowPlayingTarget::NewL(class CRemConInterfaceSelector &, class MRemConDatabaseAwareNowPlayingTargetObserver &)
+	?AddToNowPlayingResponse@CRemConNowPlayingTargetBase@@QAEXH@Z @ 4 NONAME ; void CRemConNowPlayingTargetBase::AddToNowPlayingResponse(int)
+	?NewL@CRemConDatabaseUnawareNowPlayingTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConDatabaseUnawareNowPlayingTargetObserver@@@Z @ 5 NONAME ; class CRemConDatabaseUnawareNowPlayingTarget * CRemConDatabaseUnawareNowPlayingTarget::NewL(class CRemConInterfaceSelector &, class MRemConDatabaseUnawareNowPlayingTargetObserver &)
+	?PlayItemResponse@CRemConNowPlayingTargetBase@@QAEXH@Z @ 6 NONAME ; void CRemConNowPlayingTargetBase::PlayItemResponse(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/eabi/remconnowplayingapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,10 @@
+EXPORTS
+	_ZN27CRemConNowPlayingTargetBase16PlayItemResponseEi @ 1 NONAME
+	_ZN27CRemConNowPlayingTargetBase23AddToNowPlayingResponseEi @ 2 NONAME
+	_ZN27CRemConNowPlayingTargetBase24NowPlayingContentChangedEv @ 3 NONAME
+	_ZN27CRemConNowPlayingTargetBaseD0Ev @ 4 NONAME
+	_ZN27CRemConNowPlayingTargetBaseD1Ev @ 5 NONAME
+	_ZN27CRemConNowPlayingTargetBaseD2Ev @ 6 NONAME
+	_ZN36CRemConDatabaseAwareNowPlayingTarget4NewLER24CRemConInterfaceSelectorR44MRemConDatabaseAwareNowPlayingTargetObserver @ 7 NONAME
+	_ZN38CRemConDatabaseUnawareNowPlayingTarget4NewLER24CRemConInterfaceSelectorR46MRemConDatabaseUnawareNowPlayingTargetObserver @ 8 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,33 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconnowplayingapi.mmp
+
+PRJ_EXPORTS
+../public/remcondatabaseawarenowplayingtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawarenowplayingtarget.h)
+../public/remcondatabaseawarenowplayingtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawarenowplayingtargetobserver.h)
+
+../public/remcondatabaseunawarenowplayingtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingtarget.h)
+../public/remcondatabaseunawarenowplayingtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingtargetobserver.h)
+
+../public/remconnowplayingtargetbase.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(remcon/remconnowplayingtargetbase.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/group/remconnowplayingapi.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,61 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconmediainformationapi.dll Remote Control Media Information API - an outer-layer client side library.
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET			remconnowplayingapi.dll
+TARGETPATH		/system/libs
+
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x10285bbc
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE          remconnowplayingtargetbase.cpp 
+SOURCE          remcondatabaseawarenowplayingtarget.cpp 
+SOURCE          remcondatabaseunawarenowplayingtarget.cpp 
+SOURCE          remconnowplayingutils.cpp
+
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+USERINCLUDE      ../inc
+USERINCLUDE      ../../common
+
+LIBRARY 		euser.lib
+LIBRARY 		remconinterfacebase.lib
+LIBRARY 		avrcpipc.lib
+LIBRARY         remconmediainformationapi.lib
+LIBRARY         remconmediabrowseapi.lib
+LIBRARY			estor.lib 
+
+#include <bluetooth/btlogger.mmh>
+#include <comms-infras/commsdebugutility.mmh>
+
+UNPAGED
+
+SMPSAFE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/inc/remconnowplayingfault.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,42 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#ifndef REMCONNOWPLAYINGFAULT_H_
+#define REMCONNOWPLAYINGFAULT_H_
+
+#include <e32base.h>
+
+_LIT(KNowPlayingFaultName, "RcNpFault");
+
+enum TRemConNowPlayingFault
+	{
+	EInvalidEventId = 0,
+	};
+
+class NowPlayingFault
+	{
+public:
+	static void Fault(TRemConNowPlayingFault aFault);
+	};
+
+#endif /*REMCONNOWPLAYINGFAULT_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/public/remcondatabaseawarenowplayingtarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONDATABASEAWARENOWPLAYINGTARGET_H
+#define REMCONDATABASEAWARENOWPLAYINGTARGET_H
+
+
+#include <e32base.h>
+#include <remcon/remconnowplayingtargetbase.h>
+
+class CRemConInterfaceSelector;
+
+NONSHARABLE_CLASS(CRemConDatabaseAwareNowPlayingTarget) : public CRemConNowPlayingTargetBase
+	{
+public:
+	IMPORT_C static CRemConDatabaseAwareNowPlayingTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector,
+			MRemConDatabaseAwareNowPlayingTargetObserver& aObserver);
+	virtual ~CRemConDatabaseAwareNowPlayingTarget();
+
+
+private:
+	CRemConDatabaseAwareNowPlayingTarget(CRemConInterfaceSelector& aInterfaceSelector,
+			MRemConDatabaseAwareNowPlayingTargetObserver& aObserver);
+	void ConstructL();
+	};
+
+#endif //REMCONDATABASEAWARENOWPLAYINGTARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/public/remcondatabaseawarenowplayingtargetobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,103 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONDATABASEAWARENOWPLAYINGTARGETOBSERVER_H
+#define REMCONDATABASEAWARENOWPLAYINGTARGETOBSERVER_H
+
+#include <remconmediabrowsetypes.h>
+
+/**
+It is intended for the client which is database aware.
+Clients must implement this interface in order to instantiate objects of type 
+CRemConDatabaseAwareNowPlayingTarget. This interface passes incoming commands 
+from RemCon to the client. 
+
+@see CRemConDatabaseAwareNowPlayingTarget
+*/
+NONSHARABLE_CLASS(MRemConDatabaseAwareNowPlayingTargetObserver) 
+	{
+public:
+	/**
+	Requests to play an item.
+	
+	@param aItem The item requested to play. 
+	     - If it does not refer to any valid item, the client must call 
+	       CRemConNowPlayingTargetBase::PlayItemResponse() 
+	       with the error KErrInvalidUid;	
+	     - If it refers to a directory which can not be handled by this media 
+	       player, the client must call 
+	       CRemConNowPlayingTargetBase::PlayItemResponse() 
+	       with the error KErrNowPlayingUidIsADirectory;
+	     - If it is in use and can not be played, the client must call 
+	       CRemConNowPlayingTargetBase::PlayItemResponse() 
+	       with the error KErrNowPlayingMediaInUse;
+	
+	@param aScope The scope in which the item was requested to play. 
+	
+	@param aMediaLibraryStateCookie The cookie which the remote device 
+	       believes refers to the current state of the media library. If this
+	       does not match the current state according to the client then the 
+	       client must call 
+	       CRemConNowPlayingTargetBase::PlayItemResponse() 
+	       with the error KErrInvalidMediaLibraryStateCookie.
+	
+    @see CRemConNowPlayingTargetBase::PlayItemResponse().
+	*/
+	virtual void MrcdanptoPlayItem(const TRemConItemUid& aItem, 
+			TRemConFolderScope aScope, 
+			TUint16 aMediaLibraryStateCookie) = 0;
+
+	/**
+	Requests to add an item to now playing list.
+	
+	@param aItem The item requested to play.
+	     - If it does not refer to any valid item, the client must call 
+	       CRemConNowPlayingTargetBase::AddToNowPlayingResponse() 
+	       with the error KErrInvalidUid;
+	     - If it refers to a directory which can not be handled by this media 
+	       player, the client must call 
+	       CRemConNowPlayingTargetBase::AddToNowPlayingResponse() 
+	       with the error KErrNowPlayingUidIsADirectory;
+	     - If it is in use and can not be added to now playing list, the 
+	       client must call 
+	       CRemConNowPlayingTargetBase::AddToNowPlayingResponse() 
+	       with the error KErrNowPlayingMediaInUse;
+	
+	@param aScope The scope in which the item was requested to play. 
+	
+	@param aMediaLibraryStateCookie The cookie which the remote device 
+	       believes refers to the current state of the media library. If this 
+	       does not match the current state according to the client then the 
+	       client must call 
+	       CRemConNowPlayingTargetBase::PlayItemResponse()
+	       with the error KErrInvalidMediaLibraryStateCookie.
+	
+    @see CRemConNowPlayingTargetBase::AddToNowPlayingResponse().
+	*/
+	virtual void MrcdanptoAddToNowPlaying(const TRemConItemUid& aItem, 
+			TRemConFolderScope aScope, 
+			TUint16 aMediaLibraryStateCookie) = 0;
+	};
+
+
+#endif //REMCONDATABASEAWARENOWPLAYINGTARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/public/remcondatabaseunawarenowplayingtarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,46 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONDATABASEUNAWARENOWPLAYINGTARGET_H
+#define REMCONDATABASEUNAWARENOWPLAYINGTARGET_H
+
+#include <e32base.h>
+#include <remcon/remconnowplayingtargetbase.h>
+
+class CRemConInterfaceSelector;
+
+NONSHARABLE_CLASS(CRemConDatabaseUnawareNowPlayingTarget) : public CRemConNowPlayingTargetBase
+	{
+public:
+	IMPORT_C static CRemConDatabaseUnawareNowPlayingTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector,
+			MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver);
+	virtual ~CRemConDatabaseUnawareNowPlayingTarget();
+
+
+private:
+	CRemConDatabaseUnawareNowPlayingTarget(CRemConInterfaceSelector& aInterfaceSelector,
+			MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver);
+	void ConstructL();
+	};
+
+#endif //REMCONDATABASEUNAWARENOWPLAYINGTARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/public/remcondatabaseunawarenowplayingtargetobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,86 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONDATABASEUNAWARENOWPLAYINGTARGETOBSERVER_H
+#define REMCONDATABASEUNAWARENOWPLAYINGTARGETOBSERVER_H
+
+#include <remconmediabrowsetypes.h>
+
+/**
+It is intended for the client which is database aware.
+Clients must implement this interface in order to instantiate objects of type 
+CRemConDatabaseUnawareNowPlayingTarget. This interface passes incoming 
+commands from RemCon to the client. 
+
+@see CRemConDatabaseUnawareNowPlayingTarget
+*/
+NONSHARABLE_CLASS(MRemConDatabaseUnawareNowPlayingTargetObserver) 
+	{
+public:
+	/**
+	Requests to play an item.
+	
+	@param aItem The item requested to play. 
+	     - If it does not refer to any valid item, the client must call 
+	       CRemConNowPlayingTargetBase::PlayItemResponse() with the error 
+	       KErrInvalidUid;	
+	     - If it refers to a directory which can not be handled by this media 
+	       player, the client must call 
+	       CRemConNowPlayingTargetBase::PlayItemResponse() 
+	       with the error KErrNowPlayingUidIsADirectory;
+	     - If it is in use and can not be played, the client must call 
+	       CRemConNowPlayingTargetBase::PlayItemResponse() 
+	       with the error KErrNowPlayingMediaInUse;
+	
+	@param aScope The scope in which the item was requested to play. 
+	
+    @see CRemConNowPlayingTargetBase::PlayItemResponse().
+	*/
+	virtual void MrcdunptoPlayItem(const TRemConItemUid& aItem, 
+			TRemConFolderScope aScope) = 0;
+
+	/**
+	Requests to add an item to now playing list.
+	
+	@param aItem The item requested to play.
+	     - If it does not refer to any valid item, the client must call 
+	       CRemConNowPlayingTargetBase::AddToNowPlayingResponse() 
+	       with the error KErrInvalidUid;
+	     - If it refers to a directory which can not be handled by this media 
+	       player, the client must call 
+	       CRemConNowPlayingTargetBase::AddToNowPlayingResponse() 
+	       with the error KErrNowPlayingUidIsADirectory;
+	     - If it is in use and can not be added to now playing list, the 
+	       client must call 
+	       CRemConNowPlayingTargetBase::AddToNowPlayingResponse() 
+	       with the error KErrNowPlayingMediaInUse;
+	
+	@param aScope The scope in which the item was requested to play. 
+	
+    @see CRemConNowPlayingTargetBase::AddToNowPlayingResponse().
+	*/
+	virtual void MrcdunptoAddToNowPlaying(const TRemConItemUid& aItem, 
+			TRemConFolderScope aScope) = 0;
+	};
+
+#endif //REMCONDATABASEUNAWARENOWPLAYINGTARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/public/remconnowplayingtargetbase.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,111 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONNOWPLAYINGTARGETBASE_H
+#define REMCONNOWPLAYINGTARGETBASE_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+#include <remconmediabrowsetypes.h>
+
+class CRemConInterfaceSelector;
+class MRemConDatabaseAwareNowPlayingTargetObserver;
+class MRemConDatabaseUnawareNowPlayingTargetObserver;
+class TRemConMessageQueue;
+
+/**
+A parent class for CRemConDatabaseAwareNowPlayingTarget and 
+CRemConDatabaseUnawareNowPlayingTarget.
+ 
+This class is not intended for instantiation. Clients should instead use the
+appropriate derived class - either CRemConDatabaseAwareNowPlayingTarget or
+CRemConDatabaseUnawareNowPlayingTarget.
+
+This class is only to be used by classes currently derived from it.
+
+@see CRemConDatabaseAwareNowPlayingTarget
+@see CRemConDatabaseUnawareNowPlayingTarget
+*/
+NONSHARABLE_CLASS(CRemConNowPlayingTargetBase) : public CRemConInterfaceBase,
+	                                             public MRemConInterfaceIf2
+	{
+public:
+	IMPORT_C void PlayItemResponse(TInt aErr);
+	IMPORT_C void AddToNowPlayingResponse(TInt aErr);
+	IMPORT_C void NowPlayingContentChanged();
+	
+protected:
+	IMPORT_C virtual ~CRemConNowPlayingTargetBase();
+	
+	CRemConNowPlayingTargetBase(CRemConInterfaceSelector& aInterfaceSelector,
+			MRemConDatabaseAwareNowPlayingTargetObserver& aObserver);
+	
+	CRemConNowPlayingTargetBase(CRemConInterfaceSelector& aInterfaceSelector,
+			MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver);
+
+	virtual void BaseConstructL();
+
+private: //From CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: //From MRemConInterfaceIf2
+	void MrcibNewMessage(TUint aOperationId,
+			const TDesC8& aData,
+			TRemConMessageSubType aMsgSubType);
+
+private: //Utility functions
+	void SendResponse(TUint8 aStatus, TUint aOperationId);
+	void SendError(TInt aError, TUint aOperationId);	
+	void SendNotificationResponse(TRemConMessageSubType aMsgSubType);
+	
+	void ProcessGetStatus();
+	void ProcessGetStatusAndBeginObserving();	
+	void ProcessPlayItem(const TDesC8& aData);
+	void ProcessAddToNowPlaying(const TDesC8& aData);
+	
+	TBool ProcessNowPlaying(const TDesC8& aData,
+			TUint aOperationId,
+			TUint64& aItem, 
+			TRemConFolderScope& aScope, 
+			TUint16& aMediaLibraryStateCookie);
+
+	static TInt NextMessageCb(TAny* aThis);
+	void DoNextMessage();
+	void AddToOperationQueue(TInt aOperationId, const TDesC8& aData);
+		
+private: //Unowned
+	MRemConDatabaseAwareNowPlayingTargetObserver*	iDaObserver;
+	MRemConDatabaseUnawareNowPlayingTargetObserver*	iDuObserver;
+	CRemConInterfaceSelector&                   	iInterfaceSelector;
+
+private: //Owned
+	TBool                                       iNotificationPending;
+	RBuf8                                       iOutBuf;
+
+    TBool                                       iInProgress;
+    TRemConMessageQueue*                         iMsgQueue;
+    CAsyncCallBack*                             iNextMessageCallBack;
+	};
+
+#endif //REMCONNOWPLAYINGTARGETBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/src/remcondatabaseawarenowplayingtarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,53 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <remcondatabaseawarenowplayingtarget.h>
+
+EXPORT_C CRemConDatabaseAwareNowPlayingTarget* CRemConDatabaseAwareNowPlayingTarget::NewL(
+	CRemConInterfaceSelector& aInterfaceSelector,
+	MRemConDatabaseAwareNowPlayingTargetObserver& aObserver)
+	{
+	CRemConDatabaseAwareNowPlayingTarget* self = new(ELeave)CRemConDatabaseAwareNowPlayingTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+			
+CRemConDatabaseAwareNowPlayingTarget::~CRemConDatabaseAwareNowPlayingTarget()
+	{
+	}
+
+CRemConDatabaseAwareNowPlayingTarget::CRemConDatabaseAwareNowPlayingTarget(
+	CRemConInterfaceSelector& aInterfaceSelector,
+	MRemConDatabaseAwareNowPlayingTargetObserver& aObserver)
+	: CRemConNowPlayingTargetBase(aInterfaceSelector, aObserver)
+	{
+	}
+			
+void CRemConDatabaseAwareNowPlayingTarget::ConstructL()
+	{
+	BaseConstructL();
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/src/remcondatabaseunawarenowplayingtarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,51 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <remcondatabaseunawarenowplayingtarget.h>
+
+EXPORT_C CRemConDatabaseUnawareNowPlayingTarget* CRemConDatabaseUnawareNowPlayingTarget::NewL(
+	CRemConInterfaceSelector& aInterfaceSelector,
+	MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver)
+	{
+	CRemConDatabaseUnawareNowPlayingTarget* self = new(ELeave)CRemConDatabaseUnawareNowPlayingTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+			
+CRemConDatabaseUnawareNowPlayingTarget::~CRemConDatabaseUnawareNowPlayingTarget()
+	{
+	}
+
+CRemConDatabaseUnawareNowPlayingTarget::CRemConDatabaseUnawareNowPlayingTarget(
+	CRemConInterfaceSelector& aInterfaceSelector,
+	MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver)
+	: CRemConNowPlayingTargetBase(aInterfaceSelector, aObserver)
+	{
+	}
+			
+void CRemConDatabaseUnawareNowPlayingTarget::ConstructL()
+	{
+	BaseConstructL();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/src/remconnowplayingtargetbase.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,472 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <remconmediabrowsetypes.h>
+#include <remcondatabaseawarenowplayingtargetobserver.h>
+#include <remcondatabaseunawarenowplayingtargetobserver.h>
+#include <remcon/remconnowplayingtargetbase.h>
+#include <remcon/avrcpspec.h>
+#include <remconinterfaceselector.h>
+#include <bluetooth/logger.h>
+
+#include "mediabrowse.h"
+#include "nowplaying.h"
+#include "remconnowplayingfault.h"
+#include "remconqueuemessage.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCONNOWPLAYINGAPI);
+_LIT8(KLogFormat, "Operation Id = 0x%x, Data Lengh = %d");
+#endif
+
+CRemConNowPlayingTargetBase::CRemConNowPlayingTargetBase(
+	CRemConInterfaceSelector& aInterfaceSelector,
+	MRemConDatabaseAwareNowPlayingTargetObserver& aObserver)
+	: CRemConInterfaceBase(
+	TUid::Uid(KRemConNowPlayingApiUid),
+	KMaxLengthNowPlayingMsg,
+	aInterfaceSelector,
+	ERemConClientTypeTarget), 
+	iDaObserver(&aObserver),
+	iInterfaceSelector(aInterfaceSelector),
+	iInProgress(EFalse)
+	{
+	}
+		
+CRemConNowPlayingTargetBase::CRemConNowPlayingTargetBase(
+	CRemConInterfaceSelector& aInterfaceSelector,
+	MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver)
+	: CRemConInterfaceBase(
+	TUid::Uid(KRemConNowPlayingApiUid),
+	KMaxLengthNowPlayingMsg,
+	aInterfaceSelector,
+	ERemConClientTypeTarget), 
+	iDuObserver(&aObserver),
+	iInterfaceSelector(aInterfaceSelector),
+	iInProgress(EFalse)
+	{
+	}
+	
+void CRemConNowPlayingTargetBase::BaseConstructL()
+	{
+	iMsgQueue = new(ELeave)TRemConMessageQueue;
+	TCallBack cb(&NextMessageCb, this);
+	iNextMessageCallBack = new (ELeave) CAsyncCallBack(cb,
+			CActive::EPriorityStandard);
+		
+	iOutBuf.CreateL(KMaxLengthNowPlayingMsg);
+	
+    // Mandate the following features supported.
+	RRemConInterfaceFeatures features;
+	User::LeaveIfError(features.Open());
+	CleanupClosePushL(features);
+
+	features.AddOperationL(EPlayItem);
+	features.AddOperationL(EAddToNowPlaying);
+	features.AddOperationL(ERegisterNotification);
+	
+    CRemConInterfaceBase::BaseConstructL(features);
+    CleanupStack::PopAndDestroy(&features);
+	}
+	
+
+EXPORT_C CRemConNowPlayingTargetBase::~CRemConNowPlayingTargetBase()
+	{
+	iOutBuf.Close();
+
+	iNextMessageCallBack->Cancel();
+	delete iNextMessageCallBack;
+	
+	iMsgQueue->Reset();
+	delete iMsgQueue;
+	}
+
+/** 
+@internalComponent
+@released
+
+Gets a pointer to a specific interface version.
+
+@return A pointer to the interface, NULL if not supported.
+*/
+TAny* CRemConNowPlayingTargetBase::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf2) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf2*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+/**
+Provide a response to the play item command. For database aware clients this 
+would have been called via MrcdanptoPlayItem(). For database unaware client
+this would have been called via MrcdunptoPlayItem()
+
+The client must call NowPlayingContentChanged() if the content of the now 
+playing list has been changed after the client successfully plays the item
+and provides the response with KErrNone through this function.
+
+@param aErr The result of play item operation.
+     - KErrNone if the operation was successful.
+     - KErrInvalidMediaLibraryStateCookie if the client is able to maintain 
+       unique UIDs accross the entire virtual filesystem, but the media 
+       library state cookie provided does not match the client's state cookie.
+     - KErrInvalidUid if the uid of the item provided does not refer to any 
+       valid item.
+     - KErrNowPlayingUidIsADirectory if the uid of the item provided refers to
+       a directory which can not be handled by this media player.
+     - KErrNowPlayingMediaInUse if the item is in use and can not be played.
+     - System wide error code otherwise.
+
+@see NowPlayingContentChanged()
+*/
+EXPORT_C void CRemConNowPlayingTargetBase::PlayItemResponse(TInt aErr)
+	{
+	TUint8 status = RAvrcpIPC::SymbianErrToStatus(aErr);
+	SendResponse(status, EPlayItem);
+	
+	iInProgress = EFalse;		
+	if (!iMsgQueue->IsEmpty())
+		{
+		iNextMessageCallBack->CallBack();
+		}
+	}
+
+/**
+Sends the response for the request MrcnptoAddToNowPlaying()
+
+The client must call NowPlayingContentChanged() if the content of the now 
+playing list has been changed after the client successfully adds the item
+to the now playing list and provides the response with KErrNone through 
+this function.
+
+param aErr The result of add to now playing operation.
+    - KErrNone if the operation was successful.
+    - KErrInvalidMediaLibraryStateCookie if the client is able to maintain 
+      unique UIDs accross the entire virtual filesystem, but the media 
+      library state cookie provided does not match the client's state cookie.
+    - KErrInvalidUid if the uid of the item provided does not 
+      refer to any valid item.
+    - KErrNowPlayingUidIsADirectory if the uid of the item provided refers to
+      a directory which can not be handled by this media player.
+    - KErrNowPlayingMediaInUse if the item is in use and can not be added to 
+      now playing list.
+    - KErrNowPlayingListFull if the now playing list if full and no more items
+      can be added.
+    - System wide error code otherwise.
+
+@see NowPlayingContentChanged()
+*/
+EXPORT_C void CRemConNowPlayingTargetBase::AddToNowPlayingResponse(TInt aErr)
+	{
+	TUint8 status = RAvrcpIPC::SymbianErrToStatus(aErr);
+	SendResponse(status, EAddToNowPlaying);
+
+	iInProgress = EFalse;		
+	if (!iMsgQueue->IsEmpty())
+		{
+		iNextMessageCallBack->CallBack();
+		}
+	}
+
+/**
+Called by the client in the case that the now playing content changed.
+
+@see PlayItemResponse()
+@see AddToNowPlayingResponse()
+*/
+EXPORT_C void CRemConNowPlayingTargetBase::NowPlayingContentChanged()
+	{
+	if(iNotificationPending)
+		{
+		iNotificationPending = EFalse;
+		SendNotificationResponse(ERemConNotifyResponseChanged);
+		}
+	}
+
+void CRemConNowPlayingTargetBase::SendResponse(TUint8 aStatus, TUint aOperationId)
+	{
+	TInt error = KErrNone;
+
+	// Formats the response in a RRemConNowPlayingResponse
+	RRemConNowPlayingResponse response;
+	response.iStatus = aStatus;
+	
+	TRAP(error, response.WriteL(iOutBuf));
+	if (error == KErrNone)
+		{
+		// Send the response back to the CT
+		error = InterfaceSelector().SendUnreliable(
+				TUid::Uid(KRemConNowPlayingApiUid),
+				aOperationId, ERemConResponse, iOutBuf );
+		}
+
+	}
+
+void CRemConNowPlayingTargetBase::SendError(TInt aError, TUint aOperationId)
+	{
+	TInt error = KErrNone;	
+	RAvrcpIPCError response;
+	response.iError = RAvrcpIPC::SymbianErrorCheck(aError);
+	TRAP(error, response.WriteL(iOutBuf));
+	if (error == KErrNone)
+		{
+		InterfaceSelector().SendUnreliable(TUid::Uid(KRemConNowPlayingApiUid),
+				aOperationId, ERemConResponse, iOutBuf);
+		}
+	}
+
+// From MRemConInterfaceIf2
+void CRemConNowPlayingTargetBase::MrcibNewMessage(
+		TUint aOperationId, 
+		const TDesC8& aData, 
+		TRemConMessageSubType aMsgSubType)
+	{
+	LOG_FUNC
+	LOG2(KLogFormat, aOperationId, aData.Length());
+
+	TMetadataTransferPDU currentOp =
+	RAvrcpIPC::GetPDUIdFromIPCOperationId(aOperationId);
+	switch(currentOp)
+		{
+	case EPlayItem:
+		if ( !iInProgress && 
+			 !iMsgQueue->Find(TUid::Uid(KRemConNowPlayingApiUid), EPlayItem))
+			{
+			ProcessPlayItem(aData);
+			}
+		else
+			{
+			AddToOperationQueue(EPlayItem, aData);
+			}
+		break;
+	case EAddToNowPlaying:
+		if ( !iInProgress && 
+			 !iMsgQueue->Find(TUid::Uid(KRemConNowPlayingApiUid), EAddToNowPlaying))
+			{
+			ProcessAddToNowPlaying(aData);
+			}
+		else
+			{
+			AddToOperationQueue(EAddToNowPlaying, aData);
+			}
+		break;
+	case ERegisterNotification:
+		{
+		// obtain eventId from aOperationId
+		TRegisterNotificationEvent eventId = 
+		RAvrcpIPC::GetEventIdFromIPCOperationId(aOperationId);
+		
+		// If asserted here, must something wrong occured in the 
+		// remconbearer handling
+		__ASSERT_DEBUG(eventId == ERegisterNotificationNowPlayingContentChanged
+				, NowPlayingFault::Fault(EInvalidEventId));
+        
+		// register for Notifications
+		if (aMsgSubType == ERemConNotifyCommandAwaitingInterim)
+			{
+			ProcessGetStatusAndBeginObserving();
+			}
+		else if (aMsgSubType == ERemConNotifyCommandAwaitingChanged)
+			{
+			ProcessGetStatus();
+			}
+	 	break;
+		}
+	default:
+		break;
+		};
+	}
+	
+void CRemConNowPlayingTargetBase::ProcessPlayItem(const TDesC8& aData)
+	{
+	TUint64 item;
+	TRemConFolderScope scope;
+	TUint16 uidCounter;
+	
+	if (!ProcessNowPlaying(aData, EPlayItem, item, scope, uidCounter))
+		{
+		return;
+		}
+	
+	iInProgress = ETrue;
+	if (iDaObserver && (uidCounter > 0))	
+		{
+		iDaObserver->MrcdanptoPlayItem(item, scope, uidCounter);
+		}
+	else if (!iDaObserver && (0 == uidCounter))
+		{
+		iDuObserver->MrcdunptoPlayItem(item, scope);
+		}
+	else
+		{
+		PlayItemResponse(KErrAvrcpAirInvalidParameter);
+		}
+	}
+
+void CRemConNowPlayingTargetBase::ProcessAddToNowPlaying(const TDesC8& aData)
+	{
+	TUint64 item;
+	TRemConFolderScope scope;
+	TUint16 uidCounter;
+	
+	if (!ProcessNowPlaying(aData, EAddToNowPlaying, item, scope, uidCounter))
+		{
+		return;
+		}
+
+	iInProgress = ETrue;
+	if (iDaObserver && (uidCounter > 0))
+		{
+		iDaObserver->MrcdanptoAddToNowPlaying(item, scope, uidCounter);
+		}
+	else if (!iDaObserver && (0 == uidCounter))
+		{
+		iDuObserver->MrcdunptoAddToNowPlaying(item, scope);
+		}
+	else
+		{
+		AddToNowPlayingResponse(KErrAvrcpAirInvalidParameter);
+		}
+	}
+
+TBool CRemConNowPlayingTargetBase::ProcessNowPlaying(
+		const TDesC8& aData, 
+		TUint aOperationId,
+		TUint64& aItem, 
+		TRemConFolderScope& aScope, 
+		TUint16& aMediaLibraryStateCookie)
+	{
+	RRemConNowPlayingRequest request;
+	TRAPD(error, request.ReadL(aData))
+	if (error != KErrNone)
+		{
+		// Nothing in packet
+		SendError(KErrAvrcpMetadataParameterNotFound, aOperationId);
+		return EFalse;
+		}
+    
+	aItem = request.iElement;
+	aScope = request.iScope;
+	aMediaLibraryStateCookie = request.iUidCounter;
+	
+	//Does not allow invalid scope
+	if (   aScope != EBrowseFolder 
+		&& aScope != ESearchResultFolder
+		&& aScope != ENowPlayingFolder )
+		{
+		SendError(KErrAvrcpAirInvalidScope, aOperationId);
+		return EFalse;
+		}
+	return ETrue;
+	}
+
+void CRemConNowPlayingTargetBase::ProcessGetStatusAndBeginObserving()
+	{
+	// and request another notification (if there is not one already pending)
+	// on the next state change  
+	iNotificationPending = ETrue;
+		
+	// send the current status
+	SendNotificationResponse(ERemConNotifyResponseInterim);
+	}
+
+void CRemConNowPlayingTargetBase::ProcessGetStatus()
+	{
+	// send the current value
+	SendNotificationResponse(ERemConNotifyResponseChanged);
+	}
+
+void CRemConNowPlayingTargetBase::SendNotificationResponse(
+		TRemConMessageSubType aMsgSubType)
+	{
+	LOG_FUNC
+
+	TInt error = KErrNone;
+
+	// No extra data needed
+	RAvrcpIPCError response;
+	response.iError = KErrNone;
+	TRAP(error, response.WriteL(iOutBuf));
+
+	if (error == KErrNone)
+		{
+		// send the response back to the CT
+		TUint operationId = 
+		RAvrcpIPC::SetIPCOperationIdFromEventId(
+				ERegisterNotificationNowPlayingContentChanged);
+		
+		error = InterfaceSelector().SendUnreliable(
+				TUid::Uid(KRemConNowPlayingApiUid),
+				operationId, ERemConResponse, aMsgSubType, iOutBuf);
+		}
+	}
+
+TInt CRemConNowPlayingTargetBase::NextMessageCb(TAny* aThis)
+	{
+	static_cast<CRemConNowPlayingTargetBase*>(aThis)->DoNextMessage();
+	return KErrNone;
+	}
+
+void CRemConNowPlayingTargetBase::DoNextMessage()
+	{
+	CRemConQueuedMessage* msg = iMsgQueue->First();
+	iMsgQueue->Remove(*msg);
+	
+	switch (msg->iOperationId)
+		{
+		case EPlayItem:
+			ProcessPlayItem(msg->Data());
+			break;
+		case EAddToNowPlaying:
+			ProcessAddToNowPlaying(msg->Data());
+			break;
+		default:
+			// Never come here.
+			ASSERT(NULL);
+			break;
+		}
+	delete msg;
+	}
+
+void CRemConNowPlayingTargetBase::AddToOperationQueue(TInt aOperationId, 
+		const TDesC8& aData)
+	{
+	CRemConQueuedMessage* msg = NULL;
+	TRAPD(err, msg = CRemConQueuedMessage::NewL(
+			TUid::Uid(KRemConNowPlayingApiUid), aData, aOperationId));			
+	if (err == KErrNone)
+		{
+		iMsgQueue->AddLast(*msg);
+		}
+	else
+		{
+		SendError(KErrAvrcpMetadataInternalError, aOperationId);
+		}
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/nowplayingapi/src/remconnowplayingutils.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include "remconnowplayingfault.h"
+
+void NowPlayingFault::Fault(TRemConNowPlayingFault aFault)
+	{
+	User::Panic(KNowPlayingFaultName, aFault);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/bwins/remconplayerinformationu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+EXPORTS
+	??1CPlayerApplicationSettings@@UAE@XZ @ 1 NONAME ABSENT ; CPlayerApplicationSettings::~CPlayerApplicationSettings(void)
+	??1CPlayerInfoTarget@@UAE@XZ @ 2 NONAME ; CPlayerInfoTarget::~CPlayerInfoTarget(void)
+	?AddCompanyId@MPlayerCapabilitiesObserver@@QAEHH@Z @ 3 NONAME ; int MPlayerCapabilitiesObserver::AddCompanyId(int)
+	?AddEvent@MPlayerCapabilitiesObserver@@QAEHW4TRegisterNotificationEvent@@@Z @ 4 NONAME ; int MPlayerCapabilitiesObserver::AddEvent(enum TRegisterNotificationEvent)
+	?ClearCompanyIds@MPlayerCapabilitiesObserver@@QAEXXZ @ 5 NONAME ; void MPlayerCapabilitiesObserver::ClearCompanyIds(void)
+	?ClearEvents@MPlayerCapabilitiesObserver@@QAEXXZ @ 6 NONAME ; void MPlayerCapabilitiesObserver::ClearEvents(void)
+	?DefineAttributeL@MPlayerApplicationSettingsObserver@@QAEXIAAVTDesC8@@AAV?$RArray@I@@AAV?$RArray@VTPtrC8@@@@I@Z @ 7 NONAME ; void MPlayerApplicationSettingsObserver::DefineAttributeL(unsigned int, class TDesC8 &, class RArray<unsigned int> &, class RArray<class TPtrC8> &, unsigned int)
+	?DefineAttributesL@PlayerApplicationSettingsResourceInit@@SAXAAVMPlayerApplicationSettingsObserver@@AAVCResourceFile@@@Z @ 8 NONAME ; void PlayerApplicationSettingsResourceInit::DefineAttributesL(class MPlayerApplicationSettingsObserver &, class CResourceFile &)
+	?NewL@CPlayerApplicationSettings@@SAPAV1@IAAVTDesC8@@V?$RArray@I@@AAV?$RArray@VTPtrC8@@@@I@Z @ 9 NONAME ABSENT ; class CPlayerApplicationSettings * CPlayerApplicationSettings::NewL(unsigned int, class TDesC8 &, class RArray<unsigned int>, class RArray<class TPtrC8> &, unsigned int)
+	?NewL@CPlayerInfoTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAPAVMPlayerCapabilitiesObserver@@AAPAVMPlayerApplicationSettingsObserver@@AAPAVMPlayerEventsObserver@@AAVMPlayerApplicationSettingsNotify@@@Z @ 10 NONAME ; class CPlayerInfoTarget * CPlayerInfoTarget::NewL(class CRemConInterfaceSelector &, class MPlayerCapabilitiesObserver * &, class MPlayerApplicationSettingsObserver * &, class MPlayerEventsObserver * &, class MPlayerApplicationSettingsNotify &)
+	?PlaybackStatusChanged@MPlayerEventsObserver@@QAEXW4TPlaybackStatus@1@@Z @ 11 NONAME ; void MPlayerEventsObserver::PlaybackStatusChanged(enum MPlayerEventsObserver::TPlaybackStatus)
+	?RemoveCompanyID@MPlayerCapabilitiesObserver@@QAEHH@Z @ 12 NONAME ; int MPlayerCapabilitiesObserver::RemoveCompanyID(int)
+	?RemoveEvent@MPlayerCapabilitiesObserver@@QAEHW4TRegisterNotificationEvent@@@Z @ 13 NONAME ; int MPlayerCapabilitiesObserver::RemoveEvent(enum TRegisterNotificationEvent)
+	?SetAttributeL@MPlayerApplicationSettingsObserver@@QAEXII@Z @ 14 NONAME ; void MPlayerApplicationSettingsObserver::SetAttributeL(unsigned int, unsigned int)
+	?SetBatteryStatus@MPlayerEventsObserver@@QAEXW4TTargetBatteryStatus@1@@Z @ 15 NONAME ; void MPlayerEventsObserver::SetBatteryStatus(enum MPlayerEventsObserver::TTargetBatteryStatus)
+	?SetPlaybackPosition@MPlayerEventsObserver@@QAEXK@Z @ 16 NONAME ; void MPlayerEventsObserver::SetPlaybackPosition(unsigned long)
+	?TrackChanged@MPlayerEventsObserver@@QAEX_KK@Z @ 17 NONAME ; void MPlayerEventsObserver::TrackChanged(unsigned long long, unsigned long)
+	?TrackReachedEnd@MPlayerEventsObserver@@QAEXXZ @ 18 NONAME ; void MPlayerEventsObserver::TrackReachedEnd(void)
+	?TrackReachedStart@MPlayerEventsObserver@@QAEXXZ @ 19 NONAME ; void MPlayerEventsObserver::TrackReachedStart(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/eabi/remconplayerinformationu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+EXPORTS
+	_ZN17CPlayerInfoTarget4NewLER24CRemConInterfaceSelectorRP27MPlayerCapabilitiesObserverRP34MPlayerApplicationSettingsObserverRP21MPlayerEventsObserverR32MPlayerApplicationSettingsNotify @ 1 NONAME
+	_ZN17CPlayerInfoTargetD0Ev @ 2 NONAME
+	_ZN17CPlayerInfoTargetD1Ev @ 3 NONAME
+	_ZN17CPlayerInfoTargetD2Ev @ 4 NONAME
+	_ZN21MPlayerEventsObserver12TrackChangedEym @ 5 NONAME
+	_ZN21MPlayerEventsObserver15TrackReachedEndEv @ 6 NONAME
+	_ZN21MPlayerEventsObserver16SetBatteryStatusENS_20TTargetBatteryStatusE @ 7 NONAME
+	_ZN21MPlayerEventsObserver17TrackReachedStartEv @ 8 NONAME
+	_ZN21MPlayerEventsObserver19SetPlaybackPositionEm @ 9 NONAME
+	_ZN21MPlayerEventsObserver21PlaybackStatusChangedENS_15TPlaybackStatusE @ 10 NONAME
+	_ZN27MPlayerCapabilitiesObserver11ClearEventsEv @ 11 NONAME
+	_ZN27MPlayerCapabilitiesObserver11RemoveEventE26TRegisterNotificationEvent @12 NONAME
+	_ZN27MPlayerCapabilitiesObserver12AddCompanyIdEi @ 13 NONAME
+	_ZN27MPlayerCapabilitiesObserver15ClearCompanyIdsEv @ 14 NONAME
+	_ZN27MPlayerCapabilitiesObserver15RemoveCompanyIDEi @ 15 NONAME
+	_ZN27MPlayerCapabilitiesObserver8AddEventE26TRegisterNotificationEvent @16 NONAME
+	_ZN34MPlayerApplicationSettingsObserver13SetAttributeLEjj @ 17 NONAME
+	_ZN34MPlayerApplicationSettingsObserver16DefineAttributeLEjR6TDesC8R6RArrayIjERS2_I6TPtrC8Ej @ 18 NONAME
+	_ZN37PlayerApplicationSettingsResourceInit17DefineAttributesLER34MPlayerApplicationSettingsObserverR13CResourceFile @ 19 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,26 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconplayerinformation.mmp
+
+PRJ_EXPORTS
+../public/playerinformationtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(playerinformationtarget.h)
+../public/playerinformationtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(playerinformationtargetobserver.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/group/remconplayerinformation.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,66 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconcoreapi.dll Remote Control Core API- an outer-layer client 
+// side library.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET			remconplayerinformation.dll
+TARGETPATH		/system/libs
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			playerinformation.cpp
+SOURCE			settingsresource.cpp
+SOURCE			playersettings.cpp
+SOURCE			playercapabilities.cpp
+SOURCE			playerevents.cpp
+SOURCE			playerapplicationsetting.cpp
+SOURCE			eventsmask.cpp
+
+USERINCLUDE 	../inc
+USERINCLUDE 	../../common
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		bafl.lib
+LIBRARY 		euser.lib
+LIBRARY			estor.lib 
+LIBRARY 		remconinterfacebase.lib
+LIBRARY			avrcpipc.lib
+LIBRARY			esock.lib
+
+SOURCEPATH		../resource
+USERINCLUDE		../resource
+
+start resource avrcp-settings.rss
+targetpath /bluetooth/avrcp/
+end
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/inc/eventsmask.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,51 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#ifndef EVENTSMASK_H
+#define EVENTSMASK_H
+
+// INCLUDES
+#include <e32base.h>
+#include <remcon/avrcpspec.h>
+
+/**
+This class stores the supported events list in a bitmask. 
+The event ids are numbers from 0x01 to 0x09 (from specs).
+A 1 in the 0xXX position means that the XX eventid event is supported, a 0 in 
+the same position means that it's not supported.
+ */
+NONSHARABLE_CLASS(TEventsMask) 
+	{
+public:
+	TEventsMask();
+	void Reset();
+	TBool Find(TRegisterNotificationEvent aEvent) const; 
+	void Append(TRegisterNotificationEvent aEvent);
+	void Remove(TRegisterNotificationEvent aEvent);
+	void Begin();
+	TBool Next();
+	TRegisterNotificationEvent Get() const;
+private:
+	TUint16							iMask;
+	TUint8							iNextSupportedEvent;
+	};
+
+#endif // EVENTSMASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/inc/playereventsutils.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,42 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef PLAYEREVENTSUTILS_H
+#define PLAYEREVENTSUTILS_H
+
+_LIT(KPlayerEventsPanicName, "PlayerEvents");
+
+enum TPlayerEventsPanic
+	{
+	ETwoGetPlayStatusUpdatesQueued = 0,
+	EBadlyFormattedInternalData = 1,
+	};
+
+class PlayerEventsUtils
+	{
+public:
+	static void Panic(TPlayerEventsPanic aPanic); 
+	};
+
+/** Utility PlayerEvents panic function.
+
+@param aPanic The panic number.
+*/
+void PlayerEventsUtils::Panic(TPlayerEventsPanic aPanic)
+	{
+	User::Panic(KPlayerEventsPanicName, aPanic);
+	}
+
+#endif // PLAYEREVENTSUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/inc/playersettingsutils.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,41 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef PLAYERSETTTINGSUTILS_H
+#define PLAYERSETTTINGSUTILS_H
+
+_LIT(KPlayerSettingsPanicName, "PlayerSettings");
+
+enum TPlayerSettingsPanic
+	{
+	EPlayerSettingsFunnyLengthData = 0,
+	};
+
+class PlayerSettingsUtils
+	{
+public:
+	static void Panic(TPlayerSettingsPanic aPanic); // The macro is probably more useful so this can be removed
+	};
+
+/** Utility PlayerSettings panic function.
+
+@param aPanic The panic number.
+*/
+void PlayerSettingsUtils::Panic(TPlayerSettingsPanic aPanic)
+	{
+	User::Panic(KPlayerSettingsPanicName, aPanic);
+	}
+
+#endif //PLAYERSETTTINGSUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/public/playerinformationtarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,175 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONPLAYERINFORMATIONTARGET_H
+#define REMCONPLAYERINFORMATIONTARGET_H
+
+#include <e32base.h>
+#include <s32mem.h>
+#include <e32hashtab.h>
+
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+#include <remcon/avrcpspec.h>
+#include <playerinformationtargetobserver.h>
+
+class CRemConInterfaceSelector;
+class CPlayerApplicationSettings;
+class TEventsMask;
+
+// This is the maximum length of the player application setting attribute and value strings
+const TInt KMaxPlayerApplicationSettingsValue = 255 ;
+// This is the minimum length of the player application setting attribute and value strings
+const TInt KMinPlayerApplicationSettingsValue = 1 ;
+
+/**
+Client-instantiable class supporting player information responses.
+This is the container class for the three interface parts
+*/
+NONSHARABLE_CLASS(CPlayerInfoTarget) : 	public CRemConInterfaceBase,
+								       	public MRemConInterfaceIf2, 
+								       	private MPlayerCapabilitiesObserver,
+										private MPlayerApplicationSettingsObserver,
+										private MPlayerEventsObserver
+								           
+	{
+public:
+	/**
+	Factory function.
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aPlayerCapabilitiesObserver Returns a pointer to a MPlayerCapabilitiesObserver for this interface, owned by the CPlayerInfoTarget.
+	@param aPlayerApplicationSettingsObserver Returns a pointer to a MPlayerApplicationSettingsObserver for this interface, owned by the CPlayerInfoTarget
+	@param aPlayerEventsObserver Returns a pointer to a MPlayerEventsObserver for this interface, owned by the CPlayerInfoTarget
+	@return A new CPlayerInfoTarget, owned by the interface selector.
+	*/
+	IMPORT_C static CPlayerInfoTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector,
+								       	MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver,
+										MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver,
+										MPlayerEventsObserver*& aPlayerEventsObserver,
+										MPlayerApplicationSettingsNotify& aApplicationSettingNotifier );
+	
+	/** Destructor */
+	IMPORT_C ~CPlayerInfoTarget();
+
+
+
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	*/
+	CPlayerInfoTarget(CRemConInterfaceSelector& aInterfaceSelector, MPlayerApplicationSettingsNotify& aApplicationSettingNotifier );
+
+	void ConstructL(MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver,
+							MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver,
+							MPlayerEventsObserver*& aPlayerEventsObserver );
+	
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData, TRemConMessageSubType aMsgSubType);
+
+private: 
+	// Bearer attributes (settings) processing
+	void ProcessListPlayerApplicationAttributes( TInt aOperationId );
+	void ProcessGetPlayerApplicationAttributeText( const TDesC8& aData, TInt aOperationId );
+	void ProcessListPlayerApplicationValues( const TDesC8& aData, TInt aOperationId );
+	void ProcessGetPlayerApplicationValueText( const TDesC8& aData, TInt aOperationId );
+	void ProcessGetCurrentPlayerApplicationValue( const TDesC8& aData, TInt aOperationId );
+	void ProcessSetPlayerApplicationValue( const TDesC8& aData, TInt aOperationId );
+
+	// Bearer attributes (settings) API implementation from MPlayerApplicationSettingsObserver
+	void DoDefineAttributeL(TUint aAttributeID, TDesC8& aAttributeText, RArray<TUint> &aValues, RArray<TPtrC8> &aValueTexts, TUint aInitialValue);
+	void DoSetAttributeL(TUint aAttributeID, TUint aValue);
+
+	// Notifier Events API implementation from MPlayerEventsObserver
+	void DoPlaybackStatusChanged(TPlaybackStatus aStatus);
+	void DoTrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds);
+	void DoTrackReachedEnd();
+	void DoTrackReachedStart();
+	void DoSetPlaybackPosition(TUint32 aMilliseconds);	
+	void DoSetBatteryStatus(TTargetBatteryStatus aBatteryStatus);
+
+	// Notifier Events bearer processing  
+	void ProcessGetPlayStatus();
+	void ProcessGetStatusAndBeginObserving(TUint aOperationId, TRegisterNotificationEvent aEventId, const TDesC8& aData);
+	void ProcessGetStatus(TUint aOperationId, TRegisterNotificationEvent aEventId);
+	void SendNotificationResponse(TRegisterNotificationEvent aEventId, TRemConMessageSubType aMsgSubType);
+	void ProcessGetPlayStatusUpdate(const TDesC8& aData);
+	
+	// Capabilities API implementation from MPlayerCapabilitiesObserver
+	void DoClearEvents();
+	TInt DoAddEvent(TRegisterNotificationEvent aEvent);
+	TInt DoRemoveEvent(TRegisterNotificationEvent aEvent);
+	void DoClearCompanyIds();
+	TInt DoAddCompanyId(TInt aID);
+	TInt DoRemoveCompanyID(TInt aID);
+
+	// Capabilities bearer processing 
+	void ProcessGetCapabilities( const TDesC8& aData );
+	
+	// Miscellaneous
+	TBool AttributeSettingExists(TUint anAttribute);
+	TBool IsValidAttributeValue(TUint anAttributeId, TUint aAttributeValue);
+	TBool AttributeValueCanBeSet(TUint anAttributeId, TUint aAttributeValue);
+	void SendError(TInt, TInt);
+	void SendError(TInt, TInt, TRemConMessageSubType aSubType);
+	CPlayerApplicationSettings* GetSetting(TUint anAttribute);
+	MPlayerEventsObserver::TTargetBatteryStatus DetectBatteryStatus();
+
+private: // owned
+	RBuf8								iOutBuf;
+
+	MPlayerApplicationSettingsNotify& 	iApplicationSettingNotifier;
+		
+	// data for MPlayerEventsObserver
+	TPlaybackStatus 					iPlayBackStatus;
+	TUint64 							iTrackId;
+	TUint32 							iLengthInMilliseconds;
+	TPlayPosition						iTrackPosition;
+	
+	// The time interval (received as part if the RegisterNotification) 
+	// in which the change in playback position will be notified
+	TUint32   							iPlayBackIntervalInMilliseconds;
+
+	TTargetBatteryStatus				iBatteryStatus;
+	TUint32 							iPlaybackPositionInMilliseconds;
+	TUint32								iLastNotifiedPlaybackPositionInMilliseconds;
+	
+	// data for MPlayerCapabilitiesObserver
+	TEventsMask*						iSupportedNotificationEventList;
+	RArray<TInt> 						iCompanyIdList;
+
+	// list of events for which notifications have been request 
+	RArray<TRegisterNotificationEvent> 			iPendingNotificationEventList;
+	
+	// Whether we've been asked for an update when the play status changes
+	TBool								iPlaybackStatusUpdatePending;
+
+	// Attribute (settings) data MPlayerApplicationSettingsObserver
+	RHashMap<TInt, CPlayerApplicationSettings*>		iPlayerApplicationSettings;
+
+	};
+
+
+#endif // REMCONPLAYERINFORMATIONTARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/public/playerinformationtargetobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,298 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONPLAYERINFORMATIONTARGETOBSERVER_H
+#define REMCONPLAYERINFORMATIONTARGETOBSERVER_H
+
+#include <e32base.h>
+#include <remcon/avrcpspec.h>
+#include <barsc2.h>
+
+
+/**
+This class is used to define the capabilities of the current application,
+and the implementation will generate AVRCP responses to the controller.
+For the event part of the API, it is recommended to add all events which make
+sense for the media player. In general, this will be everything except
+ESystemStatusChanged. The company ID part of the API is only needed if
+the media player needs to support vendor extensions other than bluetooth SIG.
+The bluetooth SIG company ID is always included in responses to a COMPANY_ID request.
+*/
+class MPlayerCapabilitiesObserver 
+	{
+	public:
+		/**
+		Remove all notification events from the supported list
+		*/
+		IMPORT_C void ClearEvents();
+		/**
+		Add a notification event to the supported list of events
+		The AVRCP 1.3 specification mandates that PlaybackStatusChanged
+		and TrackChanged events must be supported; KErrAlreadyExists will
+		be returned if AddEvent() is called with either of these events.
+		@param aEvent the event to add
+		@return KErrAlreadyExists if the event is already present.
+		KErrNotSupported if the event isn't supported by the implementation, e.g.. ESystemStatusChanged
+		*/
+		IMPORT_C TInt AddEvent(TRegisterNotificationEvent aEvent);
+		/**
+		Remove a notification event from the supported list of events
+		The AVRCP 1.3 specification mandates that PlaybackStatusChanged
+		and TrackChanged events must be supported; KErrNotSupported will
+		be returned if RemoveEvent() is called with either of these events.
+		@param aEvent the event to remove
+		@return KErrNone if this completes successfully, KErrNotFound if aID
+		was not in the list, or any other system wide error code.
+		*/
+		IMPORT_C TInt RemoveEvent(TRegisterNotificationEvent aEvent);
+
+		const static TInt KMaxCompanyID = 0xFFFFFF;
+		const static TInt KMaxNrOfCompanyIDs = 255;
+		
+		/**
+		Remove all additional company IDs from the supported list
+		*/
+		IMPORT_C void ClearCompanyIds();
+		/**
+		Add a company id to the supported list of company ids.
+		The AVRCP 1.3 specification mandates that the Bluetooth SIG vendor id 
+		must be supported; KErrAlreadyExists will be returned if AddCompanyId()
+		is called with this company id.
+		@param aID the id to add
+		@return KErrNone if this completes successfully,
+		KErrAlreadyExists if aID is already present,
+		KErrOverflow if the maximum number of company ids are already listed,
+		or any other system wide error code.
+		*/
+		IMPORT_C TInt AddCompanyId(TInt aID);
+		/**
+		Remove a company id from the list of supported vendor extensions.
+		The Bluetooth SIG id can't be removed, as this must always be supported
+		@param aID the id to remove
+		@return KErrNone if this completes successfully, KErrNotFound if aID
+		was not in the list, or any other system wide error code.
+		*/
+		IMPORT_C TInt RemoveCompanyID(TInt aID);
+		
+	private:
+		virtual void DoClearEvents() = 0;
+		virtual TInt DoAddEvent(TRegisterNotificationEvent aEvent) = 0;
+		virtual TInt DoRemoveEvent(TRegisterNotificationEvent aEvent) = 0;
+		virtual void DoClearCompanyIds() = 0;
+		virtual TInt DoAddCompanyId(TInt aID) = 0;
+		virtual TInt DoRemoveCompanyID(TInt aID) = 0;
+	};
+
+/**
+This class is for supporting the player application settings PDUs in AVRCP1.3
+specification section 5.2. The RegisterNotification PDU for
+EVENT_PLAYER_APPLICATION_SETTING_CHANGED is also supported through this API.
+
+The media player should first define all the attributes it supports, using
+DefineAttributeL. When an attribute's value is changed by the media player,
+it should call SetAttributeL to inform the controller. When the controller
+changes a setting, the media player application receives a callback via the
+MPlayerApplicationSettingsNotify interface
+*/
+class MPlayerApplicationSettingsObserver 
+	{
+	public:
+		/**
+		Define an attribute supported by this player.
+		It will be included in future responses to the following PDUs:
+			ListPlayerApplicationSettingAttributes,
+			ListPlayerApplicationSettingValues,
+			GetCurrentPlayerApplicationSettingValue,
+			GetPlayerApplicationSettingAttributeText,
+			GetPlayerApplicationSettingValueText,
+		@param aAttributeID The specification or player defined attribute
+		@param aAttributeText The UTF8 text name of the attribute(allowed text length is 1-255) - the API will take a copy
+		@param aValues The list of defined values
+		@param aValueTexts The UTF8 text for each defined value(allowed text length is 1-255) - The API will make copies.
+		@param aInitialValue The initial value for this attribute
+		@leave KErrNoMemory if memory could not be allocated to store the copies of aAttributeID and relative settings
+		@leave KErrNotSupported if attribute or value is out of specification defined range,
+			or aValueTexts is not equal length to aValues
+		*/
+		IMPORT_C void DefineAttributeL(TUint aAttributeID,
+										TDesC8& aAttributeText,
+										RArray<TUint> &aValues,
+										RArray<TPtrC8> &aValueTexts,
+										TUint aInitialValue);
+
+		/**
+		Set the current value of a previously defined attribute
+		This updates the cache and will cause completion of a 
+		pending EVENT_PLAYER_APPLICATION_SETTING_CHANGED notification PDU
+		@param aAttributeID The specification or player defined attribute
+		@param aValue The current value
+		@leave KErrNotFound if the attribute is not defined,
+			KErrArgument if the value is not valid according to the definition
+		*/
+		IMPORT_C void SetAttributeL(TUint aAttributeID, TUint aValue);
+
+	private:
+		virtual void DoDefineAttributeL(TUint aAttributeID,
+										TDesC8& aAttributeText,
+										RArray<TUint> &aValues,
+										RArray<TPtrC8> &aValueTexts,
+										TUint aInitialValue) = 0;
+		virtual void DoSetAttributeL(TUint aAttributeID, TUint aValue) = 0;
+	
+	};
+
+/**
+This is a helper API allowing CPlayerApplicationSettings to be initialised
+via a resource file. Using a resource file may help to provide localised text
+for the attributes and values, according to current language setting of the phone.
+*/
+class PlayerApplicationSettingsResourceInit
+	{
+	public:
+	/**
+	Defines multiple attributes supported by this player, which are listed in a resource file.
+	@param aSettings The CPlayerApplicationSettings object on which the attributes should be defined
+	@param aResource A fully constructed CResourceFile
+	@leave KErrNoMemory, or leave from CResourceFile functions
+	*/
+	IMPORT_C static void DefineAttributesL(MPlayerApplicationSettingsObserver& aSettings, CResourceFile &aResource);
+	};
+
+/**
+This class supports the notification PDUs in AVRCP1.3 specification section 5.4,
+with the following exceptions:
+   EVENT_SYSTEM_STATUS_CHANGED is not supported, it is only for adaptors that plug into a media player
+   EVENT_PLAYER_APPLICATION_SETTING_CHANGED is supported through the CPlayerApplicationSettings API
+
+Events are pushed by the media player calling functions in this API, where they are
+cached until the controller pulls them via a GetPlayStatus or RegisterNotification PDU
+@see CPlayerApplicationSettings
+*/
+class MPlayerEventsObserver 
+	{
+	public:
+		enum TTargetBatteryStatus
+			{
+			ENormal     = 0,
+			EWarning    = 1,
+			ECritical   = 2,
+			EExternal   = 3,
+			EFullCharge = 4,
+			EUnknown	= 5
+			};	
+			
+		enum TPlaybackStatus
+			{
+			EStopped = 0,
+			EPlaying = 1,
+			EPaused = 2,
+			EFwdSeek = 3,
+			ERevSeek = 4,
+			EError = 0xFF
+			};
+
+		enum TPlayPosition
+			{
+			EStart = 0,
+			EMiddle = 1,
+			EEnd= 2,
+			};
+
+		static const TUint64 KNoTrackSelected = KMaxTUint64;
+
+		static const TUint32 KPlaybackPositionUnknown = 0xFFFFFFFF;
+		
+		/**
+		Call this function whenever the playback status changes.
+		It will be used to complete pending EVENT_PLAYBACK_STATUS_CHANGED
+		and EVENT_PLAYBACK_POS_CHANGED notifications.
+		The value is used to generate the response to a GetPlayStatus PDU.
+		@param aStatus The specification defined playback status
+		*/
+		IMPORT_C void PlaybackStatusChanged(TPlaybackStatus aStatus);
+		/**
+		Call this function whenever the current media track is changed.
+		use KNoTrackSelected to indicate that there is no media selected. 
+		This is the default value on construction. It will be used to
+		complete pending EVENT_TRACK_CHANGED and EVENT_PLAYBACK_POS_CHANGED notifications.
+		The values are used to generate the response to a GetPlayStatus PDU.
+		@param aTrackId A handle to the current track.
+		@param aLengthInMilliseconds The length of the current track.
+		*/
+		IMPORT_C void TrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds);
+		/**
+		Call this function whenever the current track reaches the end position,
+		e.g. due to playback or forward seek. It will be used to complete
+		pending EVENT_TRACK_REACHED_END and EVENT_PLAYBACK_POS_CHANGED notifications.
+		*/
+		IMPORT_C void TrackReachedEnd();
+		/**
+		Call this function whenever the current track reaches the start position,
+		e.g. due to reverse seek (rewind). It will be used to complete pending
+		EVENT_TRACK_REACHED_START and EVENT_PLAYBACK_POS_CHANGED notifications.
+		*/
+		IMPORT_C void TrackReachedStart();
+		/**
+		Call this function during playback or seek operations, to indicate the
+		current position within the track. It will be used to complete a pending
+		EVENT_PLAYBACK_POS_CHANGED notification. The value is used to generate the
+		response to a GetPlayStatus PDU.
+		@param aMilliseconds The current playback position. It is recommended to call
+		with a resolution <=1000ms to satisfy the 1s resolution of the notification
+		playback interval.
+		*/
+		IMPORT_C void SetPlaybackPosition(TUint32 aMilliseconds);
+
+		/**
+		Call this function to report the current battery status
+		@param aBatteryStatus The current battery status.
+		*/
+		IMPORT_C void SetBatteryStatus(TTargetBatteryStatus aBatteryStatus);
+		
+	private:
+		virtual void DoPlaybackStatusChanged(TPlaybackStatus aStatus) = 0;
+		virtual void DoTrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds) = 0;
+		virtual void DoTrackReachedEnd() = 0;
+		virtual void DoTrackReachedStart() = 0;
+		virtual void DoSetPlaybackPosition(TUint32 aMilliseconds) = 0;
+		virtual void DoSetBatteryStatus(TTargetBatteryStatus aBatteryStatus) = 0;
+	
+		
+	};
+
+/**
+Clients must implement this interface if they require callbacks 
+when the controller has changed the settings via a SetPASValue message
+*/
+class MPlayerApplicationSettingsNotify  
+	{
+	public:
+		/**
+		This is called when the controller has changed a setting
+		@param aAttributeID A list of attribute IDs whose value has changed.
+		@param aAttributeValue A list of new values for the attributes listed in aAttributeID.
+		*/
+		virtual void MpasnSetPlayerApplicationValueL(const RArray<TInt>& aAttributeID,
+													const RArray<TInt>& aAttributeValue)=0;
+	};
+	
+
+#endif // REMCONPLAYERINFORMATIONTARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/resource/avrcp-settings.rls	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,144 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @localize yes
+// @description Text that will be displayed on the UI of a remote controller to duplicate
+// the UI of the local media player. This text represents Equalizer Mode
+// @uicontext notvisible
+// 
+//
+
+rls_string8<255> STRING_EqualizerMode	"Equalizer Mode"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Equalizer Mode Off
+@uicontext notvisible
+*/
+rls_string8<255> STRING_EqualizerOff		"Off"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Equalizer Mode On
+@uicontext notvisible
+*/
+rls_string8<255> STRING_EqualizerOn		"On"
+
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Repeat Mode
+@uicontext notvisible
+*/
+rls_string8<255> STRING_RepeatMode		"Repeat Mode"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Repeat Mode Off
+@uicontext notvisible
+*/
+rls_string8<255> STRING_RepeatOff		"Off"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Single Track Repeat
+@uicontext notvisible
+*/
+rls_string8<255> STRING_RepeatSingle		"Single Track Repeat"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents All Tracks Repeat
+@uicontext notvisible
+*/
+rls_string8<255> STRING_RepeatAll		"All Tracks Repeat"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Group Repeat
+@uicontext notvisible
+*/
+rls_string8<255> STRING_RepeatGroup		"Group Repeat"
+
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Shuffle Mode
+@uicontext notvisible
+*/
+rls_string8<255> STRING_ShuffleMode		"Shuffle Mode"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Shuffle Mode Off
+@uicontext notvisible
+*/
+rls_string8<255> STRING_ShuffleOff		"Off"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents All Tracks Shuffle
+@uicontext notvisible
+*/
+rls_string8<255> STRING_ShuffleAll		"All Tracks Shuffle"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Group Shuffle
+@uicontext notvisible
+*/
+rls_string8<255> STRING_ShuffleGroup		"Group Shuffle"
+
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Scan Mode
+@uicontext notvisible
+*/
+rls_string8<255> STRING_ScanMode			"Scan Mode"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Scan Mode Off
+@uicontext notvisible
+*/
+rls_string8<255> STRING_ScanOff			"Off"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents All Tracks Scan
+@uicontext notvisible
+*/
+rls_string8<255> STRING_ScanAll			"All Tracks Scan"
+
+/*&
+@localize yes
+@description Text that will be displayed on the UI of a remote controller to duplicate
+the UI of the local media player. This text represents Group Scan
+@uicontext notvisible
+*/
+rls_string8<255> STRING_ScanGroup		"Group Scan"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/resource/avrcp-settings.rss	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,124 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "settings.rh"
+#include "avrcp-settings.rls"
+
+UID2 KUidAVRCPResourceFile
+
+// Test setting matching rules
+RESOURCE SETTINGS avrcpsettings
+	{
+	settings =
+		{
+		SETTING
+			{ // Equalizer mode
+			attribute = KEqualizerMode;
+			initialValue = KOff;
+			description = STRING_EqualizerMode;
+			definedValues =
+				{
+				VALUE
+					{
+					valueId = KOff;
+					description = STRING_EqualizerOff;
+					},
+				VALUE
+					{
+					valueId = KOn;
+					description = STRING_EqualizerOn;
+					}
+				};
+			},
+		SETTING
+			{ // Repeat mode
+			attribute = KRepeatMode;
+			initialValue = KAllTracksRepeat;
+			description = STRING_RepeatMode;
+			definedValues =
+				{
+				VALUE
+					{
+					valueId = KOff;
+					description = STRING_RepeatOff;
+					},
+				VALUE
+					{
+					valueId = KSingleTrackRepeat;
+					description = STRING_RepeatSingle;
+					},
+				VALUE
+					{
+					valueId = KAllTracksRepeat;
+					description = STRING_RepeatAll;
+					},
+				VALUE
+					{
+					valueId = KGroupRepeat;
+					description = STRING_RepeatGroup;
+					}
+				};
+			},
+		SETTING
+			{ // Shuffle mode
+			attribute = KShuffleMode;
+			initialValue = KAllTracksShuffle;
+			description = STRING_ShuffleMode;
+			definedValues =
+				{
+				VALUE
+					{
+					valueId = KOff;
+					description = STRING_ShuffleOff;
+					},
+				VALUE
+					{
+					valueId = KAllTracksShuffle;
+					description = STRING_ShuffleAll;
+					},
+				VALUE
+					{
+					valueId = KGroupShuffle;
+					description = STRING_ShuffleGroup;
+					}
+				};
+			},
+		SETTING
+			{ // Scan mode
+			attribute = KScanMode;
+			initialValue = KAllTracksScan;
+			description = STRING_ScanMode;
+			definedValues =
+				{
+				VALUE
+					{
+					valueId = KOff;
+					description = STRING_ScanOff;
+					},
+				VALUE
+					{
+					valueId = KAllTracksScan;
+					description = STRING_ScanAll;
+					},
+				VALUE
+					{
+					valueId = KGroupScan;
+					description = STRING_ScanGroup;
+					}
+				};
+			}			
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/resource/settings.rh	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,131 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Resource header for AVRCP resource files.
+// 
+//
+
+/**
+ @file settings.rh
+ @publishedPartner
+ @released
+*/
+
+#ifndef SETTINGS_RH
+#define SETTINGS_RH
+
+/** 
+This resource header file defines the structures and constants required
+for the AVRCP Player Application Settings and Values, as defined in
+Appendix F of the Bluetooth Specification (AVRCP), page 80.
+
+A setting file consists of an arbitrary number of settings. This file
+will be parsed and used to set values for a media application at
+startup time, to be queried through the AVRCP profile.
+
+A setting file has the following structure
+
+UID2 KUidAVRCPResourceFile    // Identifies this as an AVRCP settings file
+
+RESOURCE SETTINGS mysettings
+    {
+    settings =
+        {
+        SETTING
+            {
+            // definition of setting 1
+            },
+        SETTING
+            {
+            // definition of setting 2
+            },
+        // etc
+        };
+    }
+*/
+
+#define KUidAVRCPResourceFile       0x10285ACD
+
+#define KIllegal        0x00
+#define KEqualizerMode  0x01
+#define KRepeatMode     0x02
+#define KShuffleMode    0x03
+#define KScanMode       0x04
+
+#define KOff            0x01
+#define KOn             0x02
+
+// Off                      0x01
+#define KSingleTrackRepeat  0x02
+#define KAllTracksRepeat    0x03
+#define KGroupRepeat        0x04
+
+// Off                      0x01
+#define KAllTracksShuffle   0x02
+#define KGroupShuffle       0x03
+
+// Off                      0x01
+#define KAllTracksScan      0x02
+#define KGroupScan          0x03
+
+#define KUserDefined        0x80
+
+// Defines a single setting
+STRUCT SETTING
+    {
+    // The player application setting attribute
+    // e.g. 0x00 illegal, not to be used
+    //      0x01 equalizer status
+    //      0x02 repeat mode status
+    //      0x03 shuffle mode status
+    //      0x04 scan mode status
+    //      0x05 - 0x7f reserved for future use
+    //      0x80 - 0xff provided for TG driver static media player menu extension by CT
+    BYTE    attribute = 0;
+
+    // The defined settings for this attribute
+    BYTE    initialValue = 0;
+
+    // An string which describes this setting
+    // This can be localised into the target language
+    LTEXT8   description = "";
+
+    // The values and descriptions that this attribute can take
+    STRUCT  definedValues[];
+    }
+
+// Defines a single setting
+STRUCT VALUE
+    {
+    // The setting value id in hex
+    BYTE    valueId = 0;
+
+    // An string which describes this value
+    // This can be localised into the target language
+    LTEXT8   description = "";
+    }
+
+// Defines a set of settings and the implementations UIDs of the default
+// setting evaluator and dialog creator plug-ins.
+STRUCT SETTINGS
+    {
+    // Version of the AVRCP resource file.
+    // Settings files MUST NOT change this value.
+    // This must match with the number defined in settingsresource.cpp
+    WORD version = 1;
+
+    // An array of SETTING structures
+    STRUCT settings[];
+    }
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/src/eventsmask.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,104 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include "eventsmask.h"
+
+#ifdef _DEBUG
+_LIT(KEventsMask, "TEventsMask");
+#endif
+
+TEventsMask::TEventsMask ()
+	{
+	Reset();
+	}
+
+void TEventsMask::Reset()
+	{
+	iMask = 0x0000;
+	iNextSupportedEvent = 0x00;
+	}
+
+TBool TEventsMask::Find(TRegisterNotificationEvent aEvent) const
+	{
+	return ( (0x0001 << (aEvent -1)) & iMask ) ? ETrue : EFalse;
+	}
+
+void TEventsMask::Append(TRegisterNotificationEvent aEvent)
+	{
+	// the assertion assures that aEvent is a valid argument (in the range) 
+	__ASSERT_DEBUG((aEvent >= ERegisterNotificationPlaybackStatusChanged) && 
+		(aEvent < ERegisterNotificationReservedLast), 
+		User::Panic(KEventsMask, KErrArgument));
+
+	iMask |= (0x0001 << (aEvent -1));
+	}
+
+void TEventsMask::Remove(TRegisterNotificationEvent aEvent)
+	{
+	// the assertion assures that aEvent is a valid argument (in the range)
+	__ASSERT_DEBUG((aEvent >= ERegisterNotificationPlaybackStatusChanged) && 
+		(aEvent < ERegisterNotificationReservedLast), 
+		User::Panic(KEventsMask, KErrArgument));
+		
+	iMask &= ~(0x0001 << (aEvent -1));
+	}
+
+void TEventsMask::Begin()
+	{
+	iNextSupportedEvent = 0x00;
+	}
+
+TBool TEventsMask::Next()
+	{
+	TUint index = iNextSupportedEvent+1;
+	
+	if (index == ERegisterNotificationReservedLast)
+		{
+		return EFalse;
+		}
+	
+	while( (!Find((TRegisterNotificationEvent)index)) && (index < ERegisterNotificationReservedLast) )
+		{
+		index++;
+		}
+	
+	if (index < ERegisterNotificationReservedLast)
+		{
+		iNextSupportedEvent = index;
+		return ETrue;
+		}
+	else
+		{
+		return EFalse;
+		}
+	}
+
+TRegisterNotificationEvent TEventsMask::Get() const
+	{
+	// if Get() is called before calling Begin() and at least one call to Next()
+	// it Panics because iNextSupportedEvent is invalid (equals to 0x00).
+	__ASSERT_DEBUG(iNextSupportedEvent >= ERegisterNotificationPlaybackStatusChanged, User::Panic(KEventsMask, KErrUnderflow));
+	// this should never happen, it would mean that iNextSupport overtakes the
+	// last valid value
+	__ASSERT_DEBUG(iNextSupportedEvent < ERegisterNotificationReservedLast, User::Panic(KEventsMask, KErrOverflow));
+
+	return static_cast<TRegisterNotificationEvent>(iNextSupportedEvent);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/src/playerapplicationsetting.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,133 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file contains the CPlayerApplicationSettings class.
+// This is used to contain the Player application Setting Attributes
+// defined by the Bluetooth AVRCP 1.3 specification
+// 
+//
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <playerinformationtarget.h>
+
+#include "playerapplicationsetting.h"
+#include "playerinformation.h"
+
+CPlayerApplicationSettings* CPlayerApplicationSettings::NewL( TUint aAttributeID,
+		TDesC8& 						aAttributeText,
+		const RArray<TUint>& 			aValues,
+		RArray<TPtrC8>&					aValueTexts,
+		TUint 							aInitialValue )
+	{
+	CPlayerApplicationSettings* self = new(ELeave) CPlayerApplicationSettings();
+	CleanupStack::PushL(self);
+	self->ConstructL( aAttributeID, aAttributeText, aValues, aValueTexts, aInitialValue);
+	CleanupStack::Pop(self);
+	return self;
+	}
+	
+
+CPlayerApplicationSettings::~CPlayerApplicationSettings()
+	{
+	delete iAttributeText;
+	iValues.Close();
+	iValueText.ResetAndDestroy();
+	}
+
+CPlayerApplicationSettings::CPlayerApplicationSettings( )
+	{
+	}
+
+void CPlayerApplicationSettings::ConstructL(TUint aAttributeID,
+		TDesC8& 						aAttributeText,
+		const RArray<TUint>& 			aValues,
+		RArray<TPtrC8>&					aValueText,
+		TUint 							aInitialValue )
+	{
+	iAttributeID = aAttributeID;
+
+	// copy the attribute description	
+	iAttributeText = aAttributeText.AllocL();
+
+	// copy the allowed values
+	for (TInt i=0; i < aValues.Count(); i++ )
+		{
+		
+		// avoid duplicated defined values
+		if (iValues.Find(aValues[i]) != KErrNotFound)
+			{
+			User::Leave(KErrArgument);
+			}
+
+		iValues.AppendL( aValues[i] );
+		
+		// copy the value description into a HBuf and add pointer to iValueTexts
+		HBufC8 * valueText = aValueText[i].AllocL();
+		CleanupStack::PushL(valueText);
+		iValueText.AppendL(valueText);
+		CleanupStack::Pop(valueText);
+		}
+		
+	TInt error = SetCurrentValue( aInitialValue );
+	if ( error != KErrNone )
+		{	
+		User::Leave( error );
+		}
+	}
+
+TUint CPlayerApplicationSettings::GetAttributeID()
+	{
+	return( iAttributeID );
+	}
+
+TUint CPlayerApplicationSettings::GetCurrentValue()
+	{
+	return( iCurrentValue );
+	}
+
+TPtrC8 CPlayerApplicationSettings::GetAttributeText()
+	{
+	return( *iAttributeText );
+	}
+
+RArray<TUint>* CPlayerApplicationSettings::GetValues()
+	{
+	return( &iValues );
+	}
+
+RPointerArray<HBufC8>* CPlayerApplicationSettings::GetValuesTexts()
+	{
+	return( &iValueText );
+	}
+
+TInt CPlayerApplicationSettings::SetCurrentValue(TUint aValue)
+	{
+	// Only allow setting already defined values
+	for (TInt i=0; i < iValues.Count(); i++ )
+		{
+		if ( aValue == iValues[i] )
+			{
+			iCurrentValue = aValue;
+			return KErrNone;
+			}
+		}
+	
+	// value was not already defined, so return KErrArgument
+	return KErrArgument;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/src/playerapplicationsetting.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,89 @@
+// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#ifndef PLAYERAPPLICATIONSETTING_H
+#define PLAYERAPPLICATIONSETTING_H
+
+
+/**
+Class containing all the information for one attribute.
+All the attributes for a player are contained in a RHashMap 
+of CPlayerApplicationSettings in CPlayerInfoTarget
+*/
+NONSHARABLE_CLASS(CPlayerApplicationSettings) : 	public CBase
+	{
+public:
+	/**
+	Factory function.
+	@param  aAttributeID The ID value
+	@param  aAttributeText A text description of the attribute
+	@param  aValues A list of valid values
+	@param  aValueTexts A list of descriptions of the possible values
+	@param  aInitialValue The starting value
+	@return A new CPlayerApplicationSettings
+	*/
+	static CPlayerApplicationSettings* NewL( TUint aAttributeID,
+		TDesC8& 						aAttributeText,
+		const RArray<TUint>& 			aValues,
+		RArray<TPtrC8>&					aValueTexts,
+		TUint 							aInitialValue );
+	
+	/** Destructor */
+	~CPlayerApplicationSettings();
+
+	TUint GetAttributeID();
+	TUint GetCurrentValue();
+	TPtrC8 GetAttributeText();
+	RArray<TUint>* GetValues();
+	RPointerArray<HBufC8>* GetValuesTexts();
+	TInt SetCurrentValue(TUint aValue);
+
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	*/
+	CPlayerApplicationSettings( );
+
+	void ConstructL(TUint aAttributeID,
+		TDesC8& 						aAttributeText,
+		const RArray<TUint>& 			aValues,
+		RArray<TPtrC8>&					aValueText,
+		TUint 							aInitialValue );
+
+private:
+	/* attribute ID */
+	TUint 							iAttributeID;
+	
+	/* text description of the attribute */
+	HBufC8*	 						iAttributeText;
+	
+	/* array of allowed values */
+	RArray<TUint> 					iValues;
+	
+	/* array of text descriptions of allowed values */
+	RPointerArray<HBufC8>			iValueText;
+	
+	/* the current value */
+	TUint 							iCurrentValue;
+	};
+	
+#endif // PLAYERAPPLICATIONSETTING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/src/playercapabilities.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,274 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file contains the capabilites part of playerinformation.
+// 
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <bluetooth/logger.h>
+#include <remconinterfaceselector.h>
+#include <remcon/avrcpspec.h>
+#include <playerinformationtarget.h>
+
+#include "eventsmask.h"
+#include "playerinformation.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_PLAYER_INFO);
+#endif
+
+class TRemConMetadataTransferGetCapabilities 
+	{
+public:
+	TUint8	 				iCapabilityID;
+	};
+
+EXPORT_C void MPlayerCapabilitiesObserver::ClearEvents()
+	{
+	DoClearEvents();
+	}
+
+EXPORT_C TInt MPlayerCapabilitiesObserver::AddEvent(TRegisterNotificationEvent aEvent)
+	{
+	return DoAddEvent(aEvent);
+	}
+	
+EXPORT_C TInt MPlayerCapabilitiesObserver::RemoveEvent(TRegisterNotificationEvent aEvent)
+	{
+	return DoRemoveEvent(aEvent);
+	}
+
+EXPORT_C void MPlayerCapabilitiesObserver::ClearCompanyIds()
+	{
+	DoClearCompanyIds();
+	}
+
+EXPORT_C TInt MPlayerCapabilitiesObserver::AddCompanyId(TInt aID)
+	{
+	return DoAddCompanyId( aID );
+	}
+
+EXPORT_C TInt MPlayerCapabilitiesObserver::RemoveCompanyID(TInt aID)
+	{
+	return DoRemoveCompanyID( aID );
+	}
+
+
+// from MPlayerCapabilitiesObserver
+void CPlayerInfoTarget::DoClearEvents()
+	{
+	// AVRCP 1.3 specification, Appendix H says that PlaybackStatusChanged
+	// and TrackChanged event notification support is mandatory, so add these
+	
+	iSupportedNotificationEventList->Reset();
+	iSupportedNotificationEventList->Append(ERegisterNotificationPlaybackStatusChanged);
+	iSupportedNotificationEventList->Append(ERegisterNotificationTrackChanged);
+	}
+
+
+TInt CPlayerInfoTarget::DoAddEvent( TRegisterNotificationEvent aEvent )
+	{
+	// check the event is supported (note system status is NOT supported)
+	if (   aEvent >= ERegisterNotificationReservedLast
+		|| aEvent == ERegisterNotificationSystemStatusChanged_NotSupported)
+		{
+		return KErrNotSupported;
+		}
+		
+	// check if aEvent is already in the list of supported events
+	if (!iSupportedNotificationEventList->Find(aEvent))
+		{
+		// not found so add it to the list
+		iSupportedNotificationEventList->Append(aEvent);
+		return KErrNone;
+		}
+	
+	// else return already in the list
+	return KErrAlreadyExists;
+	}
+
+
+TInt CPlayerInfoTarget::DoRemoveEvent( TRegisterNotificationEvent aEvent )
+	{
+	// AVRCP 1.3 specification, Appendix H says that PlaybackStatusChanged
+	// and TrackChanged event notification support is mandatory, so add these
+	TInt err = KErrNone;
+	if (   aEvent == ERegisterNotificationPlaybackStatusChanged
+		|| aEvent == ERegisterNotificationTrackChanged)
+		{
+		return KErrNotSupported;
+		}
+	
+	// Find aEvent in the list of supported events
+	if (iSupportedNotificationEventList->Find(aEvent))
+		{
+		// and then remove it
+		iSupportedNotificationEventList->Remove(aEvent);
+		TInt pendingPos = iPendingNotificationEventList.Find(aEvent);
+		if (pendingPos != KErrNotFound)
+			{
+			iPendingNotificationEventList.Remove( pendingPos );
+			
+			// Tell anyone waiting for a notification that an event has been
+			// removed. Alas, we can't specify _WHICH_ event has been removed
+			// since there's no way to indicate this in an INTERNAL_ERROR response
+			SendError(KErrAvrcpMetadataInternalError, 
+					  RAvrcpIPC::SetIPCOperationIdFromEventId(aEvent), 
+					  ERemConNotifyResponseChanged);
+			}
+		}
+	else
+		{
+		err = KErrNotFound;
+		}
+	return err;
+	}
+
+
+void CPlayerInfoTarget::DoClearCompanyIds()
+	{
+	// The Bluetooth SIG vendor id must always be present
+	// See AVRCP 1.3 Specification, section 5.5.1, table 5.4
+	iCompanyIdList.Reset();
+	iCompanyIdList.Append(KBluetoothSIGVendorId);
+	}
+
+
+TInt CPlayerInfoTarget::DoAddCompanyId( TInt aID )
+	{
+	if ( aID > KMaxCompanyID )
+		{
+		return KErrNotSupported;
+		}
+		
+	// check if the ID is already in the list
+	TInt pos = iCompanyIdList.Find( aID );
+
+	// add only if not present in list to avoid duplicates
+	if (pos != KErrNotFound)
+		{
+		return KErrAlreadyExists;
+		}
+	
+	// make sure the list cannot contain more than 255 items
+	if (iCompanyIdList.Count() >= KMaxNrOfCompanyIDs)
+		{
+		return KErrOverflow;
+		}
+		
+	return iCompanyIdList.Append( aID );
+	}
+
+
+TInt CPlayerInfoTarget::DoRemoveCompanyID( TInt aID )
+	{
+	// The Bluetooth SIG vendor id must always be present
+	// See AVRCP 1.3 Specification, section 5.5.1, table 5.4
+	if ( aID == KBluetoothSIGVendorId )
+		{
+		return KErrNotSupported;
+		}
+		
+	// check if the ID is in the list
+	TInt pos = iCompanyIdList.Find( aID );
+
+	// if found remove else do nothing
+	if (pos != KErrNotFound)
+		{
+		iCompanyIdList.Remove( pos );
+		return KErrNone;
+		}
+	return pos;
+	}
+
+
+void CPlayerInfoTarget::ProcessGetCapabilities(const TDesC8& aData)
+	{
+	LOG_STATIC_FUNC
+
+	/* Decode the get capability message */
+	TRemConMetadataTransferGetCapabilities getCapability;
+	
+	// check there is at least 1 byte of data
+	if (!aData.Length())
+		{
+		// Invalid packet
+		return SendError(KErrAvrcpMetadataInvalidParameter, EGetCapabilities);
+		}
+		
+	TPckgC<TRemConMetadataTransferGetCapabilities> data(*reinterpret_cast<const TRemConMetadataTransferGetCapabilities*>(aData.Ptr()));
+	getCapability = data();
+	TGetCapabilityValues id = (TGetCapabilityValues) getCapability.iCapabilityID;
+	
+	// format the response in a TRemConGetCapabilitiesResponse
+	RRemConGetCapabilitiesResponse response;
+
+	switch ( id )
+		{
+	case ECapabilityIdCompanyID:
+		// respond with ECapabilityIdCompanyID
+		response.iCapabilityId = ECapabilityIdCompanyID;
+
+		// followed by number of IDs
+		response.iCapabilityCount = iCompanyIdList.Count();
+
+		// and then list of company ids,
+		for (TInt i=0; i< iCompanyIdList.Count(); i++ )
+			{
+			TInt x = iCompanyIdList[i];
+			if (response.iCapabilities.Append(x) != KErrNone)
+				{
+				response.Close();
+				return SendError(KErrAvrcpMetadataInternalError, EGetCapabilities);   // Try to send internal error if OOM
+				}
+			}
+		break;
+		
+	case ECapabilityIdEventsSupported:
+		// respond with ECapabilityIdEventsSupported
+		response.iCapabilityId = ECapabilityIdEventsSupported;
+		
+		// followed by number of supported events, and then list of events
+		response.iCapabilityCount = 0;
+		iSupportedNotificationEventList->Begin();
+		while(iSupportedNotificationEventList->Next())
+			{
+			if (KErrNone != response.iCapabilities.Append(iSupportedNotificationEventList->Get()))
+				{
+				response.Close();
+				return SendError(KErrAvrcpMetadataInternalError, EGetCapabilities);   // Try to send internal error if OOM
+				}
+			response.iCapabilityCount++;
+			}
+		break;	
+		
+	default:
+		/* other IDs are reserved */
+		return SendError(KErrAvrcpMetadataInvalidParameter, EGetCapabilities);  // Invalid packet
+		}
+
+	TInt error = 0;
+	TRAP(error, response.WriteL(iOutBuf));   // Don't send error if OOM
+	response.Close();
+	if (error == KErrNone)
+		// send the result back to the CT
+		InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+											EGetCapabilities, ERemConResponse, iOutBuf );
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/src/playerevents.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,477 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file contains the events part of the PlayerInformation API.
+// 
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <bluetooth/logger.h>
+#include <remconinterfaceselector.h>
+#include <remconbeareravrcp.h>
+#include <playerinformationtarget.h>
+#include <playerinformationtargetobserver.h>
+
+#include "playerapplicationsetting.h"
+#include "eventsmask.h"
+#include "playereventsutils.h"
+#include "playerinformation.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_PLAYER_INFO);
+#endif
+
+EXPORT_C void MPlayerEventsObserver::PlaybackStatusChanged(TPlaybackStatus aStatus)
+	{
+	DoPlaybackStatusChanged(aStatus);
+	}
+
+EXPORT_C void MPlayerEventsObserver::TrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds) 
+	{
+	DoTrackChanged(aTrackId, aLengthInMilliseconds); 
+	}
+
+EXPORT_C void MPlayerEventsObserver::TrackReachedEnd() 
+	{
+	DoTrackReachedEnd();
+	}
+
+EXPORT_C void MPlayerEventsObserver::TrackReachedStart()
+	{
+	DoTrackReachedStart();
+	}
+
+EXPORT_C void MPlayerEventsObserver::SetPlaybackPosition(TUint32 aMilliseconds) 
+	{
+	DoSetPlaybackPosition(aMilliseconds); 
+	}
+	
+EXPORT_C void MPlayerEventsObserver::SetBatteryStatus(TTargetBatteryStatus aBatteryStatus) 
+	{
+	DoSetBatteryStatus(aBatteryStatus); 
+	}
+
+void CPlayerInfoTarget::ProcessGetStatusAndBeginObserving( const TUint aOperationId, TRegisterNotificationEvent aEventId, const TDesC8& aData)
+	{
+	// check the event is in the supported list
+	if (!iSupportedNotificationEventList->Find(aEventId))
+		{
+		// Not supported so return error
+		SendError(KErrAvrcpMetadataInvalidParameter, aOperationId, ERemConNotifyResponseInterim);
+		return;
+		}
+		
+	// if the event is EPlaybackPosChanged then the timeinterval is included in the RegisterNofication
+	if (aEventId == ERegisterNotificationPlaybackPosChanged)
+		{
+		// decode the playback interval from aData
+		TInt error = 0;
+		RRemConPlayerInformation32BitResponse request;
+		TRAP(error, request.ReadL(aData));
+		
+		if (error != KErrNone)
+			{
+			// Not supported so return error
+			SendError(KErrAvrcpMetadataParameterNotFound, aOperationId, ERemConNotifyResponseInterim);
+			return;
+			}
+		
+		// save the playback interval
+		iPlayBackIntervalInMilliseconds = request.iValue * 1000;
+		
+		// and the current position
+		iLastNotifiedPlaybackPositionInMilliseconds = iPlaybackPositionInMilliseconds;
+		}
+		
+	// and request another notification (if there is not one already pending)
+	// on the next state change  
+	if (KErrNotFound ==iPendingNotificationEventList.Find(aEventId))
+		{
+		if (iPendingNotificationEventList.Append(aEventId) != KErrNone)
+			{
+			return SendError(KErrAvrcpMetadataInternalError, aOperationId);   // Try to send internal error if OOM
+			}
+		}
+		
+	// send the current status
+	SendNotificationResponse(aEventId, ERemConNotifyResponseInterim );
+	}
+
+void CPlayerInfoTarget::ProcessGetStatus( const TUint aOperationId, TRegisterNotificationEvent aEventId)
+	{
+	// send the current value
+	if (iSupportedNotificationEventList->Find(aEventId))
+		{
+		SendNotificationResponse(aEventId, ERemConNotifyResponseChanged );
+		}
+	else
+		{
+		// Not found so return error
+		SendError(KErrAvrcpMetadataInvalidParameter, aOperationId, ERemConNotifyResponseChanged);
+		}
+	}
+		
+/* ProcessGetPlayStatus This returns the current values of SongLength, 
+   SongPosition and PlayStatus.
+   Note if SongLength and SongPosition are not supported KPlaybackPositionUnknown is returned
+ */
+void CPlayerInfoTarget::ProcessGetPlayStatus()
+	{
+	LOG_FUNC
+
+	TInt error =0;
+
+	// format the response in a RRemConPlayerInformationGetPlayStatusResponse
+	RRemConPlayerInformationGetPlayStatusResponse response;
+	response.iTrackLength = iLengthInMilliseconds;
+	response.iPlayPos = iPlaybackPositionInMilliseconds;
+	response.iStatus = iPlayBackStatus;
+	
+	TRAP(error, response.WriteL(iOutBuf));
+	if (error == KErrNone)
+		{
+		// send the response back to the CT
+		error = InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+												EGetPlayStatus, ERemConResponse, iOutBuf );
+		}
+	}
+
+/* ProcessGetPlayStatusUpdate returns the current play status if it has changed
+ * relative to the provided play status, otherwise the request is queued until
+ * the play status changes.
+ */
+void CPlayerInfoTarget::ProcessGetPlayStatusUpdate(const TDesC8& aData)
+	{
+	LOG_FUNC
+
+	// Bearer should never send us more than one of these in parallel
+	__ASSERT_DEBUG(!iPlaybackStatusUpdatePending, PlayerEventsUtils::Panic(ETwoGetPlayStatusUpdatesQueued));
+	
+	TInt error =0;
+	RRemConPlayerInformationGetPlayStatusUpdateRequest request;
+	TRAP(error, request.ReadL(aData));
+	__ASSERT_DEBUG(error == KErrNone, PlayerEventsUtils::Panic(EBadlyFormattedInternalData));
+
+	if(request.iStatus != iPlayBackStatus)
+		{
+		// format the response in a RRemConPlayerInformationGetPlayStatusResponse
+		RRemConPlayerInformationGetPlayStatusUpdateResponse response;
+		response.iStatus = iPlayBackStatus;
+		
+		TRAP(error, response.WriteL(iOutBuf));
+		if (error == KErrNone)
+			{
+			// send the response back to the CT
+			error = InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+													EGetPlayStatusUpdate, ERemConResponse, iOutBuf );
+			if(error != KErrNone)
+				{
+				// We will try and send the response again next time we get an update
+				iPlaybackStatusUpdatePending = ETrue;
+				}
+			}
+		}
+	else
+		{
+		iPlaybackStatusUpdatePending = ETrue;
+		}
+	}
+
+// Send a Notification message for aEventID 
+void CPlayerInfoTarget::SendNotificationResponse( TRegisterNotificationEvent aEventId, TRemConMessageSubType aMsgSubType )
+	{
+	LOG_FUNC
+
+	TInt error = 0;
+	iOutBuf.Zero();
+
+	if (!iSupportedNotificationEventList->Find(aEventId))
+		{
+		return SendError(KErrAvrcpMetadataInvalidParameter, 
+						 RAvrcpIPC::SetIPCOperationIdFromEventId(aEventId), aMsgSubType);
+		}
+		
+	switch (aEventId)
+		{
+		case ERegisterNotificationTrackReachedEnd:
+		case ERegisterNotificationTrackReachedStart:
+			{
+			// no extra data for reached start or end 
+			RAvrcpIPCError response;
+			response.iError = KErrNone;
+			TRAP(error, response.WriteL(iOutBuf));
+			break;
+			}
+
+		case ERegisterNotificationPlaybackStatusChanged:
+			{
+			// 8bit response -- current playback status 
+			RRemConPlayerInformation8BitResponse response;
+			response.iValue = iPlayBackStatus;
+			TRAP(error, response.WriteL(iOutBuf));
+			break;
+			}
+
+		case ERegisterNotificationBatteryStatusChanged:
+			{
+			// 8bit response -- current battery status
+			RRemConPlayerInformation8BitResponse response;
+			response.iValue = iBatteryStatus;
+			TRAP(error, response.WriteL(iOutBuf));
+			break;
+			}
+
+		case ERegisterNotificationPlaybackPosChanged:
+			{
+			// 32bit response -- current playback position in millisecond 
+			RRemConPlayerInformation32BitResponse response;
+			response.iValue = iPlaybackPositionInMilliseconds;
+			TRAP(error, response.WriteL(iOutBuf));
+			break;
+			}
+
+		case ERegisterNotificationTrackChanged:
+			{
+			// 64bit response -- index of the current track 
+			RRemConPlayerInformation64BitResponse response;
+			response.iValue = iTrackId;
+			TRAP(error, response.WriteL(iOutBuf));
+			break;
+			}
+
+		case ERegisterNotificationPlayerApplicationSettingChanged:
+			{
+			// Send a list of the settings that have changed followed by their value 
+			// starting with the number of attributes to be sent 
+			RRemConPlayerAttributeIdsAndValues response;
+			response.iNumberAttributes = 0;
+		
+			// for every entry in the list
+			THashMapIter<TInt, CPlayerApplicationSettings*> iter(iPlayerApplicationSettings);
+			CPlayerApplicationSettings* const* setting = iter.NextValue();
+			while ( setting != NULL )
+				{
+				TUint8 value = (*setting)->GetCurrentValue();
+				TInt ret1 = response.iAttributeValue.Append(value);
+				TInt ret2 = response.iAttributeId.Append((*setting)->GetAttributeID());
+				if (ret1 != KErrNone || ret2 != KErrNone)
+					{
+					response.Close();
+					return SendError(KErrAvrcpMetadataInternalError, 
+									 RAvrcpIPC::SetIPCOperationIdFromEventId(aEventId),
+									 aMsgSubType);   // Try to send internal error if OOM
+					}
+				response.iNumberAttributes++;
+				setting = iter.NextValue();
+				}
+				
+			TRAP(error, response.WriteL(iOutBuf));
+			response.Close();
+			break;
+			}
+		default:
+			return;
+		}
+	
+	if (error == KErrNone)
+		{
+		// send the response back to the CT
+		TUint operationId = RAvrcpIPC::SetIPCOperationIdFromEventId(aEventId);
+		error = InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+												operationId, ERemConResponse, aMsgSubType, iOutBuf);
+		}
+	}
+	 
+// from MPlayerEventsObserver
+ void CPlayerInfoTarget::DoPlaybackStatusChanged(TPlaybackStatus  aStatus)
+	{
+	LOG_FUNC
+
+	iPlayBackStatus = aStatus;
+	
+	// if the playback status is in the current event list
+	TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackStatusChanged );
+	if (pos != KErrNotFound)
+		{
+		iPendingNotificationEventList.Remove( pos );
+		SendNotificationResponse( ERegisterNotificationPlaybackStatusChanged, ERemConNotifyResponseChanged);
+		}
+	
+	pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackPosChanged );
+	if (pos != KErrNotFound)
+		{
+		iPendingNotificationEventList.Remove( pos );
+		SendNotificationResponse(ERegisterNotificationPlaybackPosChanged, ERemConNotifyResponseChanged);
+		}
+	
+	if(iPlaybackStatusUpdatePending)
+		{
+		// format the response in a RRemConPlayerInformationGetPlayStatusResponse
+		RRemConPlayerInformationGetPlayStatusUpdateResponse response;
+		response.iStatus = iPlayBackStatus;
+		
+		TRAPD(error, response.WriteL(iOutBuf));
+		if (error == KErrNone)
+			{
+			// send the response back to the CT
+			error = InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+													EGetPlayStatusUpdate, ERemConResponse, iOutBuf );
+			if(error == KErrNone)
+				{
+				iPlaybackStatusUpdatePending = EFalse;
+				}
+			// if we did error we will try and respond again next time the client's play status
+			// changes
+			}
+		}
+	}
+	
+void CPlayerInfoTarget::DoTrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds)
+	{
+	LOG_FUNC
+
+	iTrackId = aTrackId;
+	iLengthInMilliseconds = aLengthInMilliseconds;
+
+	// if the playback status is in the current event list 
+	TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationTrackChanged );
+	if (pos != KErrNotFound)
+		{
+		iPendingNotificationEventList.Remove( pos );
+		SendNotificationResponse(ERegisterNotificationTrackChanged, ERemConNotifyResponseChanged);
+		}
+
+	pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackPosChanged );
+	if (pos != KErrNotFound)
+		{
+		iPendingNotificationEventList.Remove( pos );
+		iPlaybackPositionInMilliseconds = 0;	//set 0 to current position for new track
+		SendNotificationResponse(ERegisterNotificationPlaybackPosChanged, ERemConNotifyResponseChanged);
+		}
+	}
+
+void CPlayerInfoTarget::DoTrackReachedEnd()
+	{
+	LOG_FUNC
+	
+	iTrackPosition = EEnd;
+
+	// if the ETrackReachedEnd status is in the current event list 
+	TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationTrackReachedEnd );
+	if (pos != KErrNotFound)
+		{
+		iPendingNotificationEventList.Remove( pos );
+		SendNotificationResponse(ERegisterNotificationTrackReachedEnd, ERemConNotifyResponseChanged);
+		}
+	
+	pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackPosChanged );
+	if (pos != KErrNotFound)
+		{
+		iPendingNotificationEventList.Remove( pos );
+		iPlaybackPositionInMilliseconds = iLengthInMilliseconds;
+		SendNotificationResponse(ERegisterNotificationPlaybackPosChanged, ERemConNotifyResponseChanged);
+		}
+	}
+
+void CPlayerInfoTarget::DoTrackReachedStart()
+	{
+	LOG_FUNC
+
+	iTrackPosition = EStart;
+
+	// if the ETrackReachedStart status is in the current event list 
+	TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationTrackReachedStart );
+	if (pos != KErrNotFound)
+		{
+		iPendingNotificationEventList.Remove( pos );
+		SendNotificationResponse(ERegisterNotificationTrackReachedStart, ERemConNotifyResponseChanged);
+		}
+	
+	pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackPosChanged );
+	if (pos != KErrNotFound)
+		{
+		iPendingNotificationEventList.Remove( pos );
+		iPlaybackPositionInMilliseconds = 0;
+		SendNotificationResponse(ERegisterNotificationPlaybackPosChanged, ERemConNotifyResponseChanged);
+		}
+	}
+
+void CPlayerInfoTarget::DoSetPlaybackPosition(TUint32 aMilliseconds)		
+	{
+	LOG_FUNC
+	
+	iPlaybackPositionInMilliseconds = aMilliseconds;
+
+	// if the playback position is in the current Notification event list 
+	TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackPosChanged );
+	if (pos != KErrNotFound)
+		{
+		// a notification has been requested, now check if it is due
+
+		TUint32 difference = (iPlaybackPositionInMilliseconds > iLastNotifiedPlaybackPositionInMilliseconds) ?
+        	iPlaybackPositionInMilliseconds - iLastNotifiedPlaybackPositionInMilliseconds:
+        	iLastNotifiedPlaybackPositionInMilliseconds - iPlaybackPositionInMilliseconds;
+
+		if (difference >= iPlayBackIntervalInMilliseconds)
+			{
+			// Due now so send
+			iPendingNotificationEventList.Remove( pos );
+			SendNotificationResponse(ERegisterNotificationPlaybackPosChanged, ERemConNotifyResponseChanged);			
+			}	
+		}
+	}
+
+void CPlayerInfoTarget::DoSetBatteryStatus(TTargetBatteryStatus aBatteryStatus)
+	{
+	LOG_FUNC
+
+	TBool validStatus = ETrue;
+	if (aBatteryStatus < MPlayerEventsObserver::ENormal || 
+		aBatteryStatus > MPlayerEventsObserver::EFullCharge)
+		{
+		LOG1(_L("Invalid battery status: %d"),aBatteryStatus);
+		validStatus = EFalse;
+		}
+	else
+		{
+		iBatteryStatus = aBatteryStatus;
+		}
+
+	// if the battery status is in the current event list
+	TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationBatteryStatusChanged );
+	if (pos != KErrNotFound)
+		{
+		iPendingNotificationEventList.Remove( pos );
+		if (validStatus)
+			{
+			SendNotificationResponse(ERegisterNotificationBatteryStatusChanged, ERemConNotifyResponseChanged);
+			}
+		}
+	}
+	
+void CPlayerInfoTarget::SendError(TInt aError, TInt aOperationId, TRemConMessageSubType aSubType)
+	{
+	TInt error = 0;
+	RAvrcpIPCError response;
+	response.iError = aError;
+	TRAP(error, response.WriteL(iOutBuf));   // Don't send error if OOM
+	if (error == KErrNone)
+		InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+										aOperationId, ERemConResponse, aSubType, iOutBuf);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/src/playerinformation.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,293 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <bluetooth/logger.h>
+#include <playerinformationtarget.h>
+#include <e32property.h> 
+#include <hwrmpowerstatesdkpskeys.h>
+
+#include "playerapplicationsetting.h"
+#include "eventsmask.h"
+#include "playerinformation.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_PLAYER_INFO);
+#endif
+
+EXPORT_C CPlayerInfoTarget* CPlayerInfoTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector,
+										MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver,
+										MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver,
+										MPlayerEventsObserver*& aPlayerEventsObserver,
+										MPlayerApplicationSettingsNotify& aApplicationSettingNotifier )
+	{
+	LOG_STATIC_FUNC
+
+	CPlayerInfoTarget* self = new(ELeave) CPlayerInfoTarget(aInterfaceSelector, aApplicationSettingNotifier);
+	CleanupStack::PushL(self);
+	self->ConstructL( aPlayerCapabilitiesObserver, aPlayerApplicationSettingsObserver, aPlayerEventsObserver );
+	CleanupStack::Pop(self);
+	return self;
+	}
+	
+/** 
+Constructs this interface.
+@param aInterfaceSelector An interface selector for use with this interface.
+@internalComponent
+@released
+*/
+CPlayerInfoTarget::CPlayerInfoTarget(CRemConInterfaceSelector& aInterfaceSelector, MPlayerApplicationSettingsNotify& aApplicationSettingNotifier)
+:	CRemConInterfaceBase(TUid::Uid(KRemConPlayerInformationUid), 
+						 KMaxLengthPlayerInformationMsg,
+						 aInterfaceSelector,
+						 ERemConClientTypeTarget),
+	iApplicationSettingNotifier(aApplicationSettingNotifier),
+	iPlaybackStatusUpdatePending(EFalse)
+	{
+	}
+	
+		
+void CPlayerInfoTarget::ConstructL(MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver,
+										MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver,
+										MPlayerEventsObserver*& aPlayerEventsObserver )
+	{
+	// reserve two AV/C frames, for this reasoning:
+	// GetCapabilities (PDU 0x10) can generate a response
+	// which is (255 * 3 bytes) + 2 bytes = 767 total and
+	// will fit into two AVC frames. Other PDUs generate
+	// less than this, except for PDUs 0x15 and 0x16 which
+	// use their own buffer pre-allocated by calling Size()
+	iOutBuf.CreateL(KAVCFrameMaxLength * 2);
+	
+	BaseConstructL();
+	
+	aPlayerCapabilitiesObserver = this;
+	aPlayerApplicationSettingsObserver = this;
+	aPlayerEventsObserver = this;
+	
+	// default values for event notifiers
+	iPlayBackStatus = EStopped;
+	
+	// If no track currently selected
+	iTrackId = KNoTrackSelected;
+	
+	iLengthInMilliseconds = 0;
+	iTrackPosition = EStart;
+	
+	// If no track currently selected, then return KPlaybackPositionUnknown
+	iPlaybackPositionInMilliseconds = KPlaybackPositionUnknown;
+	iLastNotifiedPlaybackPositionInMilliseconds	= KPlaybackPositionUnknown;
+
+	// The time interval used for playback position notification
+	iPlayBackIntervalInMilliseconds = 0;
+
+	// Try to detect battery status from hardware P&S properties	
+	iBatteryStatus = DetectBatteryStatus();
+
+	// The Bluetooth SIG vendor id must always be present
+	// See AVRCP 1.3 Specification, section 5.5.1, table 5.4
+	iCompanyIdList.AppendL(KBluetoothSIGVendorId);
+ 
+	// AVRCP 1.3 specification, Appendix H says that PlaybackStatusChanged
+	// and TrackChanged event notification support is mandatory, so add these
+	iSupportedNotificationEventList = new (ELeave) TEventsMask();
+	iSupportedNotificationEventList->Append(ERegisterNotificationPlaybackStatusChanged);
+	iSupportedNotificationEventList->Append(ERegisterNotificationTrackChanged);
+	}
+
+EXPORT_C CPlayerInfoTarget::~CPlayerInfoTarget()
+	{
+	iPendingNotificationEventList.Close();
+	iCompanyIdList.Close();
+	iOutBuf.Close();
+
+	// Free up all the settings memory
+	THashMapIter<TInt, CPlayerApplicationSettings*> iter(iPlayerApplicationSettings);
+	CPlayerApplicationSettings* const* setting = iter.NextValue();
+	while ( setting != NULL )
+		{
+		delete *setting;
+		setting = iter.NextValue();
+		}
+
+	// Now close the hash table itself
+	iPlayerApplicationSettings.Close();
+	delete iSupportedNotificationEventList;
+	}
+	
+		
+TAny* CPlayerInfoTarget::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf2) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf2*>(this)
+			);
+		}
+
+	return ret;	
+	}
+
+// from MRemConInterfaceIf
+void CPlayerInfoTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData, TRemConMessageSubType aMsgSubType)
+	{
+	LOG(_L("CPlayerInfoTarget::MrcibNewMessage"));
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	LOG1(_L("\taData.Length = %d"), aData.Length());
+	LOG1(_L("\taMsgSubType = 0x%02x"), aMsgSubType);
+
+	TMetadataTransferPDU currentOp = RAvrcpIPC::GetPDUIdFromIPCOperationId(aOperationId);
+	
+	switch (currentOp)
+		{
+		case EGetCapabilities:
+			{
+			/* process this in playercapabilities */
+			ProcessGetCapabilities( aData );
+			break;
+			}
+		case EListPlayerApplicationSettingAttributes:	
+			{
+			/* respond with Player Application Attributes*/
+			ProcessListPlayerApplicationAttributes( aOperationId );
+			break;
+			}
+		case EGetPlayerApplicationSettingAttributeText:	
+			{
+			/* respond with Player Application Attribute Text*/
+			ProcessGetPlayerApplicationAttributeText( aData, aOperationId );
+			break;
+			}
+		case EListPlayerApplicationSettingValues:
+			{
+			/* respond with Player Application Values*/
+			ProcessListPlayerApplicationValues( aData, aOperationId );
+			break;
+			}
+		case EGetPlayerApplicationSettingValueText:
+			{
+			/* respond with Application Value Text*/
+			ProcessGetPlayerApplicationValueText( aData, aOperationId );
+			break;
+			}
+		case EGetCurrentPlayerApplicationSettingValue:
+			{
+			/* respond with Current Player Application Value*/
+			ProcessGetCurrentPlayerApplicationValue( aData, aOperationId );
+			break;
+			}
+		case ESetPlayerApplicationSettingValue:
+			{
+			/* Set Player Application Value*/
+			ProcessSetPlayerApplicationValue( aData, aOperationId );
+			break;
+			}
+		case EGetPlayStatus:
+			{
+			// process in playerevents
+			ProcessGetPlayStatus();
+			break;
+			}
+		case ERegisterNotification:
+			{
+			// obtain eventId from aOperationId
+			TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(aOperationId);
+			
+			// register for Notifications
+			if (aMsgSubType == ERemConNotifyCommandAwaitingInterim)
+				{
+				ProcessGetStatusAndBeginObserving(aOperationId, eventId, aData);
+				}
+			else if (aMsgSubType == ERemConNotifyCommandAwaitingChanged)
+				{
+				ProcessGetStatus(aOperationId, eventId);
+				}
+		 	break;
+		 	}
+		case EGetPlayStatusUpdate:
+			{
+			// process in playerevents
+			ProcessGetPlayStatusUpdate(aData);
+			break;
+			}
+		default:
+			break;
+		}
+		
+	}
+
+MPlayerEventsObserver::TTargetBatteryStatus CPlayerInfoTarget::DetectBatteryStatus()
+	{
+	MPlayerEventsObserver::TTargetBatteryStatus status = ECritical;
+	TInt err = KErrNone;
+	TInt batteryStatus = EBatteryStatusUnknown;
+	TInt chargingStatus = EChargingStatusNotConnected;
+	err = RProperty::Get(KPSUidHWRMPowerState,KHWRMBatteryStatus,batteryStatus);
+	if (!err)
+		{
+		err = RProperty::Get(KPSUidHWRMPowerState,KHWRMChargingStatus,chargingStatus);
+		}
+
+	switch (batteryStatus)
+		{
+		// Normal or Charging
+		case EBatteryStatusOk:
+			{
+			if (chargingStatus == EChargingStatusCharging ||
+				chargingStatus == EChargingStatusAlmostComplete ||
+				chargingStatus == EChargingStatusChargingContinued)
+				{
+				iBatteryStatus = EExternal;
+				}
+			else
+				{
+				if (chargingStatus == EChargingStatusChargingComplete)
+					{
+					iBatteryStatus = EFullCharge;
+					}
+				else
+					{
+					iBatteryStatus = ENormal;
+					}
+				}
+			}
+			break;
+		// Warning
+		case EBatteryStatusLow:
+			{
+			iBatteryStatus = EWarning;
+			}
+			break;
+		// Critical
+		case EBatteryStatusEmpty:
+			{
+			iBatteryStatus = ECritical;
+			}
+			break;
+		// Unknown state, set as ECritical
+		case EBatteryStatusUnknown:
+			{
+			iBatteryStatus = ECritical;
+			}
+			break;
+		}
+	return status;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/src/playersettings.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,685 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <remconinterfaceselector.h>
+#include <playerinformationtarget.h>
+
+#include "playerapplicationsetting.h"
+#include "playerinformation.h"
+#include "playersettingsutils.h"
+
+
+void CPlayerInfoTarget::SendError(TInt aError, TInt aOperationId)
+	{
+	TInt error = 0;
+	RAvrcpIPCError response;
+	response.iError = aError;
+	TRAP(error, response.WriteL(iOutBuf));   // Try to send internal error if OOM
+	if (error == KErrNone)
+		{
+		InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+										aOperationId, ERemConResponse, iOutBuf);
+		}								
+	}
+
+
+// PDU 0x11
+void CPlayerInfoTarget::ProcessListPlayerApplicationAttributes(TInt aOperationId)
+	{
+	RRemConPlayerListOfAttributes response;
+	response.iNumberAttributes = iPlayerApplicationSettings.Count();
+
+	THashMapIter<TInt, CPlayerApplicationSettings*> iter(iPlayerApplicationSettings);
+	const TInt* attribute = iter.NextKey();
+	while ( attribute != NULL )
+		{
+		if (response.iAttributes.Append(*attribute) != KErrNone)
+			{
+			response.Close();
+			return SendError(KErrAvrcpMetadataInternalError, aOperationId);   // Try to send internal error if OOM
+			}
+		attribute = iter.NextKey();
+		}
+
+	// send the response back to the CT
+	TInt error = 0;
+	TRAP(error, response.WriteL(iOutBuf));   // Try to send internal error if OOM
+	response.Close();
+	if (error != KErrNone)
+		{
+		return SendError(KErrAvrcpMetadataInternalError, aOperationId);
+		}
+		
+	InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+									EListPlayerApplicationSettingAttributes, ERemConResponse, iOutBuf );
+	}
+
+// PDU 0x12
+void CPlayerInfoTarget::ProcessListPlayerApplicationValues(const TDesC8& aData, TInt aOperationId)
+	{
+	TInt error =0;
+	RDesReadStream readStream;
+	readStream.Open(aData);
+	TInt attributeID = 0;
+	TRAP(error, attributeID = readStream.ReadUint8L());
+	readStream.Close();
+	if (error != KErrNone)
+		{
+		return SendError(KErrAvrcpMetadataParameterNotFound, aOperationId);  // Nothing in packet
+		}
+		
+	// Send the number of values for this attribute (1 byte),
+	// followed by the defined values themselves (n x 1byte)
+	CPlayerApplicationSettings* thisSetting = GetSetting(attributeID);
+	if (thisSetting == NULL) 
+		{
+		// Attribute Id not found
+		return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId);  
+		}
+		
+	RRemConPlayerListOfAttributes response;
+	RArray<TUint>* values = thisSetting->GetValues();
+	TInt numValues = values->Count();
+	response.iNumberAttributes = numValues;
+
+	// Make sure that we always have at least one result to return
+	// Table 5.18 says that the number of results provided has an
+	// allowed value of 1-255, so we cannot return zero results.
+	if (response.iNumberAttributes == 0)
+		{
+		return SendError(KErrAvrcpMetadataParameterNotFound, aOperationId);  // No attributes matched
+		}
+
+	for ( TInt i = 0; i < numValues; i++ )
+		{
+		TInt value = (*values)[i];
+		if (response.iAttributes.Append(value) != KErrNone)
+			{
+			response.Close();
+			return SendError(KErrAvrcpMetadataInternalError, aOperationId);   // Try to send internal error if OOM
+			}
+		}
+
+	// send the response back to the CT
+	TRAP(error, response.WriteL(iOutBuf));   // Try to send internal error if OOM
+	response.Close();
+	if (error != KErrNone)
+		{
+		return SendError(KErrAvrcpMetadataInternalError, aOperationId);
+		}
+		
+	InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+									aOperationId, ERemConResponse, iOutBuf );
+	}
+
+// PDU 0x15
+void CPlayerInfoTarget::ProcessGetPlayerApplicationAttributeText(const TDesC8& aData, TInt aOperationId)
+	{
+	TInt error =0;
+
+	// If we can't parse the request, then return an error
+	RRemConPlayerListOfAttributes request;
+	TRAP(error, request.ReadL(aData));
+	if (error != KErrNone)
+		{
+		request.Close();
+		return SendError(KErrAvrcpMetadataInvalidCommand, aOperationId);
+		}
+		
+	// Iterate through requested attributes and remove
+	// those which we don't have any settings for.
+	for (TInt i = 0; i < request.iNumberAttributes; i++)
+		{
+		if (! AttributeSettingExists(request.iAttributes[i]))
+			{
+			request.iAttributes.Remove(i);
+			request.iNumberAttributes--;
+			i--;
+			}
+		}
+		
+	// Make sure that we always have at least one result to return
+	// Table 5.18 says that the number of results provided has an
+	// allowed value of 1-255, so we cannot return zero results.
+	RRemConGetPlayerApplicationTextResponse response;
+	response.iNumberAttributes = request.iNumberAttributes;
+	if (response.iNumberAttributes == 0)
+		{
+		request.Close();
+		return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId);  // No attributes matched
+		}
+
+	// for every attribute text requested
+	for (TInt i = 0; i < request.iNumberAttributes; i++)
+		{
+		// start with the attribute id requested and the character set
+		RSettingWithCharset setting;
+		TInt attId = request.iAttributes[i];
+		CPlayerApplicationSettings* thisSetting = GetSetting(attId);
+		setting.iAttributeId = attId;
+		setting.iCharset = KUtf8MibEnum;
+		const TPtrC8 text = thisSetting->GetAttributeText();
+		setting.iStringLen = text.Length();
+		setting.iString = text.Alloc();
+		
+		// If OOM, try to return an internal error.
+		if (setting.iString == NULL)
+			{
+			request.Close();
+			response.Close();
+			return SendError(KErrAvrcpMetadataInternalError, aOperationId);
+			}
+			
+		// If OOM, try to return an internal error.
+		if (response.iAttributes.Append(setting) != KErrNone)
+			{
+			setting.Close();
+			request.Close();
+			response.Close();
+			return SendError(KErrAvrcpMetadataInternalError, aOperationId);
+			}
+		}
+	request.Close();
+	
+	// Allocate a buffer for the formatted message
+	RBuf8 messageBuffer;
+	if ( messageBuffer.Create(response.Size()) != KErrNone )
+		{
+		// On OOM drop the message
+		response.Close();
+		return;
+		}
+		
+	// send the response back to the CT
+	TRAP(error, response.WriteL(messageBuffer));   // Try to send internal error if OOM
+	response.Close();
+	if (error != KErrNone)
+		{
+		messageBuffer.Close();
+		return SendError(KErrAvrcpMetadataInternalError, aOperationId);
+		}
+		
+	InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+									aOperationId, ERemConResponse, messageBuffer );
+	
+	messageBuffer.Close();
+	}
+
+// PDU 0x14
+void CPlayerInfoTarget::ProcessSetPlayerApplicationValue(const TDesC8& aData, TInt aOperationId)
+	{
+	RRemConPlayerAttributeIdsAndValues request;
+	TInt error = 0;
+
+	// If we can't parse the request, then return an error
+	TRAP(error, request.ReadL(aData));
+	if (error != KErrNone)
+		{
+		request.Close();
+		return SendError(KErrAvrcpMetadataInvalidCommand, aOperationId);
+		}
+		
+	// Iterate through all the settings we're sent to update and set them
+	for (TInt i = 0; i < request.iNumberAttributes; i++)
+		{
+		if (! AttributeValueCanBeSet(request.iAttributeId[i], request.iAttributeValue[i]))
+			{
+			// remove this setting
+			request.iAttributeId.Remove(i);
+			request.iAttributeValue.Remove(i);
+			request.iNumberAttributes--;
+			i--;
+			}
+		}
+	__ASSERT_DEBUG(request.iAttributeId.Count() == request.iAttributeValue.Count(), PlayerSettingsUtils::Panic(EPlayerSettingsFunnyLengthData));
+	
+	// Section 5.7 of the AVRCP specification (page 56) says:
+	// If CT sent a PDU with nonexistent PDU ID or a PDU containing
+	// only one parameter with nonexistent parameter ID, TG shall return
+	// REJECTED response with Error Status Code. If CT sent a PDU with
+	// multiple parameters where at least one ID is existent and the
+	// others are nonexistent, TG shall proceed with the existent ID and
+	// ignore the non-existent IDs.
+	//
+	// This means we return REJECTED if we have nothing to set
+	if (request.iNumberAttributes == 0)
+		{
+		request.Close();
+		return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId);
+		}
+		
+	// If an application setting notifier has been requested then notify it
+	// If the notification succeeds, then set all the values
+
+	TRAP(error, iApplicationSettingNotifier.MpasnSetPlayerApplicationValueL(request.iAttributeId, request.iAttributeValue));
+	if ( error == KErrNone )
+		{
+		for (TInt i = 0; i < request.iNumberAttributes; i++)
+			{
+			CPlayerApplicationSettings* thisSetting = GetSetting(request.iAttributeId[i]);
+			thisSetting->SetCurrentValue(request.iAttributeValue[i]);
+			}
+		}
+	else
+		{
+		// Return an AVRCP internal error via RemCon. See section 5.7.1 of specification.
+		request.Close();
+		return SendError(KErrAvrcpMetadataInternalError, aOperationId);
+		}
+		
+	request.Close();
+     // Send a notification if one has been registered
+     if ( KErrNotFound != iPendingNotificationEventList.Find( ERegisterNotificationPlayerApplicationSettingChanged ))
+          {
+           SendNotificationResponse( ERegisterNotificationPlayerApplicationSettingChanged, ERemConNotifyResponseChanged );
+          }
+       
+		
+	// SendError KErrNone is used to send a valid response
+	SendError(KErrNone, aOperationId);
+	}
+
+// PDU 0x13
+void CPlayerInfoTarget::ProcessGetCurrentPlayerApplicationValue(const TDesC8& aData, TInt aOperationId)
+	{
+	TInt error = 0;
+
+	// If we can't parse the request, then return an error
+	RRemConPlayerListOfAttributes request;
+	TRAP(error, request.ReadL(aData));
+	if (error != KErrNone)
+		{
+		request.Close();
+		return SendError(KErrAvrcpMetadataInvalidCommand, aOperationId);
+		}
+		
+	// Look through requested attributes, and assemble a response
+	// for those which we posess. If none are found, return an error
+	RRemConPlayerAttributeIdsAndValues response;
+	response.iNumberAttributes = 0;
+	request.iAttributes.Sort();
+	
+	for (TInt i = 0; i < request.iNumberAttributes; i++)
+		{
+		TInt attToSend = request.iAttributes[i];
+		if (AttributeSettingExists(attToSend))
+			{
+			TInt ret1 = response.iAttributeId.Append(attToSend);
+			TInt ret2 = response.iAttributeValue.Append(GetSetting(attToSend)->GetCurrentValue());
+			if (ret1 != KErrNone || ret2 != KErrNone)
+				{
+				request.Close();
+				response.Close();
+				return SendError(KErrAvrcpMetadataInternalError, aOperationId);   // Try to send internal error if OOM
+				}
+			response.iNumberAttributes++;
+			}
+		}
+	request.Close();
+		
+	// Make sure that we always have at least one result to return
+	// Table 5.18 says that the number of results provided has an
+	// allowed value of 1-255, so we cannot return zero results.
+	if (response.iNumberAttributes == 0)
+		{
+		response.Close();
+		return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId);  // No attributes matched
+		}
+		
+	// send the response back to the CT
+	TRAP(error, response.WriteL(iOutBuf));   // Try to send internal error if OOM
+	response.Close();
+	if (error != KErrNone)
+		{
+		return SendError(KErrAvrcpMetadataInternalError, aOperationId);
+		}
+		
+	InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+									aOperationId, ERemConResponse, iOutBuf );
+	}
+
+// PDU 0x16
+void CPlayerInfoTarget::ProcessGetPlayerApplicationValueText(const TDesC8& aData, TInt aOperationId)
+	{
+	RDesReadStream readStream;
+	readStream.Open(aData);
+
+	TInt error = 0;
+	TInt reqAttribute = 0;
+	
+	// Read the attribute id
+	TRAP(error, reqAttribute = readStream.ReadUint8L());
+	if (error != KErrNone)
+		{
+		readStream.Close();
+		return SendError(KErrAvrcpMetadataParameterNotFound, aOperationId);  // Nothing in packet
+		}
+		
+	// If we don't have settings for this attribute, return an error
+	CPlayerApplicationSettings* thisSetting = GetSetting(reqAttribute);
+	if (thisSetting == NULL)
+		{
+		readStream.Close();
+		return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId);  // Attribute not found
+		}
+		
+	// Read the number of PAS values
+	TInt numSettings = 0;
+	TRAP(error, numSettings = readStream.ReadUint8L());
+	if (error != KErrNone)
+		{
+		readStream.Close();
+		return SendError(KErrAvrcpMetadataParameterNotFound, aOperationId);  // Nothing in packet
+		}
+	
+	RArray<TInt> valueTextsRequested;
+	for (TInt i = 0; i < numSettings; i++)
+		{
+		TInt requestedValueText = 0;
+		TRAP(error, requestedValueText = readStream.ReadUint8L());
+		if (error == KErrNone)
+			{
+			if (valueTextsRequested.Append(requestedValueText) != KErrNone)
+				{
+				readStream.Close();
+				return SendError(KErrAvrcpMetadataInternalError, aOperationId);   // Try to send internal error if OOM
+				}
+			}
+		}
+	
+	readStream.Close();
+	
+	// format the response in a RRemConGetPlayerApplicationTextResponse
+	RRemConGetPlayerApplicationTextResponse response;
+	response.iNumberAttributes = 0;
+
+	// for every attribute text requested
+	RPointerArray<HBufC8>* textValues = thisSetting->GetValuesTexts();
+	RArray<TUint>* values = thisSetting->GetValues();
+	TInt numRequested = valueTextsRequested.Count();
+	for (TInt i = 0; i < numRequested; i++)
+		{
+		// start with the attribute id requested and the character set
+		RSettingWithCharset setting;
+		TInt valueToSend = valueTextsRequested[i];
+		setting.iAttributeId = valueToSend;
+		setting.iCharset = KUtf8MibEnum;
+
+		// text length followed by the text
+		TInt found = values->Find(valueToSend);
+		if (found != KErrNotFound)
+			{
+			HBufC8* text = (*textValues)[found];
+			setting.iStringLen = text->Length();
+			setting.iString = text->Alloc();
+			
+			// If OOM, try to return an internal error.
+			if (setting.iString == NULL)
+				{
+				response.Close();
+				valueTextsRequested.Close();
+				return SendError(KErrAvrcpMetadataInternalError, aOperationId);
+				}
+				
+			// If OOM, try to return an internal error. Of course, this could fail too
+			if (response.iAttributes.Append(setting) != KErrNone)
+				{
+				response.Close();
+				setting.Close();
+				valueTextsRequested.Close();
+				return SendError(KErrAvrcpMetadataInternalError, aOperationId);
+				}
+				
+			response.iNumberAttributes++;
+			}
+		}
+	valueTextsRequested.Close();
+	
+	// Make sure that we always have at least one result to return
+	// Table 5.18 says that the number of results provided has an
+	// allowed value of 1-255, so we cannot return zero results.
+	if (response.iNumberAttributes == 0)
+		{
+		response.Close();
+		return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId);
+		}
+		
+	// Allocate a buffer for the formatted message
+	RBuf8 messageBuffer;
+	if ( messageBuffer.Create(response.Size()) != KErrNone )
+		{
+		// On OOM drop the message
+		response.Close();
+		return;
+		}
+		
+	// send the response back to the CT
+	TRAP(error, response.WriteL(messageBuffer));   // Try to send internal error if OOM
+	response.Close();
+	if (error != KErrNone)
+		{
+		messageBuffer.Close();
+		return SendError(KErrAvrcpMetadataInternalError, aOperationId);
+		}
+		
+	InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid),
+									aOperationId, ERemConResponse, messageBuffer );
+	messageBuffer.Close();
+	}
+
+TBool CPlayerInfoTarget::AttributeSettingExists(TUint anAttributeID)
+	{
+	if (GetSetting(anAttributeID) == NULL)
+		{
+		return EFalse;
+		}
+	else
+		{
+		return ETrue;
+		}
+	}
+
+TBool CPlayerInfoTarget::IsValidAttributeValue(TUint anAttributeID, TUint anAttributeValue)
+	{
+	// As defined in Appendix F of the AVRCP specification, page 81
+	// Attribute 0x01 - range 0x01 to 0x02
+	// Attribute 0x02 - range 0x01 to 0x04
+	// Attribute 0x03 - range 0x01 to 0x03
+	// Attribute 0x04 - range 0x01 to 0x03
+	// Attribute 0x05 - 0x7f -- invalid; reserved for future use
+	// Attribute 0x80 - 0xff -- vendor dependent
+	if (anAttributeID >= 0x80 && anAttributeID <= 0xff && anAttributeValue <= 0xff )
+		{
+		return ETrue;
+		}
+		
+	if (anAttributeID == 0x01 && anAttributeValue >= 0x01 && anAttributeValue <= 0x02)
+		{
+		return ETrue;
+		}
+		
+	if (anAttributeID == 0x02 && anAttributeValue >= 0x01 && anAttributeValue <= 0x04)
+		{
+		return ETrue;
+		}
+		
+	if ((anAttributeID == 0x03 || anAttributeID == 0x04)
+		&& anAttributeValue >= 0x01 && anAttributeValue <= 0x03)
+		{
+		return ETrue;
+		}
+		
+	// Everything else is invalid, as defined by the specification
+	return EFalse;
+	}
+
+// Check that anAttributeValue is in the valid value list for anAttributeID
+TBool CPlayerInfoTarget::AttributeValueCanBeSet(TUint anAttributeID, TUint anAttributeValue)
+	{
+	CPlayerApplicationSettings* thisSetting = GetSetting(anAttributeID);
+	if (thisSetting == NULL)
+		{
+		return EFalse;
+		}
+		
+	RArray<TUint>* values = thisSetting->GetValues();
+	if (values == NULL)
+		{
+		return EFalse;
+		}
+		
+	if (values->Find(anAttributeValue) == KErrNotFound)
+		{
+		return EFalse;
+		}
+		
+	// This attribute id and value has been already defined by the RSS
+	// file, and checked that it conforms to the specification when the
+	// RSS file was loaded. Now allow this value to be set over the air.
+	return ETrue;
+	}
+
+CPlayerApplicationSettings* CPlayerInfoTarget::GetSetting(TUint anAttributeID)
+	{
+	// Will return NULL if anAttributeID is not found
+	CPlayerApplicationSettings** settings = iPlayerApplicationSettings.Find(anAttributeID);
+	if (settings == NULL)
+		{
+		return NULL;
+		}
+		
+	return *settings;
+	}
+
+
+// from MPlayerApplicationSettingsObserver
+// exported function wrapper for internal pure virtual
+EXPORT_C void MPlayerApplicationSettingsObserver::DefineAttributeL(TUint aAttributeID,
+																	TDesC8& aAttributeText,
+																	RArray<TUint>& aValues,
+																	RArray<TPtrC8>& aValueTexts,
+																	TUint aInitialValue)
+	{
+	DoDefineAttributeL(aAttributeID, aAttributeText, aValues, aValueTexts, aInitialValue);
+	}
+
+EXPORT_C void MPlayerApplicationSettingsObserver::SetAttributeL(TUint aAttributeID, TUint aValue)
+	{
+	DoSetAttributeL(aAttributeID, aValue );
+	}
+
+void CPlayerInfoTarget::DoDefineAttributeL(TUint aAttributeID,
+											TDesC8& aAttributeText,
+											RArray<TUint>& aValues,
+											RArray<TPtrC8>& aValueTexts,
+											TUint aInitialValue)
+	{
+	//Check Length of the player application setting attribute string is 1-255
+	if(aAttributeText.Length() > KMaxPlayerApplicationSettingsValue || 
+			aAttributeText.Length() < KMinPlayerApplicationSettingsValue )
+		{
+		User::Leave(KErrNotSupported);
+		}
+	
+	//Check the number of player application setting values is 1-255
+	if(aValues.Count() > KMaxPlayerApplicationSettingsValue || 
+			aValues.Count() < KMinPlayerApplicationSettingsValue )
+		{
+		User::Leave(KErrNotSupported);
+		}	
+	
+	//Check the numbers of player application setting values and 
+	//player application setting value texts are equal
+	if(aValues.Count() != aValueTexts.Count())
+		{
+		User::Leave(KErrNotSupported);
+		}
+	
+	//Check Length of the player application setting value string is 1-255
+	for(TInt i = 0; i < aValueTexts.Count(); i++ )
+		{
+		if(aValueTexts[i].Length() > KMaxPlayerApplicationSettingsValue ||
+				aValueTexts[i].Length() < KMinPlayerApplicationSettingsValue )
+			{
+			User::Leave (KErrNotSupported);
+			}			
+		}
+
+	for (TInt i = 0; i < aValues.Count(); i++)
+		{
+		// The user cannot define certain attribute ids or values; see Appendix F
+		if ( ! IsValidAttributeValue(aAttributeID, aValues[i]))
+			{
+			User::Leave(KErrNotSupported);
+			}
+		}
+	
+	// Check the initial value, too
+	if ( ! IsValidAttributeValue(aAttributeID, aInitialValue))
+		{
+		User::Leave(KErrNotSupported);
+		}
+		
+	// check that aInitialValue is in aValues
+	if (aValues.Find(aInitialValue) == KErrNotFound)
+		{
+		User::Leave(KErrNotSupported);
+		}
+		
+	// create a new TPlayerApplicationSettings
+	CPlayerApplicationSettings* newSetting = CPlayerApplicationSettings::NewL(aAttributeID, aAttributeText, aValues, aValueTexts, aInitialValue);
+	CleanupStack::PushL(newSetting);
+	
+	// Backup the settings of aAttributeID if they exist, return NULL if the attribute ID cannot be found
+	CPlayerApplicationSettings* backupSetting = GetSetting(aAttributeID); 
+	
+	// and save it 
+	iPlayerApplicationSettings.InsertL(aAttributeID, newSetting);
+	
+	//Delete backupSetting, as the InsertL will replace the old objects by the provided objects 
+	delete backupSetting;
+	
+	CleanupStack::Pop(newSetting);
+	}
+
+void CPlayerInfoTarget::DoSetAttributeL(TUint aAttributeID, TUint aValue)
+	{
+	// Will return NULL if the attribute ID cannot be found
+	CPlayerApplicationSettings* setting = GetSetting(aAttributeID);
+	if (setting == NULL)
+		{
+		User::Leave(KErrNotFound);
+		}
+		
+	if ( ! IsValidAttributeValue(aAttributeID, aValue))
+		{
+		User::Leave(KErrNotSupported);
+		}
+		
+	setting->SetCurrentValue(aValue);
+	
+	if ( KErrNotFound != iPendingNotificationEventList.Find( ERegisterNotificationPlayerApplicationSettingChanged ))
+		{
+		// send response
+		SendNotificationResponse( ERegisterNotificationPlayerApplicationSettingChanged, ERemConNotifyResponseChanged );
+		}
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/playerinformation/src/settingsresource.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,88 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <playerinformationtargetobserver.h>
+#include <barsread2.h>
+#include <barsc2.h>
+
+
+// AVRCP resource files must only contain one top level resource.
+static const int KAVRCPResourceId = 1;
+static const TInt KAVRCPFormatVersion = 1;
+
+
+EXPORT_C void PlayerApplicationSettingsResourceInit::DefineAttributesL(MPlayerApplicationSettingsObserver& aSettings,
+																CResourceFile& aResourceFile)
+	{
+	// Read the settings from the resource file
+	RResourceReader reader;
+	reader.OpenLC(&aResourceFile, KAVRCPResourceId);
+	
+	// Check the version of this resource file
+	TUint16 formatVersion = reader.ReadUint16L();
+	if (formatVersion != KAVRCPFormatVersion)
+		{
+		reader.Close();
+		User::Leave(KErrCorrupt);
+		}
+	
+	// Find out how many settings this resource file contains
+	TInt settingsCount = reader.ReadUint16L();
+	if (settingsCount < 0)
+		{
+		reader.Close();
+		User::Leave(KErrCorrupt);
+		}
+
+	// read the settings from aResource
+	RArray<TUint> values;
+	RArray<TPtrC8> valueTexts;
+	CleanupClosePushL(values);
+ 	CleanupClosePushL(valueTexts);
+
+	// Read each AVRCP attribute setting in turn
+	for (int i = 0; i < settingsCount; i++)
+		{
+		values.Reset();
+		valueTexts.Reset();
+		
+		// Read attribute, description text, initial value and defined values
+		TUint attributeID(reader.ReadUint8L());
+		TUint initialValue(reader.ReadUint8L());
+		TPtrC8 attributeText(reader.ReadTPtrC8L());
+		TInt valuesCount(reader.ReadUint16L());
+
+		for (int j = 0; j < valuesCount; j++)
+			{
+			TUint thisValue = reader.ReadUint8L();
+			TPtrC8 thisDescription = reader.ReadTPtrC8L();
+			
+			values.AppendL(thisValue);
+			valueTexts.AppendL(thisDescription);
+			}
+		
+		// Now define this attribute, then continue to next attribute
+		aSettings.DefineAttributeL(attributeID, attributeText, values, valueTexts, initialValue);
+		}
+	// cleaning up values and valueTexts
+	 CleanupStack::PopAndDestroy(3); // values, valueTexts, reader
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,28 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconbeareravrcp.mmp
+
+PRJ_EXPORTS
+../public/remconbeareravrcp.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconbeareravrcp.h)	
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/group/remconbeareravrcp.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,85 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconbeareravrcp.dll and resource file. AVRCP bearer plugin for Rem Con server.
+//
+
+
+
+/**
+ @file
+*/
+
+#include <remcon/remconservercaps.mmh>
+
+TARGET        remconbeareravrcp.dll
+TARGETTYPE    plugin
+
+UID 0x10009d8d 0x1020685e
+VENDORID 0x70000001
+
+SOURCEPATH ../src
+SOURCE        avrcpcommandframer.cpp 
+SOURCE        avrcpfragmenter.cpp
+SOURCE        avrcpimplementationproxy.cpp
+SOURCE        avrcpincomingcommandhandler.cpp
+SOURCE        avrcpoutgoingcommandhandler.cpp
+SOURCE        avrcpremotedevice.cpp 
+SOURCE        avrcprouter.cpp
+SOURCE        avrcputils.cpp
+SOURCE        remconbeareravrcp.cpp
+SOURCE		  avrcpMetadataTransfer.cpp
+SOURCE		  avrcpbrowsingcommandhandler.cpp
+SOURCE		  browsingframe.cpp
+SOURCE		  browsecommand.cpp 
+SOURCE		  avrcpadvancedcontrol.cpp 
+SOURCE		  avrcpplayerinfomanager.cpp 
+SOURCE		  playerbitmasks.cpp 
+SOURCE		  avrcpsdputils.cpp
+SOURCE		  bulkbearer.cpp
+SOURCE		  avrcpcommand.cpp 
+SOURCE		  playerstatewatcher.cpp 
+SOURCE		  controlcommand.cpp 
+SOURCE		  internalcommand.cpp
+SOURCE		  passthroughhelper.cpp 
+
+
+START RESOURCE 1020685e.rss
+TARGET remconbeareravrcp.rsc
+END
+
+USERINCLUDE   ../inc
+USERINCLUDE   ../../common
+
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY       avc.lib
+LIBRARY       ecom.lib
+LIBRARY	      estor.lib
+LIBRARY       euser.lib
+LIBRARY       bluetooth.lib
+LIBRARY       bluetoothav.lib
+LIBRARY       sdpdatabase.lib
+LIBRARY       avctpservices.lib
+LIBRARY       remconbearerplugin.lib
+LIBRARY       remcontypes.lib
+LIBRARY       avrcpipc.lib
+LIBRARY       remconabsolutevolume.lib
+
+#include <bluetooth/btlogger.mmh>
+
+
+UNPAGED
+
+SMPSAFE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcp.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,57 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+#ifndef AVRCP_H
+#define AVRCP_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+namespace AvrcpStatus
+	{
+	enum TCode
+		{
+		EInvalidCommand = 0,
+		EInvalidParameter = 1,
+		EParameterNotFound = 2,
+		EInternalError = 3,
+		ESuccess = 4,
+		EUidChanged = 5,
+		EReserved = 6,
+		EInvalidDirection = 7,
+		ENotADirectory = 8,
+		EDoesNotExist = 9,
+		EInvalidScope = 0xa,
+		ERangeOutOfBounds = 0xb,
+		EUidIsADirectory = 0xc,
+		EMediaInUse = 0xd,
+		ENowPlayingListFull = 0xe,
+		ESearchNotSupported = 0xf,
+		ESearchInProgress = 0x10,
+		EInvalidPlayerId = 0x11,
+		EPlayerNotBrowesable = 0x12,
+		EPlayerNotAddressed = 0x13,
+		ENoValidSearchResults = 0x14,
+		ENoAvailablePlayers = 0x15,
+		EAddressedPlayerChanged = 0x16,
+		};
+	}
+
+
+#endif // AVRCP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcpbearerinterface.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,42 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPBEARERINTERFACE_H
+#define AVRCPBEARERINTERFACE_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <e32base.h>
+#include <bt_sock.h>
+
+class MIncomingCommandHandler;
+class MOutgoingCommandHandler;
+NONSHARABLE_CLASS(MAvrcpBearer)
+	{
+public:
+	virtual MIncomingCommandHandler* IncomingHandler(const TBTDevAddr& aAddr) = 0;
+	virtual MOutgoingCommandHandler* OutgoingHandler(const TBTDevAddr& aAddr) = 0;
+	
+	virtual void ConnectIndicate(const TBTDevAddr& aBTDevice) = 0;
+	virtual void ConnectConfirm(const TBTDevAddr& aBTDevice, TInt aError) = 0;
+	virtual void DisconnectIndicate(const TBTDevAddr& aBTDevice) = 0;
+	virtual void DisconnectConfirm(const TBTDevAddr& aBTDevice, TInt aError) = 0;
+	};
+
+#endif //AVRCPBEARERINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcpbrowsingcommandhandler.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,87 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// avrcpbrowsingincomingcommandhandler.h
+//
+
+#ifndef AVRCPBROWSINGINCOMINGCOMMANDHANDLER_H
+#define AVRCPBROWSINGINCOMINGCOMMANDHANDLER_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <avctpservices.h>
+#include <e32base.h>
+#include "avrcpplayerinfomanager.h"
+#include "commandhandlerinterface.h"
+#include "remconcommandinterface.h"
+
+class CBulkRouter;
+class CAvrcpBulkBearer;
+class TBTDevAddr;
+class CBrowseCommand;
+NONSHARABLE_CLASS(CRcpBrowsingCommandHandler) : public CBase, public MIncomingCommandHandler
+	{
+public:
+	static CRcpBrowsingCommandHandler* NewL(MRemConBulkCommandInterface& aCommandInterface,
+		CBulkRouter& aRouter,
+		CAvrcpPlayerInfoManager& aPlayerInfoManager,
+		const TBTDevAddr& aAddr);
+	~CRcpBrowsingCommandHandler();
+	
+	void Disconnect();
+	const TBTDevAddr& BtAddr() const;
+
+private: // from MIncomingCommandHandler
+	void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult);
+	void MaxPacketSize(TInt aMtu);
+	void ReceiveCommandL(const TDesC8& aMessageInformation, SymbianAvctp::TTransactionLabel aTransLabel, const TBTDevAddr& aAddr);
+	
+	TInt SendRemConResponse(TUid aInterfaceUid, TUint aId, RBuf8& aData);
+	void SendReject(TUid aInterfaceUid, TUint aTransactionId);
+
+private:
+	CRcpBrowsingCommandHandler(MRemConBulkCommandInterface& aCommandInterface,
+		CBulkRouter& aRouter,
+		CAvrcpPlayerInfoManager& aPlayerInfoManager,
+		const TBTDevAddr& aAddr);
+	
+	void Respond(CBrowseCommand& aCommand, TInt aErr);
+	void HandledCommand(CBrowseCommand& aCommand);
+	
+	void HandleInternalCommand(CBrowseCommand& aCommand);
+	TInt HandleGetFolderItems(TUint aId, RBuf8& aCommandData);
+	void DoHandleGetFolderItemsL(RBuf8& aCommandData, RBuf8& aResponseData);
+	
+	TInt SendInternalResponse(TUint aId, RBuf8& aData);
+	TInt SendResponse(TDblQue<CBrowseCommand>& aCommandQueue, TUint aId, RBuf8& aData);
+		
+	TBool HandleSetBrowsedPlayer(CBrowseCommand& aCommand);
+
+private:
+	TDblQue<CBrowseCommand>			iCommandQueue;
+	TDblQue<CBrowseCommand>			iInternalCommandQueue;
+	
+	MRemConBulkCommandInterface&	iCommandInterface;
+	CBulkRouter&					iRouter;
+	
+	TInt							iMtu;
+	
+	CAvrcpPlayerInfoManager&		iPlayerInfoManager;
+	TBTDevAddr						iAddr;
+	};
+
+#endif //AVRCPBROWSINGINCOMINGCOMMANDHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcpcommand.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,91 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPCOMMAND_H
+#define AVRCPCOMMAND_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <e32base.h>
+#include <bluetoothav.h>
+#include <bluetooth/avctptypes.h>
+#include "avrcputils.h"
+
+class CAvrcpPlayerInfoManager;
+/**
+This class is a base class for all AVRCP commands.  It provides 
+the functionality that is common between the AV/C and Browse 
+commands.
+*/
+NONSHARABLE_CLASS(CAvrcpCommand) : public CBase
+	{
+public:
+	// called from Router
+	void Sent();
+	virtual SymbianAvctp::TMessageType MessageType() const = 0;
+	
+	// Called by users of command
+	void DecrementUsers();
+	void IncrementUsers();
+
+	// Called from bearer
+	void GetCommandInfo(TUid& aInterfaceUid, 
+		TUint& aId, 
+		TUint& aOperationId, 
+		RBuf8& aCommandData, 
+		TBTDevAddr& aAddr);
+
+	virtual const TDesC8& Data() const = 0;
+	
+	const TBTDevAddr& RemoteAddress() const;
+	SymbianAvctp::TTransactionLabel TransactionLabel() const;
+	TUint RemConCommandId() const;
+	
+	const TUid& RemConInterfaceUid() const;
+	TUint RemConOperationId() const;
+	
+	TBool KnownToBearer() const;
+
+protected:
+	explicit CAvrcpCommand(TUint aRemConId,
+			SymbianAvctp::TTransactionLabel aTransactionLabel, 
+			const TBTDevAddr& aAddr);
+	
+public:
+	TAvrcpDblQueLink	iHandlingLink;	// Used to form handling queue in command handlers
+	TAvrcpDblQueLink	iReadyLink;		// Used to form ready command queue in CRemConBearerAvrcp
+	TAvrcpDblQueLink	iSendLink;		// Used to form send queue in CRcpRouter
+
+protected:
+	TUint							iRemConId;
+	SymbianAvctp::TTransactionLabel	iTransactionLabel;
+		
+	TBTDevAddr						iRemoteAddr;
+
+	TUid							iInterfaceUid;
+	TUint							iOperationId;
+	RBuf8							iCommandData;
+	
+	TUint							iUsers;
+	TBool							iKnownToBearer;
+	
+	CAvrcpPlayerInfoManager*  		iPlayerInfoManager;
+	};
+
+#endif //AVRCPCOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcpcommandframer.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,41 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPCOMMANDFRAMER_H
+#define AVRCPCOMMANDFRAMER_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <avcpanel.h>
+#include <remcon/avrcpspec.h>
+
+class CAVCFrame;
+NONSHARABLE_CLASS(AvrcpCommandFramer)
+	{
+public:
+	static CAVCFrame* PassthroughL(AVCPanel::TOperationId aOperationId, 
+		AVCPanel::TButtonAction aButtonAction);
+	
+	static CAVCFrame* UnitInfoResponseL();
+	static CAVCFrame* SubunitInfoResponseL();
+	static CAVCFrame* SetAbsoluteVolumeCommandL(TUint8 aAbsVol);
+	static CAVCFrame* NotifyVolumeChangeCommandL();
+	};
+
+#endif // AVRCPCOMMANDFRAMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcpfragmenter.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,52 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPFRAGMENTER_H
+#define AVRCPFRAGMENTER_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#define KAVRCPMinVendorDependentResponseLen 4
+
+#include <e32base.h>
+
+NONSHARABLE_CLASS(CAVRCPFragmenter) : public CBase
+	{
+public:
+	static CAVRCPFragmenter* NewL();
+	void Reset();
+	void AssignPayload(const RBuf8& aPayload);
+	TBool InFragmentedState();
+	TPtr8 GetNextFragmentHeader();
+	TPtr8 GetNextFragment();
+	TBool LastFragment();
+	TInt GetPDU();
+	~CAVRCPFragmenter() { iPayload.Close(); }
+		
+private:
+	CAVRCPFragmenter() {}
+	void Construct();
+	
+private:
+	RBuf8 iPayload;
+	TBool iInFragmentedState;
+	TInt iStart;
+	};
+
+#endif // AVRCPFRAGMENTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcpincomingcommandhandler.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,127 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPINCOMINGCOMMANDHANDLER_H
+#define AVRCPINCOMINGCOMMANDHANDLER_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <avctpservices.h>
+#include <e32base.h>
+#include <remcon/clientid.h>
+
+#include "controlcommand.h"
+#include "avrcpplayerinfomanager.h"
+#include "commandhandlerinterface.h"
+
+class CPassthroughHelper;
+class CRcpRouter;
+class MRemConControlCommandInterface;
+class CAVCFrame;
+class TBTDevAddr;
+NONSHARABLE_CLASS(CRcpIncomingCommandHandler) : public CBase, public MPlayerChangeObserver, public MIncomingCommandHandler
+	{
+public:
+	static CRcpIncomingCommandHandler* NewL(MRemConControlCommandInterface& aCommandInterface, 
+		MRemConBearerObserver& aObserver,
+		CRcpRouter& aRouter,
+		CDeltaTimer& aTimer,
+		CAvrcpPlayerInfoManager& aPlayerInfoManager, TBTDevAddr& aDevice);
+	void ConstructL();
+	~CRcpIncomingCommandHandler();
+	
+	void Disconnect();
+			
+	inline CAvrcpPlayerInfoManager& AvrcpPlayerInfoManager() const;
+	
+private: // from MIncomingCommandHandler
+	void MaxPacketSize(TInt aMtu);
+	void ReceiveCommandL(const TDesC8& aMessageInformation, SymbianAvctp::TTransactionLabel aTransLabel, const TBTDevAddr& aAddr);
+	void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult);
+	
+	TInt SendRemConResponse(TUid aInterfaceUid, TUint aId, RBuf8& aData);
+	void SendReject(TUid aInterfaceUid, TUint aId);
+
+private:
+	CRcpIncomingCommandHandler(MRemConControlCommandInterface& aCommandInterface, 
+		MRemConBearerObserver& aObserver,
+		CRcpRouter& aRouter,
+		CDeltaTimer& aTimer,
+		CAvrcpPlayerInfoManager& aPlayerInfoManager,
+		TBTDevAddr& aDevice);
+	
+	// From MPlayerChangeObserver
+	void MpcoAvailablePlayersChanged();
+	void MpcoAddressedPlayerChangedLocally(TRemConClientId aClientId);
+	void MpcoUidCounterChanged(TRemConClientId aClientId);
+
+	void Respond(CControlCommand& aCommand, TInt aErr);
+	void HandledCommand(CControlCommand& aCommand);
+	
+	void HandleInternalCommand(CControlCommand& aCommand);
+	void HandleRemConCommand(CControlCommand& aCommand);
+
+	TInt HandleSetAddressedPlayer(TUint aId, RBuf8& aCommandData);
+	void DoHandleSetAddressedPlayerL(RBuf8& aCommandData);
+	void AddressedPlayerChangedL(TRemConClientId aClientId);
+
+	TInt HandleRegisterAvailablePlayersNotification(CControlCommand& aCommand);
+	void DoHandleRegisterAvailablePlayersNotificationL(RBuf8& aResponseData, CControlCommand& aCommand);
+
+	TInt HandleRegisterAddressedPlayerNotification(CControlCommand& aCommand);
+	void DoHandleRegisterAddressedPlayerNotificationL(RBuf8& aResponseData, CControlCommand& aCommand);
+
+	TInt HandleUidChangedNotification( CControlCommand& aCommand);
+	void DoHandleUidChangedNotificationL(RBuf8& aResponseData, TUint16 aUidCounter);
+
+	void SendInternalResponse(TUint aId, RBuf8& aData);
+	void SendResponse(TDblQue<CControlCommand>& aCommandQueue, TUint aId, RBuf8& aData);
+	
+	void EnterAddressedMode();
+
+	// Timer functions
+	TBool DuplicateNotify(TDblQue<CControlCommand>& aCommandQueue, const CControlCommand& aCommand) const;
+	CControlCommand* FindNotify(TDblQue<CControlCommand>& aCommandQueue, TUid aInterfaceUid, TUint aOperationId);
+private:
+	TDblQue<CControlCommand>	iCommandQueue;
+	TDblQue<CControlCommand>	iInternalCommandQueue;
+	
+	CAVRCPFragmenter*					iFragmenter;
+	MRemConControlCommandInterface&		iCommandInterface;
+	MRemConBearerObserver&				iObserver;
+	CRcpRouter&							iRouter;
+	CDeltaTimer& 						iTimer;
+	TRemConClientId						iClientId;	// We store the client id even if we aren't
+													// in addressed mode as we may switch into
+													// it and need to know the current local
+													// addressed player
+	TBool					iAddressedMode;
+	
+	CAvrcpPlayerInfoManager&	iPlayerInfoManager;
+	TBTDevAddr&					iDevice;
+	
+	CPassthroughHelper*			iPassthroughHelper;
+	};
+
+CAvrcpPlayerInfoManager& CRcpIncomingCommandHandler::AvrcpPlayerInfoManager() const
+	{
+	return iPlayerInfoManager;
+	}
+
+#endif // AVRCPINCOMINGCOMMANDHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcplog.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,40 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Declares logging and instrumentation for avrcp (when flogging active)
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef AVRCPLOG_H
+#define AVRCPLOG_H
+
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_BEARER);
+#endif // __FLOG_ACTIVE
+
+#define AVRCPLOG(A) LOG(A)
+#define AVRCPLOG2(A,B) LOG1(A,B)
+#define AVRCPLOG3(A,B,C) LOG2(A,B,C)
+#define AVRCPLOG4(A,B,C,D) LOG3(A,B,C,D)
+#define AVRCPLOG5(A,B,C,D,E) LOG4(A,B,C,D,E)
+
+#endif //AVRCPLOG_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcpoutgoingcommandhandler.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,122 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPOUTGOINGCOMMANDHANDLER_H
+#define AVRCPOUTGOINGCOMMANDHANDLER_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <e32base.h>
+#include <avctpservices.h>
+#include "commandhandlerinterface.h"
+
+using namespace SymbianAvctp;
+
+class CControlCommand;
+class CRcpRouter;
+class MRemConControlCommandInterface;
+class MRemConBearerObserver;
+NONSHARABLE_CLASS(CRcpOutgoingCommandHandler) : public CBase, public MOutgoingCommandHandler
+	{
+public:
+	// Construction/Destruction
+	static CRcpOutgoingCommandHandler* NewL(MRemConControlCommandInterface& aCommandInterface, 
+		MRemConBearerObserver& aObserver,
+		CRcpRouter& aRouter,
+		CDeltaTimer& aTimer);
+	~CRcpOutgoingCommandHandler();
+	
+	// Called from bearer
+	void Disconnect(TBool aClearQueue);
+		
+	// Delta timer callback functions
+	static TInt ResponseExpiry(TAny* aExpiryInfo);
+	static TInt ReleaseExpiry(TAny* aExpiryInfo);
+	
+private:
+	// From MOutgoingCommandHandler 
+	void MaxPacketSize(TInt aMtu);
+	void ReceiveResponse(const TDesC8& aMessageInformation, TTransactionLabel aTransLabel, TBool aIpidBitSet);	
+	void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult);
+	
+	void SendCommandL(TUid aInterfaceUid, 
+		TUint aCommand, 
+		TUint aId,  
+		RBuf8& aCommandData, 
+		const TBTDevAddr& aAddr);
+	
+	void SendNotifyCommandL(TUid aInterfaceUid, 
+			TUint aCommand, 
+			TUint aId,  
+			RBuf8& aCommandData, 
+			const TBTDevAddr& aAddr);
+
+private:
+	CRcpOutgoingCommandHandler(MRemConControlCommandInterface& aCommandInterface, 
+		MRemConBearerObserver& aObserver,
+		CRcpRouter& aRouter,
+		CDeltaTimer& aTimer);
+	
+	// Internal send utility funcs
+	void CleanupUnreleased();
+	CControlCommand& SendCommandL(TUid aInterfaceUid,
+		TUint aCommand, 
+		TUint aId, 
+		RBuf8& aCommandData, 
+		TBool isClick, 
+		const TBTDevAddr& aAddr,
+		TBool aKnownToBearer,
+		TBool aNotify);	
+
+	void HandleCoreApiCommandL(TUint aCommand, 
+		TUint aId,  
+		RBuf8& aCommandData, 
+		const TBTDevAddr& aAddr);
+
+	void GenerateFailureResult(CControlCommand& aCommand, TInt aResult);
+	void GenerateCommandL(CControlCommand& aCommand, TRemConCoreApiButtonAction aButtonAct);
+		
+	// Timer functions
+	void ResponseExpiry(CControlCommand& aCommand);
+	void ReleaseExpiry(CControlCommand& aCommand);
+	void StartResponseTimer(CControlCommand& aCommand);
+	void StartReleaseTimer(CControlCommand& aCommand);
+	void ClearQueue(TDblQue<CControlCommand>& aQue);
+	void ProcessDisconnect(TDblQue<CControlCommand>& aQue, TBool aClearQueue);
+	CControlCommand* FindInQueue(TDblQue<CControlCommand>& aQue, SymbianAvctp::TTransactionLabel aTransLabel);
+	void ProcessReceiveResponse(CAVCFrame* aFrame, 
+								TBool aIpidBitSet,
+								CControlCommand* aCommand, 
+								TBool aNotify);
+private:
+	TTransactionLabel			iCurrentTrans;
+	TDblQue<CControlCommand>	iCommandQueue;
+	TDblQue<CControlCommand>	iNotifyCommandQueue;
+	
+	MRemConControlCommandInterface& iCommandInterface;
+	MRemConBearerObserver&			iObserver;
+	CRcpRouter&						iRouter;
+	CDeltaTimer&					iTimer;
+	
+	CControlCommand*			iUnreleasedCommand;
+	TBool					iUnreleasedHasResponse;
+	TInt					iReleaseTimerExpiryCount;
+	};
+
+#endif // AVRCPOUTGOINGCOMMANDHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcpplayerinfomanager.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,178 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#ifndef AVRCPPLAYERINFOMANAGER_H
+#define AVRCPPLAYERINFOMANAGER_H
+
+#include <btsdp.h>
+#include <e32base.h>
+#include <playerinformationtargetobserver.h>
+#include <remconcoreapi.h>
+#include <remcon/clientid.h>
+#include <remcon/playertype.h>
+#include <remcon/remconbearerobserver.h>
+#include "avrcpinternalinterface.h"
+#include "avrcputils.h"
+#include "playerbitmasks.h"
+#include "playerstatewatcher.h"
+
+const TInt KAvrcpMediaPlayerItemBaseSize = 28;
+
+NONSHARABLE_CLASS(MPlayerChangeObserver)
+	{
+public:
+	virtual void MpcoAvailablePlayersChanged() = 0;
+	virtual void MpcoAddressedPlayerChangedLocally(TRemConClientId aClientId) = 0;
+	virtual void MpcoUidCounterChanged(TRemConClientId aClientId) = 0;
+	};
+
+NONSHARABLE_STRUCT(TAvrcpMediaPlayerItem)
+	{
+public:
+	TRemConClientId iId;
+	TUint8 iPlayerType;
+	TUint32 iPlayerSubType;
+	TPlayerFeatureBitmask iFeatureBitmask;
+	TPtrC8 iName;
+	// iUidCounter is set from the bulk thread and read from the control thread
+	TUint16 iUidCounter;
+	// iLastUpdatedUidCounter is only accessed from the control thread to see if an update
+	// is needed
+	TUint16 iLastUpdatedUidCounter; 				
+	MPlayerEventsObserver::TPlaybackStatus iPlaybackStatus;
+	TUint8 iSdpFeatures;
+	TBool iBulkClientAvailable;
+	// We store absolute volume support because it's returned as part of 
+	// a GetCapabilities(EventIds) response.  Some implementations poll
+	// for changes to this value so it's probably worthwhile avoiding
+	// having to ask RemCon for it repeatedly.
+	TBool iAbsoluteVolumeSupport;
+	};
+
+class MIncomingCommandHandler;
+class MRemConCommandInterface;
+class CUidWatcher;
+NONSHARABLE_CLASS(CAvrcpPlayerInfoManager) 
+	: public CBase, public MUidObserver, public MPlayStatusObserver
+	{
+//---------------------------------------------------------
+// Control thread only functions
+//---------------------------------------------------------
+public:
+	static CAvrcpPlayerInfoManager* NewL(MRemConBearerObserver& aObserver, MRemConCommandInterface& aCommandInterface);
+	~CAvrcpPlayerInfoManager();
+	
+	// Interface to bearer/remcon
+	void ClientAvailable(const TRemConClientId& aId, TPlayerType aClientType, TPlayerSubType aClientSubType, const TDesC8& aName);
+	void ClientNotAvailable(const TRemConClientId& aId);
+	void ClientStatus(TBool aControllerPresent, TBool aTargetPresent);	
+	TInt SetLocalAddressedClient(const TRemConClientId& aId);
+	void ControllerFeaturesUpdatedL(RArray<TUid>& aSupportedInterfaces);
+	void TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName);
+	MIncomingCommandHandler& InternalCommandHandler();
+
+	// Interface to command handler
+	void AddObserverL(MPlayerChangeObserver& aObserver);
+	void RemoveObserver(MPlayerChangeObserver& aObserver);
+	TUint16 UidCounterL(const TRemConClientId& aClientId) const;
+	TBool AbsoluteVolumeSupportedL(const TRemConClientId& aClientId) const;
+	TBool BrowsingSupportedL(const TRemConClientId& aClientId) const;
+
+private:
+	// Interface to uid counter updates
+	static TInt PlayerUpdateCallBack(TAny* aPlayerInfoMgr);
+	void UidCounterUpdate();
+	
+	// from MPlayStatusObserver
+	void MpsoPlayStatusChanged(TRemConClientId aId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus);
+	void MpsoError(TRemConClientId aId);
+
+	// Helper functions for ClientAvailable and TargetFeaturesUpdated
+	TInt SetItemDetails(TAvrcpMediaPlayerItem& aItem, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName);
+	void UpdateTargetSdpRecord();
+	
+	// Helper function for SDP record publishing
+	void CurrentTargetVersionAndFeatures(TUint16& aAvrcpVersion, TUint16& aAvctpVersion, TUint16& aSdpFeatures);
+	
+//---------------------------------------------------------
+// Bulk thread only functions
+//---------------------------------------------------------
+public:	
+	// Interface to bearer/remcon
+	void BulkClientAvailable(const TRemConClientId& aId);
+	void BulkClientNotAvailable(const TRemConClientId& aId);
+	MIncomingCommandHandler* BulkStartedL(MRemConCommandInterface& aCommandInterface);
+	void BulkStopped();
+	
+	// Interface to command handler
+	void MediaPlayerItemL(const TUint16& aAvrcpPlayerId, RMediaPlayerItem& aItem);
+
+
+private: // from MUidObserver
+	void MuoUidChanged(TRemConClientId aId, TUint16 aUidCounter);
+	void MuoError(TRemConClientId aId);
+
+
+
+//---------------------------------------------------------
+// Common functions
+//---------------------------------------------------------
+public:
+	// Used to map between AVRCP player ids and RemCon client ids
+	TRemConClientId ClientL(TUint16 aAvrcpPlayerId) const;
+	TRemConClientId Client(TUint16 aAvrcpPlayerId) const;
+	TUint16 PlayerL(const TRemConClientId& aClientId) const;
+	
+	// Used to retrieve list of current players
+	TInt PlayerListing(TUint aStartItem, TUint aEndItem, RArray<TUint>& aPlayers);
+	TInt PlayerListing(RArray<TUint>& aPlayers);
+
+private:
+	CAvrcpPlayerInfoManager(MRemConBearerObserver& aObserver);
+	void ConstructL(MRemConCommandInterface& aCommandInterface);
+	
+	TBool ValidPlayer(const TUint16& aAvrcpPlayerId) const;
+	TInt NextPlayerIndex();
+	TInt SetPlayerFeatures(const TRemConClientId& aId, TPlayerFeatureBitmask& aBitmask, TUint8& aSdpFeatures, TBool& aAbsoluteVolumeSupported);
+	void UpdateTgServiceRecordL();
+	
+private:
+	RPointerArray<MPlayerChangeObserver> iObservers;
+	RArray<TAvrcpMediaPlayerItem> iPlayers;
+	CUidWatcher* iUidWatcher;
+	CPlayStatusWatcher* iPlayStatusWatcher;
+	MRemConBearerObserver& iControlBearerObserver; // unowned - used to determine features of players
+	RSpecificThreadCallBack iControlThreadCallBack;
+	
+	RSdp						iSdp;
+	RSdpDatabase				iSdpDatabase;
+	TSdpServRecordHandle		iControllerRecord;
+	TSdpServRecordHandle		iTargetRecord;
+
+	mutable RFastLock iLock; // for use in const functions
+	};
+
+// The lock is only used for the following members....
+//
+
+#endif //AVRCPPLAYERINFOMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcpremotedevice.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,81 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPREMOTEDEVICE_H
+#define AVRCPREMOTEDEVICE_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <e32std.h>
+
+class MRemConControlCommandInterface;
+class MIncomingCommandHandler;
+class MOutgoingCommandHandler;
+class CRcpIncomingCommandHandler;
+class CRcpOutgoingCommandHandler;
+class CRcpRouter;
+class MRemConBearerObserver;
+/** 
+CRcpRemoteDevice represents one remote RCP device.  It manages
+the sending and receiving of commands between that device and the 
+local device.
+*/
+NONSHARABLE_CLASS(CRcpRemoteDevice) : public CBase
+	{
+public:
+	static CRcpRemoteDevice* NewL(const TBTDevAddr& aAddr,
+		CRcpRouter& aRouter, 
+		MRemConControlCommandInterface& aCommandInterface,
+		MRemConBearerObserver& aObserver,
+		CDeltaTimer& aTimer,
+		CAvrcpPlayerInfoManager& aPlayerInfoManager);
+		
+	virtual ~CRcpRemoteDevice();
+	
+	void Disconnect(TBool aClearQueue);
+
+	// Utility	
+	const TBTDevAddr& RemoteAddress() const;
+	MIncomingCommandHandler& IncomingHandler() const;
+	MOutgoingCommandHandler& OutgoingHandler() const;
+
+private:
+	CRcpRemoteDevice(const TBTDevAddr& aAddr,
+		CRcpRouter& aRouter, 
+		MRemConControlCommandInterface& aCommandInterface,
+		CDeltaTimer& aTimer);
+		
+	void ConstructL(MRemConBearerObserver& aObserver,
+					CAvrcpPlayerInfoManager& aPlayerInfoManager);
+
+public:
+	TDblQueLink						iLink;			// Used by bearer and router to manage remotes
+private:
+	TBTDevAddr						iDevice;
+	
+	CRcpIncomingCommandHandler*		iIncoming;
+	CRcpOutgoingCommandHandler*		iOutgoing;
+
+	CRcpRouter&						iRouter;
+	MRemConControlCommandInterface& iCommandInterface;
+	CDeltaTimer&					iTimer;
+	};
+
+
+#endif // AVRCPREMOTEDEVICE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcprouter.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,123 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPROUTER_H
+#define AVRCPROUTER_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <avctpservices.h>
+#include <e32base.h>
+#include "avrcp.h"
+#include "avrcpbearerinterface.h"
+
+
+class CAvrcpCommand;
+class CBrowseCommand;
+
+NONSHARABLE_CLASS(CRcpRouter) : public CBase, public MAvctpEventNotify
+	{		
+private:
+	enum TAvrcpRouterState
+		{
+		EAvrcpRouterSending,
+		EAvrcpRouterCanSend
+		};
+
+public:
+	~CRcpRouter();
+		
+	// Data functions called from command handlers
+	void AddToSendQueue(CAvrcpCommand& aCommand);
+	void RemoveFromSendQueue(CAvrcpCommand& aCommand);
+	
+	// Control functions called from bearer
+	TInt ConnectRequest(const TBTDevAddr& aAddr);	
+	TInt DisconnectRequest(const TBTDevAddr& aAddr);
+	
+	// MAvctpEventNotify functions
+	virtual void MaenAttachIndicate(const TBTDevAddr& aBTDevice, TInt aMtu, TBool& aAccept);
+				 
+	virtual void MaenAttachConfirm(const TBTDevAddr& aBTDevice, TInt aMtu, TInt aConnectResult);
+	
+	virtual void MaenDetachIndicate(const TBTDevAddr& aBTDevice); 
+	
+	virtual void MaenDetachConfirm(const TBTDevAddr& aBTDevice, TInt aDisconnectResult); 
+	
+	virtual void MaenMessageReceivedIndicate(const TBTDevAddr& aBTDevice,
+					SymbianAvctp::TTransactionLabel aTransactionLabel,
+					SymbianAvctp::TMessageType aType,
+					TBool aIpidBitSet,
+					const TDesC8& aMessageInformation);
+					
+	virtual void MaenMessageSendComplete(const TBTDevAddr& aBTDevice, 
+					SymbianAvctp::TTransactionLabel aTransactionLabel,   
+					TInt aSendResult); 
+
+	virtual void MaenCloseComplete();
+	
+	virtual void MaenErrorNotify(const TBTDevAddr& aBTDevice, TInt aError);			
+	
+	virtual void MaenExtensionInterfaceL(TUid aInterface, void*& aObject); 	
+		
+protected:
+	explicit CRcpRouter(MAvrcpBearer& aBearer);
+	
+private:
+	// Utility functions
+	void Send();
+	
+protected:
+	MAvctpChannel*				iChannel;
+	MAvrcpBearer&				iBearer;
+	
+	TDblQue<CAvrcpCommand>		iSendQueue;
+	TAvrcpRouterState			iState;
+//	TAvctpChannel				iChannel;
+
+	};
+
+NONSHARABLE_CLASS(CControlRouter) : public CRcpRouter
+	{
+public:
+	static CControlRouter* NewL(RAvctp& aAvctp, MAvrcpBearer& aBearer);
+	~CControlRouter();
+	
+private:
+	explicit CControlRouter(RAvctp& aAvctp, MAvrcpBearer& aBearer);
+	void ConstructL();
+	
+private:
+	RAvctp&	iAvctp;
+	};
+
+NONSHARABLE_CLASS(CBulkRouter) : public CRcpRouter
+	{
+public:
+	static CBulkRouter* NewL(RAvctp& aAvctp, MAvrcpBearer& aBearer);
+	~CBulkRouter();
+	
+private:
+	explicit CBulkRouter(RAvctp& aAvctp, MAvrcpBearer& aBearer);
+	void ConstructL();
+	
+private:
+	RAvctp&	iAvctp;
+	};
+#endif // AVRCPROUTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcpsdputils.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,82 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef AVRCPSDPUTILS_H
+#define AVRCPSDPUTILS_H
+
+#include <e32base.h>
+#include <btsdp.h>
+
+namespace AvrcpSdp
+	{
+	enum TRecordType
+		{
+		ERemoteControl,
+		ERemoteControlTarget,
+		};
+	
+	_LIT8(KAvrcpProviderName, "Symbian OS");
+	_LIT8(KAvrcpTargetServiceName, "AVRCP Target");	
+	_LIT8(KAvrcpControllerServiceName, "AVRCP Controller");
+	_LIT8(KAvrcpServiceDescription, "Audio Video Remote Control");
+	
+	const TUint16 KAvrcpProfileVersion14 = 0x0104;
+	const TUint16 KAvrcpProfileVersion13 = 0x0103;
+	const TUint16 KAvctpProtocolVersion13 = 0x103;
+	const TUint16 KAvctpProtocolVersion12 = 0x102;
+	
+	enum TAvrcpFeature
+		{
+		EPlayerRecorder		= 1 << 0,
+		EMonitorAmplifier	= 1 << 1,
+		ETuner				= 1 << 2,
+		EMenu				= 1 << 3,
+		EPlayer				= 1 << 4,
+		EGroupNavigation	= 1 << 5,
+		EBrowsing			= 1 << 6,
+		EMultiplePlayers	= 1 << 7,
+		};
+	
+	const TUint16 KAvrcpBaseCtFeatures = 	EPlayerRecorder | 
+											EMonitorAmplifier |
+											ETuner |
+											EMenu;
+	
+	const TUint16 KAvrcpBaseTgFeatures = 	EPlayerRecorder | 
+											EMonitorAmplifier |
+											ETuner |
+											EMenu;
+	}
+
+NONSHARABLE_CLASS(AvrcpSdpUtils)
+	{
+public:
+	static void CreateTargetServiceRecordL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle);
+	static void CreateControllerServiceRecordL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProfileVersion);
+	static void UpdateControllerServiceClassListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProfileVersion);
+	static void UpdateProtocolDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProtocolVersion);
+	static void UpdateAdditionalProtocolDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle);
+	static void UpdateProfileDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProfileVersion);
+	static void UpdateSupportedFeaturesL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, AvrcpSdp::TRecordType aType, TUint16 aFeatures);
+	};
+
+#endif // AVRCPSDPUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcptimer.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,53 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPTIMER_H
+#define AVRCPTIMER_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <e32base.h>
+
+class CControlCommand;
+NONSHARABLE_CLASS(TAvrcpTimerExpiryInfo)
+	{
+public:
+	inline TAvrcpTimerExpiryInfo(CBase* aHandler, CControlCommand& aCommand);
+public:
+	CBase*			iHandler;
+	CControlCommand&	iCommand;
+	};
+	
+
+//------------------------------------------------------------------------------------
+// TAvrcpTimerEntry
+//------------------------------------------------------------------------------------
+
+/** Constructor.
+
+@param aHandler	The CommandHandler to be informed on timer expiry.
+@param aCommand	The CControlCommand that this timer event relates to.
+@return A fully constructed TAvrcpTimerExpiryInfo.
+*/
+inline TAvrcpTimerExpiryInfo::TAvrcpTimerExpiryInfo(CBase* aHandler, CControlCommand& aCommand)
+	: iHandler(aHandler), iCommand(aCommand)
+	{
+	}
+
+#endif // AVRCPTIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/avrcputils.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,193 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef AVRCPUTILS_H
+#define AVRCPUTILS_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+_LIT(KAvrcpPanicName, "AVRCP Panic");
+
+enum TAvrcpPanic
+	{
+	EAvrcpNoAVCFrame = 0,
+	EAvrcpNotConnected = 1,
+	EAvrcpNoOutstandingSend = 2,
+	EAvrcpHoldExpiryForRelease = 3,
+	EAvrcpReleaseExpiryForRelease = 4,
+	EAvrcpUnknownAvctpTransId = 5,
+	EAvrcpNoResponsesAvailable = 6,
+	EAvrcpResponseToUnknownCommand = 7,
+	EAvrcpBadBTAddr = 8,
+	EAvrcpCommandStillInUse = 9,
+	EAvrcpCommandDataTooLong = 10,
+	EAvrcpFunnyLengthData = 11,
+	EAvrcpTimerNotCancelled = 12,
+	EAvrcpNotVendorDependent = 13,
+	EAvrcpMismatchedConnectDisconnect = 14,
+	EAvrcpDummyCallbackCalled = 15,
+	EAvrcpUnknownButtonAction = 16,
+	EAvrcpPressHasPhantomResponse = 17,
+	EAvrcpReleaseTimerStartedWithoutResponse = 18,
+	EAvrcpReleaseExpiryForOldCommand = 19,
+	EAvrcpSendingMessageFailed = 20,
+	EAvrcpDisconnectRequestWhilePartiallyConstructed = 21,
+	EAvrcpReleaseExpiryForClick = 22,
+	EAvrcpIncomingCommandsNotHandled = 23,
+	EAvrcpCommandStillQueuedForHandling = 24,
+	EAvrcpCommandStillQueuedAsReady = 25,
+	EAvrcpCommandStillQueuedForSending = 26,
+	EAvrcpPressNotPreviousPassthroughCommand = 27,
+	EAvrcpInterfaceUidNotSet = 28,
+	EAvrcpCTypeNotSet = 29,
+	EAvrcpCompanyIDNotSet = 30,
+	EAvrcpNotFullyConstructed = 31,
+	EAvrcpInternalHandlingRequestedOnWrongInterface = 32,
+	EAvrcpVolumeBeyondMaxVolume = 33,
+	EAvrcpInvalidEventId = 34,
+	EAvrcpInvalidPlayerId = 35,
+	EAvrcpConnectConfirmOnBrowseChannel = 36,
+	EAvrcpDisconnectConfirmOnBrowseChannel = 37,
+	EAlreadyWatchingPlayer = 38,
+	ENotWatchingPlayer = 39,
+	EAvctpMessageTypeRequestedForInternalCommand = 40,
+	ELowerInterfaceUsedOnInternalHandler = 41,
+	EFurtherProcessingRequiredForNonSetBrowsedPlayer = 42,
+	ESetBrowsePlayerRequestCorruptedLocally = 43,
+	ESpecificAddressUsedForBrowsingCommand = 44,
+	EUidUpdateRequestWriteFailure = 45,
+	EUnmatchedResponseFromRemCon = 46,
+	EResponseForWrongInterface = 47,
+	EInvalidBtAddrInResponse = 48,
+	EInvalidPlayerId = 49,
+	EMysteryInternalResponse = 50,
+	ECommandAlreadyQueuedForSending = 52,
+	EPassthroughQueueNotEmptyAfterDisconnect = 53,
+	EPreviousPassthroughNonNullReplacing = 54,
+	ETooManyRemotesRegisterForLocalAddressedPlayerUpdates = 55,
+	ETooFewRemotesRegisterForLocalAddressedPlayerUpdates = 56,
+	};
+
+template <typename XAny>
+struct TAvrcpPanicCodeTypeChecker
+	{
+	inline static void Check(XAny) { }
+	};
+
+#define AVRCP_PANIC(CODE) \
+	TAvrcpPanicCodeTypeChecker<TAvrcpPanic>::Check(CODE), \
+	PANIC(KAvrcpPanicName, CODE)
+
+
+class TBTDevAddr;
+class TRemConAddress;
+class AvrcpUtils
+	{
+public:
+	static void Panic(TAvrcpPanic aPanic); // The macro is probably more useful so this can be removed
+		
+	static void SetCommandDataFromInt(RBuf8& aCommandData, TInt aOffset, TInt aLength, TInt aValue);
+	static void ReadCommandDataToInt(const RBuf8& aCommandData, TInt aOffset, TInt aLength, TInt& aValue);
+	
+	static TInt RemConToBTAddr(const TRemConAddress& aRemoteAddress, TBTDevAddr& aBTAddr);
+	static void BTToRemConAddr(const TBTDevAddr& aBTAddr, TRemConAddress& aRemConAddress);
+	};
+
+//
+// Thread Assertions
+//
+
+enum TAvrcpThreadId
+	{
+	EControlThread	= 0x00000001,
+	EBulkThread		= 0x00000002,
+	};
+	
+#define ASSERT_THREAD(aaa) ASSERT_DEBUG(reinterpret_cast<TUint32>(Dll::Tls()) == aaa)
+#define WEAK_ASSERT_THREAD(aaa) if(Dll::Tls()) { ASSERT_THREAD(aaa); }
+#define ASSERT_CONTROL_THREAD ASSERT_THREAD(EControlThread)
+#define ASSERT_BULK_THREAD ASSERT_THREAD(EBulkThread)
+#define WEAK_ASSERT_BULK_THREAD WEAK_ASSERT_THREAD(EBulkThread)
+
+//
+// Cleanup Stack utils
+//
+
+template <class T>
+class CleanupSignal
+	{
+public:
+	inline static void PushL(T& aRef) {CleanupStack::PushL(TCleanupItem(&Signal,&aRef));};
+private:
+	static void Signal(TAny *aPtr) {(static_cast<T*>(aPtr))->Signal();};
+	};
+
+template <class T>
+inline void CleanupSignalPushL(T& aRef)
+	{CleanupSignal<T>::PushL(aRef);}
+
+template <class T>
+class CleanupDeleteAndNull
+	{
+public:
+	inline static void PushL(T*& aRef) {CleanupStack::PushL(TCleanupItem(&DeleteAndNull,&aRef));};
+private:
+	static void DeleteAndNull(TAny *aPtr) {T*& ptr = *static_cast<T**>(aPtr); delete ptr; ptr = NULL;};
+	};
+
+template <class T>
+inline void CleanupDeleteAndNullPushL(T*& aRef)
+	{CleanupDeleteAndNull<T>::PushL(aRef);}
+
+class CSpecificThreadCallBackBody;
+NONSHARABLE_CLASS(RSpecificThreadCallBack)
+	{
+public:
+	RSpecificThreadCallBack();
+	
+	TInt Create(const TCallBack& aCallBack, TInt aPriority);
+	void Close();
+	
+	TInt Start();
+	TInt CallBack();
+	void Cancel();
+	
+private:
+	CSpecificThreadCallBackBody*	iBody;
+	};
+
+/**
+An extended double queue link class to provide additional features.
+*/
+NONSHARABLE_CLASS(TAvrcpDblQueLink) : public TDblQueLink
+	{
+	public:
+		inline TBool IsQueued() const;
+	};
+
+/**
+Indicates whether the queue link is attached to a queue.
+@return True if the link is queued, false otherwise.
+*/
+inline TBool TAvrcpDblQueLink::IsQueued() const
+	{
+	return iNext ? ETrue : EFalse;
+	}
+
+#endif // AVRCPUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/browsecommand.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,82 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef BROWSECOMMAND_H
+#define BROWSECOMMAND_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <avctpservices.h>
+#include <e32base.h>
+#include <remcon/remconbearerplugin.h>
+#include "avrcpcommand.h"
+#include "avrcpplayerinfomanager.h"
+
+const TInt KMinLengthSetBrowsedPlayerPdu = 2; // PDU 0x70
+const TInt KMinLengthGetFolderItemsPdu = 10; // PDU 0x71
+const TInt KMinLengthChangePathPdu = 3; // PDU 0x72
+const TInt KMinLengthGetItemAttributesPdu = 12; // PDU 0x73
+const TInt KMinLengthSearchPdu = 4; // PDU 0x80
+const TInt KMinLengthGeneralReject = 4; // PDU 0xa0
+
+class CRcpRemoteDevice;
+class MRemConBearerObserver;
+NONSHARABLE_CLASS(CBrowseCommand) : public CAvrcpCommand
+	{
+public:
+	static CBrowseCommand* NewL(const TDesC8& aMessageInformation, 
+		TUint aRemConId,
+		SymbianAvctp::TTransactionLabel aTransLabel, 
+		const TBTDevAddr& aAddr,
+		CAvrcpPlayerInfoManager* aPlayerInfoManager);
+			
+	// Called from handlers
+	TInt ProcessIncomingCommandL(TInt aMaxResponse);
+	void ProcessOutgoingResponse(RBuf8& aCommandData);
+	void SetResult(TInt aErr);
+	const TDesC8& CommandData() const;
+	
+	const TDesC8& Data() const;
+	virtual SymbianAvctp::TMessageType MessageType() const;
+
+private:		
+	CBrowseCommand(TUint aRemConId,
+		SymbianAvctp::TTransactionLabel aTransLabel, 
+		const TBTDevAddr& aAddr,
+		CAvrcpPlayerInfoManager* aPlayerInfoManager);
+		
+	~CBrowseCommand();
+	void ConstructL(const TDesC8& aMessageInformation);
+		
+	TInt HandleSetBrowsedPlayer();
+	TInt HandleGetFolderItems();
+	TInt HandleChangePath();
+	TInt HandleGetItemAttributes();
+	TInt HandleSearch();
+	TInt HandleUnknownPdu();
+	
+	TInt AppendIncomingPayload(const TPtrC8& aPayload);
+	void GenerateRejectPayloadL(TInt aErr);	
+			
+private:
+	RBuf8							iFrame;
+	TInt 							iMaxResponse;
+	};
+	
+#endif //BROWSECOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/bulkbearer.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,110 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#ifndef BULKBEARER_H
+#define BULKBEARER_H
+
+#include <e32base.h>
+#include <remcon/remconbearerbulkinterface.h>
+
+#include "remconcommandinterface.h"
+
+class CBrowseCommand;
+class CRcpBrowsingCommandHandler;
+class TBTDevAddr;
+class TRemConAddress;
+
+NONSHARABLE_CLASS(CAvrcpBulkBearer) : public CBase, public MRemConBearerBulkInterface,
+	public MAvrcpBearer, public MRemConBulkCommandInterface
+	{
+public:
+	static CAvrcpBulkBearer* NewL(RAvctp& aAvctp, CAvrcpPlayerInfoManager& aPlayerInfoManager);
+	~CAvrcpBulkBearer();
+		
+private:	// Interface to command handlers, from MRemConCommandInterface
+	void MrcciNewCommand(CAvrcpCommand& aCommand);
+	void MrcciNewCommand(CAvrcpCommand& aCommand,const TRemConClientId& aClientId);
+	
+	TUint MrcciNewTransactionId();
+    void MrcciCommandExpired(TUint aTransactionId);
+	
+	TInt MrcbciSetAddressedClient(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+	void MrcbciRemoveAddressing(const TRemConAddress& aAddr);
+
+private: // Interface to router, from MAvrcpBearer
+	MIncomingCommandHandler* IncomingHandler(const TBTDevAddr& aAddr);
+	MOutgoingCommandHandler* OutgoingHandler(const TBTDevAddr& aAddr);
+	
+	void ConnectIndicate(const TBTDevAddr& aBTDevice);
+	void ConnectConfirm(const TBTDevAddr& aBTDevice, TInt aError);
+	void DisconnectIndicate(const TBTDevAddr& aBTDevice);
+	void DisconnectConfirm(const TBTDevAddr& aBTDevice, TInt aError);
+
+private: // interface to RemCon, from MRemConBulkBearerInterface
+	virtual TInt MrcbbiGetCommand(TUid& aInterfaceUid, 
+		TUint& aTransactionId, 
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr);
+
+	virtual TInt MrcbbiSendResponse(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint aTransactionId, 
+		RBuf8& aData, 
+		const TRemConAddress& aAddr);
+
+	virtual void MrcbbiSendReject(TUid aInterfaceUid, 
+			TUint aOperationId, 
+			TUint aTransactionId, 
+			const TRemConAddress& aAddr);
+	
+	virtual TInt MrcbbiStartBulk(MRemConBearerBulkObserver& aObserver);
+	virtual void MrcbbiStopBulk();
+	
+	virtual void MrcbbiBulkClientAvailable(const TRemConClientId& aId);
+	virtual void MrcbbiBulkClientNotAvailable(const TRemConClientId& aId);
+	
+private:
+	explicit CAvrcpBulkBearer(CAvrcpPlayerInfoManager& aPlayerInfoManager, RAvctp& aAvctp);
+	
+	// utility functions
+	TBool Operational() const;
+	void DoConnectIndicateL(const TBTDevAddr& aBTDevice);
+	void DoStartBulkL();
+	static TBool CompareBrowsingCommandHandlerByBDAddr(const TBTDevAddr* aKey, const CRcpBrowsingCommandHandler& aHandler);
+	void DoNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId);
+private: // unowned
+	MRemConBearerBulkObserver* iObserver;
+	CAvrcpPlayerInfoManager& iPlayerInfoManager;
+	RAvctp& iAvctp;
+	MIncomingCommandHandler* iInternalHandler; 
+	
+	TDblQue<CAvrcpCommand>	iReadyBrowseCommands;
+
+private: // owned 
+	CBulkRouter* iRouter;
+	RPointerArray<CRcpBrowsingCommandHandler> iBrowseHandlers;
+	
+	};
+
+#endif //BULKBEARER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/commandhandlerinterface.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,66 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef COMMANDHANDLERINTERFACE_H
+#define COMMANDHANDLERINTERFACE_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <avctpservices.h>
+
+class CAvrcpCommand;
+NONSHARABLE_CLASS(MAvrcpCommandHandler)
+	{
+public:
+	virtual void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult) = 0;
+	};
+
+NONSHARABLE_CLASS(MIncomingCommandHandler) : public MAvrcpCommandHandler
+	{
+public:
+	// lower interface 
+	virtual void MaxPacketSize(TInt aMtu) = 0;
+	virtual void ReceiveCommandL(const TDesC8& aMessageInformation, SymbianAvctp::TTransactionLabel aTransLabel, const TBTDevAddr& aAddr) = 0;
+	
+	// upper interface
+	virtual TInt SendRemConResponse(TUid aInterfaceUid, TUint aId, RBuf8& aData) = 0;
+	virtual void SendReject(TUid aInterfaceUid, TUint aTransactionId) = 0;
+	};
+
+NONSHARABLE_CLASS(MOutgoingCommandHandler) : public MAvrcpCommandHandler
+	{
+public:
+	// lower interface
+	virtual void ReceiveResponse(const TDesC8& aMessageInformation, SymbianAvctp::TTransactionLabel aTransLabel, TBool aIpidBitSet) = 0;
+	
+	// upper interface
+	virtual void SendCommandL(TUid aInterfaceUid, 
+		TUint aCommand, 
+		TUint aId,  
+		RBuf8& aCommandData, 
+		const TBTDevAddr& aAddr) = 0;
+	
+	virtual void SendNotifyCommandL(TUid aInterfaceUid, 
+		TUint aCommand, 
+		TUint aId,  
+		RBuf8& aCommandData, 
+		const TBTDevAddr& aAddr) = 0;
+	};
+
+#endif // COMMANDHANDLERINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/controlbearer.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,195 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef CONTROLBEARER_H
+#define CONTROLBEARER_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <avctpservices.h>
+#include <btsdp.h>
+#include <e32std.h>
+#include <remcon/clientid.h>
+#include <remcon/remconbearerinterface.h>
+#include <remcon/remconbearerplugin.h>
+#include <remcon/avrcpspec.h>
+#include <remcon/messagetype.h>
+#include <remcon/playertype.h>
+#include "avrcpbearerinterface.h"
+#include "remconcommandinterface.h"
+
+class CControlCommand;
+class CRcpRemoteDevice;
+class CControlRouter;
+class TBTDevAddr;
+class CBrowseCommand;
+class CAvrcpPlayerInfoManager;
+class CAvrcpBulkBearer;
+
+NONSHARABLE_CLASS(CRemConBearerAvrcp) : public CRemConBearerPlugin, public MRemConBearerInterfaceV3,
+	public MAvrcpBearer, public MRemConControlCommandInterface
+	{
+public:
+	static CRemConBearerAvrcp* NewL(TBearerParams& aParams);	
+	virtual ~CRemConBearerAvrcp();	
+		
+public:	// Interface to command handlers, from MRemConCommandInterface
+	void MrcciNewCommand(CAvrcpCommand& aCommand);
+	void MrcciNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId);
+	void MrccciNewNotifyCommand(CAvrcpCommand& aCommand);
+	void MrccciNewNotifyCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId);
+
+	void MrccciNewResponse(CAvrcpCommand& aCommand);
+	void MrccciNewNotifyResponse(CControlCommand& aCommand);
+	
+	TUint MrcciNewTransactionId();
+    void MrcciCommandExpired(TUint aTransactionId);
+    
+	void MrccciSetAddressedClient(const TRemConClientId& aClient);
+	void MrccciRegisterForLocalAddressedClientUpdates();
+	void MrccciUnregisterForLocalAddressedClientUpdates();
+
+private: // MRemConBearerInterfaceV3 functions called from RemCon
+	virtual TInt GetResponse(TUid& aInterfaceUid, 
+		TUint& aId, 
+		TUint& aOperationId, 
+		RBuf8& aCommandData, 
+		TRemConAddress& aAddr);
+			
+	virtual TInt SendCommand(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint aId,  
+		RBuf8& aData, 
+		const TRemConAddress& aAddr);
+		
+	virtual TInt GetCommand(TUid& aInterfaceUid, 
+		TUint& aId, 
+		TUint& aOperationId, 
+		RBuf8& aCommandData, 
+		TRemConAddress& aAddr);	
+	
+	virtual TInt GetNotifyCommand(TUid& aInterfaceUid, 
+		TUint& aId, 
+		TUint& aOperationId, 
+		RBuf8& aCommandData, 
+		TRemConAddress& aAddr);	
+			
+	virtual CAvrcpCommand* GetFirstCommand(TDblQue<CAvrcpCommand>& aQue,
+		TUid& aInterfaceUid, 
+		TUint& aId, 
+		TUint& aOperationId, 
+		RBuf8& aCommandData, 
+		TRemConAddress& aAddr);
+		
+	virtual TInt SendResponse(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint aId, 
+		RBuf8& aData, 
+		const TRemConAddress& aAddr);
+	
+	virtual void SendReject(TUid aInterfaceUid, 
+			TUint aOperationId, 
+			TUint aTransactionId, 
+			const TRemConAddress& aAddr); 
+	virtual void ConnectRequest(const TRemConAddress& aAddr);
+	virtual void DisconnectRequest(const TRemConAddress& aAddr);	
+	
+	virtual TSecurityPolicy SecurityPolicy() const;
+	void ClientStatus(TBool aControllerPresent, TBool aTargetPresent);	
+	virtual void ClientAvailable(TRemConClientId& aId, TPlayerType aClientType, TPlayerSubType aClientSubType, const TDesC8& aName);
+	virtual void ClientNotAvailable(TRemConClientId& aId);
+	virtual void ControllerFeaturesUpdated(RArray<TUid>& aSupportedInterfaces);
+	
+	virtual TInt SetLocalAddressedClient(TRemConClientId& aId);
+	
+	virtual void TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName);
+	
+private: // from CRemConBearerPlugin
+	TAny* GetInterface(TUid aUid);
+	
+private:	
+	// from MAvrcpBearer called from router
+	void ConnectIndicate(const TBTDevAddr& aBTDevice);
+	void ConnectConfirm(const TBTDevAddr& aBTDevice, TInt aError);
+	void DisconnectIndicate(const TBTDevAddr& aBTDevice);
+	void DisconnectConfirm(const TBTDevAddr& aBTDevice, TInt aError);
+	
+	MIncomingCommandHandler* IncomingHandler(const TBTDevAddr& aAddr);
+	MOutgoingCommandHandler* OutgoingHandler(const TBTDevAddr& aAddr);
+	
+private:
+	// MRemConBearerInterfaceV3 plugin functions called from RemCon
+	virtual TInt SendNotifyCommand(TUid aInterfaceUid, 
+			TUint aOperationId, 
+			TUint aId,  
+			RBuf8& aData, 
+			const TRemConAddress& aAddr);
+	
+	virtual TInt GetNotifyResponse(TUid& aInterfaceUid, 
+			TUint& aId, 
+			TUint& aOperationId, 
+			RBuf8& aCommandData, 
+			TRemConAddress& aAddr,
+			TRemConMessageSubType& aSubMessageType);
+
+private:
+	enum TAvrcpRecordType
+		{
+		EAvrcpRemoteControlRecord,
+		EAvrcpRemoteControlTargetRecord,
+		};
+
+private:
+	CRemConBearerAvrcp(TBearerParams& aParams);
+	void ConstructL();
+	
+	// utility functions
+	CRcpRemoteDevice* RemoteDevice(const TBTDevAddr& aAddr);
+	
+	void UpdateServiceRecordL(RSdpDatabase& aSdpDatabase,
+		TBool aController,
+		TBool aTarget);
+	void RegisterServiceRecordL(RSdpDatabase& aSdpDatabase,
+		TAvrcpRecordType aType);
+	
+	void HandleUndeliveredCommand(CAvrcpCommand& aCommand, const TRemConAddress& aAddr);
+	
+private:
+	TDblQue<CRcpRemoteDevice>	iRemotes;
+	TDblQue<CAvrcpCommand>		iReadyCommands;
+	TDblQue<CAvrcpCommand>		iReadyResponses;
+	TDblQue<CControlCommand>	iReadyNotifyResponses;
+	TDblQue<CAvrcpCommand>		iReadyNotifyCommands;
+	CControlRouter*				iRouter;
+	CDeltaTimer*				iTimer;
+	RSdp						iSdp;
+	TSdpServRecordHandle		iControllerSdpRecordHandle;
+	TSdpServRecordHandle		iTargetSdpRecordHandle;
+	TBool						iConstructionComplete;
+	CAvrcpPlayerInfoManager*	iPlayerInfoManager;
+	MIncomingCommandHandler*	iInternalHandler;
+	
+	CAvrcpBulkBearer*			iBulkBearer;
+	
+	RAvctp						iAvctp;
+	
+	TInt						iRemotesInterestedInLocalAddressedClient;
+	};
+
+#endif //CONTROLBEARER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/controlcommand.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,276 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef CONTROLCOMMAND_H
+#define CONTROLCOMMAND_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <avctpservices.h>
+#include <e32base.h>
+#include <remconcoreapi.h>
+#include <remcon/remconbearerplugin.h>
+#include <remcon/clientid.h>
+
+#include <avcframe.h>
+
+#include "avrcpcommand.h"
+#include "avrcptimer.h"
+#include "avrcpfragmenter.h"
+
+const TInt KRcpResponseTimeOut = 30000000;	// Allow remote 300ms to respond
+const TInt KRcpHoldThreshold = 300000;		// After 300ms we may assume an unreleased button 
+											// action is a press and hold
+const TInt KRcpIncomingButtonReleaseTimeout = 1700000; // 1.7s (ie 2s - 300ms), if a button press 
+											// has not been released after 2s we assume the release
+											// has been lost (and generate one internally)	
+const TInt KRcpOutgoingButtonReleaseTimeout = 1000000; // The remote expects a press refresh within
+											// 2s, it's fine to send one before that.
+
+const TUint KRemConStatusApiDefaultPageDataLength = 4;
+const TUint KRemConMetadataHeaderLength = 4;
+
+// Absolute lengths of Vendor Dependent PDU requests
+const TUint8 KLengthGetCapabilitiesPdu = 1;          // PDU 0x10
+const TUint8 KLengthListPASAttributesPdu = 0;        // PDU 0x11
+const TUint8 KLengthListPASValuesPdu = 1;            // PDU 0x12
+const TUint8 KLengthInformBatteryStatusOfCTPdu = 1;  // PDU 0x18
+const TUint8 KLengthGetPlayStatusPdu = 0;            // PDU 0x30
+const TUint8 KLengthRegisterNotification = 5;        // PDU 0x31
+const TUint8 KLengthSetAddressedPlayerPdu = 2;		 // PDU 0x60
+
+// Minimum lengths of Vendor Dependent PDU requests
+const TUint8 KMinLengthGetCurrentPASValuePdu = 2;    // PDU 0x13
+const TUint8 KMinLengthSetPASValuePdu = 1;           // PDU 0x14
+const TUint8 KMinLengthGetPASAttributeTextPdu = 2;   // PDU 0x15
+const TUint8 KMinLengthGetPASValueTextPdu = 3;       // PDU 0x16
+const TUint8 KMinLengthGetElementAttributesPdu = 9;  // PDU 0x20
+const TUint8 KMinLengthAddToNowPlayingPdu = 11;      // PDU 0x90
+
+// Other lengths
+const TUint8 KLengthPlaybackPosChangedParam = 4;     // Parameter length for this event (section 5.4.2)
+const TUint8 KVendorDependentNumberAttributes = 0;   // Index to Number of attributes (the first byte)
+const TUint8 KVendorDependentNumberAttribsPdu16 = 1; // Index to Number of attributes for PDU 0x16 (the second byte)
+const TUint8 KVendorDependentEventId = 0;            // Index to Event Id (the first byte)
+
+enum TMetadataTransferErrorCodes
+	{
+	EInvalidCommand		= 0x0,
+	EInvalidParameter	= 0x1,
+	EParameterNotFound	= 0x2,
+	EInternalError		= 0x3,
+	};
+
+enum TMetaDataTransferPacketType
+	{
+	EUnfragmented		= 0x0,
+	EFragmentStart		= 0x1,
+	EFragmentContinue	= 0x2,
+	EFragmentEnd		= 0x3,
+	};
+
+// Format of the first 3 bytes of a Vendor Dependent Request
+// See example packets in AVRCP Specification Appendix I (page 84)
+const TUint8 KVendorDependentRequestPDUId        = 0;
+const TUint8 KVendorDependentRequestReservedByte = 1;
+const TUint8 KVendorDependentRequestParamLenMSB  = 2;
+const TUint8 KVendorDependentRequestParamLenLSB  = 3;
+
+//See example packets in AVRCP Specification Appendix D (Volume Change Notification)
+const TUint8 KVendorDependentNotifyEventIdOffset = 4;
+
+// Format of the first 2 bytes of a Pass Through Request
+// See example packets in AVRCP Specification Appendix I (page 89)
+const TUint8 KPassThroughRequestOperationIdMSB  = 0;
+const TUint8 KPassThroughRequestOperationIdLSB  = 1;
+
+const TInt KSetAddressedPlayerPlayerIdOffset = 0;
+
+const TInt KCapabilityIdOffset = 0;
+
+const TInt KNumberEventsNotInPlayerInfoApi = 5;
+
+typedef TUint8 TMetadataTransferPDUID;
+typedef TUint8 TMetadataTransferNotifyEventID;
+
+class CRcpRemoteDevice;
+class CAVRCPFragmenter;
+class CRcpIncomingCommandHandler;
+class MRemConBearerObserver;
+class CAvrcpPlayerInfoManager;
+class CAvrcpPlayerInfoManager;
+NONSHARABLE_CLASS(CControlCommand) : public CAvrcpCommand
+	{
+public:
+	static CControlCommand* NewL(TUid aInterfaceUid,
+		TUint aCommand, 
+		TUint aRemConId, 
+		SymbianAvctp::TTransactionLabel aTransactionLabel, 
+		RBuf8& aCommandData, 
+		TBool aIsClick,
+		const TBTDevAddr& aAddr,
+		TBool aKnownToBearer);
+		
+	static CControlCommand* NewL(CAVCFrame* aFrame, 
+		TUint aRemConId,
+		SymbianAvctp::TTransactionLabel aTransLabel, 
+		const TBTDevAddr& aAddr,
+		const TRemConClientId& aClientId,
+		CAvrcpPlayerInfoManager* aPlayerInfoManager);
+	
+	SymbianAvctp::TMessageType MessageType() const;
+	const TDesC8& Data() const; 
+	
+	// Called from bearer
+	const TRemConClientId& ClientId() const;
+		
+	// Called from handlers
+	TInt ParseIncomingCommandL(MRemConBearerObserver& aObserver, CAVRCPFragmenter& aFragmenter);
+	void ProcessOutgoingCommandL(MRemConBearerObserver& aObserver);
+	TInt ParseIncomingResponse(MRemConBearerObserver& aObserver, const CAVCFrame& aFrame);
+	TInt ProcessOutgoingResponse(MRemConBearerObserver& aObserver, RBuf8& aCommandData, CAVRCPFragmenter& aFragmenter);
+	void SetResponseType(TInt aErr);
+	
+	TDeltaTimerEntry* TimerEntry();
+	TAvrcpTimerExpiryInfo* TimerExpiryInfo();
+	void CancelTimer(CDeltaTimer& aTimer);
+	
+	const CAVCFrame& Frame() const;
+	AVCPanel::TButtonAction ButtonAct() const;
+	TBool Click() const;
+	void SetClick(TBool aIsClick);
+	void ReSetCoreButtonActionL(TRemConCoreApiButtonAction aButtonAct, TBool aCommand);
+
+	void SetCoreButtonAction(TRemConCoreApiButtonAction aButtonAct, TBool aCommand);
+	TInt InsertCoreResult(TInt aResult);
+	TBool IsAvrcpPassthrough() const;
+	TBool IsPassthrough() const;
+	TInt SetSetAbsoluteVolumeResult(const CAVCFrame& aFrame);
+	TInt SetNotifyVolumeChangeResult(const CAVCFrame& aFrame);
+	TBool PlayerSpecificNotify() const;
+	TBool NormalCommand();
+	
+	CControlCommand* InterimResponseL();
+	
+private:
+	CControlCommand(TUid aInterfaceUid,
+		TUint aCommand,
+		TUint aRemConId, 
+		SymbianAvctp::TTransactionLabel aTransactionLabel, 
+		RBuf8& aCommandData, 
+		TBool aIsClick,
+		const TBTDevAddr& aAddr,
+		TBool aKnownToBearer);
+
+	CControlCommand(CAVCFrame* aFrame,
+		TUint aRemConId,
+		SymbianAvctp::TTransactionLabel aTransLabel, 
+		const TBTDevAddr& aAddr,
+		const TRemConClientId& aClientId,
+		CAvrcpPlayerInfoManager* aPlayerInfoManager);
+
+	void ConstructL();
+	~CControlCommand();
+	
+	TInt ParseIncomingKnownOpcodeL(MRemConBearerObserver& aObserver);
+	TInt ParseIncomingVendorCommandL(MRemConBearerObserver& aObserver, CAVRCPFragmenter& aFragmenter);
+
+	void ParseIncomingUnknownResponse(MRemConBearerObserver& aObserver, const CAVCFrame& aFrame);
+
+	TInt ParseInformBatteryStatusOfCT( TPtrC8& mtPayload);
+													 
+	TInt ParseContinuingResponse(TPtrC8& mtPayload,
+									CAVRCPFragmenter& aFragmenter);
+										
+	TInt ParseAbortContinuingResponse(TPtrC8& mtPayload,
+									CAVRCPFragmenter& aFragmenter);
+										
+	TInt ParseSetPlayerApplicationSettingValue(TPtrC8& mtPayload);
+	TInt ParseGetCapabilities(TPtrC8& aMtPayload);
+	TInt ParseGetPlayStatus(TPtrC8& aMtPayload);
+	TInt ParseListPlayerApplicationSettingAttributes(TPtrC8& aMtPayload);
+	TInt ParseListPlayerApplicationSettingValues(TPtrC8& aMtPayload);
+	TInt ParseGetCurrentPlayerApplicationSettingValue(TPtrC8& aMtPayload);
+	TInt ParseGetPlayerApplicationSettingAttributeText(TPtrC8& aMtPayload);
+	TInt ParseGetPlayerApplicationSettingValueText(TPtrC8& aMtPayload);
+	TInt ParseGetElementAttributes(TPtrC8& aMtPayload);
+	TInt ParseSetAddressedPlayer(TPtrC8& aMtPayload);
+	TInt ParsePlayItem(TPtrC8& aMtPayload);
+	TInt ParseAddToNowPlaying(TPtrC8& aMtPayload);
+	TInt ParseUidsChangedNotification(TPtrC8& aMtPayload);
+	TInt ParseInternalUidsChangedNotification(TPtrC8& aMtPayload);
+	TInt ParseVolumeChangedNotification(TPtrC8& aMtPayload);
+	TInt ParseSetAbsoluteVolume(TPtrC8& aMtPayload);
+	void DoParseSetAbsoluteVolumeL(const TPtrC8& aMtPayload, TDes8& aPayload);
+
+	TInt ParseMetadataTransferVendorCommand(CAVRCPFragmenter& aFragmenter);
+	TInt ParseVendorUniquePassthroughCommand(MRemConBearerObserver& aObserver);
+	TInt ParseMetadataTransferPassthroughCommand();
+	TInt GenerateMetadataResponsePayload(MRemConBearerObserver& aObserver, RBuf8& aFramePayload, const RBuf8& aResponseData);
+	TInt GenerateMetadataGetCapabilitiesResponsePayloadL(MRemConBearerObserver& aObserver, RBuf8& aFramePayload, const RBuf8& aResponseData);
+	void GenerateSetAbsoluteVolumeResponsePayloadL(RBuf8& aFramePayload, const TDesC8& responseData);
+	void DoGenerateNotifyVolumeChangeResponsePayloadL(RBuf8& aFramePayload, const TDesC8& responseData);
+	TInt GenerateNotificationResponsePayload(RBuf8& aFramePayload, const TDesC8& aResponseData);
+	void GenerateMetadataRejectPayloadL(TInt aError);
+	void SetVendorInfoL(TBool aIsPassthrough);
+
+	void DoProcessOutgoingResponseL(MRemConBearerObserver& aObserver, RBuf8& aCommandData,
+									CAVRCPFragmenter& aFragmenter);
+
+	TUint8 GetPDUIdFromIPCOperationId(TInt aOperationId);
+	TUint8 GetEventIdFromIPCOperationId(TInt aOperationId);
+
+	TInt RespondToInforms(TMetadataTransferPDUID aMetadataPDUID);
+	TInt AppendIncomingPayload(const TPtrC8& aPayload);
+	
+	static TInt AvrcpToRemConOperation(TUint aAvrcpOp, TUint& aRemConOp, TUid& aRemConIf);
+	static TInt RemConToAvrcpOperation(TUint aRemConOp, AVCPanel::TOperationId& aAvrcpOp);
+	
+	TUint16 Get16(const TPtrC8& aPtr);
+	
+	static TInt DummyCallback(TAny*);
+
+	void DoSetAbsoluteVolumeResultL(const CAVCFrame& aFrame);
+	void DoSetNotifyVolumeChangeResultL(const CAVCFrame& aFrame);
+	
+private:
+	TBool							iIsClick;
+	
+	TDeltaTimerEntry*				iTimerEntry;
+	TAvrcpTimerExpiryInfo*			iTimerExpiryInfo;
+	
+	CAVCFrame*						iFrame;
+	AVC::TAVCVendorId				iVendorId;
+	TPtrC8							iVendorPayloadData; // ptr to the vendor data in iFrame;
+	
+	TRemConClientId					iClientId;
+	};
+
+class MetadataTransferParser
+	{
+public:
+    static AVC::TAVCVendorId GetVID(const CAVCFrame& aFrame); // could be elsewhere really!
+	static TMetadataTransferPDUID GetPDUID(const TPtrC8& aData);
+	static TUint16 GetParamLength(const TPtrC8& aData);
+	static TUint16 GetPassThroughOperationId(const TPtrC8& aData);
+	static TMetadataTransferPDUID GetNotifyEventID(const TPtrC8& aData);
+	};
+
+	
+#endif // CONTROLCOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/internalcommand.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,43 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef INTERNALCOMMAND_H
+#define INTERNALCOMMAND_H
+
+#include "avrcpcommand.h"
+
+const SymbianAvctp::TTransactionLabel KDummyTransactionLabel = 0;
+
+NONSHARABLE_CLASS(CInternalCommand) : public CAvrcpCommand
+	{
+public:
+	static CInternalCommand* NewL(TUid aInterfaceUid, 
+			TUint aId, 
+			TUint aOperationId,
+			const TDesC8& aCommandData);
+	
+	void ResetL(TUint& aId, const TDesC8& aCommandData);
+	virtual SymbianAvctp::TMessageType MessageType() const;
+	virtual const TDesC8& Data() const;
+	
+private:
+	CInternalCommand(TUid aInterfaceUid, 
+			TUint aId, 
+			TUint aOperationId);
+	~CInternalCommand();
+	void ConstructL(const TDesC8& aCommandData);
+	};
+
+#endif //INTERNALCOMMAND_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/internalhelper.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,75 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef INTERNALHELPER_H
+#define INTERNALHELPER_H
+
+#include <e32base.h>
+#include "avrcpplayerinfomanager.h"
+
+class CControlCommand;
+class CRemConBearerAvrcp;
+class CRcpRouter;
+NONSHARABLE_CLASS(CInternalCommandHelper) : public CBase, public MPlayerChangeObserver
+	{
+public:
+	static CInternalCommandHelper* NewL(CRemConBearerAvrcp& aBearer, 
+			CRcpRouter& aRouter, TRemConClientId& aClientId, 
+			CAvrcpPlayerInfoManager& aPlayerInfoManager);
+	~CInternalCommandHelper();
+	
+	void Disconnect();
+	void HandleInternalCommand(CControlCommand& aCommand);
+	
+private:
+	CInternalCommandHelper(CRemConBearerAvrcp& aBearer, 
+			CRcpRouter& aRouter, TRemConClientId& aClientId,
+			CAvrcpPlayerInfoManager& aPlayerInfoManager);
+	void ConstructL();
+	
+	// From MPlayerChangeObserver
+	void MpcoAvailablePlayersChanged();
+	void MpcoAddressedPlayerChangedLocally(TRemConClientId aClientId);
+	void MpcoUidCounterChanged(TRemConClientId aClientId);
+	
+	void Respond(CControlCommand& aCommand, TInt aErr);
+	void HandledCommand(CControlCommand& aCommand);
+	
+	TInt HandleSetAddressedPlayer(TUint aId, RBuf8& aCommandData);
+	void DoHandleSetAddressedPlayerL(RBuf8& aCommandData);
+	void AddressedPlayerChangedL(TRemConClientId aClientId);
+
+	TInt HandleRegisterAvailablePlayersNotification(CControlCommand& aCommand);
+	void DoHandleRegisterAvailablePlayersNotificationL(RBuf8& aResponseData, CControlCommand& aCommand);
+
+	TInt HandleRegisterAddressedPlayerNotification(CControlCommand& aCommand);
+	void DoHandleRegisterAddressedPlayerNotificationL(RBuf8& aResponseData, CControlCommand& aCommand);
+
+	TInt HandleUidChangedNotification( CControlCommand& aCommand);
+	void DoHandleUidChangedNotificationL(RBuf8& aResponseData, TUint16 aUidCounter);
+
+	void SendResponse(TUint aId, RBuf8& aData);
+	
+private:
+	CRemConBearerAvrcp& iBearer;
+	CRcpRouter& iRouter;
+	TRemConClientId& iClientId; 
+	
+	CAvrcpPlayerInfoManager& iPlayerInfoManager;
+
+	TDblQue<CControlCommand> iInternalCommandQueue;
+	};
+
+#endif // INTERNALHELPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/passthroughhelper.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,60 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef PASSTHROUGHHELPER_H
+#define PASSTHROUGHHELPER_H
+
+#include <e32base.h>
+
+class CRcpRouter;
+class MRemConControlCommandInterface;
+class CControlCommand;
+NONSHARABLE_CLASS(CPassthroughHelper) : public CBase
+	{
+public:
+	static CPassthroughHelper* NewL(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer);
+	~CPassthroughHelper();
+	
+	void Disconnect();
+	
+	void HandlePassthrough(CControlCommand& aCommand); // FIXME for now
+private:
+	CPassthroughHelper(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer);
+	void ConstructL();
+	
+	void Respond(CControlCommand& aCommand, TInt aErr);
+	void HandledCommand(CControlCommand& aCommand);
+
+	void NewPress(CControlCommand& aCommand);
+	void BalanceHandledCommand(CControlCommand& aCommand);
+	
+	// Timer functions
+	void HoldExpiry(CControlCommand& aCommand);
+	void ReleaseExpiry(CControlCommand& aCommand);
+	void StartHoldTimer(CControlCommand& aCommand);
+	void StartReleaseTimer(CControlCommand& aCommand);
+	
+	// Delta timer callback functions
+	static TInt HoldExpiry(TAny* aExpiryInfo);
+	static TInt ReleaseExpiry(TAny* aExpiryInfo);
+
+private:
+	CRcpRouter& iRouter;
+	MRemConControlCommandInterface& iCommandInterface;
+	CDeltaTimer& iTimer;
+	CControlCommand* iPreviousPassthrough;
+	};
+
+#endif // PASSTHROUGHHELPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/playerbitmasks.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,196 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// TPlayerFeatureBitmask.h
+//
+
+#ifndef PLAYERBITMASKS_H_
+#define PLAYERBITMASKS_H_
+
+/**
+@file
+@internalComponent
+@released
+*/
+#include <e32base.h>
+
+const TInt KFeatureBitmaskLength = 16;
+
+enum TByteOffsets
+	{
+	ESelectByteOffset = 0,
+	EUpByteOffset = 0,
+	EDownByteOffset = 0,
+	ELeftByteOffset = 0,
+	ERightByteOffset = 0,
+	ERightUpByteOffset = 0,
+	ERightDownByteOffset = 0,
+	ELeftUpByteOffset = 0,
+	ELeftDownByteOffset = 1,
+	ERootMenuByteOffset = 1,
+	ESetupMenuByteOffset = 1,
+	EContentsMenuByteOffset = 1,
+	EFavoriteMenuByteOffset = 1,
+	EExitByteOffset = 1,
+	E0ByteOffset = 1,
+	E1ByteOffset = 1,
+	E2ByteOffset = 2,
+	E3ByteOffset = 2,
+	E4ByteOffset = 2,
+	E5ByteOffset = 2,
+	E6ByteOffset = 2,
+	E7ByteOffset = 2,
+	E8ByteOffset = 2,
+	E9ByteOffset = 2,
+	EDotByteOffset = 3,
+	EEnterByteOffset = 3,
+	EClearByteOffset = 3,
+	EChannelUpByteOffset = 3,
+	EChannelDownByteOffset = 3,
+	EPreviousChannelByteOffset = 3,
+	ESoundSelectByteOffset = 3,
+	EInputSelectByteOffset = 3,
+	EDisplayInformationByteOffset = 4,
+	EHelpByteOffset = 4,
+	EPageUpByteOffset = 4,
+	EPageDownByteOffset = 4,
+	EPowerByteOffset = 4,
+	EVolumeUpByteOffset = 4,
+	EVolumeDownByteOffset = 4,
+	EMuteByteOffset = 4,
+	EPlayByteOffset = 5,
+	EStopByteOffset = 5,
+	EPauseByteOffset = 5,
+	ERecordByteOffset = 5,
+	ERewindByteOffset = 5,
+	EFastForwardByteOffset = 5,
+	EEjectByteOffset = 5,
+	EForwardByteOffset = 5,
+	EBackwardByteOffset = 6,
+	EAngleByteOffset = 6,
+	ESubpictureByteOffset = 6,
+	EF1ByteOffset = 6,
+	EF2ByteOffset = 6,
+	EF3ByteOffset = 6,
+	EF4ByteOffset = 6,
+	EF5ByteOffset = 6,
+	EVendorUniqueByteOffset = 7,
+	EGroupNavigationByteOffset = 7,
+	EAdvancedControlPlayerByteOffset = 7,
+	EBrowsingByteOffset = 7,
+	ESearchByteOffset = 7,
+	EAddToNowPlayingByteOffset = 7,
+	EDatabaseAwareByteOffset = 7,
+	EBrowsableOnlyWhenAddressedByteOffset = 7,
+	ESearchableOnlyWhenAddressedByteOffset = 8,
+	ENowPlayingByteOffset = 8,
+	EUidPersistencyByteOffset = 8,
+	};
+
+enum TBitOffset
+	{
+	ESelectBitOffset = 0,
+	EUpBitOffset = 1,
+	EDownBitOffset = 2,
+	ELeftBitOffset = 3,
+	ERightBitOffset = 4,
+	ERightUpBitOffset = 5,
+	ERightDownBitOffset = 6,
+	ELeftUpBitOffset = 7,
+	ELeftDownBitOffset = 0,
+	ERootMenuBitOffset = 1,
+	ESetupMenuBitOffset = 2,
+	EContentsMenuBitOffset = 3,
+	EFavoriteMenuBitOffset = 4,
+	EExitBitOffset = 5,
+	E0BitOffset = 6,
+	E1BitOffset = 7,
+	E2BitOffset = 0,
+	E3BitOffset = 1,
+	E4BitOffset = 2,
+	E5BitOffset = 3,
+	E6BitOffset = 4,
+	E7BitOffset = 5,
+	E8BitOffset = 6,
+	E9BitOffset = 7,
+	EDotBitOffset = 0,
+	EEnterBitOffset = 1,
+	EClearBitOffset = 2,
+	EChannelUpBitOffset = 3,
+	EChannelDownBitOffset = 4,
+	EPreviousChannelBitOffset = 5,
+	ESoundSelectBitOffset = 6,
+	EInputSelectBitOffset = 7,
+	EDisplayInformationBitOffset = 0,
+	EHelpBitOffset = 1,
+	EPageUpBitOffset = 2,
+	EPageDownBitOffset = 3,
+	EPowerBitOffset = 4,
+	EVolumeUpBitOffset = 5,
+	EVolumeDownBitOffset = 6,
+	EMuteBitOffset = 7,
+	EPlayBitOffset = 0,
+	EStopBitOffset = 1,
+	EPauseBitOffset = 2,
+	ERecordBitOffset = 3,
+	ERewindBitOffset = 4,
+	EFastForwardBitOffset = 5,
+	EEjectBitOffset = 6,
+	EForwardBitOffset = 7,
+	EBackwardBitOffset = 0,
+	EAngleBitOffset = 1,
+	ESubpictureBitOffset = 2,
+	EF1BitOffset = 3,
+	EF2BitOffset = 4,
+	EF3BitOffset = 5,
+	EF4BitOffset = 6,
+	EF5BitOffset = 7,
+	EVendorUniqueBitOffset = 0,
+	EGroupNavigationBitOffset = 1,
+	EAdvancedControlPlayerBitOffset = 2,
+	EBrowsingBitOffset = 3,
+	ESearchBitOffset = 4,
+	EAddToNowPlayingBitOffset = 5,
+	EDatabaseAwareBitOffset = 6,
+	EBrowsableOnlyWhenAddressedBitOffset = 7,
+	ESearchableOnlyWhenAddressedBitOffset = 0,
+	ENowPlayingBitOffset = 1,
+	EUidPersistencyBitOffset = 2,
+	};
+
+class TPlayerFeatureBitmask
+	{
+public:
+	TPlayerFeatureBitmask();
+	TPlayerFeatureBitmask(const TPlayerFeatureBitmask& aFeatureBitmask);
+	
+	inline const TDesC8& FeatureBitmask() const;
+
+	void SetCoreApiFeatures(const RArray<TUint>& aOperation);
+	void SetAbsoluteVolumeApiFeatures(const RArray<TUint>& aOperation);
+	void SetGroupNavigationApiFeatures(const RArray<TUint>& aOperation);
+	void SetNowPlayingApiFeatures(const RArray<TUint>& aOperation);
+	void SetMediaBrowseApiFeatures(const RArray<TUint>& aOperation);
+
+private:
+	void SetCoreApiFeatures();
+
+private:
+	TBuf8<KFeatureBitmaskLength> iFeatureBitmask;
+	};
+
+const TDesC8& TPlayerFeatureBitmask::FeatureBitmask() const
+	{
+	return iFeatureBitmask;
+	}
+#endif /*PLAYERBITMASKS_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/playerstatewatcher.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,121 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef PLAYERSTATEWATCHER_H
+#define PLAYERSTATEWATCHER_H
+
+#include <e32base.h>
+#include <e32hashtab.h>
+#include <remcon/clientid.h>
+#include <playerinformationtargetobserver.h>
+#include "commandhandlerinterface.h"
+
+class MRemConCommandInterface;
+class CInternalCommand;
+class CAvrcpCommand;
+NONSHARABLE_CLASS(CPlayerWatcherBase) : public CBase, public MIncomingCommandHandler
+	{
+public:
+	virtual void StartWatchingPlayerL(TRemConClientId aClientId) = 0;
+	void StopWatchingPlayer(TRemConClientId aClientId);
+	
+protected:
+	virtual void ReceiveUpdate(CInternalCommand& aCommand, TRemConClientId aClientId, RBuf8& aData) = 0;
+	virtual void ReceiveReject(TRemConClientId aClientId) = 0;
+
+private: // from MIncomingCommandHandler
+
+	// lower interface 
+	void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult);
+	void MaxPacketSize(TInt aMtu);
+	void ReceiveCommandL(const TDesC8& aMessageInformation, SymbianAvctp::TTransactionLabel aTransLabel, const TBTDevAddr& aAddr);
+	
+	// upper interface
+	TInt SendRemConResponse(TUid aInterfaceUid, TUint aTransactionId, RBuf8& aData) ;
+	void SendReject(TUid aInterfaceUid, TUint aTransactionId);
+	void Disconnect();
+	
+protected:
+	CPlayerWatcherBase(MRemConCommandInterface& aCommandInterface);
+	~CPlayerWatcherBase();
+	
+private:
+	CInternalCommand& FindCommand(TUid aInterfaceUid, TUint aTransactionId, 
+			TRemConClientId& aFoundClientId);
+
+	
+protected:
+	MRemConCommandInterface& iCommandInterface;
+	RHashMap<TRemConClientId, CInternalCommand*> iCommands;
+	};
+
+NONSHARABLE_CLASS(MPlayStatusObserver)
+	{
+public:
+	virtual void MpsoPlayStatusChanged(TRemConClientId aId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus) = 0;
+	virtual void MpsoError(TRemConClientId aId) = 0;
+	};
+
+NONSHARABLE_CLASS(CPlayStatusWatcher) : public CPlayerWatcherBase
+	{
+public:
+	static CPlayStatusWatcher* NewL(MPlayStatusObserver& aObserver,
+			MRemConCommandInterface& aCommandInterface);
+	~CPlayStatusWatcher();
+
+	void StartWatchingPlayerL(TRemConClientId aClientId);
+	
+private:
+	CPlayStatusWatcher(MPlayStatusObserver& aObserver,
+			MRemConCommandInterface& aCommandInterface);
+	
+	void SendPlayStatusUpdateRequest(CInternalCommand& aCommand, TRemConClientId& aClientId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus);
+	void ReceiveUpdate(CInternalCommand& aCommand, TRemConClientId aClientId, RBuf8& aData);
+	void ReceiveReject(TRemConClientId aClientId);
+
+private:
+	MPlayStatusObserver& iObserver;
+	};
+
+
+NONSHARABLE_CLASS(MUidObserver)
+	{
+public:
+	virtual void MuoUidChanged(TRemConClientId aId, TUint16 aUidCounter) = 0;
+	virtual void MuoError(TRemConClientId aId) = 0;
+	};
+
+NONSHARABLE_CLASS(CUidWatcher) : public CPlayerWatcherBase
+	{
+public:
+	static CUidWatcher* NewL(MUidObserver& aObserver,
+			MRemConCommandInterface& aCommandInterface);
+	~CUidWatcher();
+	
+	void StartWatchingPlayerL(TRemConClientId aClientId);
+
+private:
+	CUidWatcher(MUidObserver& aObserver,
+			MRemConCommandInterface& aCommandInterface);
+	
+	void SendUidUpdateRequest(CInternalCommand& aCommand, TRemConClientId& aClientId, TUint16 aUidCounter);
+	void ReceiveUpdate(CInternalCommand& aCommand, TRemConClientId aClientId, RBuf8& aData);
+	void ReceiveReject(TRemConClientId aClientId);
+
+private:
+	MUidObserver& iObserver;
+	};
+
+#endif //PLAYERSTATEWATCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/inc/remconcommandinterface.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,58 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef REMCONCOMMANDINTERFACE_H
+#define REMCONCOMMANDINTERFACE_H
+
+#include <e32base.h>
+#include <remcon/clientid.h>
+
+class CControlCommand;
+class CAvrcpCommand;
+class TBTDevAddr;
+class TRemConAddress;
+
+NONSHARABLE_CLASS(MRemConCommandInterface)
+	{
+public:
+	virtual void MrcciNewCommand(CAvrcpCommand& aCommand) = 0;
+	virtual void MrcciNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId) = 0;
+
+	virtual TUint MrcciNewTransactionId() = 0;
+	virtual void MrcciCommandExpired(TUint aTransactionId) = 0;
+	};
+
+NONSHARABLE_CLASS(MRemConBulkCommandInterface) : public MRemConCommandInterface
+	{
+public:
+	virtual TInt MrcbciSetAddressedClient(const TRemConAddress& aAddr, const TRemConClientId& aClient) = 0;
+	virtual void MrcbciRemoveAddressing(const TRemConAddress& aAddr) = 0;
+	};
+
+NONSHARABLE_CLASS(MRemConControlCommandInterface) : public MRemConCommandInterface
+	{
+public:
+	virtual void MrccciNewNotifyCommand(CAvrcpCommand& aCommand) = 0;
+	virtual void MrccciNewNotifyCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId) = 0;
+
+	virtual void MrccciNewResponse(CAvrcpCommand& aCommand) = 0;
+	virtual void MrccciNewNotifyResponse(CControlCommand& aCommand) = 0;
+	
+	virtual void MrccciSetAddressedClient(const TRemConClientId& aClient) = 0;
+	virtual void MrccciRegisterForLocalAddressedClientUpdates() = 0;
+	virtual void MrccciUnregisterForLocalAddressedClientUpdates() = 0;
+	};
+
+#endif //REMCONCOMMANDINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/public/remconbeareravrcp.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef REMCONBEARERAVRCP_H
+#define REMCONBEARERAVRCP_H
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+#include <e32base.h>
+
+const TInt KRemConBearerAvrcpImplementationUid = 0x1020685f;
+
+#endif // REMCONBEARERAVRCP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/1020685e.rss	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x1020685E;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x10204546;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x1020685F;
+					version_no = 1;
+					display_name = "RCP";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpMetadataTransfer.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,1087 @@
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @prototype
+*/
+
+#include <avcframe.h>
+#include <e32base.h>
+#include <remcon/remconbearerobserver.h>
+#include <remcon/remconconverterplugin.h>
+#include <remcon/messagetype.h>
+#include <remcon/avrcpspec.h>
+#include <remconbeareravrcp.h>
+
+#include <remconbatterytargetobserver.h>
+#include <absolutevolumeapi.h>
+#include <absolutevolumeutils.h>
+
+#include "avrcp.h"
+#include "controlcommand.h"
+#include "avrcpcommandframer.h"
+#include "avrcpinternalinterface.h"
+#include "avrcpipc.h"
+#include "avrcplog.h"
+#include "avrcputils.h"
+#include "avrcpincomingcommandhandler.h"
+#include "mediabrowse.h"
+#include "mediainformation.h"
+#include "nowplaying.h"
+#include "playerinformation.h"
+#include "remconbattery.h"
+#include "remcongroupnavigation.h"
+
+TInt CControlCommand::ParseMetadataTransferPassthroughCommand()
+	{
+	// company id and frame type should already be set before here
+	__ASSERT_DEBUG(iFrame->Type() == AVC::EControl,  AvrcpUtils::Panic(EAvrcpCTypeNotSet));
+	__ASSERT_DEBUG(iVendorId == KBluetoothSIGVendorId,  AvrcpUtils::Panic(EAvrcpCompanyIDNotSet));
+
+	TInt ret = KErrNotSupported;
+	TUint16 operation = MetadataTransferParser::GetPassThroughOperationId(iVendorPayloadData);
+	if (operation == ENextGroup)
+		{
+		iOperationId = ENextGroup;
+		iInterfaceUid = TUid::Uid(KRemConGroupNavigationApiUid);
+		ret = KErrNone;
+		}
+	else if (operation == EPreviousGroup)
+		{
+		iOperationId = EPreviousGroup;
+		iInterfaceUid = TUid::Uid(KRemConGroupNavigationApiUid);
+		ret = KErrNone;
+		}
+	return ret;
+	}
+
+/* Before calling this method, the following MUST be set:
+ *  - Vendor Payload data
+ *  - Opcode       == Vendor Dependent
+ *  - Subunit Type == Panel
+ *  - Subunit Id   == 0
+ */
+ 
+TInt CControlCommand::ParseMetadataTransferVendorCommand(CAVRCPFragmenter& aFragmenter)
+	{
+	__ASSERT_DEBUG(iFrame->Opcode() == AVC::EVendorDependent, AvrcpUtils::Panic(EAvrcpNotFullyConstructed));
+	__ASSERT_DEBUG(iFrame->SubunitType() == AVC::EPanel,      AvrcpUtils::Panic(EAvrcpNotFullyConstructed));
+	__ASSERT_DEBUG(iFrame->SubunitID() == 0,                  AvrcpUtils::Panic(EAvrcpNotFullyConstructed));
+	
+	TInt ret = KErrNotSupported;
+	iInterfaceUid = TUid::Uid(0);
+	
+	TMetadataTransferPDUID metadataPDUID = MetadataTransferParser::GetPDUID(iVendorPayloadData);
+	
+	TPtrC8 mtPayload(iVendorPayloadData.Mid(KRemConMetadataHeaderLength));
+	
+	TUint paramLength = MetadataTransferParser::GetParamLength(iVendorPayloadData);
+	
+	if (mtPayload.Length() != paramLength)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+		
+	// If we're in a fragmented state, and we receive an un-expected
+	// PDU (i.e. not CONTINUE or ABORT) then throw away the fragment
+	// and just process the request. The specification (section 5.5.1)
+	// isn't entirely clear as to what should happen, but Sian reckons
+	// this is probably the most polite thing to do (be liberal, etc)
+	if (aFragmenter.InFragmentedState())
+		{
+		if (   metadataPDUID != ERequestContinuingResponse
+			&& metadataPDUID != EAbortContinuingResponse)
+			{
+			aFragmenter.Reset();
+			}
+		}
+		
+	switch (iFrame->Type())
+		{
+		case AVC::EControl:
+			{
+			switch (metadataPDUID)	
+				{
+				case ERequestContinuingResponse:
+					ret = ParseContinuingResponse(mtPayload, aFragmenter);
+					break;
+				case EAbortContinuingResponse:
+					ret = ParseAbortContinuingResponse(mtPayload, aFragmenter);
+					break;
+				case ESetPlayerApplicationSettingValue:
+					ret = ParseSetPlayerApplicationSettingValue(mtPayload);
+					break;
+					
+				case EInformBatteryStatusOfCT:
+					ret = ParseInformBatteryStatusOfCT(mtPayload);
+					break;
+					
+				case EInformDisplayableCharacterSet:
+					ret = KErrNotSupported;
+					break;
+				case ESetAddressedPlayer:
+					ret = ParseSetAddressedPlayer(mtPayload);
+					break;
+				case EPlayItem:
+					ret = ParsePlayItem(mtPayload);
+					break;
+				case EAddToNowPlaying:
+					ret = ParseAddToNowPlaying(mtPayload);
+					break;
+					
+				case ESetAbsoluteVolume:
+				    ret =ParseSetAbsoluteVolume(mtPayload);
+				    break;
+				default:
+					// not allowed PDUID for Control
+					ret = KErrAvrcpMetadataInvalidCommand;
+				}
+			break;
+			}
+		case AVC::EStatus:
+			{
+			switch (metadataPDUID)	
+				{
+				case EGetCapabilities:
+					ret = ParseGetCapabilities( mtPayload );
+					break;
+					
+				case EGetPlayStatus:
+					ret = ParseGetPlayStatus( mtPayload );
+					break;
+					
+				case EListPlayerApplicationSettingAttributes:
+					ret = ParseListPlayerApplicationSettingAttributes( mtPayload );
+					break;
+					
+				case EListPlayerApplicationSettingValues:
+					ret = ParseListPlayerApplicationSettingValues( mtPayload );
+					break;
+					
+				case EGetCurrentPlayerApplicationSettingValue:
+					ret = ParseGetCurrentPlayerApplicationSettingValue( mtPayload );
+					break;
+
+				case EGetPlayerApplicationSettingAttributeText:
+					ret = ParseGetPlayerApplicationSettingAttributeText( mtPayload );
+					break;
+
+				case EGetPlayerApplicationSettingValueText:
+					ret = ParseGetPlayerApplicationSettingValueText( mtPayload );
+					break;
+					
+				case EGetElementAttributes:
+					ret = ParseGetElementAttributes(mtPayload );
+					break;
+					
+				case ESetAddressedPlayer:
+					ret = ParseSetAddressedPlayer(mtPayload );
+					break;
+				
+				case EPlayItem:
+					ret = ParsePlayItem(mtPayload );
+					break;
+					
+				case EAddToNowPlaying:
+					ret = ParseAddToNowPlaying(mtPayload );
+					break;
+				default:
+					// not allowed PDUID for Status
+					ret = KErrAvrcpMetadataInvalidCommand;
+				}
+				
+			break;
+			}
+		case AVC::ENotify:
+			{
+			if (metadataPDUID==ERegisterNotification)
+				{
+				if (mtPayload.Length() != KLengthRegisterNotification)
+					{
+					ret = KErrAvrcpMetadataInvalidCommand;
+					}
+				else
+					{
+					ret = KErrNone;
+					TRegisterNotificationEvent eventId = static_cast<TRegisterNotificationEvent>(mtPayload[KVendorDependentEventId]);
+					switch (eventId)
+						{
+						case ERegisterNotificationPlaybackStatusChanged:
+						case ERegisterNotificationTrackChanged:
+						case ERegisterNotificationTrackReachedEnd:
+						case ERegisterNotificationTrackReachedStart:
+						case ERegisterNotificationBatteryStatusChanged:
+						case ERegisterNotificationPlayerApplicationSettingChanged:
+							{
+							iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid);
+							iOperationId = RAvrcpIPC::SetIPCOperationIdFromEventId(eventId);
+							break;
+							}
+						// Note: ERegisterNotificationPlaybackPosChanged takes a 4 byte parameter
+						case ERegisterNotificationPlaybackPosChanged:
+							{
+							iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid);
+							iOperationId = RAvrcpIPC::SetIPCOperationIdFromEventId(eventId);
+							iCommandData.Close();
+							ret = iCommandData.Create(KLengthPlaybackPosChangedParam);
+							if (ret == KErrNone)
+								{
+								iCommandData.Append(mtPayload.Right(KLengthPlaybackPosChangedParam));
+								}
+							else
+								{
+								ret = KErrAvrcpMetadataInternalError;
+								}
+							break;
+							}
+							
+						// Note ERegisterNotificationSystemStatusChanged is not supported
+						case ERegisterNotificationSystemStatusChanged_NotSupported:
+							{
+							ret = KErrNotSupported;
+							break;
+							}
+							
+						case ERegisterNotificationNowPlayingContentChanged:
+							{
+							iInterfaceUid = TUid::Uid(KRemConNowPlayingApiUid);
+							iOperationId = RAvrcpIPC::SetIPCOperationIdFromEventId(eventId);
+							break;
+							}
+						case ERegisterNotificationAvailablePlayersChanged:
+						case ERegisterNotificationAddressedPlayerChanged:
+						case ERegisterNotificationUidsChanged:
+							{
+							iInterfaceUid = TUid::Uid(KUidAvrcpInternalInterface);
+							iOperationId = RAvrcpIPC::SetIPCOperationIdFromEventId(eventId);
+							ret = KErrAvrcpInternalCommand;
+							break;
+							}
+						case ERegisterNotificationVolumeChanged	:
+							{
+							ret = ParseVolumeChangedNotification(mtPayload);
+							break;
+							}
+						default:
+							{
+							ret = KErrAvrcpMetadataInvalidParameter;
+							}
+						}
+					}
+				}
+			else
+				{
+				ret = KErrAvrcpMetadataInvalidCommand;
+				}
+			break;
+			}
+		case AVC::EReserved1:
+		case AVC::EReserved2:
+		case AVC::EReserved3:
+		case AVC::EReserved4:
+			{
+			ret = KErrAvrcpInvalidCType;
+			break;
+			}
+		default:
+			ret = KErrAvrcpMetadataInvalidCommand;
+		}
+
+	return ret;
+	}
+
+/** Allocate correct space and append the payload to iCommandData
+ */
+TInt CControlCommand::AppendIncomingPayload(const TPtrC8& aPayload)
+	{
+	iCommandData.Close();
+	if (iCommandData.Create(aPayload.Length()) != KErrNone)
+		{
+		return KErrAvrcpMetadataInternalError;
+		}
+	iCommandData.Append(aPayload);
+	return KErrNone;
+	}
+
+/** Decode a InformBatteryStatusOfCT PDU ID: 0x18 and call the BatteryStatus API 
+ */
+TInt CControlCommand::ParseInformBatteryStatusOfCT(TPtrC8& aMtPayload)
+												 
+	{
+	if (aMtPayload.Length() != KLengthInformBatteryStatusOfCTPdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	
+	TUint8 batteryStatus = aMtPayload[0];
+	if (batteryStatus > EFullCharge)
+		{
+		return KErrAvrcpMetadataInvalidParameter;
+		}
+	
+	if (AppendIncomingPayload(aMtPayload) != KErrNone)
+		{
+		return KErrAvrcpMetadataInvalidParameter;
+		}
+	
+	iOperationId = EInformBatteryStatusOfCT;
+	iInterfaceUid = TUid::Uid(KRemConBatteryApiUid);
+		
+	TInt ret = RespondToInforms(EInformBatteryStatusOfCT);
+	if (ret != KErrNone)
+		{
+		return ret;
+		}
+	
+	return KErrAvrcpHandledInternallyInformRemCon;
+	}
+
+
+/** Decode PDU ID 0x40 - fragmentation support
+ */
+TInt CControlCommand::ParseContinuingResponse(TPtrC8& aMtPayload,
+										  CAVRCPFragmenter& aFragmenter)
+	{
+	// Check if in fragmentation state, return error if not
+	if (! aFragmenter.InFragmentedState())
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	
+	// Check if the parameter matches the fragmented response
+	TMetadataTransferPDUID pduId = MetadataTransferParser::GetPDUID(aMtPayload);
+	if (pduId != aFragmenter.GetPDU())
+		{
+		return KErrAvrcpMetadataInvalidParameter;
+		}
+	
+	RBuf8 respPayload;
+	CAVCFrame* frame = NULL;
+	TRAPD(err, frame = CAVCVendorDependentResponse::NewL(KBluetoothSIGVendorId));
+	err = respPayload.Create(KAVCMaxVendorDependentPayload); //longest resp
+	if (err == KErrNone)
+		{
+		respPayload.Append(aFragmenter.GetNextFragmentHeader());
+		respPayload.Append(aFragmenter.GetNextFragment());
+		frame->SetType(AVC::EStable);
+		frame->Append(respPayload);
+		delete iFrame;
+		iFrame = frame;
+		respPayload.Close();
+		}
+	else
+		return KErrAvrcpMetadataInternalError;
+	
+	return KErrAvrcpHandledInternallyRespondNow;
+	}
+
+
+/** Decode PDU ID 0x41 - fragmentation support
+ */
+TInt CControlCommand::ParseAbortContinuingResponse(TPtrC8& aMtPayload,
+												CAVRCPFragmenter& aFragmenter)
+	{
+	// Check if in fragmentation state, return error if not
+	if (! aFragmenter.InFragmentedState())
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	
+	// Check if the parameter matches the fragmented response
+	TMetadataTransferPDUID pduId = MetadataTransferParser::GetPDUID(aMtPayload);
+	if (pduId != aFragmenter.GetPDU())
+		{
+		return KErrAvrcpMetadataInvalidParameter;
+		}
+	
+	aFragmenter.Reset();
+	
+	CAVCFrame* frame = NULL;
+	TRAPD(err, frame = CAVCVendorDependentResponse::NewL(KBluetoothSIGVendorId));
+	if (err == KErrNone)
+		{
+		frame->Append(EAbortContinuingResponse);
+		frame->Append(EUnfragmented);
+		// the package length is 0
+		frame->Append( 0 );
+		frame->Append( 0 );
+		frame->SetType(AVC::EStable);
+		delete iFrame;
+		iFrame = frame;
+		}
+	else
+		{
+		return KErrAvrcpMetadataInternalError;
+		}
+	
+	return KErrAvrcpHandledInternallyRespondNow;
+	}
+
+
+/** Decode a SetPlayerApplicationSettingValue PDU ID: 0x14 and call the PlayerInformation API 
+ */
+TInt CControlCommand::ParseSetPlayerApplicationSettingValue(TPtrC8& aMtPayload)
+	{
+	if (aMtPayload.Length() < KMinLengthSetPASValuePdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+		
+	// get the number of attributes contained 
+	TUint8 numAttributes = aMtPayload[KVendorDependentNumberAttributes];
+	
+	// Each attribute is 16 bits long
+	if (sizeof(numAttributes) + numAttributes*sizeof(TUint16) != aMtPayload.Length())
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	
+	iOperationId = ESetPlayerApplicationSettingValue;
+	iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid);
+	return AppendIncomingPayload(aMtPayload);
+	}
+
+/** Decode a GetCapabilities PDU ID: 0x10 and call the PlayerInformation API 
+ */
+TInt CControlCommand::ParseGetCapabilities(TPtrC8& aMtPayload)
+	{
+	// check enough data available
+	if (aMtPayload.Length() != KLengthGetCapabilitiesPdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	
+	// pass one byte of data to Player Information API 
+	iOperationId = EGetCapabilities;
+	iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid);
+	return AppendIncomingPayload(aMtPayload);
+	}
+
+/** Decode a GetPlayStatus PDU ID: 0x30 and call the PlayerInformation API 
+ */
+TInt CControlCommand::ParseGetPlayStatus(TPtrC8& aMtPayload)
+	{
+	// no payload in this command
+	if (aMtPayload.Length()!=KLengthGetPlayStatusPdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	
+	iOperationId = EGetPlayStatus;
+	iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid);
+	return KErrNone;
+	}
+
+/** Decode a ListPlayerApplicationSettingAttributes PDU ID: 0x11 and call the PlayerInformation API 
+ */
+TInt CControlCommand::ParseListPlayerApplicationSettingAttributes(TPtrC8& aMtPayload)
+	{
+	// check length, there should be no parameters
+	if (aMtPayload.Length()!=KLengthListPASAttributesPdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+
+	iOperationId = EListPlayerApplicationSettingAttributes;
+	iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid);
+	return KErrNone;
+	}
+
+/** Decode a ListPlayerApplicationSettingValues PDU ID: 0x12 and call the PlayerInformation API 
+ */
+TInt CControlCommand::ParseListPlayerApplicationSettingValues(TPtrC8& aMtPayload)
+	{
+	// check length, there should be 1 byte of data
+	if (aMtPayload.Length() != KLengthListPASValuesPdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+		
+	iOperationId = EListPlayerApplicationSettingValues;
+	iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid);
+	return AppendIncomingPayload(aMtPayload);
+	}
+
+/** Decode a GetCurrentPlayerApplicationSettingValue PDU ID: 0x13 and call the PlayerInformation API 
+ */
+TInt CControlCommand::ParseGetCurrentPlayerApplicationSettingValue(TPtrC8& aMtPayload)
+	{
+	// check the length
+	if (aMtPayload.Length() < KMinLengthGetCurrentPASValuePdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+		
+	TUint8 numAttributes = aMtPayload[KVendorDependentNumberAttributes];
+	if (sizeof(numAttributes) + numAttributes != aMtPayload.Length())
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	
+	iOperationId = EGetCurrentPlayerApplicationSettingValue;
+	iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid);
+	return AppendIncomingPayload(aMtPayload);
+	}
+
+/** Decode a GetPlayerApplicationSettingAttributeText PDU ID: 0x15 and call the PlayerInformation API 
+ */
+TInt CControlCommand::ParseGetPlayerApplicationSettingAttributeText(TPtrC8& aMtPayload)
+	{
+	if (aMtPayload.Length() < KMinLengthGetPASAttributeTextPdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	// get the number of attributes contained 
+	TUint8 numAttributes = aMtPayload[KVendorDependentNumberAttributes];
+	if (sizeof(numAttributes) + numAttributes != aMtPayload.Length())
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	
+	iOperationId = EGetPlayerApplicationSettingAttributeText;
+	iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid);
+	return AppendIncomingPayload(aMtPayload);
+	}
+
+/** Decode a GetPlayerApplicationSettingValueText PDU ID: 0x16 and call the PlayerInformation API 
+ */
+TInt CControlCommand::ParseGetPlayerApplicationSettingValueText(TPtrC8& aMtPayload)
+	{
+	if (aMtPayload.Length() < KMinLengthGetPASValueTextPdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	
+	// get number of values; preceded by attributeId (1byte) and numValues (1byte)
+	TUint8 numValues = aMtPayload[KVendorDependentNumberAttribsPdu16];
+	if (sizeof(TUint8) + sizeof(numValues) + numValues != aMtPayload.Length())
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	
+	iOperationId = EGetPlayerApplicationSettingValueText;
+	iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid);
+	return AppendIncomingPayload(aMtPayload);
+	}
+	
+/** Decode a GetElementAttributes PDU ID: 0x20 and call the PlayerInformation API 
+ */
+TInt CControlCommand::ParseGetElementAttributes(TPtrC8& aMtPayload)
+	{
+	LOG_FUNC
+	
+	if (aMtPayload.Length() < KMinLengthGetElementAttributesPdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+		
+	iOperationId = EGetElementAttributes;
+	iInterfaceUid = TUid::Uid(KRemConMediaInformationApiUid);
+	return AppendIncomingPayload(aMtPayload);
+	}
+
+TInt CControlCommand::ParseSetAddressedPlayer(TPtrC8& aMtPayload)
+	{
+	LOG_FUNC
+	
+	if (aMtPayload.Length() < KLengthSetAddressedPlayerPdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+
+	iOperationId = EAvrcpInternalSetAddressedPlayer;
+	iInterfaceUid = TUid::Uid(KUidAvrcpInternalInterface);
+	TInt err = AppendIncomingPayload(aMtPayload);
+
+	return err == KErrNone ? KErrAvrcpInternalCommand : err;
+	}
+
+TInt CControlCommand::ParsePlayItem(TPtrC8& aMtPayload)
+	{
+	LOG_FUNC
+	
+	if (aMtPayload.Length() < KMinLengthAddToNowPlayingPdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+		
+	iOperationId = EPlayItem;
+	iInterfaceUid = TUid::Uid(KRemConNowPlayingApiUid);
+	return AppendIncomingPayload(aMtPayload);
+	}
+
+TInt CControlCommand::ParseAddToNowPlaying(TPtrC8& aMtPayload)
+	{
+	LOG_FUNC
+	
+	if (aMtPayload.Length() < KMinLengthAddToNowPlayingPdu)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+		
+	iOperationId = EAddToNowPlaying;
+	iInterfaceUid = TUid::Uid(KRemConNowPlayingApiUid);
+	return AppendIncomingPayload(aMtPayload);
+	}
+
+TInt CControlCommand::ParseUidsChangedNotification(TPtrC8& /*aMtPayload*/)
+	{
+	LOG_FUNC
+	iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid);
+	iOperationId = RAvrcpIPC::SetIPCOperationIdFromEventId(ERegisterNotificationUidsChanged);
+	
+	return KErrAvrcpHandledInternallyRespondNow;	
+	}
+
+TInt CControlCommand::ParseVolumeChangedNotification(TPtrC8& /*aMtPayload*/)
+	{
+	LOG_FUNC
+	iInterfaceUid = TUid::Uid(KRemConAbsoluteVolumeTargetApiUid);
+	iOperationId = KRemConAbsoluteVolumeNotification;
+	
+	return KErrNone;
+	}
+
+TInt CControlCommand::GenerateMetadataResponsePayload(MRemConBearerObserver& aObserver, RBuf8& aFramePayload, const RBuf8& aResponseData)
+	{
+	TInt err = KErrNone;
+	
+	// If it's a very large response; this requires re-allocating the buffer
+	if (aResponseData.Length() > KAVCFrameMaxLength)
+		{
+		aFramePayload.Close();
+		if (aFramePayload.Create(aResponseData.Length()) != KErrNone)
+			return KErrAvrcpMetadataInternalError;
+		}
+	
+	// Obtain the PDU from the combined PDU + (possible) notification eventId
+	TMetadataTransferPDU pduId = RAvrcpIPC::GetPDUIdFromIPCOperationId(iOperationId);
+	aFramePayload.Zero();
+	aFramePayload.Append(pduId);
+	aFramePayload.Append(EUnfragmented);
+
+	//Check whether it is absolute volume response.
+	TBool absoluteVolumeResponse = EFalse;
+	if (pduId == ESetAbsoluteVolume)
+		{
+		absoluteVolumeResponse = ETrue;
+		}
+	else if (pduId == ERegisterNotification)
+		{
+		TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(iOperationId);
+		if (eventId == ERegisterNotificationVolumeChanged)
+			{
+			absoluteVolumeResponse = ETrue;
+			}
+		}
+	
+	TPtr8 responseData(NULL, 0);
+	if (absoluteVolumeResponse)
+		{
+		responseData.Set(aResponseData.RightTPtr(aResponseData.Length()));
+		}
+	else
+		{
+		// Read 4 byte Big-Endian error code before the payload
+		RAvrcpIPCError response;
+		TRAP(err, response.ReadL(aResponseData));
+		
+		// If we couldn't parse the response via IPC, send an internal error
+		if (err != KErrNone)
+			{
+			return KErrAvrcpMetadataInternalError;
+			}
+		
+		// If an error occurred, return it (now that we've filled in the PDU id)
+		if (response.iError != KErrNone)
+			{
+			return response.iError;
+			}
+		
+		// Pass the rest of the response (minus error code) to be parsed
+		responseData.Set(aResponseData.RightTPtr(aResponseData.Length() - KLengthErrorResponse));
+		}
+	
+	switch (pduId)
+		{
+		case ESetPlayerApplicationSettingValue:
+			{
+			// the package length is 0
+			aFramePayload.Append( 0 );
+			aFramePayload.Append( 0 );
+			break;
+			}
+		
+		case EGetCapabilities:
+			{
+			TRAP(err,GenerateMetadataGetCapabilitiesResponsePayloadL(aObserver, aFramePayload, aResponseData));
+			if(err != KErrNone)
+				{
+				return KErrAvrcpMetadataInternalError;
+				}
+			break;
+			}
+		case EListPlayerApplicationSettingAttributes:
+		case EListPlayerApplicationSettingValues:
+		case EGetCurrentPlayerApplicationSettingValue:
+		case EGetPlayerApplicationSettingAttributeText:
+		case EGetPlayerApplicationSettingValueText:
+		case EGetElementAttributes:
+		case EGetPlayStatus:
+		case EPlayItem:
+		case EAddToNowPlaying:
+		case ESetAddressedPlayer:
+			{
+			// the package length is the response length
+			TInt packageLength = responseData.Length();
+			aFramePayload.Append(packageLength>>8);
+			aFramePayload.Append(packageLength);
+			aFramePayload.Append(responseData);
+			break;
+			}
+		case ESetAbsoluteVolume:
+			{			
+			TRAPD(err, GenerateSetAbsoluteVolumeResponsePayloadL(aFramePayload,responseData));
+			if (err != KErrNone)
+				{
+				return KErrAvrcpMetadataInternalError;
+				}
+		    break;
+			}
+		case ERegisterNotification:
+			{		
+			GenerateNotificationResponsePayload(aFramePayload, responseData);
+			break;
+			}		
+		default:
+			{
+			return KErrNotSupported;
+			}
+		}
+
+	// Success. Error conditions have been handled previously
+	return KErrNone;
+	}
+
+void CControlCommand::GenerateSetAbsoluteVolumeResponsePayloadL(
+		RBuf8& aFramePayload, 
+		const TDesC8& responseData)
+	{
+	RRemConAbsoluteVolumeResponse response;
+	CleanupClosePushL(response);
+	
+	response.ReadL(responseData);
+	if (response.iError != KErrNone)
+	    {
+	    User::Leave(response.iError);
+	    }
+	TUint8 absVol = KAvrcpMaxAbsoluteVolume * response.iVolume / response.iMaxVolume;	
+	TUint16 len = KLengthSetAbsoluteVolumeResponseParamter<<8 & 0xffff;
+	TPckgBuf<TUint16> parameterLength(len);
+	aFramePayload.Append(parameterLength);
+	aFramePayload.Append( absVol );
+	
+	CleanupStack::PopAndDestroy(&response);
+	}
+
+void CControlCommand::DoGenerateNotifyVolumeChangeResponsePayloadL(
+		RBuf8& aFramePayload, 
+		const TDesC8& responseData)
+	{
+	RRemConAbsoluteVolumeResponse response;
+	CleanupClosePushL(response);
+	
+	response.ReadL(responseData);
+	if (response.iError != KErrNone)
+	    {
+	    User::Leave(response.iError);
+	    }
+	TUint8 absVol = KAvrcpMaxAbsoluteVolume * response.iVolume / response.iMaxVolume;
+	TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(iOperationId);
+	TUint16 len = KLengthNotifyVolumeChangeResponseParameter<<8 & 0xffff;
+	TPckgBuf<TUint16> parameterLength(len);
+	aFramePayload.Append( parameterLength );
+	aFramePayload.Append( eventId );
+	aFramePayload.Append( absVol );
+	
+	CleanupStack::PopAndDestroy(&response);
+	}
+
+TInt CControlCommand::GenerateNotificationResponsePayload(RBuf8& aFramePayload, const TDesC8& responseData)
+	{
+	TInt err = KErrNone;
+	
+	TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(iOperationId);
+	switch(eventId)
+		{
+	case ERegisterNotificationVolumeChanged:
+		{
+		TRAPD(err, DoGenerateNotifyVolumeChangeResponsePayloadL(aFramePayload, responseData));
+		if (err != KErrNone)
+			{
+			return KErrAvrcpMetadataInternalError;
+			}
+		break;
+		}
+	case ERegisterNotificationPlaybackStatusChanged:
+	case ERegisterNotificationTrackChanged:
+	case ERegisterNotificationTrackReachedEnd:
+	case ERegisterNotificationTrackReachedStart:
+	case ERegisterNotificationPlaybackPosChanged:
+	case ERegisterNotificationBatteryStatusChanged:
+	case ERegisterNotificationPlayerApplicationSettingChanged:
+	case ERegisterNotificationNowPlayingContentChanged:
+	case ERegisterNotificationAvailablePlayersChanged:
+	case ERegisterNotificationAddressedPlayerChanged:
+	case ERegisterNotificationUidsChanged:
+		{
+		TUint paramLength = responseData.Length() + 1;
+		aFramePayload.Append( paramLength >>8 );
+		aFramePayload.Append( paramLength );
+		aFramePayload.Append( eventId );
+		aFramePayload.Append( responseData );
+		break;
+		}
+	default:
+		{
+		err = KErrNotSupported;
+		break;
+		}
+		};
+
+	return err;
+	}
+
+TInt CControlCommand::GenerateMetadataGetCapabilitiesResponsePayloadL(MRemConBearerObserver& /* aObserver */, RBuf8& aFramePayload, const RBuf8& aResponseData)
+	{
+	LOG_FUNC
+	__ASSERT_DEBUG(iPlayerInfoManager, AVRCP_PANIC(EAvrcpNotFullyConstructed));
+	TPtr8 responseData = aResponseData.RightTPtr(aResponseData.Length() - KLengthErrorResponse);
+
+	if(responseData[KCapabilityIdOffset] == ECapabilityIdEventsSupported)
+		{
+		// Add supported events not handled in the player info API.
+		RBuf8 eventsBuf;
+		eventsBuf.CreateL(KNumberEventsNotInPlayerInfoApi);
+		CleanupClosePushL(eventsBuf);
+		TInt count = 0;
+		
+		// If a specific player (i.e. a specific client ID)  has been indicated then
+		// we add support for the event if supported by the specific player.
+		// If no specific player has been indicated (i.e. an invalid client ID), then
+		// general support for the event is added if supported by any player.
+		// The player info manager APIs handles these different "support" semantics.
+		
+		if(iPlayerInfoManager->AbsoluteVolumeSupportedL(ClientId()))
+			{
+			count++;
+			eventsBuf.Append(ERegisterNotificationVolumeChanged );
+			}
+		
+		if(iPlayerInfoManager->BrowsingSupportedL(ClientId()))
+			{
+			count += 2;
+			eventsBuf.Append(ERegisterNotificationNowPlayingContentChanged );
+			eventsBuf.Append(ERegisterNotificationUidsChanged );
+			}
+		
+		// If there are any browsing clients then mark support for the player addressing
+		// events.  Without browsing support the remote will not be able to see the 
+		// information about the players so it is better not to let them see events
+		// relating to the them
+		if(iPlayerInfoManager->BrowsingSupportedL(KNullClientId))
+			{
+			count+= 2;
+			eventsBuf.Append(ERegisterNotificationAvailablePlayersChanged );
+			eventsBuf.Append(ERegisterNotificationAddressedPlayerChanged );
+			}
+		
+		responseData[1] += count;
+
+		TInt packageLength = responseData.Length()+ count;
+		aFramePayload.Append(packageLength>>8);
+		aFramePayload.Append(packageLength);
+		aFramePayload.Append(responseData);
+		aFramePayload.Append(eventsBuf);
+		
+		CleanupStack::PopAndDestroy(&eventsBuf);
+		}
+	else
+		{
+		TInt packageLength = responseData.Length();
+		aFramePayload.Append(packageLength>>8);
+		aFramePayload.Append(packageLength);
+		aFramePayload.Append(responseData);
+		}
+	return KErrNone;
+	}
+TMetadataTransferPDUID MetadataTransferParser::GetNotifyEventID(const TPtrC8& aData)
+	{
+	return static_cast<TMetadataTransferNotifyEventID>(aData[KVendorDependentNotifyEventIdOffset]);
+	}
+	
+TMetadataTransferPDUID MetadataTransferParser::GetPDUID(const TPtrC8& aData)
+	{
+	return static_cast<TMetadataTransferPDUID>(aData[KVendorDependentRequestPDUId]);
+	}
+
+TUint16 MetadataTransferParser::GetParamLength(const TPtrC8& aData)
+	{
+	TUint16 paramLength;
+	paramLength  = aData[KVendorDependentRequestParamLenMSB] << 8;
+	paramLength += aData[KVendorDependentRequestParamLenLSB];
+	return paramLength;
+	}
+
+TUint16 MetadataTransferParser::GetPassThroughOperationId(const TPtrC8& aData)
+	{
+	TUint16 operation;
+	operation  = aData[KPassThroughRequestOperationIdMSB] << 8;
+	operation += aData[KPassThroughRequestOperationIdLSB];
+	return operation;
+	}
+
+	
+TInt CControlCommand::RespondToInforms(TMetadataTransferPDUID aMetadataPDUID)
+	{
+	CAVCFrame* frame = NULL;
+	TRAPD(err, frame = CAVCVendorDependentResponse::NewL(KBluetoothSIGVendorId));
+		
+	RBuf8 respPayload;
+	err = respPayload.Create(KAVRCPMinVendorDependentResponseLen);
+	if (err == KErrNone)
+		{
+		respPayload.Append(aMetadataPDUID);
+		respPayload.Append(EUnfragmented);   // No fragmentation needed
+		respPayload.Append(0);	// no params
+		respPayload.Append(0);	// no params
+	
+		frame->SetType(AVC::EAccepted);
+		frame->Append(respPayload);
+		
+		delete iFrame;
+		iFrame = frame;
+		respPayload.Close();
+		}
+	else
+		{
+		err = KErrAvrcpMetadataInternalError;
+		}
+	return err;	
+	}
+
+void CControlCommand::GenerateMetadataRejectPayloadL(TInt aError)
+	{
+	CAVCFrame* frame = CAVCVendorDependentResponse::NewL(KBluetoothSIGVendorId);
+	frame->SetType(AVC::ERejected);
+
+	frame->Append(iFrame->Data()[6]); // PDU ID
+	frame->Append(EUnfragmented);
+	
+	// Param length - 2 bytes
+	frame->Append(0x0);
+	frame->Append(0x1);
+
+	TUint8 avcError = 0;
+	switch (aError)
+		{
+		case KErrAvrcpMetadataInvalidCommand:
+			{
+			avcError = EInvalidCommand;
+			break;
+			}
+		case KErrAvrcpMetadataInvalidParameter:
+			{
+			avcError = EInvalidParameter;
+			break;
+			}
+		case KErrAvrcpMetadataParameterNotFound:
+			{
+			avcError = EParameterNotFound;
+			break;
+			}
+		case KErrAvrcpMetadataInternalError:
+			{
+			avcError = EInternalError;
+			break;
+			}
+		case KErrAvrcpAirInvalidCommand:
+		case KErrAvrcpAirInvalidParameter:
+		case KErrAvrcpAirParameterNotFound:
+		case KErrAvrcpAirInternalError:
+		case KErrAvrcpAirSuccess:
+		case KErrAvrcpAirUidChanged:
+		case KErrAvrcpAirReserved:
+		case KErrAvrcpAirInvalidDirection:
+		case KErrAvrcpAirNotADirectory:
+		case KErrAvrcpAirDoesNotExist:
+		case KErrAvrcpAirInvalidScope:
+		case KErrAvrcpAirRangeOutOfBounds:
+		case KErrAvrcpAirUidIsADirectory:
+		case KErrAvrcpAirMediaInUse:
+		case KErrAvrcpAirNowPlayingListFull:
+		case KErrAvrcpAirSearchNotSupported:
+		case KErrAvrcpAirSearchInProgress:
+		case KErrAvrcpAirInvalidPlayerId:
+		case KErrAvrcpAirPlayerNotBrowesable:
+		case KErrAvrcpAirPlayerNotAddressed:
+		case KErrAvrcpAirNoValidSearchResults:
+		case KErrAvrcpAirNoAvailablePlayers:
+		case KErrAvrcpAirAddressedPlayerChanged:
+			{
+			avcError = KErrAvrcpAirBase - aError;
+			break;
+			}
+		}
+	frame->Append(avcError);
+	delete iFrame;
+	iFrame = frame;
+	}
+
+/** Decode a SetAbsoluteVolume PDU ID: 0x50 and SetAbsoluteTarget call the  API 
+ */
+TInt CControlCommand::ParseSetAbsoluteVolume(TPtrC8& aMtPayload)
+	{
+	if (aMtPayload.Length() != KLengthSetAbsoluteVolumeRequestParameter)
+		{
+		return KErrAvrcpMetadataInvalidCommand;
+		}
+	
+	iOperationId = KRemConSetAbsoluteVolume;
+	iInterfaceUid = TUid::Uid(KRemConAbsoluteVolumeTargetApiUid);
+	
+	TBuf8<KAbsoluteVolumeRequestDataSize> payload;
+	TRAPD(err, DoParseSetAbsoluteVolumeL(aMtPayload, payload));
+	if (err != KErrNone)
+		{
+		return KErrAvrcpMetadataInternalError;
+		}
+	
+	return AppendIncomingPayload(payload);
+	}
+
+void CControlCommand::DoParseSetAbsoluteVolumeL(const TPtrC8& aMtPayload, TDes8& aPayload)
+	{
+	RRemConAbsoluteVolumeRequest request;
+	CleanupClosePushL(request);
+	request.iVolume = KAbsoluteVolumeMask & aMtPayload[KLengthSetAbsoluteVolumeRequestParameter - 1];
+	request.iMaxVolume = KAvrcpMaxAbsoluteVolume;
+	request.WriteL(aPayload);
+	CleanupStack::PopAndDestroy(&request);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpadvancedcontrol.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,161 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <remconaddress.h>
+#include <remcon/avrcpspec.h>
+#include "avrcpinternalinterface.h"
+#include "avrcplog.h"
+#include "avrcputils.h"
+#include "browsecommand.h"
+#include "browsingframe.h"
+#include "mediabrowse.h"
+#include "nowplaying.h"
+
+TInt CBrowseCommand::HandleSetBrowsedPlayer()
+	{
+	LOG_FUNC	
+	
+	TPtrC8 payload;
+	AvrcpBrowsing::BrowsingFrame::Payload(iFrame, payload);
+	if (payload.Length() < KMinLengthSetBrowsedPlayerPdu)
+		{
+		return KErrAvrcpAirInvalidCommand;
+		}
+
+	iOperationId = ESetBrowsedPlayerOperationId;
+	iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid);
+	
+	RRemConSetBrowsedPlayerRequest request;
+	request.iPlayerId = static_cast<TUint16>(payload[0]) << 8;
+	request.iPlayerId |= payload[1];
+	request.iMaxResponse = iMaxResponse;
+	TBuf8<KMediaBrowseOutBufMaxLength> buf;
+	// Only reason for WriteL to leave is insufficently large buffer
+	TRAP_IGNORE(request.WriteL(buf));
+	TInt err = AppendIncomingPayload(buf);
+	return (err == KErrNone) ? KErrAvrcpFurtherProcessingRequired : err;
+	}
+
+TInt CBrowseCommand::HandleGetFolderItems()
+	{
+	LOG_FUNC	
+
+	TPtrC8 payload;
+	AvrcpBrowsing::BrowsingFrame::Payload(iFrame, payload);
+	if (payload.Length() < KMinLengthGetFolderItemsPdu)
+		{
+		return KErrAvrcpAirInvalidCommand;
+		}
+	
+	TInt err = KErrAvrcpInvalidScope;
+	switch(iFrame[3])
+		{
+	case AvrcpBrowsing::KMediaPlayerScope:
+		{
+		iOperationId = EAvrcpInternalGetFolderItems;
+		iInterfaceUid = TUid::Uid(KUidAvrcpInternalInterface);
+		err = (AppendIncomingPayload(payload) == KErrNone) ? KErrAvrcpInternalCommand : err;
+		break;
+		}
+	case AvrcpBrowsing::KVirtualFilesystemScope:
+	case AvrcpBrowsing::KSearchScope:
+	case AvrcpBrowsing::KNowPlayingScope:
+		{
+		iOperationId = EGetFolderItemsOperationId;
+		iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid);
+		err = AppendIncomingPayload(payload);
+		break;
+		}
+		};
+	
+	return err;
+	}
+
+TInt CBrowseCommand::HandleChangePath()
+	{
+	LOG_FUNC	
+	
+	TPtrC8 payload;
+	AvrcpBrowsing::BrowsingFrame::Payload(iFrame, payload);
+	if (payload.Length() < KMinLengthChangePathPdu)
+		{
+		return KErrAvrcpAirInvalidCommand;
+		}
+		
+	iOperationId = EChangePathOperationId;
+	iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid);
+	return AppendIncomingPayload(payload);
+	}
+
+TInt CBrowseCommand::HandleGetItemAttributes()
+	{
+	LOG_FUNC	
+	
+	TPtrC8 payload;
+	AvrcpBrowsing::BrowsingFrame::Payload(iFrame, payload);
+	if (payload.Length() < KMinLengthGetItemAttributesPdu)
+		{
+		return KErrAvrcpAirInvalidCommand;
+		}
+	
+	iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid);
+	iOperationId = EGetItemAttributesOperationId;
+	return AppendIncomingPayload(payload);
+	}
+
+TInt CBrowseCommand::HandleSearch()
+	{
+	LOG_FUNC	
+	
+	TPtrC8 payload;
+	AvrcpBrowsing::BrowsingFrame::Payload(iFrame, payload);
+	if (payload.Length() < KMinLengthSearchPdu)
+		{
+		return KErrAvrcpAirInvalidCommand;
+		}
+		
+	iOperationId = ESearchOperationId;
+	iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid);
+	return AppendIncomingPayload(payload);
+	}
+
+/** Allocate correct space and append the payload to iCommandData
+ */
+TInt CBrowseCommand::AppendIncomingPayload(const TPtrC8& aPayload)
+	{
+	iCommandData.Close();
+	if (iCommandData.Create(aPayload.Length()) != KErrNone)
+		{
+		return KErrAvrcpAirInternalError;
+		}
+
+	iCommandData.Append(aPayload);
+
+	return KErrNone;
+	}
+
+TInt CBrowseCommand::HandleUnknownPdu()
+	{
+	iFrame.Close();
+	TInt err = iFrame.CreateMax(KMinLengthGeneralReject);
+	if(!err)
+		{
+		iFrame[0] = AvrcpBrowsing::EGeneralReject;
+		iFrame[1] = (KMinLengthGeneralReject - AvrcpBrowsing::KHeaderLength) >> 8;
+		iFrame[2] = (KMinLengthGeneralReject - AvrcpBrowsing::KHeaderLength);
+		iFrame[3] = KErrAvrcpAirInvalidCommand - KErrAvrcpAirBase;
+		}
+	return err ? err : KErrAvrcpHandledInternallyRespondNow;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpbrowsingcommandhandler.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,489 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// avrcpincomingcommandhandler.cpp
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+#include <e32base.h>
+#include <remcon/remconbearerbulkobserver.h>
+#include <remconaddress.h>
+
+#include "browsecommand.h"
+#include "avrcpbrowsingcommandhandler.h"
+#include "avrcpinternalinterface.h"
+#include "avrcplog.h"
+#include "avrcprouter.h"
+#include "avrcputils.h"
+#include "browsingframe.h"
+#include "bulkbearer.h"
+#include "mediabrowse.h"
+#include "remconcommandinterface.h"
+
+//------------------------------------------------------------------------------------
+// Construction/Destruction
+//------------------------------------------------------------------------------------
+
+/** Factory function.
+
+@param aCommandInterface	The interface for providing commands that have been handled.
+@param aRouter	A CRcpRouter to use for communication with remote devices.
+@param aPlayerInfoManager	The central manager for player information.
+@param aAddr	The Bluetooth device address for the remote device handled by this handler.
+@return A fully constructed CRcpBrowsingCommandHandler.
+@leave System wide error codes.
+*/
+CRcpBrowsingCommandHandler* CRcpBrowsingCommandHandler::NewL(MRemConBulkCommandInterface& aCommandInterface,
+	CBulkRouter& aRouter,
+	CAvrcpPlayerInfoManager& aPlayerInfoManager,
+	const TBTDevAddr& aAddr)
+	{
+	LOG_STATIC_FUNC
+	CRcpBrowsingCommandHandler* handler = new(ELeave) CRcpBrowsingCommandHandler(aCommandInterface, aRouter, aPlayerInfoManager, aAddr);
+	return handler;
+	}
+
+/**
+@param aCommandInterface	The interface for providing commands that have been handled.
+@param aRouter	A CRcpRouter to use for communication with remote devices.
+@param aPlayerInfoManager	The central manager for player information.
+@param aAddr	The Bluetooth device address for the remote device handled by this handler.
+@return A partially constructed CRcpBrowsingCommandHandler.
+*/	
+CRcpBrowsingCommandHandler::CRcpBrowsingCommandHandler(MRemConBulkCommandInterface& aCommandInterface,
+	CBulkRouter& aRouter,
+	CAvrcpPlayerInfoManager& aPlayerInfoManager,
+	const TBTDevAddr& aAddr) 
+	: iCommandQueue(_FOFF(CBrowseCommand, iHandlingLink))
+	, iInternalCommandQueue(_FOFF(CBrowseCommand, iHandlingLink))
+	, iCommandInterface(aCommandInterface)
+	, iRouter(aRouter)
+	, iMtu(335) // initialise to min for browse channel
+	, iPlayerInfoManager(aPlayerInfoManager)
+	, iAddr(aAddr)
+	{
+	LOG_FUNC
+	}
+	
+CRcpBrowsingCommandHandler::~CRcpBrowsingCommandHandler()
+	{
+	LOG_FUNC
+
+	while (!iCommandQueue.IsEmpty())
+		{
+		CBrowseCommand *command = iCommandQueue.First();
+		HandledCommand(*command);
+		}
+	
+	TRemConAddress remConAddr;
+	AvrcpUtils::BTToRemConAddr(iAddr, remConAddr);
+	iCommandInterface.MrcbciRemoveAddressing(remConAddr);
+	}
+
+//---------------------------------------------------------------------
+// Called from the bearer
+//---------------------------------------------------------------------
+
+/** Tell the handler to gracefully shutdown.
+
+*/
+void CRcpBrowsingCommandHandler::Disconnect()
+	{
+	LOG_FUNC
+	
+	while (!iCommandQueue.IsEmpty())
+		{
+		CBrowseCommand* command = iCommandQueue.First();
+		iRouter.RemoveFromSendQueue(*command);
+		
+		HandledCommand(*command);
+		}
+	}
+
+//------------------------------------------------------------------------------------
+// Called by router
+//------------------------------------------------------------------------------------
+
+/** Receive an incoming AVRCP browse command.
+
+@param aMessageInformation	The command data from the AVCTP message.
+@param aTransactionLabel	AVCTP transaction label for this command.
+@param aAddr	The bluetooth device from which this command originated.
+@leave System Wide Error code
+*/
+void CRcpBrowsingCommandHandler::ReceiveCommandL(const TDesC8& aMessageInformation, 
+	SymbianAvctp::TTransactionLabel aTransactionLabel, 
+	const TBTDevAddr& aAddr)
+	{
+	LOG_FUNC
+	
+	// If there's nothing beyond a header this is bobs.  Dump it now.
+	AvrcpBrowsing::BrowsingFrame::VerifyFrameL(aMessageInformation);
+	
+	TUint id = iCommandInterface.MrcciNewTransactionId();
+	CBrowseCommand* command = CBrowseCommand::NewL(aMessageInformation, id, aTransactionLabel, aAddr, &iPlayerInfoManager);
+	CleanupStack::PushL(command);
+	
+	TInt result = command->ProcessIncomingCommandL(iMtu);
+	CleanupStack::Pop(command);
+
+	command->IncrementUsers();
+	
+	switch(result)
+		{
+	case KErrAvrcpFurtherProcessingRequired: 
+		{
+		// The only command that we need to check out before sending on is
+		// SetBrowsedPlayer.  Although it's been parsed to verify that it's 
+		// a syntactically valid command we need to ensure that the selected
+		// player is available before sending it on.
+
+		__ASSERT_DEBUG(command->RemConInterfaceUid() == TUid::Uid(KRemConMediaBrowseApiUid) && command->RemConOperationId() == ESetBrowsedPlayerOperationId, AVRCP_PANIC(EFurtherProcessingRequiredForNonSetBrowsedPlayer));
+		TBool valid = HandleSetBrowsedPlayer(*command);
+		
+		if(!valid)
+			{
+			Respond(*command, result);
+			command->DecrementUsers();
+			break;
+			}
+		else
+			{
+			result = KErrNone;
+			}
+		// valid case fallsthrough to be handled as normal
+		}
+	case KErrAvrcpHandledInternallyInformRemCon:  // this case falls through
+	case KErrNone:
+		{
+		iCommandQueue.AddLast(*command);
+		iCommandInterface.MrcciNewCommand(*command);
+		
+		if (result == KErrNone)
+			{
+			break;
+			}
+		// KErrAvrcpHandledInternallyInformRemCon fallsthrough here
+		}
+	case KErrAvrcpHandledInternallyRespondNow:
+		{
+		// If the command has already set payload, just sent the command
+		iRouter.AddToSendQueue(*command);
+		command->DecrementUsers();
+		break;
+		}
+	case KErrAvrcpInternalCommand:
+		{
+		iInternalCommandQueue.AddLast(*command);
+		HandleInternalCommand(*command);
+		break;
+		}
+	default:
+		{
+		Respond(*command, result);
+		command->DecrementUsers();
+		break;
+		}
+		};
+	}
+
+/** Called from the router to indicate send completion.
+
+@param aCommand The command that has been sent.
+@param aSendResult KErrNone if the command was sent successfully.  System wide
+				   error code otherwise.
+*/
+void CRcpBrowsingCommandHandler::MessageSent(CAvrcpCommand& /*aCommand*/, TInt /*aSendResult*/)
+	{
+	LOG_FUNC
+	// We try and send the response, but if we fail there's not a lot we can do about
+	// it.  Just let the remote assume the response.
+	}
+
+void CRcpBrowsingCommandHandler::MaxPacketSize(TInt aMtu)
+	{
+	iMtu = aMtu-AvrcpBrowsing::KHeaderLength;
+	}
+
+//------------------------------------------------------------------------------------
+// Called by bearer
+//------------------------------------------------------------------------------------
+
+/** Send a response.
+
+@param aInterfaceUid The RemCon interface this response is from.
+@param aId The RemCon transaction label of the command to respond to.
+@param aData The command response data.
+@return KErrNotFound if the command was not found on the queue.
+		System wide error codes.
+*/
+TInt CRcpBrowsingCommandHandler::SendRemConResponse(TUid /*aInterfaceUid*/, TUint aId, RBuf8& aData)
+	{
+	LOG_FUNC
+
+	return SendResponse(iCommandQueue, aId, aData);
+	}
+
+//------------------------------------------------------------------------------------
+// Internal command handling functions
+//------------------------------------------------------------------------------------
+
+
+/** Sends a response to the remote device.
+
+@param aCommand The command to respond to.
+@param aErr The result of handling the command.
+*/
+void CRcpBrowsingCommandHandler::Respond(CBrowseCommand& aCommand, TInt aErr)
+	{
+	LOG_FUNC
+	aCommand.SetResult(aErr);
+	iRouter.AddToSendQueue(aCommand);
+	}
+
+/** To be called on completion of command handling.
+
+This aggregates the handler's tidying up of a finished
+command.
+
+@param aCommand The command to tidy up.
+*/	
+void CRcpBrowsingCommandHandler::HandledCommand(CBrowseCommand& aCommand)
+	{
+	LOG_FUNC
+
+	aCommand.iHandlingLink.Deque();
+	aCommand.DecrementUsers();
+	}
+
+void CRcpBrowsingCommandHandler::HandleInternalCommand(CBrowseCommand& aCommand)
+	{
+	LOG_FUNC
+
+	TUid interfaceUid;
+	TUint id;
+	TUint operationId;
+	RBuf8 commandData;
+	TBTDevAddr addr;
+	
+	aCommand.GetCommandInfo(interfaceUid, id, operationId, commandData, addr);
+	
+	__ASSERT_DEBUG(interfaceUid == TUid::Uid(KUidAvrcpInternalInterface), AvrcpUtils::Panic(EAvrcpInternalHandlingRequestedOnWrongInterface));
+	
+	TInt err = KErrNone;
+	switch(operationId)
+		{
+	case EAvrcpInternalGetFolderItems:
+		{
+		err = HandleGetFolderItems(id, commandData);
+		break;
+		}
+		};
+	
+	if(err)
+		{
+		HandledCommand(aCommand);
+		}
+	
+	commandData.Close();
+	}
+
+TInt CRcpBrowsingCommandHandler::HandleGetFolderItems(TUint aId, RBuf8& aCommandData)
+	{
+	LOG_FUNC
+
+	RBuf8 responseBuf;
+	TRAPD(err, DoHandleGetFolderItemsL(aCommandData, responseBuf));
+	
+	if(!err)
+		{
+		err = SendInternalResponse(aId, responseBuf);
+		}
+	
+	return err;
+	}
+
+void CRcpBrowsingCommandHandler::DoHandleGetFolderItemsL(RBuf8& aCommandData, RBuf8& aResponseData)
+	{
+	LOG_FUNC
+
+	__ASSERT_DEBUG( &iPlayerInfoManager != NULL, AvrcpUtils::Panic(EAvrcpNotFullyConstructed));
+	RAvrcpGetFolderItemsRequest request;
+	CleanupClosePushL(request);
+	request.ReadL(aCommandData);
+	
+	// Use 4 bytes even though player ids are 2 bytes becuase of
+	// restrictions on RArray preventing use of non-word aligned types
+	RArray<TUint> players;
+	TInt err = iPlayerInfoManager.PlayerListing(request.iStartItem, request.iEndItem, players);
+	CleanupStack::PopAndDestroy(&request);
+	
+	RRemConMediaErrorResponse errResponse;
+	if(err != KErrNone)
+		{
+		CleanupClosePushL(players);
+		errResponse.iPduId = AvrcpBrowsing::EGetFolderItems;
+		errResponse.iStatus = (err == KErrArgument) ? AvrcpStatus::ERangeOutOfBounds : AvrcpStatus::EInternalError;
+		aResponseData.CreateL(KBrowseResponseBaseLength);
+		CleanupClosePushL(aResponseData);
+		errResponse.WriteL(aResponseData);
+		CleanupStack::Pop(&aResponseData);
+		CleanupStack::PopAndDestroy(&players);
+		return;
+		}
+	
+	RAvrcpGetFolderItemsResponse response;
+	CleanupClosePushL(response);
+	CleanupClosePushL(players);
+	for(TInt i = 0; i < players.Count(); i++)
+		{
+		RMediaPlayerItem item;
+		CleanupClosePushL(item);
+		iPlayerInfoManager.MediaPlayerItemL(players[i], item);
+		response.iItems.AppendL(item);
+		CleanupStack::Pop(&item);
+		}
+	
+	response.iPduId = AvrcpBrowsing::EGetFolderItems;
+	response.iStatus = AvrcpStatus::ESuccess;
+	response.iUidCounter = KMediaPlayerListUidCounter;
+	response.iNumberItems = players.Count();
+	CleanupStack::PopAndDestroy(&players);
+	
+	//check this fits within MTU, Leave if the response size is bigger than max size 
+	CleanupClosePushL(aResponseData);
+	if(response.Size() > iMtu)
+		{
+		
+		errResponse.iPduId = AvrcpBrowsing::EGetFolderItems;
+		errResponse.iStatus = AvrcpStatus::EInternalError;
+		aResponseData.CreateL(KBrowseResponseBaseLength);
+		errResponse.WriteL(aResponseData);
+		}
+	else
+		{
+		aResponseData.CreateL(response.Size());
+		response.WriteL(aResponseData);
+		}
+	CleanupStack::Pop(&aResponseData);
+	CleanupStack::PopAndDestroy(&response);
+	}
+
+TInt CRcpBrowsingCommandHandler::SendInternalResponse(TUint aId, RBuf8& aData)
+	{
+	LOG_FUNC
+
+	return SendResponse(iInternalCommandQueue, aId, aData);
+	}
+
+TInt CRcpBrowsingCommandHandler::SendResponse(TDblQue<CBrowseCommand>& aCommandQueue, TUint aId, RBuf8& aData)
+	{
+	LOG_FUNC
+	
+	TInt err = KErrNotFound;
+	
+	TDblQueIter<CBrowseCommand> iter(aCommandQueue);
+	CBrowseCommand* command = NULL;
+
+	while (iter)
+		{
+		command = iter++;
+		if(command->RemConCommandId() == aId)
+			{
+			err = KErrNone;
+			command->ProcessOutgoingResponse(aData);
+			
+			Respond(*command, err);
+			aData.Close();
+			HandledCommand(*command);
+			
+			break;
+			}		
+		}
+
+	return err;
+	}
+
+void CRcpBrowsingCommandHandler::SendReject(TUid /*aInterfaceUid*/, TUint aTransactionId)
+	{
+	LOG_FUNC;
+
+	TDblQueIter<CBrowseCommand> iter(iCommandQueue);
+	CBrowseCommand* command = NULL;
+
+	while (iter)
+		{
+		command = iter++;
+		if(command->RemConCommandId() == aTransactionId)
+			{
+			Respond(*command, KErrAvrcpAirInternalError);
+			HandledCommand(*command);
+			}		
+		}
+	}
+
+const TBTDevAddr& CRcpBrowsingCommandHandler::BtAddr() const
+	{
+	return iAddr;
+	}
+
+TBool CRcpBrowsingCommandHandler::HandleSetBrowsedPlayer(CBrowseCommand& aCommand)
+	{
+	TInt err = KErrNone;
+	RRemConSetBrowsedPlayerRequest request;
+	
+	TRAP(err, request.ReadL(aCommand.CommandData()));
+	__ASSERT_DEBUG(err == KErrNone, AvrcpUtils::Panic(ESetBrowsePlayerRequestCorruptedLocally));
+
+	// Check if selected player exists
+	TUint16 playerId = request.iPlayerId;
+	TRemConClientId clientId;
+	TRAP(err, clientId = iPlayerInfoManager.ClientL(playerId));
+
+	if(err == KErrNone)
+		{
+		// Selected player exists, check with RemCon if we can use it
+		TRemConAddress remConAddr;
+		AvrcpUtils::BTToRemConAddr(iAddr, remConAddr);
+		
+		TInt err = iCommandInterface.MrcbciSetAddressedClient(remConAddr, clientId);
+		}
+	
+	if(err != KErrNone)
+		{
+		// Either the player was incorrect or is already in use, form a RemCon
+		// format response, then ask the command to process it for sending out
+		// on the air.
+		RBuf8 buf;
+		TInt bufErr = buf.Create(KMediaBrowseOutBufMaxLength);
+		
+		if(bufErr == KErrNone)
+			{
+			RRemConMediaErrorResponse response;
+			response.iPduId = 0x70;
+			response.iStatus = RAvrcpIPC::SymbianErrToStatus(KErrAvrcpAirInvalidPlayerId);
+			TRAP(bufErr, response.WriteL(buf));
+			aCommand.ProcessOutgoingResponse(buf);
+			buf.Close();
+			}
+		}
+	// else we will continue processing this command as normal
+	
+	return err == KErrNone ? ETrue : EFalse;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpcommand.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,164 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "avrcpcommand.h"
+#include "avrcplog.h"
+
+CAvrcpCommand::CAvrcpCommand(TUint aRemConId,
+	SymbianAvctp::TTransactionLabel aTransactionLabel, 
+	const TBTDevAddr& aAddr)
+	: iRemConId(aRemConId)
+	, iTransactionLabel(aTransactionLabel)
+	, iRemoteAddr(aAddr)
+	{
+	LOG_FUNC
+	}
+
+//------------------------------------------------------------------------------------
+// Called by handlers, router and bearer
+//------------------------------------------------------------------------------------
+
+/** Decrement the users of this command.
+
+This must be called by users of the command when they
+no longer require the command to remain in existence.
+When the number of users reaches zero, the command
+is deleted.
+*/
+void CAvrcpCommand::DecrementUsers()
+	{
+	LOG_FUNC
+	if(--iUsers < 1)
+		{
+		iHandlingLink.Deque();
+		delete this;
+		}
+	}
+
+/** Increment the users of this command.
+
+This must be called by users of the command to signify
+they require it to remain in existence.
+*/
+void CAvrcpCommand::IncrementUsers()
+	{
+	LOG_FUNC
+	iUsers++;
+	}
+
+//------------------------------------------------------------------------------------
+// Called by bearer
+//------------------------------------------------------------------------------------
+
+/** Get info needed by RemCon for this command.
+
+@param aInterfaceUid On return, the RemCon interface of this command.
+@param aId On return, the RemCon transaction id of this command.
+@param aOperationId On return, the RemCon operation id of this command.
+@param aCommandData On return, the command data for this operation. 
+					Ownership is returned.
+@param aAddr On return, the originating device for this command.
+*/
+void CAvrcpCommand::GetCommandInfo(TUid& aInterfaceUid, 
+		TUint& aId, 
+		TUint& aOperationId, 
+		RBuf8& aCommandData, 
+		TBTDevAddr& aAddr)
+	{
+	LOG_FUNC
+	aInterfaceUid = iInterfaceUid;
+	aId = iRemConId;
+	aOperationId = iOperationId;
+	
+	// RemCon will take ownership of command data
+	aCommandData.Assign(iCommandData);
+	iCommandData.Assign(NULL);
+	
+	aAddr = iRemoteAddr;
+	}
+
+//------------------------------------------------------------------------------------
+// Called by handlers
+//------------------------------------------------------------------------------------
+
+/** Gets the remote associated with this command.
+This may be the source or the destination, depending
+on if the originated locally or remotely.
+
+@return The BT address of the remote device.
+*/
+const TBTDevAddr& CAvrcpCommand::RemoteAddress() const
+	{
+	LOG_FUNC
+	return iRemoteAddr;
+	}	
+
+/** Gets the AVCTP transaction label for this command.
+This is used to match commands with responses.
+
+@return The AVCTP transaction label for this command.
+*/
+SymbianAvctp::TTransactionLabel CAvrcpCommand::TransactionLabel() const
+	{
+	LOG_FUNC
+	return iTransactionLabel;
+	}
+
+/** Gets the RemCon id of this command.
+This is used to uniquely identify a transaction to RemCon.
+
+@return The RemCon command id.
+*/	
+TUint CAvrcpCommand::RemConCommandId() const
+	{
+	LOG_FUNC
+	return iRemConId;
+	}
+
+/** Gets the RemCon interface uid of this command.
+
+This is used with the operation id to uniquely identify an operation to RemCon.
+
+@param aOperation
+@return The RemCon operation id.
+*/	
+const TUid& CAvrcpCommand::RemConInterfaceUid() const
+	{
+	LOG_FUNC
+	return iInterfaceUid;
+	}
+
+/** Gets the RemCon operation id of this command.
+
+This is used with the interface uid to uniquely identify an operation to RemCon.
+
+@param aOperation
+@return The RemCon operation id.
+*/	
+TUint CAvrcpCommand::RemConOperationId() const
+	{
+	LOG_FUNC
+	return iOperationId;
+	}
+
+
+/**
+Whether the Bearer is aware of this command.  If not we shouldn't
+inform the bearer of responses.
+*/
+TBool CAvrcpCommand::KnownToBearer() const
+	{
+	return iKnownToBearer;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpcommandframer.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,132 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <bluetoothav.h>
+#include "avrcpcommandframer.h"
+#include "avcframe.h"
+#include "avrcplog.h"
+#include <remcon/avrcpspec.h>
+#include <absolutevolumeapi.h>
+
+// The Bluetooth SIG registered VendorId, see table 4.7
+const AVC::TAVCVendorId KBluetoothSIGVendorId = 0x001958;
+
+/** Returns a new CAVCFrame representing an AV/C passthrough command.
+@param aOperationId The AV/C operation id of this command.
+@param aButtonAction The AV/C button action.
+@return An AV/C frame representing a passthrough command.
+@leave error
+*/
+CAVCFrame* AvrcpCommandFramer::PassthroughL(AVCPanel::TOperationId aOperationId, AVCPanel::TButtonAction aButtonAction)
+	{
+	LOG_STATIC_FUNC
+	CAVCFrame* frame = CAVCFrame::NewL(AVC::ECommand, AVC::EControl, AVC::EPanel, AVC::EID0);
+	frame->Append(TChar(AVC::EPassThrough));
+	frame->Append(TChar(aOperationId | aButtonAction));
+	frame->Append(TChar(0));
+	return frame;
+	}
+
+/** Returns a new CAVCFrame representing an AV/C Unit Info response.
+@return An AV/C frame representing a Unit Info response.
+@leave error
+*/	
+CAVCFrame* AvrcpCommandFramer::UnitInfoResponseL()
+	{
+	LOG_STATIC_FUNC
+	CAVCFrame* frame = CAVCFrame::NewL(AVC::EResponse, AVC::EStable, AVC::EUnit, AVC::EIgnore);
+	frame->Append(TChar(AVC::EUnitInfo));
+	frame->Append(TChar(0x7));
+	frame->Append(TChar(0x48));
+	frame->Append(TChar(0xff));
+	frame->Append(TChar(0xff));
+	frame->Append(TChar(0xff));
+	return frame;
+	}
+
+/** Returns a new CAVCFrame representing an AV/C Subunit Info response.
+@return An AV/C frame representing a Subunit Info response.
+@leave error
+*/	
+CAVCFrame* AvrcpCommandFramer::SubunitInfoResponseL()
+	{
+	LOG_STATIC_FUNC
+	CAVCFrame* frame = CAVCFrame::NewL(AVC::EResponse, AVC::EStable, AVC::EUnit, AVC::EIgnore);
+	frame->Append(TChar(AVC::ESubunitInfo));
+	frame->Append(TChar(0x7));
+	frame->Append(TChar(0x48));
+	frame->Append(TChar(0xff));
+	frame->Append(TChar(0xff));
+	frame->Append(TChar(0xff));
+	return frame;
+	}
+
+/** Returns a new CAVCFrame representing an AV/C 'set absolute volume' command
+@return An AV/C frame representing a 'set absolute volume' command.
+@leave error
+*/	
+CAVCFrame* AvrcpCommandFramer::SetAbsoluteVolumeCommandL(TUint8 aAbsVol)
+	{
+	LOG_STATIC_FUNC
+	CAVCFrame* frame = CAVCFrame::NewL(AVC::ECommand, AVC::EControl, AVC::EPanel, AVC::EID0);
+	frame->Append(TChar(AVC::EVendorDependent));
+	frame->Append(KBluetoothSIGVendorId>>16 & 0xff);	
+	frame->Append(KBluetoothSIGVendorId>>8 & 0xff);	
+	frame->Append(KBluetoothSIGVendorId & 0xff);
+	
+	frame->Append(ESetAbsoluteVolume);
+	frame->Append(TChar(AVC::EASingle));
+	
+	TUint16 len = KLengthSetAbsoluteVolumeRequestParameter<<8 & 0xffff;
+	TPckgBuf<TUint16> parameterLength(len);
+	frame->Append(parameterLength);
+	frame->Append(aAbsVol);
+	return frame;
+	}
+
+/** Returns a new CAVCFrame representing an AV/C 'Register notification absolute volume changed' command.
+@return An AV/C frame representing a 'Register notification absolute volume changed' command.
+@leave error
+*/	
+CAVCFrame* AvrcpCommandFramer::NotifyVolumeChangeCommandL()
+	{
+	LOG_STATIC_FUNC
+	CAVCFrame* frame = CAVCFrame::NewL(AVC::ECommand, AVC::ENotify, AVC::EPanel, AVC::EID0);
+	frame->Append(TChar(AVC::EVendorDependent));
+	frame->Append(KBluetoothSIGVendorId>>16 & 0xff);	
+	frame->Append(KBluetoothSIGVendorId>>8 & 0xff);	
+	frame->Append(KBluetoothSIGVendorId & 0xff);
+	
+	frame->Append(ERegisterNotification);
+	frame->Append(TChar(AVC::EASingle));
+	
+	TUint16 len = KLengthNotifyVolumeChangeRequestParameter<<8 & 0xffff;
+	TPckgBuf<TUint16> parameterLength(len);
+	frame->Append(parameterLength);
+	frame->Append(ERegisterNotificationVolumeChanged);
+	
+	TBuf8<4> reservedBuffer(KLengthNotifyVolumeChangeRequestParameter - 1);
+	reservedBuffer.FillZ();
+	frame->Append(reservedBuffer);
+	return frame;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpfragmenter.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,128 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include "avrcpfragmenter.h"
+#include "controlcommand.h"
+#include <e32debug.h>
+
+// Maximum size of data in a fragment response
+static const int KFragmentDataLength = KAVCMaxVendorDependentPayload - KAVRCPMinVendorDependentResponseLen;
+
+
+CAVRCPFragmenter* CAVRCPFragmenter::NewL()
+	{
+	CAVRCPFragmenter* self = new (ELeave) CAVRCPFragmenter();
+	self->Construct();
+	return self;
+	}
+
+TBool CAVRCPFragmenter::InFragmentedState()
+	{
+	return iInFragmentedState;
+	}
+
+void CAVRCPFragmenter::Reset()
+	{
+	iStart = KAVRCPMinVendorDependentResponseLen;
+	iInFragmentedState = EFalse;
+	}
+
+void CAVRCPFragmenter::AssignPayload(const RBuf8& aPayload)
+	{
+	// Assign the allocated memory containing the reponse to
+	// this class, allowing the caller to Close() aPayload.
+	iPayload.Close();
+	iPayload.Assign(aPayload);
+	iInFragmentedState = ETrue;
+	}
+
+TPtr8 CAVRCPFragmenter::GetNextFragmentHeader()
+	{
+	if (! InFragmentedState())
+		return TPtr8(0,0,0);
+	
+	// Fragmentation byte is 2nd byte of response; poke this
+	// and set the length correctly
+	if (iStart == KAVRCPMinVendorDependentResponseLen)
+		{
+		iPayload[1] = EFragmentStart;
+		iPayload[2] = (KFragmentDataLength >> 8) & 0xff;
+		iPayload[3] = (KFragmentDataLength) & 0xff;
+		}
+	else if (LastFragment())
+		{
+		iPayload[1] = EFragmentEnd;
+		TInt length = iPayload.Length() - iStart;
+		iPayload[2] = (length >> 8) & 0xff;
+		iPayload[3] = (length) & 0xff;
+		}
+	else
+		{
+		iPayload[1] = EFragmentContinue;
+		iPayload[2] = (KFragmentDataLength >> 8) & 0xff;
+		iPayload[3] = (KFragmentDataLength) & 0xff;
+		}
+	
+	// Return the first 4 bytes, which contain the PDU id,
+	// fragmentation status and parameter length (2 bytes)
+	return iPayload.MidTPtr(0, KAVRCPMinVendorDependentResponseLen);
+	}
+
+TPtr8 CAVRCPFragmenter::GetNextFragment()
+	{
+	if (! InFragmentedState())
+		return TPtr8(0,0,0);
+	
+	// Sigh. MidTPtr() PANICs if the 2nd argument is too large.
+	// Other APIs (e.g. Java, STL) just return to end of string.
+	TInt fragmentSize = KFragmentDataLength;
+	if (LastFragment())
+		fragmentSize = iPayload.Length() - iStart;
+	
+	TPtr8 fragment = iPayload.MidTPtr(iStart, fragmentSize);
+	
+	if (LastFragment())
+		Reset();
+	else
+		iStart += fragmentSize;
+	return fragment;
+	}
+
+TBool CAVRCPFragmenter::LastFragment()
+	{
+	if (iStart + KFragmentDataLength > iPayload.Length())
+		return ETrue;
+	else
+		return EFalse;
+	}
+
+TInt CAVRCPFragmenter::GetPDU()
+	{
+	return iPayload[0];
+	}
+
+void CAVRCPFragmenter::Construct()
+	{
+	Reset();
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpimplementationproxy.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,38 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// rcpimplementationproxy.cpp
+//
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+#include <remconbeareravrcp.h>
+#include "controlbearer.h"
+
+// __________________________________________________________________________
+// Exported proxy for instantiation method resolution
+// Define the interface UIDs
+
+const TImplementationProxy ImplementationTable[] = 
+	{
+	IMPLEMENTATION_PROXY_ENTRY(KRemConBearerAvrcpImplementationUid, CRemConBearerAvrcp::NewL)
+	};
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,879 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <remcon/avrcpspec.h>
+#include <remcon/remconbearerobserver.h>
+#include <remconcoreapi.h>
+
+#include "controlcommand.h"
+#include "avrcpcommandframer.h"
+#include "avrcpincomingcommandhandler.h"
+#include "avrcpinternalinterface.h"
+#include "avrcplog.h"
+#include "avrcprouter.h"
+#include "avrcptimer.h"
+#include "avrcputils.h"
+#include "controlbearer.h"
+#include "passthroughhelper.h"
+#include "mediainformation.h"
+#include "nowplaying.h"
+#include "playerinformation.h"
+#include "remconbattery.h"
+#include "remcongroupnavigation.h"
+
+//------------------------------------------------------------------------------------
+// Construction/Destruction
+//------------------------------------------------------------------------------------
+
+/** Factory function.
+
+@param aBearer	The CRemConBearerAvrcp this is to handle commands for.
+@param aObserver The observer of the bearer. Used to acquire converters.
+@param aRouter	A CRcpRouter to use for communication with remote devices.
+@param aTimer	CDeltaTimer to use for queuing timed events.
+@return A fully constructed CRcpIncomingCommandHandler.
+@leave System wide error codes.
+*/
+CRcpIncomingCommandHandler* CRcpIncomingCommandHandler::NewL(MRemConControlCommandInterface& aCommandInterface,
+	MRemConBearerObserver& aObserver,
+	CRcpRouter& aRouter,
+	CDeltaTimer& aTimer,
+	CAvrcpPlayerInfoManager& aPlayerInfoManager,
+	TBTDevAddr& aDevice) 
+	{
+	LOG_STATIC_FUNC
+	CRcpIncomingCommandHandler* handler = new(ELeave)CRcpIncomingCommandHandler(aCommandInterface, aObserver, aRouter, aTimer, aPlayerInfoManager, aDevice);
+	CleanupStack::PushL(handler);
+	handler->ConstructL();
+	CleanupStack::Pop(handler);
+	return handler;
+	}
+
+/** Constructor.
+
+@param aBearer	The CRemConBearerAvrcp this is to handle commands for.
+@param aObserver The observer of the bearer. Used to aquire converters.
+@param aRouter	A CRcpRouter to use for communication with remote devices.
+@param aTimer	CDeltaTimer to use for queuing timed events.
+@return A partially constructed CRcpIncomingCommandHandler.
+@leave System wide error codes.
+*/	
+CRcpIncomingCommandHandler::CRcpIncomingCommandHandler(MRemConControlCommandInterface& aCommandInterface, 
+	MRemConBearerObserver& aObserver,
+	CRcpRouter& aRouter,
+	CDeltaTimer& aTimer,
+	CAvrcpPlayerInfoManager& aPlayerInfoManager,
+	TBTDevAddr& aDevice) 
+	: iCommandQueue(_FOFF(CControlCommand, iHandlingLink))
+	, iInternalCommandQueue(_FOFF(CControlCommand, iHandlingLink))
+	, iFragmenter(NULL)
+	, iCommandInterface(aCommandInterface)
+	, iObserver(aObserver)
+	, iRouter(aRouter)
+	, iTimer(aTimer)
+	, iAddressedMode(EFalse)
+	, iPlayerInfoManager(aPlayerInfoManager)
+	, iDevice(aDevice)
+	{
+	LOG_FUNC
+	}
+
+void CRcpIncomingCommandHandler::ConstructL()
+	{
+	LOG_FUNC
+	
+	iFragmenter = CAVRCPFragmenter::NewL();
+	iPlayerInfoManager.AddObserverL(*this);
+
+	RArray<TUint> players;
+	iPlayerInfoManager.PlayerListing(players);
+	CleanupClosePushL(players);
+	
+	if(players.Count())
+		{
+		// Start out with the first player as default.  TSP will need to update
+		// us if it wants to set a different one.  Note that this wont be used 
+		// unless we enter addressed mode anyway.
+		iClientId = iPlayerInfoManager.ClientL(0);
+		}
+	// if no player have yet been registered we'll set the default when the
+	// first one is
+	
+	CleanupStack::PopAndDestroy(&players);
+	
+	iPassthroughHelper = CPassthroughHelper::NewL(iRouter, iCommandInterface, iTimer);
+	}
+
+/** Destructor.
+*/	
+CRcpIncomingCommandHandler::~CRcpIncomingCommandHandler()
+	{
+	LOG_FUNC
+
+	iCommandInterface.MrccciUnregisterForLocalAddressedClientUpdates();
+	iPlayerInfoManager.RemoveObserver( *this );
+	delete iFragmenter;
+	delete iPassthroughHelper;
+
+	// All commands should have been handled by the time we reach here.
+	__ASSERT_ALWAYS(iCommandQueue.IsEmpty(), AvrcpUtils::Panic(EAvrcpIncomingCommandsNotHandled));
+	__ASSERT_ALWAYS(iInternalCommandQueue.IsEmpty(), AvrcpUtils::Panic(EAvrcpIncomingCommandsNotHandled));
+	}
+
+//---------------------------------------------------------------------
+// Called from the bearer
+//---------------------------------------------------------------------
+
+/** Tell the handler to gracefully shutdown.
+
+*/
+void CRcpIncomingCommandHandler::Disconnect()
+	{
+	LOG_FUNC
+	
+	iPassthroughHelper->Disconnect();
+
+	if(!iCommandQueue.IsEmpty())
+		{
+		// Cleanup remaining commands
+		while(!iCommandQueue.IsEmpty())
+			{
+			CControlCommand* command = iCommandQueue.First();
+			// Tell RemCon the command is finished with
+			iObserver.CommandExpired(command->RemConCommandId());
+			// And now remove the command from the bearer
+			iRouter.RemoveFromSendQueue(*command);
+			HandledCommand(*command);
+			}
+		}
+	if(!iInternalCommandQueue.IsEmpty())
+		{
+				
+		// Cleanup remaining commands
+		while(!iInternalCommandQueue.IsEmpty())
+			{
+			CControlCommand* command = iInternalCommandQueue.First();
+			// Tell RemCon the command is finished with
+			iObserver.CommandExpired(command->RemConCommandId());
+			// And now remove the command from the bearer
+			iRouter.RemoveFromSendQueue(*command);
+			HandledCommand(*command);
+			}
+		}
+	}
+
+//------------------------------------------------------------------------------------
+// Called by router
+//------------------------------------------------------------------------------------
+
+void CRcpIncomingCommandHandler::MaxPacketSize(TInt /*aMtu*/)
+	{
+	// ignore - we don't care if we use AVCTP fragmentation on the
+	// control channel
+	}
+
+/** Receive an incoming AVRCP command.
+
+The command is parsed from a CAVCFrame into a CControlCommand owned by the
+command handler.
+
+@param aFrame	The AVC frame contained within the AVCTP message.
+@param aTransactionLabel	AVCTP transaction label for this command.
+@param aAddr	The bluetooth device from which this command originated.
+@leave System Wide Error code
+*/
+void CRcpIncomingCommandHandler::ReceiveCommandL(const TDesC8& aMessageInformation, 
+	SymbianAvctp::TTransactionLabel aTransactionLabel, 
+	const TBTDevAddr& aAddr)
+	{
+	LOG_FUNC
+		
+	TUint id = iCommandInterface.MrcciNewTransactionId();
+	
+	// If there's nothing beyond a header this is bobs.  Dump it now.
+	if(aMessageInformation.Length() <= KAVCFrameHeaderLength)
+		{
+		User::Leave(KErrCorrupt);
+		}
+
+	// Parse it out into an AV/C frame
+	CAVCFrame* frame = CAVCFrame::NewL(aMessageInformation, AVC::ECommand);
+	
+	CControlCommand* command = CControlCommand::NewL(frame, id, aTransactionLabel, aAddr, iAddressedMode ? iClientId : KNullClientId, &AvrcpPlayerInfoManager());
+	CleanupStack::PushL(command);
+
+	TInt result = command->ParseIncomingCommandL(iObserver, *iFragmenter);
+	CleanupStack::Pop(command);
+
+	command->IncrementUsers();
+	
+	switch(result)
+		{
+		case KErrAvrcpHandledInternallyInformRemCon:
+			{
+			HandleRemConCommand(*command);
+			iRouter.AddToSendQueue(*command);
+			command->DecrementUsers();
+			break;
+			}
+		case KErrNone:
+			{
+			if(! command->IsPassthrough())
+				{
+				// add to iCommandQueue for non-passthrough commands
+				iCommandQueue.AddLast(*command);
+				}
+			HandleRemConCommand(*command);
+			break;
+			}
+		case KErrAvrcpInternalCommand:
+			{
+			iInternalCommandQueue.AddLast(*command);
+			HandleInternalCommand(*command);
+			break;
+			}
+		case KErrAvrcpInvalidCType:
+			{
+			// We should ignore commands with invalid ctype (AV/C v4.0 8.3.1).
+			command->DecrementUsers();
+			break;
+			}
+		default:
+			{
+			Respond(*command, result);
+			command->DecrementUsers();
+			break;
+			}
+		}
+	}
+
+/** Called from the router to indicate send completion.
+
+@param aCommand The command that has been sent.
+@param aSendResult KErrNone if the command was sent successfully.  System wide
+				   error code otherwise.
+*/
+void CRcpIncomingCommandHandler::MessageSent(CAvrcpCommand& /*aCommand*/, TInt /*aSendResult*/)
+	{
+	LOG_FUNC
+	// We try and send the response, but if we fail there's not a lot we can do about
+	// it.  Just let the remote assume the response.
+	}
+
+//------------------------------------------------------------------------------------
+// Called by bearer
+//------------------------------------------------------------------------------------
+
+/** Send a response.
+
+@param aInterfaceUid The RemCon interface this response is from.
+@param aId The RemCon transaction label of the command to respond to.
+@param aData The command response data.
+@return KErrNone.
+*/
+TInt CRcpIncomingCommandHandler::SendRemConResponse(TUid /*aInterfaceUid*/, TUint aId, RBuf8& aData)
+	{
+	LOG_FUNC
+
+	// We always take ownership of the response data in SendResponse, so we 
+	// always return KErrNone.
+	SendResponse(iCommandQueue, aId, aData);
+	return KErrNone;
+	}
+
+void CRcpIncomingCommandHandler::SendReject(TUid aInterfaceUid, TUint aId)
+	{
+	LOG_FUNC
+
+	TDblQueIter<CControlCommand> iter(iCommandQueue);
+	CControlCommand* command = NULL;
+
+	while (iter)
+		{
+		command = iter++;
+		if(command->RemConCommandId() == aId)
+			{
+			TInt err = KErrGeneral;
+			if (aInterfaceUid.iUid == KRemConMediaInformationApiUid || aInterfaceUid.iUid == KRemConPlayerInformationUid)
+				{
+				err = KErrAvrcpMetadataInternalError;
+				}
+			
+			Respond(*command, err);
+			
+			HandledCommand(*command);
+			}		
+		}
+	}
+
+//------------------------------------------------------------------------------------
+// MPlayerChangeObserver functions
+//------------------------------------------------------------------------------------
+void CRcpIncomingCommandHandler::MpcoAvailablePlayersChanged()
+	{
+	LOG_FUNC 
+	
+	TDblQueIter<CControlCommand> internalIter(iInternalCommandQueue);
+	CControlCommand* command = NULL;
+	TInt err = KErrNone;
+	
+	while(internalIter)
+		{
+		command = internalIter++;
+		if((command->RemConInterfaceUid() == TUid::Uid(KUidAvrcpInternalInterface)) && (command->RemConOperationId() == EAvrcpInternalAvailablePlayersNotification))
+			{
+			// If this fails we cann't send the notification - just give up
+			err = HandleRegisterAvailablePlayersNotification(*command);
+			static_cast<void>(err = err); // ignore this error (i.e. give up).
+			}
+		}
+	//register internal notification
+	//still need to optimize for avoid re-registering notification
+	RArray<TUint> players;
+	err = iPlayerInfoManager.PlayerListing(players);
+	
+	if(err == KErrNone)
+		{
+		TBool currentClientAvailable = EFalse;
+
+		for(TInt i = 0 ; i < players.Count() ; i++)
+			{
+			TRemConClientId clientId = 0;
+			clientId = iPlayerInfoManager.Client(players[i]);
+			if(clientId == iClientId)
+				{
+				currentClientAvailable = ETrue;
+				}
+			}
+		
+		if((iClientId == KNullClientId || !currentClientAvailable) && players.Count())
+			{
+			// If this is the first target client we set our default client id
+			// to this
+			iClientId = iPlayerInfoManager.Client(players[0]);
+			}
+		}
+
+	players.Close();
+	}
+
+void CRcpIncomingCommandHandler::MpcoAddressedPlayerChangedLocally(TRemConClientId aClientId)
+	{
+	LOG_FUNC
+	
+	TRAP_IGNORE(AddressedPlayerChangedL(aClientId));
+	}
+
+void CRcpIncomingCommandHandler::MpcoUidCounterChanged(TRemConClientId aClientId)
+	{
+	LOG_FUNC
+	
+	CControlCommand* command;
+	if(aClientId == iClientId)
+		{
+		command = FindNotify(iInternalCommandQueue, TUid::Uid(KUidAvrcpInternalInterface),EAvrcpInternalUidChangedNotification);
+		if(command)
+			{
+			// if we fail to send an update it is effectively the same condition
+			// as when the notification arrives after the controller uses the
+			// old UID counter
+			TInt err = HandleUidChangedNotification(*command);
+			
+			if(err != KErrNone)
+				{
+				Respond(*command, KErrAvrcpAirInternalError);
+				HandledCommand(*command);
+				}
+			}
+		}
+	}
+
+//------------------------------------------------------------------------------------
+// Internal command handling functions
+//------------------------------------------------------------------------------------
+
+
+/** Sends a response to the remote device.
+
+Because of the 100ms timeout for responses we send a response to
+passthrough commands as soon as we receive them.  This means the real
+response from RemCon is currently ignored.  A real response is
+only sent if this is a vendor dependent command.
+
+@param aCommand The command to respond to.
+@param aErr The result of handling the command.  KErrNone if successful.
+			KErrNotSupported if this operation is not supported.
+*/		
+void CRcpIncomingCommandHandler::Respond(CControlCommand& aCommand, TInt aErr)
+	{
+	LOG_FUNC
+	aCommand.SetResponseType(aErr);
+	iRouter.AddToSendQueue(aCommand);
+	}
+
+/** To be called on completion of command handling.
+
+This aggregates the handler's tidying up of a finished
+command.
+
+@param aCommand The command to tidy up.
+*/	
+void CRcpIncomingCommandHandler::HandledCommand(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	aCommand.CancelTimer(iTimer);
+	aCommand.iHandlingLink.Deque();
+	aCommand.DecrementUsers();
+	}
+
+void CRcpIncomingCommandHandler::HandleInternalCommand(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	
+	TUid interfaceUid;
+	TUint id;
+	TUint operationId;
+	RBuf8 commandData;
+	TBTDevAddr addr;
+	
+	aCommand.GetCommandInfo(interfaceUid, id, operationId, commandData, addr);
+	
+	__ASSERT_DEBUG(interfaceUid == TUid::Uid(KUidAvrcpInternalInterface), AvrcpUtils::Panic(EAvrcpInternalHandlingRequestedOnWrongInterface));
+	
+	TInt err = KErrNone;
+	switch(operationId)
+		{
+	case EAvrcpInternalSetAddressedPlayer:
+		{
+		err = HandleSetAddressedPlayer(id, commandData);
+		break;
+		}
+	case EAvrcpInternalAvailablePlayersNotification:
+		{
+		err = HandleRegisterAvailablePlayersNotification(aCommand);
+		break;
+		}
+	case EAvrcpInternalAddressedPlayerNotification:
+		{
+		err = HandleRegisterAddressedPlayerNotification(aCommand);
+		break;
+		}
+	case EAvrcpInternalUidChangedNotification:
+		{
+		err = HandleUidChangedNotification(aCommand);
+		break;
+		}
+		};
+
+	if(err != KErrNone)
+		{
+		Respond(aCommand, KErrAvrcpAirInternalError);
+		HandledCommand(aCommand);
+		}
+
+	commandData.Close();
+	}
+
+void CRcpIncomingCommandHandler::HandleRemConCommand(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	
+	if(aCommand.IsPassthrough())
+		{
+		// This deals with button press/release stuff,
+		// queues the command and responds
+		iPassthroughHelper->HandlePassthrough(aCommand);
+		}
+	else 
+		{
+		// can go directly to client (unlike passthrough which may need to map 2 commands to 1 click
+		if (aCommand.Frame().Type() == AVC::ENotify)
+			{
+			iCommandInterface.MrccciNewNotifyCommand(aCommand, aCommand.ClientId());
+			}
+		else
+			{
+			iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId());
+			}
+		}
+	}
+
+TInt CRcpIncomingCommandHandler::HandleSetAddressedPlayer(TUint aId, RBuf8& aCommandData)
+	{
+	LOG_FUNC
+	
+	// Once we respond to this we've told the remote that we're using a particular player
+	EnterAddressedMode();
+	
+	// SetAddressedPlayer involves not just responding to this command but
+	// also rejecting a bunch of notifies and completing the addressed player
+	// changed notify.  We try as hard as we can to ensure our state remains
+	// consistent with the view of the remote.
+	
+	// Allocate the response buffer for the SetAddressedPlayer command first
+	RBuf8 responseBuf;
+	TInt err = responseBuf.Create(KSetAddressedPlayerResponseSize);
+	if(err == KErrNone)
+		{
+		// Now we know we can at least try and send a response to the remote 
+		// do the other gubbins, which we can cope with failing
+		TRAPD(setResult, DoHandleSetAddressedPlayerL(aCommandData));
+	
+		switch(setResult)
+			{
+		case KErrNotFound:
+			{
+			RAvrcpIPCError errorResponse;
+			errorResponse.iError = KErrAvrcpAirInvalidPlayerId;
+	
+			// Can ignore this as we know we have allocated a big enough buffer
+			TRAP_IGNORE(errorResponse.WriteL(responseBuf));
+			break;
+			}
+		case KErrNone:
+		default:
+			// For any result other than KErrNotFound we managed to set the 
+			// addressed client.  Other errors indicate a failure in sending
+			// a changed response to the AddressedPlayerChanged notify.  Even
+			// if we failed sending a changed response we should have been
+			// able to reject the outstanding notify so we are in a consistent
+			// state
+			{
+			RAvrcpSetAddressedPlayerResponse response;
+			response.iStatus = AvrcpStatus::ESuccess;
+			
+			// Can ignore this as we know we have allocated a big enough buffer
+			TRAP_IGNORE(response.WriteL(responseBuf));
+
+			iCommandInterface.MrccciSetAddressedClient(iClientId);
+			break;
+			}
+			};
+	
+		SendInternalResponse(aId, responseBuf);
+		responseBuf.Close();
+		}
+
+	return err;
+	}
+
+void CRcpIncomingCommandHandler::DoHandleSetAddressedPlayerL(RBuf8& aCommandData)
+	{
+	LOG_FUNC
+
+	RAvrcpSetAddressedPlayerRequest request;
+	request.ReadL(aCommandData);
+	
+	TRemConClientId clientId = iPlayerInfoManager.ClientL(request.iPlayerId);
+	AddressedPlayerChangedL(clientId);
+	}
+
+void CRcpIncomingCommandHandler::AddressedPlayerChangedL(TRemConClientId aClientId)
+	{
+	LOG_FUNC
+
+	if(aClientId == iClientId)
+		{
+		return;
+		}
+
+	iClientId = aClientId;
+	
+	TDblQueIter<CControlCommand> iter(iCommandQueue);
+	CControlCommand* command = NULL;
+	
+	// Complete player specific notifications
+	while(iter)
+		{
+		command = iter++;
+		if(command->PlayerSpecificNotify())
+			{
+			iObserver.CommandExpired(command->RemConCommandId());
+
+			Respond(*command, KErrAvrcpAirAddressedPlayerChanged);
+			
+			HandledCommand(*command);
+			}
+		}
+
+	command = FindNotify(iInternalCommandQueue, TUid::Uid(KUidAvrcpInternalInterface),EAvrcpInternalAddressedPlayerNotification);
+	if(command)
+		{
+		User::LeaveIfError(HandleRegisterAddressedPlayerNotification(*command));
+		}
+	}
+
+TInt CRcpIncomingCommandHandler::HandleRegisterAvailablePlayersNotification(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+
+	RBuf8 responseBuf;
+	TRAPD(err, DoHandleRegisterAvailablePlayersNotificationL(responseBuf, aCommand));
+	
+	if(err == KErrNone)
+		{
+		SendInternalResponse(aCommand.RemConCommandId(), responseBuf);
+		}
+
+	responseBuf.Close();
+	return err;
+	}
+
+void CRcpIncomingCommandHandler::DoHandleRegisterAvailablePlayersNotificationL(RBuf8& aResponseData, CControlCommand& aCommand)
+	{
+	LOG_FUNC
+
+	RAvrcpIPCError response;
+	response.iError = KErrNone;
+
+	if(DuplicateNotify(iInternalCommandQueue, aCommand))
+		{
+		response.iError = KErrAvrcpAirInvalidCommand;
+		}
+	
+	aResponseData.CreateL(KRegisterNotificationEmptyResponseSize);
+	CleanupClosePushL(aResponseData);
+	
+	response.WriteL(aResponseData);
+	CleanupStack::Pop();
+	}
+
+TInt CRcpIncomingCommandHandler::HandleRegisterAddressedPlayerNotification(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+
+	// Once we respond to this we've told the remote that we're using a particular player
+	EnterAddressedMode();
+	
+	RBuf8 responseBuf;
+	TRAPD(err, DoHandleRegisterAddressedPlayerNotificationL(responseBuf, aCommand));
+	
+	if(!err)
+		{
+		SendInternalResponse(aCommand.RemConCommandId(), responseBuf);
+		}
+
+	responseBuf.Close();
+	return err;
+	}
+
+void CRcpIncomingCommandHandler::DoHandleRegisterAddressedPlayerNotificationL(RBuf8& aResponseData, CControlCommand& aCommand)
+	{
+	LOG_FUNC
+
+	RAvrcpAddressedPlayerNotificationResponse response;
+	RAvrcpIPCError rejectResponse;
+	
+	if(DuplicateNotify(iInternalCommandQueue, aCommand))
+		{
+		aResponseData.CreateL(KRegisterNotificationEmptyResponseSize);
+		rejectResponse.iError = KErrAvrcpAirInvalidCommand;
+		CleanupClosePushL(aResponseData);
+		rejectResponse.WriteL(aResponseData);
+		}
+	else
+		{
+		// Tricky situation thinking.Reject if at this moment the client just be shut down
+		TRAPD(err, response.iPlayerId = iPlayerInfoManager.PlayerL(iClientId));
+		if(err != KErrNone)
+			{
+			aResponseData.CreateL(KRegisterNotificationEmptyResponseSize);
+			rejectResponse.iError = KErrAvrcpAirInvalidCommand;
+			CleanupClosePushL(aResponseData);
+			rejectResponse.WriteL(aResponseData);
+			}
+		else
+			{
+			// This line will never leave once the previous line pass 
+			response.iUidCounter = iPlayerInfoManager.UidCounterL(iClientId);
+			aResponseData.CreateL(KRegisterNotificationAddressedPlayerResponseSize);
+			CleanupClosePushL(aResponseData);
+			response.WriteL(aResponseData);
+			}
+		}
+	
+	CleanupStack::Pop();
+	}
+
+TInt CRcpIncomingCommandHandler::HandleUidChangedNotification(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+
+	// Although we haven't strictly told the remote which player we're using this is 
+	// a 1.4 command, and implies use of a specific player so switch into addressed mode
+	EnterAddressedMode();
+
+	RBuf8 responseBuf;
+	TUint16 uidCounter = 0;
+	TRAPD(err, uidCounter = iPlayerInfoManager.UidCounterL(iClientId));
+	
+	if(err == KErrNone && !DuplicateNotify(iInternalCommandQueue, aCommand))
+		{
+		TRAP(err, DoHandleUidChangedNotificationL(responseBuf, uidCounter));
+		}
+
+	if(err == KErrNone)
+		{
+		SendInternalResponse(aCommand.RemConCommandId(), responseBuf);
+		}
+
+	responseBuf.Close();
+	return err;
+	}
+
+void CRcpIncomingCommandHandler::DoHandleUidChangedNotificationL(RBuf8& aResponseData, TUint16 aUidCounter)
+	{
+	LOG_FUNC
+
+	RAvrcpUidCounterNotificationResponse response;
+	response.iUidCounter = aUidCounter;
+	aResponseData.CreateL(KRegisterNotificationUidChangedResponseSize);
+	CleanupClosePushL(aResponseData);
+	response.WriteL(aResponseData);
+	CleanupStack::Pop();
+	}
+
+void CRcpIncomingCommandHandler::SendInternalResponse(TUint aId, RBuf8& aData)
+	{
+	LOG_FUNC 
+
+	SendResponse(iInternalCommandQueue, aId, aData);
+	}
+
+/**
+This function always takes responsibility for the response.
+*/
+void CRcpIncomingCommandHandler::SendResponse(TDblQue<CControlCommand>& aCommandQueue, TUint aId, RBuf8& aData)
+	{
+	LOG_FUNC
+	
+	TDblQueIter<CControlCommand> iter(aCommandQueue);
+	CControlCommand* command = NULL;
+
+	while (iter)
+		{
+		command = iter++;
+		if(command->RemConCommandId() == aId)
+			{
+			TInt err = command->ProcessOutgoingResponse(iObserver, aData, *iFragmenter);
+			
+			if(command->Frame().Type() == AVC::ENotify)
+				{
+				// If the interim response was successful then create a new command 
+				// to contain the final response when it arrives.  The same command
+				// cannot be re-used as we may not have finished sending this before
+				// we get the final response.  We won't have both the commands on 
+				// the handling queue at one time though, so there is no ambiguity
+				// about which is which.  We finish handling the interim response here.
+				if(err == KErrNone)
+					{
+					// Try creating the CControlCommand which will be used for the
+					// final response to the Notify.  If it fails then we will just
+					// reject the notify straight away.
+					//
+					// To start with we set its AV/C frame to be an Interim response, 
+					// since this will match the AV/C frame of the original CControlCommand
+					// once we send the interim response later in this function.
+					CControlCommand* finalResponse = NULL;
+					TRAP(err, finalResponse = command->InterimResponseL());
+				
+					if(err == KErrNone)
+						{
+						finalResponse->IncrementUsers();
+						aCommandQueue.AddLast(*finalResponse);
+						}
+					}
+				
+				if(err != KErrNone && command->NormalCommand())
+					{
+					// If we had an unsuucessful interim response, we need to remove the command from remcon
+					iObserver.CommandExpired(aId);
+					}
+				}
+
+			Respond(*command, err);
+			HandledCommand(*command);
+			break;  // Exit while (iter) loop
+			}
+		}
+	
+	// Either we have created a response which took ownership of aData, or
+	// we didn't match a command, so this was a response to something we've
+	// already removed from our queue.  We're telling RemCon that we dealt ok
+	// with this so we have resonsibility for tidying up the data.
+	aData.Close();
+	}
+
+void CRcpIncomingCommandHandler::EnterAddressedMode()
+	{
+	iAddressedMode = ETrue;
+	iCommandInterface.MrccciRegisterForLocalAddressedClientUpdates();
+	}
+
+TBool CRcpIncomingCommandHandler::DuplicateNotify(TDblQue<CControlCommand>& aCommandQueue, const CControlCommand& aCommand) const
+	{
+	TUid interfaceUid = aCommand.RemConInterfaceUid();
+	TUint operationId = aCommand.RemConOperationId();
+	
+	CControlCommand* command = NULL;
+	TDblQueIter<CControlCommand> iter(aCommandQueue);
+	TInt count = 0;
+	TBool duplicate = EFalse;
+	
+	while(iter)
+		{
+		command = iter++;
+		if((interfaceUid == command->RemConInterfaceUid())&&(operationId == command->RemConOperationId()))
+			{
+			count++;
+			// this should be a reject if we've already got a notification outstanding
+			if(count > 1)
+				{
+				duplicate = ETrue;
+				break;
+				}
+			}
+		}
+	
+	return duplicate;
+	}
+
+CControlCommand* CRcpIncomingCommandHandler::FindNotify(TDblQue<CControlCommand>& aCommandQueue, TUid aInterfaceUid, TUint aOperationId)
+	{
+	CControlCommand* command = NULL;
+	TDblQueIter<CControlCommand> iter(aCommandQueue);
+	TBool found = EFalse;
+	
+	while(iter)
+		{
+		command = iter++;
+
+		if((command->RemConInterfaceUid() == aInterfaceUid)&&(command->RemConOperationId() == aOperationId))
+			{
+			found = ETrue;
+			break;
+			}
+		}
+	
+	return found ? command : NULL;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpoutgoingcommandhandler.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,768 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <remconcoreapi.h>
+
+#include "avcpanel.h"
+#include "controlcommand.h"
+#include "avrcpoutgoingcommandhandler.h"
+#include "avrcplog.h"
+#include "avrcprouter.h"
+#include "avrcptimer.h"
+#include "avrcputils.h"
+#include "controlbearer.h"
+
+//---------------------------------------------------------------------
+// Construction/Destruction
+//---------------------------------------------------------------------
+
+/** Factory function.
+
+@param aBearer	The CRemConBearerAvrcp this is to handle commands for.
+@param aObserver The observer of the bearer. Used to aquire converters.
+@param aRouter	A CRcpRouter to use for communication with remote devices.
+@param aTimer	CDeltaTimer to use for queuing timed events.
+@return A fully constructed CRcpOutgoingCommandHandler.
+@leave System wide error codes.
+*/
+CRcpOutgoingCommandHandler* CRcpOutgoingCommandHandler::NewL(MRemConControlCommandInterface& aCommandInterface, 
+	MRemConBearerObserver& aObserver,
+	CRcpRouter& aRouter,
+	CDeltaTimer& aTimer)
+	{
+	LOG_STATIC_FUNC
+	CRcpOutgoingCommandHandler* handler = new(ELeave)CRcpOutgoingCommandHandler(aCommandInterface, aObserver, aRouter, aTimer);
+	return handler;
+	}
+
+/** Constructor.
+
+@param aBearer	The CRemConBearerAvrcp this is to handle commands for.
+@param aObserver The observer of the bearer. Used to aquire converters.
+@param aRouter	A CRcpRouter to use for communication with remote devices.
+@param aTimer	CDeltaTimer to use for queuing timed events.
+@return A partially constructed CRcpIncomingCommandHandler.
+@leave System wide error codes.
+*/		
+CRcpOutgoingCommandHandler::CRcpOutgoingCommandHandler(MRemConControlCommandInterface& aCommandInterface, 
+	MRemConBearerObserver& aObserver,
+	CRcpRouter& aRouter,
+	CDeltaTimer& aTimer) : iCommandQueue(_FOFF(CControlCommand, iHandlingLink)),
+	iNotifyCommandQueue(_FOFF(CControlCommand, iHandlingLink)),
+	iCommandInterface(aCommandInterface), iObserver(aObserver), iRouter(aRouter), iTimer(aTimer)
+	{
+	LOG_FUNC
+	}
+
+/** Destructor.
+*/
+CRcpOutgoingCommandHandler::~CRcpOutgoingCommandHandler()
+	{
+	LOG_FUNC
+
+	ClearQueue(iCommandQueue);
+	ClearQueue(iNotifyCommandQueue);
+	}	
+
+void CRcpOutgoingCommandHandler::ClearQueue(TDblQue<CControlCommand>& aQue)
+	{
+	while(!aQue.IsEmpty())
+		{
+		CControlCommand* command = aQue.First();
+		command->CancelTimer(iTimer);
+		command->iHandlingLink.Deque();
+		command->DecrementUsers();
+		}
+	}
+//---------------------------------------------------------------------
+// Called from the bearer
+//---------------------------------------------------------------------
+
+/** Tell the handler to gracefully shutdown.
+
+@param aClearQueue Whether to clear the queue without handling the things 
+					on it.  If this is true the commands will be deleted.
+					If this is false then pending commands will have responses
+					generated to RemCon.
+*/
+void CRcpOutgoingCommandHandler::Disconnect(TBool aClearQueue)
+	{
+	LOG_FUNC	
+	ProcessDisconnect(iCommandQueue, aClearQueue);
+	ProcessDisconnect(iNotifyCommandQueue, aClearQueue);
+	}
+
+void CRcpOutgoingCommandHandler::ProcessDisconnect(TDblQue<CControlCommand>& aQue, TBool aClearQueue)
+	{
+	while(!aQue.IsEmpty())
+		{
+		CControlCommand* command = aQue.First();
+		iRouter.RemoveFromSendQueue(*command);
+		command->CancelTimer(iTimer);
+		
+		if(aClearQueue)
+			{
+			GenerateFailureResult(*command, KErrDisconnected);
+			}
+
+		command->iHandlingLink.Deque();
+		command->DecrementUsers();
+		}
+	}
+/** Sends a new command.
+
+@param aInterfaceUid	The RemCon client interface this command is from.
+@param aCommand			The operation id within aInterfaceUid.
+@param aId				A unique identifier provided by RemCon.
+@param aCommandData		Data associated with this command.
+@param aAddr			Bluetooth address of device to send this command to.
+@leave KErrNoMemory or system wide error code.
+@leave Command parsing error.
+*/
+void CRcpOutgoingCommandHandler::SendCommandL(TUid aInterfaceUid, 
+		TUint aCommand, 
+		TUint aId,  
+		RBuf8& aCommandData, 
+		const TBTDevAddr& aAddr)
+	{
+	LOG_FUNC
+	
+	if(aInterfaceUid.iUid == KRemConCoreApiUid)
+		{
+		// Passthrough commands are stateful, so we need to examine the
+		// history - we can't just blindly wham it on the queue.
+		HandleCoreApiCommandL(aCommand, aId, aCommandData, aAddr);
+		}
+	else
+		{
+		SendCommandL(aInterfaceUid, aCommand, aId, aCommandData, EFalse, aAddr, ETrue, EFalse);
+		}
+	}
+
+/** Sends a new notify command.
+
+@param aInterfaceUid	The RemCon client interface this command is from.
+@param aCommand			The operation id within aInterfaceUid.
+@param aId				A unique identifier provided by RemCon, the transaction ID.
+@param aCommandData		Data associated with this command.
+@param aAddr			Bluetooth address of device to send this command to.
+@leave KErrNoMemory or system wide error code.
+@leave Command parsing error.
+*/
+void CRcpOutgoingCommandHandler::SendNotifyCommandL(TUid aInterfaceUid, 
+		TUint aCommand, 
+		TUint aId,  
+		RBuf8& aCommandData, 
+		const TBTDevAddr& aAddr)
+	{
+	LOG_FUNC
+	SendCommandL(aInterfaceUid, aCommand, aId, aCommandData, EFalse, aAddr, ETrue, ETrue);
+	}
+	
+//---------------------------------------------------------------------
+// Data notifications from the router
+//---------------------------------------------------------------------
+
+/** Called by the router to provide a new response.
+
+@param aFrame The AV/C frame for this response. Ownership is taken.
+@param aTransLabel The AVCTP transaction id of this response. This is used
+				to match it with its command.
+@param aAddr The remote from which this response originated
+*/
+void CRcpOutgoingCommandHandler::ReceiveResponse(const TDesC8& aMessageInformation, 
+	SymbianAvctp::TTransactionLabel aTransLabel, 
+	TBool aIpidBitSet)
+	{
+	LOG_FUNC
+	
+	CAVCFrame* frame = NULL;
+	TInt err = KErrNone;
+	if(!aIpidBitSet)
+		{
+		TRAP(err, frame = CAVCFrame::NewL(aMessageInformation, AVC::EResponse));
+		}
+	
+	if(!err)
+		{
+		CControlCommand* command = NULL;
+		command = FindInQueue(iCommandQueue, aTransLabel);
+		if ( command != NULL )
+			{
+			//Found, so it is a normal command response.
+			ProcessReceiveResponse(frame, aIpidBitSet, command, EFalse);
+			}
+		else
+			{
+			//Try to find in the notify command queue.
+			command = FindInQueue(iNotifyCommandQueue, aTransLabel);
+			if( command != NULL )
+			    {
+			    //Found, so it is a notify command response.
+			    ProcessReceiveResponse(frame, aIpidBitSet, command, ETrue);
+			    }
+			}
+		
+		delete frame;
+		}
+	}
+
+CControlCommand* CRcpOutgoingCommandHandler::FindInQueue(TDblQue<CControlCommand>& aQue, 
+		SymbianAvctp::TTransactionLabel aTransLabel)
+	{	
+	CControlCommand* command = NULL;
+	TDblQueIter<CControlCommand> iter(aQue);
+	while (iter)
+		{
+		command = iter++;
+		if(command->TransactionLabel() == aTransLabel)
+			{
+			return command;
+			}
+		}
+	
+	return NULL;
+	}
+
+void CRcpOutgoingCommandHandler::ProcessReceiveResponse(CAVCFrame* aFrame, 
+		TBool aIpidBitSet,
+		CControlCommand* aCommand, 
+		TBool aNotify)
+	{
+	aCommand->CancelTimer(iTimer);
+	
+	TInt err = KErrNone;
+	// Inform the bearer if this is something it knows about
+	// ie not a click release
+	if(aCommand->KnownToBearer())
+		{
+		if(!aIpidBitSet)
+			{
+			if(aFrame->Data().Length() < KAVCFrameHeaderLength)
+				{
+				// Drop corrupt frames
+				return;
+				}
+
+			err = aCommand->ParseIncomingResponse(iObserver, *aFrame);
+			}
+		else
+			{
+			// If aIpidBitSet is true that means AVRCP is not supported
+			// by the remote end.  We handle this in the same way as not
+			// supported commands, passing them up to RemCon as not 
+			// supported, so just map the ctype here, rather than setting
+			// up another path for ipid handling, but we need pass as the
+			// frame the original because we don't get one from AVCTP if
+			// ipid is set.
+			aCommand->SetResponseType(KErrNotSupported);
+			err = aCommand->ParseIncomingResponse(iObserver, aCommand->Frame());
+			}
+		
+		if ( aNotify )
+		    {//This is a notify command
+		    iCommandInterface.MrccciNewNotifyResponse(*aCommand);
+		    }
+		else
+			{
+			iCommandInterface.MrccciNewResponse(*aCommand);
+			}
+		}
+
+	TBool doDeque = ETrue;
+	if ( (!aIpidBitSet) && (err == KErrNone) && (aNotify) && (aFrame->Type() == AVC::EInterim))
+		{
+		doDeque = EFalse;
+		}
+	
+	// If this a passthrough press that hasn't yet been released, we need 
+	// to wait for a release before getting rid of this, otherwise we're done.
+	if(aCommand == iUnreleasedCommand)
+		{
+		iUnreleasedHasResponse = ETrue;
+		StartReleaseTimer(*iUnreleasedCommand);
+		doDeque = EFalse;
+		}
+	
+	if ( doDeque )
+		{
+		aCommand->iHandlingLink.Deque();
+		aCommand->DecrementUsers();
+		}
+	}
+/** Called by the router to complete a send.
+
+@param aCommand The command which has been sent.
+@param aSendResult The result of the send. KErrNone if successful.
+*/	
+void CRcpOutgoingCommandHandler::MessageSent(CAvrcpCommand& aCommand, TInt aSendResult)
+	{
+	LOG_FUNC
+	
+	if(aSendResult == KErrNone)
+		{
+		// Set off response timer
+		StartResponseTimer(static_cast<CControlCommand&>(aCommand));
+		}
+	else
+		{
+		CControlCommand* command = FindInQueue(iNotifyCommandQueue, aCommand.TransactionLabel());
+		
+		if(command)
+			{
+			command->SetNotifyVolumeChangeResult(command->Frame());
+			iCommandInterface.MrccciNewNotifyResponse(*command);
+			}
+		else
+			{
+			command = FindInQueue(iCommandQueue, aCommand.TransactionLabel());
+			
+			// Generate error response up to RemCon
+			// if this is a core command we can set the result, 
+			// otherwise we just return it as we got it.
+			if(command->Frame().Opcode() == AVC::EPassThrough)
+				{
+				// Need to insert before setting the button action so we have
+				// long enough data
+				if (!command->InsertCoreResult(aSendResult))
+					{
+					if(command->Click())
+						{
+						command->SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue);
+						}
+					}
+				}
+			
+			iCommandInterface.MrccciNewResponse(*command);
+			}
+		
+		command->iHandlingLink.Deque();
+		command->DecrementUsers();
+		}
+	}
+
+//---------------------------------------------------------------------
+// Internal Utility functions
+//---------------------------------------------------------------------
+
+void CRcpOutgoingCommandHandler::CleanupUnreleased()
+	{
+	iUnreleasedCommand->CancelTimer(iTimer);
+	iUnreleasedCommand->iHandlingLink.Deque();
+	iUnreleasedCommand->DecrementUsers();
+	iUnreleasedHasResponse = EFalse;
+	}
+	
+/** Handle a command that is part of the Core API.
+
+@param aCommand			The operation id within aInterfaceUid.
+@param aId				A unique identifier provided by RemCon.
+@param aCommandData		Data associated with this command.
+@param aAddr			Bluetooth address of device to send this command to.
+@leave KErrNoMemory or system wide error code.
+@leave Command parsing error.
+*/
+void CRcpOutgoingCommandHandler::HandleCoreApiCommandL(TUint aCommand, 
+		TUint aId,  
+		RBuf8& aCommandData, 
+		const TBTDevAddr& aAddr)
+	{
+	if(aCommandData.Length() < KRemConCoreApiButtonDataLength)
+   		{
+   		User::Leave(KErrCorrupt);
+   		}
+
+	TInt buttonData;
+	AvrcpUtils::ReadCommandDataToInt(aCommandData, 
+   		KRemConCoreApiButtonDataOffset, KRemConCoreApiButtonDataLength, buttonData);
+ 
+ 	// First check if there's anything we need to do before sending this command,
+ 	// mainly releasing a previous press.  	
+	if(iUnreleasedCommand)
+		{
+		TUint prevOpId = iUnreleasedCommand->RemConOperationId();
+		
+		if(aCommand == prevOpId)
+			{
+			// Either we've received a release, or we've refreshed the press.
+			// If the unreleased press has already been responded too we can
+			// dispose of it now.  
+			// If the unreleased press has not been responded too we can 
+			// treat it like a normal command on reception of response, so just
+			// set iUnreleased to NULL.
+			if(iUnreleasedHasResponse)
+				{
+				CleanupUnreleased();
+				}
+
+			iUnreleasedCommand = NULL;
+			}
+		else
+			{
+			// A new operation!
+			if(buttonData != ERemConCoreApiButtonRelease)
+				{
+				// Try and generate the release for the previous command, if
+				// if fails then the remote will just have to assume it.
+				// There's no point leaving this to the release timer, because
+				// we want to send another command now, so even if we send the
+				// release later the remote should ignore it.
+				TRAP_IGNORE(GenerateCommandL(*iUnreleasedCommand, ERemConCoreApiButtonRelease));
+				
+				if(iUnreleasedHasResponse)
+					{
+					CleanupUnreleased();
+					}
+
+				iUnreleasedCommand = NULL;
+				}
+			else
+				{
+				// A release for a command other than iUnreleased.  We can't 
+				// send this now.
+				User::Leave(KErrNotReady);
+				}
+			}
+		}
+	else if(buttonData == ERemConCoreApiButtonRelease)
+		{
+		// We don't have an unreleased command.  We must have already 
+		// released this, either via the timer, or because we've sent
+		// another command in the meantime.  We can't send this now.
+		// Leaving synchronously means we don't need to worry about generating
+		// a fake response, which may mislead the application.
+		User::Leave(KErrNotReady);
+		}
+   	
+   	if(buttonData == ERemConCoreApiButtonClick)
+   		{	
+		// aCommandData is still owned by RemCon until we return successfully.
+		// If we try the operations with the new data first we won't end up 
+		// in a situation where the new CControlCommand thinks that it owns 
+		// aCommandData, then the release operation leaves, so RemCon also
+		// thinks it owns aCommandData.
+		
+		RBuf8 pressBuf;
+		pressBuf.CreateL(aCommandData);
+		CleanupClosePushL(pressBuf);
+		
+		AvrcpUtils::SetCommandDataFromInt(pressBuf, 
+			KRemConCoreApiButtonDataOffset, KRemConCoreApiButtonDataLength, ERemConCoreApiButtonPress);
+		SendCommandL(TUid::Uid(KRemConCoreApiUid), aCommand, aId, pressBuf, ETrue, aAddr, ETrue, EFalse);
+		
+		// Data has been taken ownership of by SendCommandL, so can just let 
+		// pressbuf go out of scope.
+		CleanupStack::Pop(&pressBuf);
+		
+		AvrcpUtils::SetCommandDataFromInt(aCommandData, 
+			KRemConCoreApiButtonDataOffset, KRemConCoreApiButtonDataLength, ERemConCoreApiButtonRelease);
+		SendCommandL(TUid::Uid(KRemConCoreApiUid), aCommand, aId, aCommandData, ETrue, aAddr, EFalse, EFalse);
+		}
+	else if(buttonData == ERemConCoreApiButtonPress)
+		{
+		iUnreleasedCommand = &SendCommandL(TUid::Uid(KRemConCoreApiUid), aCommand, aId, aCommandData, EFalse, aAddr, ETrue, EFalse);
+		iReleaseTimerExpiryCount = 0;
+		}
+	else
+		{
+		// Must be release
+		__ASSERT_DEBUG(buttonData == ERemConCoreApiButtonRelease, AvrcpUtils::Panic(EAvrcpUnknownButtonAction));
+		SendCommandL(TUid::Uid(KRemConCoreApiUid), aCommand, aId, aCommandData, EFalse, aAddr, ETrue, EFalse);
+		}
+	}
+
+/** Creates a command from the RemCon data.
+
+This is an internal utility function.
+
+A CControlCommand will be created.  Calling ProcessOutgoingCommandL on
+this creates a CAVCFrame from the provided data.  If an AV/C frame
+can be created the command will be added to the outgoing queue to
+wait a response from the remote.  Otherwise this function will
+leave.
+
+@param aInterfaceUid	The RemCon client interface this command is from.
+@param aCommand			The operation id within aInterfaceUid.
+@param aId				A unique identifier provided by RemCon.
+@param aCommandData		Data associated with this command.
+@param aIsClick			Whether this is a button click.
+@param aAddr			Bluetooth address of device to send this command to.
+@return The generated command.
+@leave KErrNoMemory or system wide error code.
+@leave Command parsing error.
+*/
+CControlCommand& CRcpOutgoingCommandHandler::SendCommandL(TUid aInterfaceUid,
+	TUint aCommand, 
+	TUint aId, 
+	RBuf8& aCommandData, 
+	TBool aIsClick, 
+	const TBTDevAddr& aAddr,
+	TBool aKnownToBearer,
+	TBool aNotify)
+	{
+	LOG_FUNC
+	// Create a command and wham it on our queue, so we can match it up with its response
+	// CControlCommand::NewL takes ownership of the data in aCommandData then NULLs aCommandData
+	// so a leave later in the function won't cause double deletion.
+	CControlCommand* command = CControlCommand::NewL(aInterfaceUid, aCommand, aId, iCurrentTrans, 
+			aCommandData, aIsClick, aAddr, aKnownToBearer);
+	CleanupStack::PushL(command);	
+	
+	command->ProcessOutgoingCommandL(iObserver);
+	CleanupStack::Pop(command);
+	command->IncrementUsers();
+	
+	if ( aNotify )
+		{
+		iNotifyCommandQueue.AddLast(*command);
+		}
+	else
+		{
+		iCommandQueue.AddLast(*command);
+		}
+	
+	// Increment our transaction id
+	iCurrentTrans = (iCurrentTrans + 1) % SymbianAvctp::KMaxTransactionLabel;
+	
+	// Command stays on the queue till we've got the response
+	iRouter.AddToSendQueue(*command);
+	
+	return *command;
+	}
+
+/** Generate a failure response to RemCon.
+
+This sets the result for a passthrough command.
+It informs the bearer of the new response.
+
+@param aCommand The command to finish off.
+@param aResult The result (only valid for passthrough)
+*/
+void CRcpOutgoingCommandHandler::GenerateFailureResult(CControlCommand& aCommand, TInt aResult)
+	{
+	// Response is only necessary if the bearer knows about this command.
+	if(aCommand.KnownToBearer() && (aCommand.Frame().Opcode() == AVC::EPassThrough))
+		{
+		if (aCommand.InsertCoreResult(aResult) == KErrNone)
+			{
+			if(aCommand.Click())
+				{
+				aCommand.SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue);
+				}
+			else if(aCommand.ButtonAct() == AVCPanel::EButtonPress)
+				{
+				aCommand.SetCoreButtonAction(ERemConCoreApiButtonPress, ETrue);
+				}
+			else
+				{
+				aCommand.SetCoreButtonAction(ERemConCoreApiButtonRelease, ETrue);
+				}
+
+			iCommandInterface.MrccciNewResponse(aCommand);
+           }
+		}	
+	}
+	
+/** Generate a command to the remote.
+
+This is needed in situations where the application has not met the avrcp
+button refresh requirements so we need to internally generate something
+to stop the remote getting a bad impression of us.
+
+@param aCommand The command to be issue again.
+*/
+void CRcpOutgoingCommandHandler::GenerateCommandL(CControlCommand& aCommand, TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC
+	
+	RBuf8 commandData;
+	commandData.CreateMaxL(KRemConCoreApiButtonDataLength);
+	
+	AvrcpUtils::SetCommandDataFromInt(commandData, 
+		KRemConCoreApiButtonDataOffset, KRemConCoreApiButtonDataLength, aButtonAct);
+
+	// This will not leave before taking ownership of commandData.
+	SendCommandL(aCommand.RemConInterfaceUid(), aCommand.RemConOperationId(), aCommand.RemConCommandId(), commandData, EFalse, 
+		aCommand.RemoteAddress(), EFalse, EFalse);
+	}
+
+//------------------------------------------------------------------------------------
+// Timer functions
+//------------------------------------------------------------------------------------
+
+/** Starts the response timer.
+
+AVRCP mandates a remote respond within 100ms of receiving a command.
+This is the timer for that, and is started when a command has 
+successfully been sent.
+
+@param aCommand The command to start the timer for.
+*/		
+void CRcpOutgoingCommandHandler::StartResponseTimer(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	// These use placement new, so cannot fail
+	TAvrcpTimerExpiryInfo* timerInfo = new(aCommand.TimerExpiryInfo())TAvrcpTimerExpiryInfo(this, aCommand);
+
+	TCallBack callback(ResponseExpiry, timerInfo);
+	TDeltaTimerEntry* timerEntry = new(aCommand.TimerEntry())TDeltaTimerEntry(callback);
+	
+	iTimer.Queue(KRcpResponseTimeOut, *timerEntry);
+	}
+	
+/** Callback when response timer expires.
+
+This is a static forwarding function.
+
+@param aExpiryInfo The information used by the real ResponseExpiry to
+					deal with the timer expiry.
+*/
+TInt CRcpOutgoingCommandHandler::ResponseExpiry(TAny* aExpiryInfo)
+	{
+	LOG_STATIC_FUNC
+	TAvrcpTimerExpiryInfo *timerInfo = reinterpret_cast<TAvrcpTimerExpiryInfo*>(aExpiryInfo);
+	(reinterpret_cast<CRcpOutgoingCommandHandler*>(timerInfo->iHandler))->ResponseExpiry(timerInfo->iCommand);
+	
+	return KErrNone;
+	}
+	
+/** Deals with response timeout.
+
+This sends a timeout response to RemCon.
+
+@param aCommand	The CControlCommand that has expired.
+*/
+void CRcpOutgoingCommandHandler::ResponseExpiry(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	
+	GenerateFailureResult(aCommand, KErrTimedOut);	
+	
+	// Failed to get a response to this, don't bother about trying
+	// to release it.
+	if(iUnreleasedCommand == &aCommand)
+		{
+		iUnreleasedCommand = NULL;
+		__ASSERT_DEBUG(!iUnreleasedHasResponse, AvrcpUtils::Panic(EAvrcpPressHasPhantomResponse));
+		}
+
+	aCommand.iHandlingLink.Deque();
+	aCommand.DecrementUsers();
+	}
+
+/** Starts the release timer.
+
+AVRCP requires a press to be refreshed less than 2s after the first
+press, if it is not to be assumed to have been released.  We pass 
+this requirement on to RemCon clients as we don't know when they might
+go away and we don't want to keep buttons pressed forever.  If the 
+release timer expires we will assume a release, and generate it to
+the remote.
+
+@param aCommand The command to start the timer for.
+*/	
+void CRcpOutgoingCommandHandler::StartReleaseTimer(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+
+	// These cannot fail as we use placement new
+	TAvrcpTimerExpiryInfo* timerInfo = new(aCommand.TimerExpiryInfo())TAvrcpTimerExpiryInfo(this, aCommand);
+		
+	TCallBack callback(ReleaseExpiry, timerInfo);
+	TDeltaTimerEntry* timerEntry = new(aCommand.TimerEntry())TDeltaTimerEntry(callback);
+
+	iTimer.Queue(KRcpOutgoingButtonReleaseTimeout, *timerEntry);
+	}
+
+/** Callback when release timer expires.
+
+This is a static forwarding function.
+
+@param aExpiryInfo The information used by the real ReleaseExpiry to
+					deal with the timer expiry.
+*/	
+TInt CRcpOutgoingCommandHandler::ReleaseExpiry(TAny* aExpiryInfo)
+	{
+	LOG_STATIC_FUNC
+	TAvrcpTimerExpiryInfo *timerInfo = reinterpret_cast<TAvrcpTimerExpiryInfo*>(aExpiryInfo);
+	(reinterpret_cast<CRcpOutgoingCommandHandler*>(timerInfo->iHandler))->ReleaseExpiry(timerInfo->iCommand);
+	
+	return KErrNone;
+	}
+
+/** Deals with expiry of release timer.
+
+1) Generate release for this command.
+2) Send release to remote.
+
+@param aCommand	The CControlCommand that has expired.
+*/
+void CRcpOutgoingCommandHandler::ReleaseExpiry(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	__ASSERT_DEBUG((aCommand.ButtonAct() == AVCPanel::EButtonPress), AvrcpUtils::Panic(EAvrcpReleaseExpiryForRelease));
+	__ASSERT_DEBUG(&aCommand == iUnreleasedCommand, AvrcpUtils::Panic(EAvrcpReleaseExpiryForOldCommand));
+	__ASSERT_DEBUG(iUnreleasedHasResponse, AvrcpUtils::Panic(EAvrcpReleaseTimerStartedWithoutResponse));
+		
+	iReleaseTimerExpiryCount++;
+	
+	TBool commandCompleted = ETrue;
+	// If the client is not yet obliged to refresh this, then send another press.  Otherwise generate
+	// the release for them.
+	if((iReleaseTimerExpiryCount * KRcpOutgoingButtonReleaseTimeout) < KRemConCoreApiPressRefreshInterval)
+		{
+		// This will try and generate a press that is identical to the original
+		// aCommand, but with a new AVCTP transaction id.
+		TRAPD(err, GenerateCommandL(aCommand, ERemConCoreApiButtonPress));
+		
+		if(!err)
+			{
+			// Start the timer again on the original command
+			StartReleaseTimer(aCommand);
+			commandCompleted = EFalse;
+			}
+		}
+	else
+		{
+		// Try an generate a release, but if it fails we just have to let the 
+		// remote assume it.
+		TRAP_IGNORE(GenerateCommandL(aCommand, ERemConCoreApiButtonRelease));
+		}
+		
+	// This condition may be true because
+	// -  we have failed to generate a press, in which case the remote is entitled 
+	//    to assume this is released, so we just give up on it.
+	// or
+	// -  the client has not met its press refresh obligation (whether we've 
+	//    successfully generated a release or not.
+	// In either case we won't do anything more with this command. 
+	if(commandCompleted)
+		{				
+		aCommand.iHandlingLink.Deque();
+		aCommand.DecrementUsers();
+		
+		iUnreleasedCommand = NULL;
+		iUnreleasedHasResponse = EFalse;
+		iReleaseTimerExpiryCount = 0;
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,883 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <avctpservices.h> // for AVCTP protocol version
+#include <bt_sock.h> // for PSM values
+#include <remcon/clientid.h>
+#include <absolutevolumeapi.h>
+#include <remcon/remconbearerbulkobserver.h>
+
+#include "avrcp.h"
+#include "avrcpplayerinfomanager.h"
+#include "avrcpsdputils.h"
+#include "playerbitmasks.h"
+#include "avrcputils.h"
+#include "avrcplog.h"
+#include "mediabrowse.h"
+#include "nowplaying.h"
+#include "playerinformation.h"
+#include "remcongroupnavigation.h"
+
+#ifdef _DEBUG
+PANICCATEGORY("playerinfo");
+#endif // _DEBUG
+
+static TBool PlayerCompare(const TRemConClientId* aId, const TAvrcpMediaPlayerItem& aItem)
+	{
+	LOG_STATIC_FUNC
+	return (aId && *aId == aItem.iId);
+	}
+
+enum TFirstAbsVolSupport { EFirstAbsVolSupport };
+static TBool FirstAbsVolSupport(const TFirstAbsVolSupport*, const TAvrcpMediaPlayerItem& aItem)
+	{
+	LOG_STATIC_FUNC
+	return aItem.iId != KNullClientId && aItem.iAbsoluteVolumeSupport;
+	}
+
+enum TFirstBrowsingSupport { EFirstBrowsingSupport };
+static TBool FirstBrowsingSupport(const TFirstBrowsingSupport*, const TAvrcpMediaPlayerItem& aItem)
+	{
+	LOG_STATIC_FUNC
+	return aItem.iId != KNullClientId && (aItem.iSdpFeatures & AvrcpSdp::EBrowsing);
+	}
+
+CAvrcpPlayerInfoManager* CAvrcpPlayerInfoManager::NewL(MRemConBearerObserver& aObserver, MRemConCommandInterface& aCommandInterface)
+	{
+	LOG_STATIC_FUNC
+	CAvrcpPlayerInfoManager* info = new(ELeave) CAvrcpPlayerInfoManager(aObserver);
+	CleanupStack::PushL(info);
+	info->ConstructL(aCommandInterface);
+	CleanupStack::Pop(info);
+	return info;
+	}
+
+void CAvrcpPlayerInfoManager::ConstructL(MRemConCommandInterface& aCommandInterface)
+	{
+	LOG_FUNC
+	LEAVEIFERRORL(iLock.CreateLocal());
+	LEAVEIFERRORL(iSdp.Connect());
+	LEAVEIFERRORL(iSdpDatabase.Open(iSdp));
+	
+	iPlayStatusWatcher = CPlayStatusWatcher::NewL(*this, aCommandInterface);
+	
+	TCallBack cb(PlayerUpdateCallBack, this);
+	iControlThreadCallBack.Create(cb, CActive::EPriorityStandard);
+	iControlThreadCallBack.Start();
+	}
+
+CAvrcpPlayerInfoManager::~CAvrcpPlayerInfoManager()
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+	iLock.Wait();// serialise access...
+	iLock.Close();
+	delete iPlayStatusWatcher;
+	ASSERT_DEBUG(!iUidWatcher); // created in bulk thread context...
+	iControlThreadCallBack.Close();
+	iObservers.Close();
+	iPlayers.Close();
+	iSdpDatabase.Close();
+	iSdp.Close();
+	}
+
+CAvrcpPlayerInfoManager::CAvrcpPlayerInfoManager(MRemConBearerObserver& aObserver)
+	: iControlBearerObserver(aObserver)
+	{
+	LOG_FUNC
+	}
+
+/**
+This function sets up the handling in the bulk thread.  This involves creating the 
+player state watcher, which maintains an up to date view of the UID counter values
+for each player with a bulk interface.  It does this by acting as an internal
+command handler.  The bulk bearer expects the player info manager to provide it
+with a command handling interface for commands on internal interfaces, so we provide
+it with the interface for the state watcher, which is where all our internal commands
+come from.
+*/
+MIncomingCommandHandler* CAvrcpPlayerInfoManager::BulkStartedL(MRemConCommandInterface& aCommandInterface)
+	{
+	LOG_FUNC;
+	ASSERT_BULK_THREAD;
+
+	iUidWatcher = CUidWatcher::NewL(*this, aCommandInterface);
+	return iUidWatcher;
+	}
+
+void CAvrcpPlayerInfoManager::BulkStopped()
+	{
+	LOG_FUNC;
+	ASSERT_BULK_THREAD;
+	delete iUidWatcher;
+	iUidWatcher = NULL;
+	}
+
+// Helper function for ClientAvailable and TargetFeaturesUpdated
+TInt CAvrcpPlayerInfoManager::SetItemDetails(TAvrcpMediaPlayerItem& aItem, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName)
+	{
+	aItem.iPlayerType = aPlayerType;
+	aItem.iPlayerSubType = aPlayerSubType;
+	aItem.iName.Set(aName);
+	aItem.iFeatureBitmask = TPlayerFeatureBitmask();
+	return SetPlayerFeatures(aItem.iId, aItem.iFeatureBitmask, aItem.iSdpFeatures, aItem.iAbsoluteVolumeSupport);
+	}
+
+// Helper function for ClientAvailable and TargetFeaturesUpdated
+void CAvrcpPlayerInfoManager::UpdateTargetSdpRecord()
+	{
+	// Update SDP record, if this fails we carry on, it's non-fatal
+	TInt sdpErr = KErrNone;
+	if(!iTargetRecord)
+		{
+		TRAP(sdpErr, AvrcpSdpUtils::CreateTargetServiceRecordL(iSdpDatabase, iTargetRecord));
+		}
+	if(sdpErr == KErrNone)
+		{
+		TRAP_IGNORE(UpdateTgServiceRecordL());
+		}
+	}
+
+void CAvrcpPlayerInfoManager::ClientAvailable(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName)
+	{
+	LOG_FUNC;
+	ASSERT_CONTROL_THREAD;
+	iLock.Wait();
+	// Add this to our client list, using any holes in the client id array
+	TInt index = NextPlayerIndex();
+	if(index < 0)
+		{
+		// Couldn't allocate memory to store this player, remote will just
+		// have to make do with the current set
+		iLock.Signal();
+		return;
+		}
+	
+	TAvrcpMediaPlayerItem& item = iPlayers[index];
+	item.iId = aId;
+	item.iBulkClientAvailable = EFalse;
+	item.iUidCounter = 0;
+	item.iLastUpdatedUidCounter = 0;
+	item.iPlaybackStatus = MPlayerEventsObserver::EStopped;
+	TInt err = SetItemDetails(item, aPlayerType, aPlayerSubType, aName);
+
+	// Release lock before calling out of player info manager in case
+	// anyone needs to call back in - we're finished updating the
+	// info now.
+	iLock.Signal();
+
+	if(!err)
+		{
+		TRAP(err, iPlayStatusWatcher->StartWatchingPlayerL(aId));
+		if(!err)
+			{
+			UpdateTargetSdpRecord();
+		     for(TInt i = 0; i<iObservers.Count(); i++)
+				{
+				iObservers[i]->MpcoAvailablePlayersChanged();
+				}
+			}
+		  else    
+			{
+			iLock.Wait();
+			// We know that the player array is only modified from the control thread
+			// so it's valid to use index now even though coverity thinks its stale
+			// coverity[use]
+			iPlayers[index].iId = KNullClientId;
+			iLock.Signal();
+			}
+		}
+	}
+
+void CAvrcpPlayerInfoManager::ClientNotAvailable(const TRemConClientId& aId)
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+	iLock.Wait();
+	TInt index = iPlayers.Find(aId, PlayerCompare);
+	if(index < 0)
+		{
+		// May not be here if we couldn't allocate memory to store this
+		// when we were first told about it
+		iLock.Signal();
+		return;
+		}
+	
+	iPlayStatusWatcher->StopWatchingPlayer(aId);
+	iPlayers[index].iId = KNullClientId;
+	
+	//Release lock as soon as we've stopped fiddling
+	iLock.Signal();
+	
+	for(TInt i = 0; i<iObservers.Count(); i++)
+		{
+		iObservers[i]->MpcoAvailablePlayersChanged();
+		}
+	
+	// Don't put requirement on ordering of ClientNotAvailable/ClientStatus calls
+	if(iTargetRecord)
+		{
+		TRAP_IGNORE(UpdateTgServiceRecordL());
+		}
+	}
+
+void CAvrcpPlayerInfoManager::ClientStatus(TBool aControllerPresent, TBool aTargetPresent)
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+	// SDP only used in the control thread
+	
+	//If we have gone from 1->0 on either of these we can remove the record now,
+	// otherwise wait for more detail on ClientAvailable or ControllerFeaturesUpdatedL
+	if(!aControllerPresent && iControllerRecord)
+		{
+		iSdpDatabase.DeleteRecord(iControllerRecord);
+		iControllerRecord = 0;
+		}
+			
+	if(!aTargetPresent && iTargetRecord)
+		{
+		iSdpDatabase.DeleteRecord(iTargetRecord);
+		iTargetRecord = 0;
+		}
+	}
+
+TInt CAvrcpPlayerInfoManager::SetLocalAddressedClient(const TRemConClientId& aId)
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+
+	TUint16 playerId = 0;
+	TRAPD(err, playerId = PlayerL(aId));
+	static_cast<void>(playerId==playerId); // We only want to check if the bearer knows about the client.
+	if(err == KErrNone)
+		{
+		for(TInt i = 0; i<iObservers.Count(); i++)
+			{
+			iObservers[i]->MpcoAddressedPlayerChangedLocally(aId);
+			}
+		}
+	
+	return err;
+	}
+
+void CAvrcpPlayerInfoManager::ControllerFeaturesUpdatedL(RArray<TUid>& aSupportedInterfaces)
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+	// SDP only used in the control thread
+
+	TUint16 avrcpVersion = AvrcpSdp::KAvrcpProfileVersion13; 
+	TUint16 avctpVersion = AvrcpSdp::KAvctpProtocolVersion12; 
+
+	if(aSupportedInterfaces.Find(TUid::Uid(KRemConAbsoluteVolumeControllerApiUid)) >= 0)
+		{
+		avrcpVersion = AvrcpSdp::KAvrcpProfileVersion14;
+		avctpVersion = AvrcpSdp::KAvctpProtocolVersion13;
+		}
+
+	if(!iControllerRecord)
+		{
+		AvrcpSdpUtils::CreateControllerServiceRecordL(iSdpDatabase, iControllerRecord, avrcpVersion);
+		}
+	else
+		{
+		AvrcpSdpUtils::UpdateControllerServiceClassListL(iSdpDatabase, iControllerRecord, avrcpVersion);
+		}
+
+	AvrcpSdpUtils::UpdateProtocolDescriptorListL(iSdpDatabase, iControllerRecord, avctpVersion);
+	AvrcpSdpUtils::UpdateProfileDescriptorListL(iSdpDatabase, iControllerRecord, avrcpVersion);
+	AvrcpSdpUtils::UpdateSupportedFeaturesL(iSdpDatabase, iControllerRecord, AvrcpSdp::ERemoteControl, AvrcpSdp::KAvrcpBaseCtFeatures);
+	}
+
+void CAvrcpPlayerInfoManager::TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName)
+	{
+	LOG_FUNC;
+	ASSERT_CONTROL_THREAD;
+	iLock.Wait();
+	// Find this client in our client list
+	TInt index = iPlayers.Find(aId, PlayerCompare);
+	if(index < 0)
+		{
+		// Couldn't find client in client list, maybe we removed it after an earlier failure
+		iLock.Signal();
+		return;
+		}
+
+	TAvrcpMediaPlayerItem& item = iPlayers[index];
+	TInt err = SetItemDetails(item, aPlayerType, aPlayerSubType, aName);
+
+	if(!err)
+		{
+		UpdateTargetSdpRecord();
+		}
+	else
+		{
+		// There was an error updating the features so remove this client from the client list
+		iPlayers[index].iId = KNullClientId;
+		}
+
+	// Release lock before calling out of player info manager in case
+	// anyone needs to call back in - we're finished updating the
+	// info now.
+	iLock.Signal();
+
+	for(TInt i = 0; i<iObservers.Count(); i++)
+		{
+		iObservers[i]->MpcoAvailablePlayersChanged();
+		}
+	}
+
+MIncomingCommandHandler& CAvrcpPlayerInfoManager::InternalCommandHandler()
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+
+	return *iPlayStatusWatcher;
+	}
+
+void CAvrcpPlayerInfoManager::BulkClientAvailable(const TRemConClientId& aId)
+	{
+	LOG_FUNC
+	ASSERT_BULK_THREAD
+	iLock.Wait();
+	TInt index = iPlayers.Find(aId, PlayerCompare);
+	if(index < 0)
+		{
+		iLock.Signal();
+		return;
+		}
+	ASSERT(!iPlayers[index].iBulkClientAvailable);
+	
+	TRAPD(err, iUidWatcher->StartWatchingPlayerL(aId));
+	
+	if(!err)
+		{
+		iPlayers[index].iBulkClientAvailable = ETrue;
+		}
+	
+	iLock.Signal();
+	}
+
+void CAvrcpPlayerInfoManager::BulkClientNotAvailable(const TRemConClientId& aId)
+	{
+	LOG_FUNC
+	ASSERT_BULK_THREAD
+	iLock.Wait();
+	TInt index = iPlayers.Find(aId, PlayerCompare);
+	if(index >= 0)
+		{
+		ASSERT(iPlayers[index].iBulkClientAvailable);
+		iPlayers[index].iBulkClientAvailable = EFalse;
+		}
+	iLock.Signal();
+	iUidWatcher->StopWatchingPlayer(aId);
+	}
+
+void CAvrcpPlayerInfoManager::AddObserverL(MPlayerChangeObserver& aObserver)
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+	iObservers.AppendL(&aObserver);
+	}
+
+void CAvrcpPlayerInfoManager::RemoveObserver(MPlayerChangeObserver& aObserver)
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+	TInt index = iObservers.Find(&aObserver);
+	if(index >= 0)
+		{
+		iObservers.Remove(index);
+		}
+	}
+
+TRemConClientId CAvrcpPlayerInfoManager::ClientL(TUint16 aAvrcpPlayerId) const
+	{
+	LOG_FUNC
+	// THREAD - Bulk and Control
+	
+	iLock.Wait();
+	CleanupSignalPushL(iLock);
+	
+	TRemConClientId clientId = KNullClientId;
+	if(ValidPlayer(aAvrcpPlayerId))
+		{
+		clientId = iPlayers[aAvrcpPlayerId].iId;
+		}
+	else
+		{
+		LEAVEL(KErrNotFound);
+		}
+	
+	CleanupStack::PopAndDestroy(&iLock);
+	
+	return clientId;
+	}
+
+TRemConClientId CAvrcpPlayerInfoManager::Client(TUint16 aAvrcpPlayerId) const
+	{
+	LOG_FUNC
+	// THREAD - Bulk and Control
+	
+	iLock.Wait();
+	
+	TRemConClientId clientId = KNullClientId;
+	__ASSERT_DEBUG(ValidPlayer(aAvrcpPlayerId), AvrcpUtils::Panic(EInvalidPlayerId));
+	
+	clientId = iPlayers[aAvrcpPlayerId].iId;
+	
+	iLock.Signal();
+	return clientId;
+	}
+
+TUint16 CAvrcpPlayerInfoManager::PlayerL(const TRemConClientId& aClientId) const
+	{
+	LOG_FUNC
+	// THREAD - Bulk and Control
+	
+	iLock.Wait();
+	
+	TUint16 player = 0;
+	TBool found = EFalse;
+	for(TInt i = 0; i < iPlayers.Count(); i++)
+		{
+		if(PlayerCompare(&aClientId, iPlayers[i]))
+			{
+			player = i;
+			found = ETrue;
+			}
+		}
+
+	iLock.Signal();
+	
+	if(!found)
+		{
+		LEAVEL(KErrNotFound);
+		}
+	
+	return player;
+	}
+
+TInt CAvrcpPlayerInfoManager::PlayerListing(TUint aStartItem, TUint aEndItem, RArray<TUint>& aPlayers)
+	{
+	LOG_FUNC
+	ASSERT_BULK_THREAD
+
+	if(aStartItem > aEndItem)
+		{
+		return KErrArgument;
+		}
+	
+	iLock.Wait();
+	if(aStartItem >= iPlayers.Count())
+		{
+		iLock.Signal();
+		return KErrArgument;
+		}
+	
+	TInt err = KErrNone;
+	for(TUint i = aStartItem; i <= aEndItem && i < iPlayers.Count() && err == KErrNone; i++)
+		{
+		if(iPlayers[i].iId != KNullClientId)
+			{
+			err = aPlayers.Append(i);
+			}
+		}
+	
+	iLock.Signal();
+	return err;
+	}
+
+TInt CAvrcpPlayerInfoManager::PlayerListing(RArray<TUint>& aPlayers)
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+	iLock.Wait();
+	TInt err = KErrNone;
+	for(TInt i = 0; i < iPlayers.Count() && err == KErrNone; i++)
+		{
+		if(iPlayers[i].iId != KNullClientId)
+			{
+			err = aPlayers.Append(i);
+			}
+		}
+	
+	iLock.Signal();
+	return err;
+	}
+
+void CAvrcpPlayerInfoManager::MediaPlayerItemL(const TUint16& aAvrcpPlayerId, RMediaPlayerItem& aItem)
+	{
+	LOG_FUNC
+	ASSERT_BULK_THREAD
+	iLock.Wait();
+	CleanupSignalPushL(iLock);
+	
+	if(ValidPlayer(aAvrcpPlayerId))
+		{
+		aItem.iType = AvrcpBrowsing::EMediaPlayer;
+		aItem.iPlayerId = aAvrcpPlayerId;
+		aItem.iPlayerType = iPlayers[aAvrcpPlayerId].iPlayerType;
+		aItem.iPlayerSubType = iPlayers[aAvrcpPlayerId].iPlayerSubType;
+		aItem.iPlayStatus = iPlayers[aAvrcpPlayerId].iPlaybackStatus;
+		aItem.iFeatureBitmask = iPlayers[aAvrcpPlayerId].iFeatureBitmask.FeatureBitmask();
+		aItem.iCharset = KUtf8MibEnum;
+		aItem.iNameLength = iPlayers[aAvrcpPlayerId].iName.Length();
+		// Takes a copy of media player name
+		aItem.iName.CreateL(iPlayers[aAvrcpPlayerId].iName);
+		
+		aItem.iLength = 28 + aItem.iNameLength;
+		}
+	else
+		{
+		LEAVEL(KErrNotFound);
+		}
+	
+	CleanupStack::PopAndDestroy(&iLock);
+	}
+
+TBool CAvrcpPlayerInfoManager::ValidPlayer(const TUint16& aAvrcpPlayerId) const
+	{
+	LOG_FUNC
+
+	if(aAvrcpPlayerId >= iPlayers.Count() || iPlayers[aAvrcpPlayerId].iId == KNullClientId)
+		{
+		return EFalse;
+		}
+	else
+		{
+		return ETrue;
+		}
+	}
+
+TInt CAvrcpPlayerInfoManager::NextPlayerIndex()
+	{
+	LOG_FUNC
+
+	TRemConClientId nullId = KNullClientId;
+	TInt index = iPlayers.Find(nullId, PlayerCompare);
+
+	if(index < 0)
+		{
+		// No gaps to fill, add another item to the player list
+		TAvrcpMediaPlayerItem item;
+		TInt err = iPlayers.Append(item);
+		if(!err)
+			{
+			index = iPlayers.Count() - 1;
+			}
+		}
+	
+	return index;
+	}
+
+void CAvrcpPlayerInfoManager::MuoUidChanged(TRemConClientId aId, TUint16 aUidCounter)
+	{
+	LOG_FUNC;
+	ASSERT_BULK_THREAD
+	iLock.Wait();
+	TInt index = iPlayers.Find(aId, PlayerCompare);
+	if(index >= 0)
+		{
+		iPlayers[index].iUidCounter = aUidCounter;
+		}
+	iLock.Signal();
+	
+	iControlThreadCallBack.CallBack();
+	}
+
+void CAvrcpPlayerInfoManager::MuoError(TRemConClientId aId)
+	{
+	// Narg.  Tell everyone we can't use this player anymore
+	BulkClientNotAvailable(aId);
+	}
+
+void CAvrcpPlayerInfoManager::MpsoPlayStatusChanged(TRemConClientId aId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus)
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+	iLock.Wait();
+	TInt index = iPlayers.Find(aId, PlayerCompare);
+	if(index >= 0)
+		{
+		iPlayers[index].iPlaybackStatus = static_cast<MPlayerEventsObserver::TPlaybackStatus>(aPlaybackStatus);
+		}
+	iLock.Signal();
+	}
+
+void CAvrcpPlayerInfoManager::MpsoError(TRemConClientId aId)
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+	iLock.Wait();
+	TInt index = iPlayers.Find(aId, PlayerCompare);
+	if(index >= 0)
+		{
+		iPlayers[index].iPlaybackStatus = MPlayerEventsObserver::EError;
+		}
+	iLock.Signal();
+	}
+
+TUint16 CAvrcpPlayerInfoManager::UidCounterL(const TRemConClientId& aClientId) const
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+	iLock.Wait();
+	CleanupSignalPushL(iLock);
+	TUint16 uidCounter = KErrNone;
+	TInt index = iPlayers.Find(aClientId, PlayerCompare);
+	if(index < 0)
+		{
+		LEAVEL(KErrNotFound);
+		}
+	uidCounter = iPlayers[index].iUidCounter;
+	CleanupStack::PopAndDestroy(&iLock);
+	return uidCounter;
+	}
+
+TInt CAvrcpPlayerInfoManager::SetPlayerFeatures(const TRemConClientId& aId, TPlayerFeatureBitmask& aBitmask, TUint8& aSdpFeatures, TBool& aAbsoluteVolumeSupported)
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+
+	TInt err;
+	RArray<TUint> operations;
+	
+	aAbsoluteVolumeSupported = EFalse;
+	aSdpFeatures = 0;
+	err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConCoreApiUid), operations);
+	if(!err)
+		{
+		aBitmask.SetCoreApiFeatures(operations);
+		}
+	else if(err != KErrNotSupported)
+		{
+		operations.Close();
+		return err;
+		}
+	
+	err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConPlayerInformationUid), operations);
+	if(!err)
+		{
+		aSdpFeatures |= AvrcpSdp::EPlayer;
+		}
+	else if(err != KErrNotSupported)
+		{
+		operations.Close();
+		return err;
+		}
+	
+	err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConGroupNavigationApiUid), operations);
+	if(!err)
+		{
+		aSdpFeatures |= AvrcpSdp::EGroupNavigation;
+		aBitmask.SetGroupNavigationApiFeatures(operations);
+		}
+	else if(err != KErrNotSupported)
+		{
+		return err;
+		}
+	
+	err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConAbsoluteVolumeTargetApiUid), operations);
+	if(!err)
+		{
+		aBitmask.SetAbsoluteVolumeApiFeatures(operations);
+		aAbsoluteVolumeSupported = ETrue;
+		}
+	else if(err != KErrNotSupported)
+		{
+		operations.Close();
+		return err;
+		}
+	
+	err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConNowPlayingApiUid), operations);
+	if(!err)
+		{
+		aBitmask.SetNowPlayingApiFeatures(operations);
+		}
+	else if(err != KErrNotSupported)
+		{
+		operations.Close();
+		return err;
+		}
+	
+	err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConMediaBrowseApiUid), operations);
+	if(!err)
+		{
+		aSdpFeatures |= AvrcpSdp::EBrowsing;
+		aBitmask.SetMediaBrowseApiFeatures(operations);
+		}
+	
+	operations.Close();
+	return err == KErrNotSupported ? KErrNone : err;
+	}
+
+void CAvrcpPlayerInfoManager::UpdateTgServiceRecordL()
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+
+	TUint16 features, avrcpVersion, avctpVersion;
+	CurrentTargetVersionAndFeatures(avrcpVersion, avctpVersion, features);
+	
+	AvrcpSdpUtils::UpdateProtocolDescriptorListL(iSdpDatabase, iTargetRecord, avctpVersion);
+	if(avrcpVersion == AvrcpSdp::KAvrcpProfileVersion14)
+		{
+		AvrcpSdpUtils::UpdateAdditionalProtocolDescriptorListL(iSdpDatabase, iTargetRecord);
+		}
+	
+	AvrcpSdpUtils::UpdateProfileDescriptorListL(iSdpDatabase, iTargetRecord, avrcpVersion);
+	AvrcpSdpUtils::UpdateSupportedFeaturesL(iSdpDatabase, iTargetRecord, AvrcpSdp::ERemoteControlTarget, features);
+	}
+
+void CAvrcpPlayerInfoManager::CurrentTargetVersionAndFeatures(TUint16& aAvrcpVersion, TUint16& aAvctpVersion, TUint16& aSdpFeatures)
+	{
+	aSdpFeatures = AvrcpSdp::KAvrcpBaseTgFeatures;
+	for(TInt i=0; i<iPlayers.Count(); i++)
+		{
+		if(ValidPlayer(i))
+			{
+			aSdpFeatures |= iPlayers[i].iSdpFeatures;
+			}
+		}
+	
+	aAvrcpVersion = (aSdpFeatures & AvrcpSdp::EBrowsing) ? AvrcpSdp::KAvrcpProfileVersion14 : AvrcpSdp::KAvrcpProfileVersion13;
+	aAvctpVersion = (aAvrcpVersion == AvrcpSdp::KAvrcpProfileVersion14) ? AvrcpSdp::KAvctpProtocolVersion13 : AvrcpSdp::KAvctpProtocolVersion12;
+	
+	// Only indicate support for multiple players if advertising support for AVRCP 1.4
+	if(aAvrcpVersion == AvrcpSdp::KAvrcpProfileVersion14)
+		{
+		aSdpFeatures |= AvrcpSdp::EMultiplePlayers;
+		}
+	}
+
+void CAvrcpPlayerInfoManager::UidCounterUpdate()
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+	
+	for(TInt i=0; i<iPlayers.Count(); i++)
+		{
+		if(ValidPlayer(i))
+			{
+			iLock.Wait();
+			TUint16 currentUidCounter = iPlayers[i].iUidCounter;
+			TUint16 lastUpdate = iPlayers[i].iLastUpdatedUidCounter;
+			iPlayers[i].iLastUpdatedUidCounter = currentUidCounter;
+			TRemConClientId clientId = iPlayers[i].iId;
+			iLock.Signal();
+			
+			if(currentUidCounter != lastUpdate)
+				{
+				for(TInt j=0; j<iObservers.Count(); j++)
+					{
+					// Observer can request most up to date value if it wants it
+					iObservers[j]->MpcoUidCounterChanged(clientId);
+					}
+				}
+			}
+		}
+	}
+
+/**
+If the client ID is set to a valid ID then we shall return the support
+status for the specific player referenced by the ID.
+Otherwise we shall return generic support which will indicate support across
+the device.
+@return whether absolute volume control is supported either by the specific player
+associated with a client ID, or generally by the device if an invalid client ID is
+provided.
+ */
+TBool CAvrcpPlayerInfoManager::AbsoluteVolumeSupportedL(const TRemConClientId& aClientId) const
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+
+	iLock.Wait();
+	CleanupSignalPushL(iLock);
+	
+	TBool supported = EFalse;
+	// If we receive a "NULL" client ID then it means that we should 
+	// return whether abs vol is generically supported by the device.
+	if(aClientId == KNullClientId)
+		{
+		// Try to find the first player supporting abs vol, if there is one then it is supported 
+		TInt index = iPlayers.Find(EFirstAbsVolSupport, FirstAbsVolSupport);
+		supported = (index >= 0);
+		}
+	else
+		{
+		// The abs vol support for a specific player is required, so return that.
+		TInt index = iPlayers.Find(aClientId, PlayerCompare);
+		if(index < 0)
+			{
+			LEAVEL(KErrNotFound);
+			}
+		supported = iPlayers[index].iAbsoluteVolumeSupport;
+		}
+	
+	CleanupStack::PopAndDestroy(&iLock);
+	
+	return supported;
+	}
+
+TBool CAvrcpPlayerInfoManager::BrowsingSupportedL(const TRemConClientId& aClientId) const
+	{
+	LOG_FUNC
+	ASSERT_CONTROL_THREAD
+
+	iLock.Wait();
+	CleanupSignalPushL(iLock);
+	
+	TBool supported = EFalse;
+	// If we receive a "NULL" client ID then it means that we should 
+	// return whether browsing is generically supported by the device.
+	if(aClientId == KNullClientId)
+		{
+		// Try to find the first player supporting browsing, if there is one then it is supported 
+		TInt index = iPlayers.Find(EFirstBrowsingSupport, FirstBrowsingSupport);
+		supported = (index >= 0);
+		}
+	else
+		{
+		// The browsing support for a specific player is required, so return that.
+		TInt index = iPlayers.Find(aClientId, PlayerCompare);
+		if(index < 0)
+			{
+			LEAVEL(KErrNotFound);
+			}
+		supported = iPlayers[index].iSdpFeatures & AvrcpSdp::EBrowsing;
+		}
+	
+	CleanupStack::PopAndDestroy(&iLock);
+	
+	return supported;
+	}
+
+TInt CAvrcpPlayerInfoManager::PlayerUpdateCallBack(TAny* aPlayerInfoMgr)
+	{
+	static_cast<CAvrcpPlayerInfoManager*>(aPlayerInfoMgr)->UidCounterUpdate();
+	return KErrNone;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpremotedevice.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,129 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "avrcpincomingcommandhandler.h"
+#include "avrcpoutgoingcommandhandler.h"
+#include "avrcpremotedevice.h"
+
+#include "avrcplog.h"
+
+/** Factory function.
+
+@param aAddr The remote device this manages transactions with.
+@param aRouter	A CRcpRouter to use for communication with remote devices.
+@param aBearer	The CRemConBearerAvrcp this is to handle commands for.
+@param aObserver The observer of the bearer. Used to acquire converters.
+@param aTimer	CDeltaTimer to use for queuing timed events.
+@return A fully constructed CRcpRemoteDevice.
+@leave System wide error codes.
+*/
+CRcpRemoteDevice* CRcpRemoteDevice::NewL(const TBTDevAddr& aAddr, 
+	CRcpRouter& aRouter, 
+	MRemConControlCommandInterface& aCommandInterface,
+	MRemConBearerObserver& aObserver,
+	CDeltaTimer& aTimer,
+	CAvrcpPlayerInfoManager& aPlayerInfoManager)
+	{
+	LOG_STATIC_FUNC
+	CRcpRemoteDevice* engine = new(ELeave) CRcpRemoteDevice(aAddr, aRouter, aCommandInterface, aTimer);
+	CleanupStack::PushL(engine);
+	engine->ConstructL(aObserver, aPlayerInfoManager);
+	CleanupStack::Pop(engine);
+	return engine;
+	}
+
+/** Constructor.
+
+@param aAddr The remote device this manages transactions with.
+@param aRouter	A CRcpRouter to use for communication with remote devices.
+@param aBearer	The CRemConBearerAvrcp this is to handle commands for.
+@param aObserver The observer of the bearer. Used to acquire converters.
+@param aTimer	CDeltaTimer to use for queuing timed events.
+@return A partially constructed CRcpRemoteDevice.
+@leave System wide error codes.
+*/
+CRcpRemoteDevice::CRcpRemoteDevice(const TBTDevAddr& aAddr,
+	CRcpRouter& aRouter, 
+	MRemConControlCommandInterface& aCommandInterface,
+	CDeltaTimer& aTimer) : 
+	iDevice(aAddr), iRouter(aRouter), iCommandInterface(aCommandInterface), iTimer(aTimer)
+	{
+	LOG_FUNC
+	}
+
+/** Second phase construction.
+
+@param aObserver An observer to pass the handlers to allow them to
+				acquire converters.
+*/
+void CRcpRemoteDevice::ConstructL(MRemConBearerObserver& aObserver,
+	CAvrcpPlayerInfoManager& aPlayerInfoManager)
+	{
+	LOG_FUNC	
+	iIncoming = CRcpIncomingCommandHandler::NewL(iCommandInterface, aObserver, iRouter, iTimer, aPlayerInfoManager, iDevice);
+	iOutgoing = CRcpOutgoingCommandHandler::NewL(iCommandInterface, aObserver, iRouter, iTimer);
+	}
+
+/** Destructor.
+*/
+CRcpRemoteDevice::~CRcpRemoteDevice()
+	{
+	LOG_FUNC
+	delete iIncoming;
+	delete iOutgoing;
+	}
+
+/** Stop handling for this remote device. 
+
+@param aClearQueue Whether the outgoing queue should be cleared.
+*/
+void CRcpRemoteDevice::Disconnect(TBool aClearQueue)
+	{
+	LOG_FUNC
+	iIncoming->Disconnect();	
+	iOutgoing->Disconnect(aClearQueue);
+	}
+
+/** Get the remote address of this device.
+
+@return the remote address of this device.
+*/
+const TBTDevAddr& CRcpRemoteDevice::RemoteAddress() const
+	{
+	LOG_FUNC
+	return iDevice;
+	}	
+
+/** Get the incoming handler for this device.
+
+@return The incoming handler for this device.
+*/	
+MIncomingCommandHandler& CRcpRemoteDevice::IncomingHandler() const
+	{
+	LOG_FUNC
+	return *iIncoming;
+	}
+
+/** Get the outgoing handler for this device.
+
+@return The outgoing handler for this device.
+*/	
+MOutgoingCommandHandler& CRcpRemoteDevice::OutgoingHandler() const
+	{
+	LOG_FUNC
+	return *iOutgoing;
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcprouter.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,499 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <bluetoothav.h>
+
+#include "avrcpcommand.h"
+#include "avrcplog.h"
+#include "avrcprouter.h"
+#include "avrcputils.h"
+#include "commandhandlerinterface.h"
+
+using namespace SymbianAvctp;
+
+/** Constructor.
+
+@param aRemotes The list of remote devices known to AVRCP.
+@param aBearer The bearer.
+@return A partially constructed CRcpRouter.
+*/
+CRcpRouter::CRcpRouter(MAvrcpBearer& aBearer)
+	: iChannel(NULL)
+	, iBearer(aBearer)
+	, iSendQueue(_FOFF(CAvrcpCommand, iSendLink))
+	, iState(EAvrcpRouterCanSend)
+	{
+	LOG_FUNC
+	}
+
+/** Destructor.
+*/	
+CRcpRouter::~CRcpRouter()
+	{
+	LOG_FUNC
+	// The lifetime of the Router is the same as that of the bearer plugin.
+	// This means that there is no point worrying about the stuff on our
+	// send queue as we won't be around to pass the results up to RemCon.
+	while (!iSendQueue.IsEmpty())
+		{
+		CAvrcpCommand *command = iSendQueue.First();
+		command->iSendLink.Deque();
+		command->DecrementUsers();
+		}
+	}
+	
+//------------------------------------------------------------------
+// Data functions called from command handlers
+//------------------------------------------------------------------	
+
+/** Adds command to send queue.
+
+This message will be sent as soon as the iAvcp becomes
+free for sending, unless the command is removed before
+then.
+
+@param aCommand The command to send.
+@see CRcpRouter::RemoveFromSendQueue
+*/
+void CRcpRouter::AddToSendQueue(CAvrcpCommand& aCommand)
+	{
+	LOG_FUNC
+	
+	__ASSERT_ALWAYS(!aCommand.iSendLink.IsQueued(), AVRCP_PANIC(ECommandAlreadyQueuedForSending));
+
+	iSendQueue.AddLast(aCommand);
+	aCommand.IncrementUsers();
+
+	if(iState == EAvrcpRouterCanSend)
+		{
+		Send();
+		}	
+	}
+
+/** Remove command from send queue.
+
+@param aCommand The command that is not to be sent.
+*/	
+void CRcpRouter::RemoveFromSendQueue(CAvrcpCommand& aCommand)
+	{
+	LOG_FUNC
+	
+	if(iSendQueue.IsFirst(&aCommand))
+		{
+		// If this is at the front of the queue it's currently being
+		// sent.  Cancel that and start off the next thing.
+		iChannel->MacCancelSend();
+		aCommand.iSendLink.Deque();
+		iState = EAvrcpRouterCanSend;
+		if(!iSendQueue.IsEmpty())
+			{
+			Send();
+			}
+		}
+	else
+		{
+		// Still waiting to be sent so we can just sneak it out of
+		// the queue.
+		aCommand.iSendLink.Deque();
+		}
+	}
+	
+//------------------------------------------------------------------
+// Control functions called from bearer
+//------------------------------------------------------------------
+
+/** Try to bring up an explicit connection to a remote.
+
+@param aAddr The address of the remote.
+@return System wide error.  KErrNone if this request will be
+		attempted, and generate a ConnectConfirm.
+*/
+TInt CRcpRouter::ConnectRequest(const TBTDevAddr& aAddr)
+	{
+	LOG_FUNC
+	return iChannel->MacAttachRequest(aAddr);
+	}
+
+/** Try to bring down an explicit connection to a remote.
+
+@param aAddr The address of the remote.
+@return System wide error.  KErrNone if the disconnect will be
+		attempted, and generate a DisconnectConfirm.
+*/	
+TInt CRcpRouter::DisconnectRequest(const TBTDevAddr& aAddr)
+	{
+	LOG_FUNC
+	return iChannel->MacDetachRequest(aAddr);
+	}
+	
+//------------------------------------------------------------------
+// MAvctpEventNotify functions called from RAvctp
+//------------------------------------------------------------------	
+
+/** AVCTP Connection Indicate.
+
+This is called when a remote device has connected 
+to us. NB we don't return the configuration status as 
+in Appendix A - AVCTP Upper Interface of [R2]. If aAccept 
+is not changed the connection will be refused however 
+this may not result in the actual disconnection of the 
+device if another RAvctp client did accept the connection.
+
+@param aBTDevice the address of the device connected to
+@param aAccept this parameter is provided so that the client 
+	of RAvctp can indicate whether they want to accept the 
+	connection.  The meaning of a refusal is that you don't 
+	care whether or not the connection is there or not.	
+@see RAvctp			   
+*/
+void CRcpRouter::MaenAttachIndicate(const TBTDevAddr& aBTDevice, TInt aMtu, TBool& aAccept)
+	{
+	LOG_FUNC
+	aAccept = ETrue;
+	
+	// if we have already received data from this device we will have 
+	// informed RemCon about it already, so don't pass up the connection
+	// now
+	if(!iBearer.IncomingHandler(aBTDevice))
+		{
+		iBearer.ConnectIndicate(aBTDevice);
+		}
+	
+	MIncomingCommandHandler* handler = iBearer.IncomingHandler(aBTDevice);
+	if(handler)
+		{
+		handler->MaxPacketSize(aMtu);
+		aAccept = ETrue;
+		}
+	else
+		{
+		aAccept = EFalse;
+		}
+	}
+
+/** AVCTP Connection Confirm.
+
+This is a response to RAvctp::ConnectRequest and passes on the 
+result of the Connection attempt. NB we don't return the 
+configuration status as in Appendix A - AVCTP Upper 
+Interface of [R2]. If the aConnectResult is KErrNone 
+then iAvctp is now connected.
+
+@param aBTDevice the address of the device connected to
+@param aConnectResult connection result - one of the 
+					  system-wide error codes. 
+@see RAvctp					  
+*/	
+void CRcpRouter::MaenAttachConfirm(const TBTDevAddr& aBTDevice, TInt aMtu, TInt aConnectResult)
+	{
+	LOG_FUNC
+	iBearer.ConnectConfirm(aBTDevice, aConnectResult);
+
+	MIncomingCommandHandler* handler = iBearer.IncomingHandler(aBTDevice);
+	if(handler)
+		{
+		handler->MaxPacketSize(aMtu);
+		}
+	}
+
+/** AVCTP Disconnection Indication.
+
+Indicates that a remote device has disconnected from us.
+It is only called if the device had been explicitly Connected to.
+ 
+@param aBTDevice the address of the disconnecting device
+@see RAvctp
+*/	
+void CRcpRouter::MaenDetachIndicate(const TBTDevAddr& aBTDevice)
+	{
+	LOG_FUNC
+	iBearer.DisconnectIndicate(aBTDevice);
+	}
+
+/** AVCTP Disconnection Confirm.
+
+@param aBTDevice the address of the disconnected device
+@param aDisconnectResult will be one of the system-wide 
+						 error codes. If KErrTimedOut is 
+						 returned then the RAvctp will be 
+						 disconnected.
+@see RAvctp	
+*/	
+void CRcpRouter::MaenDetachConfirm(const TBTDevAddr& aBTDevice, TInt aDisconnectResult)
+	{
+	LOG_FUNC
+	iBearer.DisconnectConfirm(aBTDevice, aDisconnectResult);
+	}
+
+/** AVCTP Message received indication.
+
+This method is called when a message has been received from 
+the given device on the RAvctp's PID. 
+
+Note that because AVCTP is a connectionless protocol, it is 
+perfectly possible to get a MaenMessageReceivedIndicate event 
+from a device that you have not either explicitly connected to.
+For instance even if you don't accept a MaenConnectIndicate 
+you may still receive messages from that remote device.
+
+@param aBTDevice address of the device sending us an AVCTP message
+@param aTransactionLabel message transaction label
+@param aType type of message 
+@param aIpidBitSet this will be set to true only if a message has been received indicating 
+				   that the profile corresponding to the originally sent message is not valid.
+				   If RAvctp was used to send the message then this response will have come from
+				   the remote device aBTDevice.
+@param aMessageInformation contains only the AVCTP Command / Response Message Information and not the whole packet.
+                           Ownership transferred to client.
+@see RAvctp
+*/	
+void CRcpRouter::MaenMessageReceivedIndicate(const TBTDevAddr& aBTDevice,
+		SymbianAvctp::TTransactionLabel aTransactionLabel,
+		SymbianAvctp::TMessageType aType,
+		TBool aIpidBitSet,
+		const TDesC8& aMessageInformation)
+	{
+	LOG_FUNC
+	AVRCPLOG(aMessageInformation)
+		
+	// Find the right handler
+	if(aType == ECommand)
+		{
+		MIncomingCommandHandler* handler = iBearer.IncomingHandler(aBTDevice);
+		
+		if(!handler)
+			{
+			iBearer.ConnectIndicate(aBTDevice);
+			
+			handler = iBearer.IncomingHandler(aBTDevice);
+			}
+		
+		if(handler)
+			{
+			// If this leaves the handler is rejecting handling this command, just
+			// ignore it.
+			TRAP_IGNORE(handler->ReceiveCommandL(aMessageInformation, aTransactionLabel, aBTDevice));
+			}
+		}
+	else
+		{
+		MOutgoingCommandHandler* handler = iBearer.OutgoingHandler(aBTDevice);
+		if(handler)
+			{
+			handler->ReceiveResponse(aMessageInformation, aTransactionLabel, aIpidBitSet);
+			}
+		}
+	}
+
+/** AVCTP Message send complete.
+
+This method is called when a RAvctp has attempted to send 
+the message defined by aTransactionLabel and aBTDevice. 
+@param aTransactionLabel The transaction label of the message 
+						 that has been sent
+@param aBTDevice the device to which the send has completed
+@param aSendResult KErrNone if the send was successful or one 
+				   of the system-wide error codes
+@see RAvctp
+*/	
+void CRcpRouter::MaenMessageSendComplete(const TBTDevAddr& aBTDevice, 
+		       		SymbianAvctp::TTransactionLabel aTransactionLabel,   
+					TInt aSendResult)
+	{
+	LOG_FUNC
+	__ASSERT_ALWAYS(!iSendQueue.IsEmpty(), AvrcpUtils::Panic(EAvrcpNoOutstandingSend));
+	
+	CAvrcpCommand* command = iSendQueue.First();
+	
+	__ASSERT_ALWAYS(command->TransactionLabel() == aTransactionLabel, AvrcpUtils::Panic(EAvrcpUnknownAvctpTransId));
+	
+	MAvrcpCommandHandler* handler = NULL;
+	if(command->MessageType() == ECommand)
+		{
+		handler = iBearer.OutgoingHandler(aBTDevice);
+		}
+	else 
+		{
+		handler = iBearer.IncomingHandler(aBTDevice);
+		}
+	
+	if(handler)
+		{
+		handler->MessageSent(*command, aSendResult);
+		}
+		
+	// Deque before calling Decrement because Decrement handling may involve
+	// deleting command
+	command->iSendLink.Deque();
+	command->DecrementUsers();
+
+	// Now able to do another send. Toggle our state and check if there
+	// are any commands waiting.
+	iState = EAvrcpRouterCanSend;
+	if(!iSendQueue.IsEmpty())
+		{
+		Send();
+		}
+	}
+
+/** AVCTP Close Complete.
+
+This is the response to the CloseGracefully() that has been
+called on a RAvctp object. It is the last event that will be 
+called until the RAvctp object is Open()'d again.
+@see RAvctp
+*/
+void CRcpRouter::MaenCloseComplete()
+	{
+	LOG_FUNC
+	}
+
+/** AVCTP error notification.
+
+Note an errored device does not indicate that the device has 
+been disconnected. If it has then a MaenDisconnectIndicate 
+event will be used to indicate this.
+
+@param aBTDevice the remote device associated with the error or TBTDevAddr(0) for a general error
+@param aError system wide error
+@see RAvctp
+*/
+void CRcpRouter::MaenErrorNotify(const TBTDevAddr& /*aBTDevice*/, TInt /*aError*/)
+	{
+	LOG_FUNC
+	}
+
+/**
+Returns a null aObject if the extension is not implemented,
+or a pointer to another interface if it is.
+
+@param aInterface UID of the interface to return
+@param aObject system wide error
+@see RAvctp
+*/	
+void CRcpRouter::MaenExtensionInterfaceL(TUid /*aInterface*/, void*& aObject)
+	{
+	LOG_FUNC
+	aObject = NULL;
+	}
+
+//------------------------------------------------------------------
+// Utility functions
+//------------------------------------------------------------------
+
+/** Issue a send to AVCTP.
+
+This sends the first message on the command queue.
+*/
+void CRcpRouter::Send()
+	{
+	LOG_FUNC
+	__ASSERT_ALWAYS(!iSendQueue.IsEmpty(), AvrcpUtils::Panic(EAvrcpNoOutstandingSend));
+	
+	CAvrcpCommand* command = iSendQueue.First();
+
+#ifdef _DEBUG	
+	TInt err = 
+#endif // _DEBUG
+	iChannel->MacSendMessage(command->RemoteAddress(),
+		command->TransactionLabel(),
+		command->MessageType(),
+		command->Data());
+	
+	__ASSERT_DEBUG(err == KErrNone, AvrcpUtils::Panic(EAvrcpSendingMessageFailed));
+	
+	iState = EAvrcpRouterSending;
+	}
+
+/** Factory funtion.
+
+@param aAvctp An open RAvctp instance.
+@param aBearer The bearer.
+@return A fully constructed CRcpRouter.
+@leave System wide error codes.
+*/
+CControlRouter* CControlRouter::NewL(RAvctp& aAvctp, MAvrcpBearer& aBearer)
+	{
+	LOG_STATIC_FUNC
+	CControlRouter* router = new(ELeave) CControlRouter(aAvctp, aBearer);
+	CleanupStack::PushL(router);
+	router->ConstructL();
+	CleanupStack::Pop(router);
+	return router;
+	}
+
+CControlRouter::~CControlRouter()
+	{
+	LOG_FUNC
+	iAvctp.Close(RAvctp::ENormal);
+	}
+
+CControlRouter::CControlRouter(RAvctp& aAvctp, MAvrcpBearer& aBearer)
+	: CRcpRouter(aBearer)
+	, iAvctp(aAvctp)
+	{
+	LOG_FUNC
+	}
+
+void CControlRouter::ConstructL()
+	{
+	LOG_FUNC
+	LEAVEIFERRORL(iAvctp.Open(*this, KAvrcpPid, iChannel));
+	}
+
+/** Factory funtion.
+
+@param aAvctp An open RAvctp instance.
+@param aBearer The bearer.
+@return A fully constructed CRcpRouter.
+@leave System wide error codes.
+*/
+CBulkRouter* CBulkRouter::NewL(RAvctp& aAvctp, MAvrcpBearer& aBearer)
+	{
+	LOG_STATIC_FUNC
+	CBulkRouter* router = new(ELeave) CBulkRouter(aAvctp, aBearer);
+	CleanupStack::PushL(router);
+	router->ConstructL();
+	CleanupStack::Pop(router);
+	return router;
+	}
+
+CBulkRouter::~CBulkRouter()
+	{
+	LOG_FUNC
+	iAvctp.UninstallSecondaryChannel();
+	}
+
+CBulkRouter::CBulkRouter(RAvctp& aAvctp, MAvrcpBearer& aBearer)
+	: CRcpRouter(aBearer)
+	, iAvctp(aAvctp)
+	{
+	LOG_FUNC
+	}
+
+void CBulkRouter::ConstructL()
+	{
+	LOG_FUNC
+	LEAVEIFERRORL(iAvctp.InstallSecondaryChannel(*this, iChannel));
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcpsdputils.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,181 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <bt_sock.h>
+
+#include "avrcpsdputils.h"
+
+static void AddCommonServiceRecordAttributesL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle aRecHandle)
+	{
+	// Provider Name
+	aSdpDatabase.UpdateAttributeL(aRecHandle,
+		KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName,
+		AvrcpSdp::KAvrcpProviderName
+		);
+	
+	// Service Description
+	aSdpDatabase.UpdateAttributeL(aRecHandle,
+		KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription,
+		AvrcpSdp::KAvrcpServiceDescription
+		);	
+	
+	// Add to public browse group
+	CSdpAttrValueDES *attrValDES = CSdpAttrValueDES::NewDESL(0);
+	CleanupStack::PushL(attrValDES);
+	attrValDES->StartListL()
+		->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID)))
+	->EndListL();
+	aSdpDatabase.UpdateAttributeL(aRecHandle, KSdpAttrIdBrowseGroupList, *attrValDES);
+	CleanupStack::PopAndDestroy(attrValDES);
+	}
+
+static CSdpAttrValueDES* GenerateControllerServiceClassListLC(TUint16 aProfileVersion)
+	{
+	// New service record with service class attribute containing
+	// 0x110e (for A/V Remote Control) and potentially also 0x110f
+	CSdpAttrValueDES* serviceClassUuids = CSdpAttrValueDES::NewDESL(NULL);
+	CleanupStack::PushL(serviceClassUuids);
+	
+	// Unfortunately in earlier releases of the specification the controller service class UUID
+	// was the same as the the profile UUID - meaning that searching for records with this UUID
+	// would return both controller and target records (since they both belong to the same profile).
+	// This was corrected by adding a specific service class UUID for the controller role - both
+	// the specific UUID and the old "profile" UUID are provided in the list of service classes (for
+	// backwards compatibility).
+	//
+	// This new SDP record structure was introduced in AVRCP 1.4 and so if we conform to AVRCP 1.4 we 
+	// can use the new SDP record structure - if we are presenting ourselves as an earlier version 
+	// we must restrain ourselves and use the previously specified structure.
+	if(aProfileVersion == AvrcpSdp::KAvrcpProfileVersion13)
+		{
+		serviceClassUuids->StartListL()
+				->BuildUUIDL(TUUID(TUint16(KAVRemoteControlUUID)))
+		->EndListL();
+		}
+	else
+		{
+		serviceClassUuids->StartListL()
+				->BuildUUIDL(TUUID(TUint16(KAVRemoteControlUUID)))
+				->BuildUUIDL(TUUID(TUint16(KAVRemoteControlControllerUUID)))
+		->EndListL();
+		}
+	
+	return serviceClassUuids;
+	}
+
+void AvrcpSdpUtils::CreateTargetServiceRecordL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle)
+	{
+	// New service record with service class attribute containing
+	// 0x110c (for A/V Remote Control Target) 
+	aSdpDatabase.CreateServiceRecordL(KAVRemoteControlTargetUUID, aRecHandle);
+	
+	aSdpDatabase.UpdateAttributeL(aRecHandle,
+		KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName,
+		AvrcpSdp::KAvrcpTargetServiceName
+		);
+	
+	AddCommonServiceRecordAttributesL(aSdpDatabase, aRecHandle);
+	}
+
+void AvrcpSdpUtils::CreateControllerServiceRecordL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProfileVersion)
+	{
+	// New service record with service class attribute containing
+	// 0x110e (for A/V Remote Control) 
+	CSdpAttrValueDES* serviceClassUuids = GenerateControllerServiceClassListLC(aProfileVersion);
+	
+	aSdpDatabase.CreateServiceRecordL(*serviceClassUuids, aRecHandle);
+	CleanupStack::PopAndDestroy(serviceClassUuids);
+	
+	aSdpDatabase.UpdateAttributeL(aRecHandle,
+		KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName,
+		AvrcpSdp::KAvrcpControllerServiceName
+		);
+	
+	AddCommonServiceRecordAttributesL(aSdpDatabase, aRecHandle);
+	}
+
+void AvrcpSdpUtils::UpdateControllerServiceClassListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProfileVersion)
+	{
+	CSdpAttrValueDES* serviceClassUuids = GenerateControllerServiceClassListLC(aProfileVersion);
+	
+	aSdpDatabase.UpdateAttributeL(aRecHandle, KSdpAttrIdServiceClassIDList, *serviceClassUuids);
+	CleanupStack::PopAndDestroy(serviceClassUuids);
+	}
+
+void AvrcpSdpUtils::UpdateProtocolDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProtocolVersion)
+	{
+	CSdpAttrValueDES *attrValDES = CSdpAttrValueDES::NewDESL(0);
+	CleanupStack::PushL(attrValDES);
+	attrValDES->StartListL()
+		->BuildDESL()->StartListL()
+			->BuildUUIDL(TUUID(TUint16(KL2CAP)))					// L2CAP
+			->BuildUintL(TSdpIntBuf<TUint16>(KAVCTP))				// PSM = AVCTP
+		->EndListL()
+		->BuildDESL()->StartListL()
+			->BuildUUIDL(TUUID(TUint16(KAVCTP)))					// AVCTP
+			->BuildUintL(TSdpIntBuf<TUint16>(aProtocolVersion))
+		->EndListL()
+	->EndListL();
+	aSdpDatabase.UpdateAttributeL(aRecHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES);
+	CleanupStack::PopAndDestroy(attrValDES);
+	}
+
+void AvrcpSdpUtils::UpdateAdditionalProtocolDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle)
+	{
+	CSdpAttrValueDES *attrValDES = CSdpAttrValueDES::NewDESL(0);
+	CleanupStack::PushL(attrValDES);
+	attrValDES->StartListL()
+		->BuildDESL()->StartListL()
+			->BuildUUIDL(TUUID(TUint16(KL2CAP)))				// L2CAP
+			->BuildUintL(TSdpIntBuf<TUint16>(0x1b))				// PSM = AVCTP_browse
+		->EndListL()
+		->BuildDESL()->StartListL()
+			->BuildUUIDL(TUUID(TUint16(KAVCTP)))					// AVCTP
+			->BuildUintL(TSdpIntBuf<TUint16>(AvrcpSdp::KAvctpProtocolVersion13))// 0x0103
+		->EndListL()
+	->EndListL();
+	aSdpDatabase.UpdateAttributeL(aRecHandle, KSdpAttrIdAdditionalProtocolDescriptorList, *attrValDES);
+	CleanupStack::PopAndDestroy(attrValDES);
+	}
+
+void AvrcpSdpUtils::UpdateProfileDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProfileVersion)
+	{
+	CSdpAttrValueDES *attrValDES = CSdpAttrValueDES::NewDESL(0);
+	CleanupStack::PushL(attrValDES);
+	attrValDES->StartListL()
+		->BuildDESL()->StartListL()
+			//In the profile descriptor list the Control UUID is used 
+			//for BOTH controller and target
+			->BuildUUIDL(KAVRemoteControlUUID) 
+			->BuildUintL(TSdpIntBuf<TUint16>(aProfileVersion))
+		->EndListL()
+	->EndListL();
+	aSdpDatabase.UpdateAttributeL(aRecHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES);
+	CleanupStack::PopAndDestroy(attrValDES);
+	}
+
+void AvrcpSdpUtils::UpdateSupportedFeaturesL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, AvrcpSdp::TRecordType aType, TUint16 aFeatures)
+	{
+	// Supported Features
+	// For both target and controller roles if we support that role then
+	// indicate support for all categories that are available within that
+	// role.
+	CSdpAttrValue* attrVal = NULL;
+	TSdpIntBuf<TUint16> featureBuf = (aType==AvrcpSdp::ERemoteControl) ? AvrcpSdp::KAvrcpBaseCtFeatures | aFeatures : AvrcpSdp::KAvrcpBaseTgFeatures | aFeatures;
+	attrVal = CSdpAttrValueUint::NewUintL(featureBuf); 
+	CleanupStack::PushL(attrVal);
+	aSdpDatabase.UpdateAttributeL(aRecHandle, KSdpAttrIdSupportedFeatures, *attrVal);
+	CleanupStack::PopAndDestroy(attrVal);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/avrcputils.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,360 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <bt_sock.h>
+#include <e32base.h>
+#include <e32msgqueue.h>
+#include <remconaddress.h>
+#include <remconbeareravrcp.h>
+#include "avrcplog.h"
+#include "avrcputils.h"
+
+/**
+@file
+@internalComponent
+@released
+*/
+
+/** Utility AVRCP panic function.
+
+@param aPanic The panic number.
+*/
+void AvrcpUtils::Panic(TAvrcpPanic aPanic)
+	{
+	User::Panic(KAvrcpPanicName, aPanic);
+	}
+	
+
+/** Set the command data.  This overwrites the current
+contents of the data buffer.
+
+@param aCommandData The buffer in which to set the data.
+@param aOffset The offset within aCommandData to set the data.
+@param aLength The length of data to replace.
+@param aValue The new value for the replaced data.
+*/
+void AvrcpUtils::SetCommandDataFromInt(RBuf8& aCommandData, 
+	TInt aOffset, TInt aLength, TInt aValue)
+	{
+	LOG_STATIC_FUNC
+	__ASSERT_DEBUG(aLength <= 4, Panic(EAvrcpCommandDataTooLong));
+	
+	for(TInt i = 0; i < aLength; i++)
+		{
+		aCommandData[aOffset+i] = aValue >> (8*i);
+		}
+	}
+
+/** Reads command data from the buffer to an int.
+
+@param aCommandData The buffer from which to read the data.
+@param aOffset The offset within aCommandData read from.
+@param aLength The length of data to read.  This must not be
+				more than 4.
+@param aValue On return, the value of the specified data section.
+*/	
+void AvrcpUtils::ReadCommandDataToInt(const RBuf8& aCommandData, 
+	TInt aOffset, TInt aLength, TInt& aValue)
+	{
+	LOG_STATIC_FUNC
+	__ASSERT_DEBUG(aLength <= 4, Panic(EAvrcpCommandDataTooLong));
+	
+	aValue = 0;
+	
+	for(TInt i = 0 ; i < aLength; i++)
+		{
+		aValue |= aCommandData[aOffset+i]<<(8*i);
+		}
+	}
+
+/** Convert from a RemCon address to a bluetooth device address.
+
+@param aRemoteAddress The RemCon format address to convert.
+@param aBTAddr On return, the bluetooth device address.
+@return Whether the conversion could be performed successfully.
+*/	
+TInt AvrcpUtils::RemConToBTAddr(const TRemConAddress& aRemoteAddress, TBTDevAddr& aBTAddr)
+	{
+	LOG_STATIC_FUNC
+	TInt err = KErrArgument;
+	
+	// Check client has provided us a valid address
+	if(aRemoteAddress.Addr().Length() == KBTDevAddrSize)
+		{
+		aBTAddr = TBTDevAddr(aRemoteAddress.Addr());
+		err = KErrNone;
+		}
+	else
+		{
+		__ASSERT_DEBUG(EFalse, AvrcpUtils::Panic(EAvrcpBadBTAddr));
+		}
+		
+	return err;
+	}
+
+/** Convert from a bluetooth device address to a RemCon address.
+
+We assume this cannot fail, as bluetooth addresses are generated
+internally rather than by a client, so they should always be
+valid, and so convertible.
+
+@param aBTAddr The bluetooth device address to convert.
+@param aRemoteAddress On return, the RemCon format address.
+*/	
+void AvrcpUtils::BTToRemConAddr(const TBTDevAddr& aBTAddr, TRemConAddress& aRemConAddress)
+	{
+	LOG_STATIC_FUNC
+	aRemConAddress.Addr() = aBTAddr.Des();
+	aRemConAddress.BearerUid() = TUid::Uid(KRemConBearerAvrcpImplementationUid);
+	}
+
+NONSHARABLE_CLASS(CSpecificThreadCallBackBody)
+	: public CActive
+	{
+public:
+	static CSpecificThreadCallBackBody* NewL(const TCallBack& aCallBack, TInt aPriority);
+	~CSpecificThreadCallBackBody();
+	
+	TInt Start();
+	TInt CallBack();
+	void HandleCancel();
+	
+private:
+	CSpecificThreadCallBackBody(const TCallBack& aCallBack, TInt aPriority);
+	void ConstructL();
+	
+	TInt AsyncMessage(TInt aParam);
+	
+private: // from CActive
+	void RunL();
+	void DoCancel();
+	
+private:
+	TCallBack		iCallBack;
+	
+	RThread			iLocalThread;
+	
+	RMsgQueue<TInt>	iInbound;
+	RMsgQueue<TInt>	iOutbound;
+	};
+
+RSpecificThreadCallBack::RSpecificThreadCallBack()
+	: iBody(NULL)
+	{
+	LOG_FUNC
+	}
+
+TInt RSpecificThreadCallBack::Create(const TCallBack& aCallBack, TInt aPriority)
+	{
+	TRAPD(err, iBody = CSpecificThreadCallBackBody::NewL(aCallBack, aPriority));
+	return err;
+	}
+
+void RSpecificThreadCallBack::Close()
+	{
+	LOG_FUNC
+	delete iBody;
+	iBody = NULL;
+	}
+
+TInt RSpecificThreadCallBack::Start()
+	{
+	return iBody->Start();
+	}
+
+TInt RSpecificThreadCallBack::CallBack()
+	{
+	return iBody->CallBack();
+	}
+
+void RSpecificThreadCallBack::Cancel()
+	{
+	return iBody->HandleCancel();
+	}
+
+CSpecificThreadCallBackBody* CSpecificThreadCallBackBody::NewL(const TCallBack& aCallBack, TInt aPriority)
+	{
+	CSpecificThreadCallBackBody* self = new(ELeave) CSpecificThreadCallBackBody(aCallBack, aPriority);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CSpecificThreadCallBackBody::CSpecificThreadCallBackBody(const TCallBack& aCallBack, TInt aPriority)
+	: CActive(aPriority)
+	, iCallBack(aCallBack)
+	{
+	LOG_FUNC
+	}
+
+void CSpecificThreadCallBackBody::ConstructL()
+	{
+	User::LeaveIfError(iInbound.CreateLocal(1));
+	User::LeaveIfError(iOutbound.CreateLocal(1));
+	}
+
+CSpecificThreadCallBackBody::~CSpecificThreadCallBackBody()
+	{
+	LOG_FUNC
+	HandleCancel();
+	iInbound.Close();
+	iOutbound.Close();
+	iLocalThread.Close();
+	}
+
+TInt CSpecificThreadCallBackBody::Start()
+	{
+	TInt err = KErrNone;
+	if(!IsAdded())
+		{
+		err = iLocalThread.Duplicate(RThread());
+		if(err == KErrNone)
+			{
+			CActiveScheduler::Add(this);
+			iInbound.NotifyDataAvailable(iStatus);
+			SetActive();
+			}
+		}
+	return err;
+	}
+
+TInt CSpecificThreadCallBackBody::CallBack()
+	{
+	TInt err = KErrUnknown;
+	if(iLocalThread.Id() == RThread().Id())
+		{
+		// Simple synchronous case.
+		err = iCallBack.CallBack();
+		}
+	else
+		{
+		RThread thisThread;
+		err = thisThread.Duplicate(RThread());
+		if(err == KErrNone)
+			{
+			err = AsyncMessage(thisThread.Handle());
+			}
+		}
+	return err;
+	}
+	
+TInt CSpecificThreadCallBackBody::AsyncMessage(TInt aParam)
+	{
+	TInt err = KErrNone;
+	TRequestStatus logonStatus;
+	iLocalThread.Logon(logonStatus);
+	if(logonStatus == KErrNoMemory)
+		{
+		// This seems kludgy, but I think it is the most reliable way.
+		User::WaitForRequest(logonStatus); // Ensure the all requests are correct...
+		err = KErrNoMemory;
+		}
+	else
+		{
+		iInbound.SendBlocking(aParam);
+		TRequestStatus status;
+		iOutbound.NotifyDataAvailable(status);
+		User::WaitForRequest(status, logonStatus);
+		if(status == KRequestPending)
+			{
+			// Remote thread is dead
+			iOutbound.CancelDataAvailable();
+			User::WaitForRequest(status);
+			err = KErrDied;
+			}
+		else
+			{
+			// Success (the thread may have subsequently died, but we are only concerned with this call).
+			iLocalThread.LogonCancel(logonStatus);
+			User::WaitForRequest(logonStatus);
+			err = status.Int();
+			if(err == KErrNone)
+				{
+				iOutbound.ReceiveBlocking(err);
+				}
+			}
+		}
+	return err;
+	}
+
+
+void CSpecificThreadCallBackBody::RunL()
+	{
+	TInt threadHandle;
+	iInbound.ReceiveBlocking(threadHandle);
+	if(threadHandle == 0)
+		{
+		// 0 is a cancel message
+		// therefore don't do anything
+		iOutbound.SendBlocking(KErrNone);
+		}
+	else
+		{
+		RThread remoteThread;
+		remoteThread.SetHandleNC(threadHandle);
+		
+		TInt result = iCallBack.CallBack();
+		
+		// There doesn't seem to be a safe way of handling when the other thread
+		// dies......
+		iOutbound.SendBlocking(result);
+		
+		remoteThread.Close();
+		
+		iInbound.NotifyDataAvailable(iStatus);
+		SetActive();
+		}
+	}
+
+void CSpecificThreadCallBackBody::DoCancel()
+	{
+	if(RThread().Id() == iLocalThread.Id())
+		{
+		iInbound.CancelDataAvailable();
+		}
+	else
+		{
+		// other thread cancelling - so just complete the
+		// request
+		TRequestStatus* status = &iStatus;
+		User::RequestComplete(status, KErrCancel);
+		}
+	}
+
+void CSpecificThreadCallBackBody::HandleCancel()
+	{
+	if(IsAdded())
+		{
+		if(RThread().Id() == iLocalThread.Id())
+			{
+			Cancel(); // synchronous cancel is fine in same thread...
+			}
+		else
+			{
+			// In a different thread - this is more interesting...
+			TInt err = AsyncMessage(0); // 0 is special as it means cancel.
+			if(err == KErrDied && IsActive())
+				{
+				// Remote thread has already died so we need to tidy up the
+				// active object ourselves.
+				Cancel();
+				}
+			}
+		}
+	// else shouldn't be active...
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/browsecommand.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,285 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// avrcpcommands.cpp
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <e32base.h>
+#include <remcon/remconbearerobserver.h>
+#include <remcon/remconconverterplugin.h>
+#include <remcon/messagetype.h>
+#include <remconbeareravrcp.h>
+
+#include "browsecommand.h"
+#include "avrcpinternalinterface.h"
+#include "avrcplog.h"
+#include "avrcputils.h"
+#include "browsingframe.h"
+#include "mediabrowse.h"
+#include "nowplaying.h"
+							
+
+//---------------------------------------------------------------------
+// Incoming command construction
+//---------------------------------------------------------------------
+
+/** Factory function.
+
+@param aFrame The frame this command is to represent.
+@param aRemConId The RemCon transaction label.
+@param aTransLabel The AVCTP transaction label.
+@param aAddr The bluetooth address to send this command to.
+@return A fully constructed CBrowseCommand.
+@leave System wide error codes.
+*/
+CBrowseCommand* CBrowseCommand::NewL(const TDesC8& aMessageInformation, 
+	TUint aRemConId, 
+	SymbianAvctp::TTransactionLabel aTransLabel, 
+	const TBTDevAddr& aAddr,
+	CAvrcpPlayerInfoManager* aPlayerInfoManager)
+	{
+	LOG_STATIC_FUNC
+	CBrowseCommand* command = new(ELeave)CBrowseCommand(aRemConId, aTransLabel, aAddr, aPlayerInfoManager);
+	CleanupStack::PushL(command);
+	command->ConstructL(aMessageInformation);
+	CleanupStack::Pop(command);
+	return command;
+	}
+
+/** Constructor.
+
+@param aFrame The AV/C frame this command is to represent.
+@param aRemConId The RemCon transaction label.
+@param aTransLabel The AVCTP transaction label.
+@param aAddr The bluetooth address to send this command to.
+@return A partially constructed CBrowseCommand.
+@leave System wide error codes.
+*/	
+CBrowseCommand::CBrowseCommand(TUint aRemConId, 
+	SymbianAvctp::TTransactionLabel aTransLabel, 
+	const TBTDevAddr& aAddr,
+	CAvrcpPlayerInfoManager* aPlayerInfoManager)
+	: CAvrcpCommand(aRemConId, aTransLabel, aAddr)
+	{
+	LOG_FUNC
+	iPlayerInfoManager = aPlayerInfoManager;
+	}
+
+/** Destructor.
+*/
+CBrowseCommand::~CBrowseCommand()
+	{
+	LOG_FUNC
+	__ASSERT_DEBUG(iUsers == 0, AvrcpUtils::Panic(EAvrcpCommandStillInUse));
+	iFrame.Close();
+	iCommandData.Close();
+	}
+
+/** Second phase construction.
+*/
+void CBrowseCommand::ConstructL(const TDesC8& aMessageInformation)
+	{
+	iFrame.CreateL(aMessageInformation);
+	}
+
+//------------------------------------------------------------------------------------
+// Called by router
+//------------------------------------------------------------------------------------
+
+SymbianAvctp::TMessageType CBrowseCommand::MessageType() const
+	{
+	return SymbianAvctp::EResponse;
+	}
+	
+//------------------------------------------------------------------------------------
+// Called by handlers
+//------------------------------------------------------------------------------------
+	
+/** Fills in command info from iFrame.
+
+This must be called by the command handler before processing this
+command.
+
+This functions sets iInterfaceUid, iOperationId and iCommandData
+to the correct values according to iFrame.  The format of iCommandData
+is defined by RemCon and is dependent on iInterfaceUid and iOperationId.
+
+@return KErrNone				If the frame has been parsed successfully.
+@return KErrNotSupported		This frame represents a command for which a
+								RemCon converter or client side interface
+								cannot be found.
+@return KErrAvrcpInvalidCType	The CType specified in this frame is invalid.
+@return KErrCorrupt	        	If the frame is corrupted(e.g invalid Operation Id).
+@return	System wide error code.
+*/
+TInt CBrowseCommand::ProcessIncomingCommandL(TInt aMaxResponse)
+	{
+	LOG_FUNC
+	TInt result = KErrNotSupported;
+	iMaxResponse = aMaxResponse-5;
+
+	// This command has already been verified as containing at least a header
+	// and an accurate length field
+	switch(AvrcpBrowsing::BrowsingFrame::PduId(iFrame)) // PDU ID
+		{
+	case AvrcpBrowsing::ESetBrowsedPlayer:
+		{
+		result = HandleSetBrowsedPlayer();
+		break;
+		}
+	case AvrcpBrowsing::EGetFolderItems:
+		{
+		result = HandleGetFolderItems();
+		break;
+		}
+	case AvrcpBrowsing::EChangePath:
+		{
+		result = HandleChangePath();
+		break;
+		}
+	case AvrcpBrowsing::EGetItemAttributes:
+		{
+		result = HandleGetItemAttributes();
+		break;
+		}
+	case AvrcpBrowsing::ESearch:
+		{
+		result = HandleSearch();
+		break;
+		}
+	case AvrcpBrowsing::EGeneralReject:
+		// We only support the target role for browsing, so we should
+		// never receive a General Reject
+		// fallthrough
+	default:
+		{
+		result = HandleUnknownPdu();
+		}
+		};
+	return result;
+	}
+	
+
+/** Processes an outgoing response.
+
+This should only be called for vendor dependent commands as
+we respond to passthrough commands internally.
+
+@param aFrame The command data for the response.
+*/
+void CBrowseCommand::ProcessOutgoingResponse(RBuf8& aCommandData)
+	{
+	__ASSERT_DEBUG(( (iInterfaceUid == TUid::Uid(KRemConMediaBrowseApiUid)) 
+				|| (iInterfaceUid == TUid::Uid(KRemConNowPlayingApiUid))
+				|| (iInterfaceUid == TUid::Uid(KUidAvrcpInternalInterface))),
+				AvrcpUtils::Panic(EAvrcpResponseToUnknownCommand));
+	
+	iFrame.Close();
+	iFrame.Assign(aCommandData);
+	TInt length = aCommandData.Length() - 3;
+	iFrame[1] = length >> 8;
+	iFrame[2] = length;
+	aCommandData.Assign(NULL);
+	}
+
+/** Set the response type in the AV/C frame.
+
+@param aErr The result of processing the operation. KErrNone if 
+			successful. KErrNotsupported if this operation is not
+			implemented, eg because no converter was found.
+*/
+void CBrowseCommand::SetResult(TInt aErr)
+	{
+	LOG_FUNC
+	switch(aErr)
+		{
+		case KErrNone:
+			break;
+		case KErrCorrupt:
+		case EAvrcpResponseToUnknownCommand:
+		case KErrAvrcpAirInvalidCommand:
+		case KErrAvrcpAirInvalidParameter:
+		case KErrAvrcpAirParameterNotFound:
+		case KErrAvrcpAirInternalError:
+		case KErrAvrcpAirSuccess:
+		case KErrAvrcpAirUidChanged:
+		case KErrAvrcpAirReserved:
+		case KErrAvrcpAirInvalidDirection:
+		case KErrAvrcpAirNotADirectory:
+		case KErrAvrcpAirDoesNotExist:
+		case KErrAvrcpAirInvalidScope:
+		case KErrAvrcpAirRangeOutOfBounds:
+		case KErrAvrcpAirUidIsADirectory:
+		case KErrAvrcpAirMediaInUse:
+		case KErrAvrcpAirNowPlayingListFull:
+		case KErrAvrcpAirSearchNotSupported:
+		case KErrAvrcpAirSearchInProgress:
+		case KErrAvrcpAirInvalidPlayerId:
+		case KErrAvrcpAirPlayerNotBrowesable:
+		case KErrAvrcpAirPlayerNotAddressed:
+		case KErrAvrcpAirNoValidSearchResults:
+		case KErrAvrcpAirNoAvailablePlayers:
+		case KErrAvrcpAirAddressedPlayerChanged:
+		case KErrAvrcpInvalidScope:
+			{
+			// If this fails we can't send the error response - just give up
+			TRAPD(err, GenerateRejectPayloadL(aErr));
+			err = err; // Avoid warning about not using it.
+			break;
+			}
+		}
+	}
+
+/** Gets this command's frame.
+@return the browse frame for this command
+*/	
+const TDesC8& CBrowseCommand::Data() const
+	{
+	LOG_FUNC
+	return iFrame;
+	}
+
+const TDesC8& CBrowseCommand::CommandData() const
+	{
+	LOG_FUNC
+	return iCommandData;
+	}
+
+void CBrowseCommand::GenerateRejectPayloadL(TInt aErr)
+	{
+	LOG_FUNC;
+	
+	TUint8 pduId = AvrcpBrowsing::BrowsingFrame::PduId(iFrame);
+	RRemConMediaErrorResponse errResponse;		
+	errResponse.iPduId = pduId;
+	errResponse.iStatus = RAvrcpIPC::SymbianErrToStatus(aErr);
+	
+	RBuf8 frame;
+	frame.CreateL(KBrowseResponseBaseLength);
+	CleanupClosePushL(frame);
+	errResponse.WriteL(frame);
+	CleanupStack::Pop(&frame);
+	
+	iFrame.Close();
+	iFrame.Assign(frame);
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/browsingframe.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,81 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "browsingframe.h"
+
+
+/** Verifies the length of a frame is correct.  Checking:
+1) Header is present
+2) Data length indicated is present
+
+This does not semantically check that the data expected for
+the PDU ID is present.
+
+@param aFrame The frame to verify
+@leave KErrCorrupt if the length of the frame is incorrect
+*/
+void AvrcpBrowsing::BrowsingFrame::VerifyFrameL(const TDesC8& aFrame)
+	{
+	if((aFrame.Length() < AvrcpBrowsing::KHeaderLength) ||
+	  (aFrame.Length() < (AvrcpBrowsing::KHeaderLength + ParamLength(aFrame))))
+		{
+		User::Leave(KErrCorrupt);
+		}
+	}
+
+
+/** Retreives the PDU ID from this frame.
+
+@pre The integrity of the frame must have been verified (@see 
+	 BrowsingFrame::VerifyFrameL) as the length is not checked
+	 before retrieving the PDU ID.
+@param aFrame The frame to retrieve the PDU ID for.
+@return The PDU ID of aFrame
+*/
+AvrcpBrowsing::TPduId AvrcpBrowsing::BrowsingFrame::PduId(const TDesC8& aFrame)
+	{
+	return aFrame[0];
+	}
+
+/** Retreives the parameter length from this frame.
+
+@pre The integrity of the frame must have been verified (@see 
+	 BrowsingFrame::VerifyFrameL) as the length is not checked
+	 before retrieving the parameter length.
+@param aFrame The frame to retrieve the parameter length for.
+@return The parameter length of aFrame
+*/
+TInt AvrcpBrowsing::BrowsingFrame::ParamLength(const TDesC8& aFrame)
+	{
+	TInt paramLength = 0;
+	paramLength += aFrame[2];
+	paramLength += ((TUint)aFrame[1]) << 8;
+	
+	return paramLength;
+	}
+
+/** Retreives the payload from this frame.
+
+@pre The integrity of the frame must have been verified (@see 
+	 BrowsingFrame::VerifyFrameL) as the length is not checked
+	 before retrieving the payload.
+@param aFrame The frame to retrieve the payload for.
+@param aPayload On return the payload of aFrame
+*/
+void AvrcpBrowsing::BrowsingFrame::Payload(const TDesC8& aFrame, TPtrC8& aPayload)
+	{
+	aPayload.Set(aFrame.Mid(AvrcpBrowsing::KHeaderLength, AvrcpBrowsing::BrowsingFrame::ParamLength(aFrame)));
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/bulkbearer.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,369 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <remconaddress.h>
+#include <remconbeareravrcp.h>
+#include <remcon/remconbearerbulkobserver.h>
+
+#include "avrcpbrowsingcommandhandler.h"
+#include "avrcprouter.h"
+#include "avrcputils.h"
+#include "browsecommand.h"
+#include "bulkbearer.h"
+#include "playerstatewatcher.h"
+
+#include "avrcplog.h"
+
+#ifdef _DEBUG
+PANICCATEGORY("avrcpbulk");
+#endif // _DEBUG
+
+CAvrcpBulkBearer* CAvrcpBulkBearer::NewL(RAvctp& aAvctp, CAvrcpPlayerInfoManager& aPlayerInfoManager)
+	{
+	LOG_STATIC_FUNC
+	CAvrcpBulkBearer* bulkBearer = new(ELeave) CAvrcpBulkBearer(aPlayerInfoManager, aAvctp);
+	return bulkBearer;
+	}
+
+CAvrcpBulkBearer::~CAvrcpBulkBearer()
+	{
+	LOG_FUNC
+	ASSERT_DEBUG(!iRouter); // Should already be stopped...
+	}
+
+CAvrcpBulkBearer::CAvrcpBulkBearer(CAvrcpPlayerInfoManager& aPlayerInfoManager, RAvctp& aAvctp)
+	: iPlayerInfoManager(aPlayerInfoManager)
+	, iAvctp(aAvctp)
+	, iReadyBrowseCommands(_FOFF(CAvrcpCommand, iReadyLink))
+	{
+	LOG_FUNC
+	}
+
+MIncomingCommandHandler* CAvrcpBulkBearer::IncomingHandler(const TBTDevAddr& aAddr)
+	{
+	LOG_FUNC
+	
+	MIncomingCommandHandler* handler = NULL;
+	TInt ix = iBrowseHandlers.Find(aAddr, CAvrcpBulkBearer::CompareBrowsingCommandHandlerByBDAddr);
+	if(ix >= 0)
+		{
+		handler = iBrowseHandlers[ix];
+		}
+
+	return handler;
+	}
+
+MOutgoingCommandHandler* CAvrcpBulkBearer::OutgoingHandler(const TBTDevAddr& /*aAddr*/)
+	{
+	LOG_FUNC
+	// We've received a response, but we haven't sent a command.  Naughty remote,
+	// just ignore it.
+	return NULL;
+	}
+
+void CAvrcpBulkBearer::DoConnectIndicateL(const TBTDevAddr& aBTDevice)
+	{
+	LOG_FUNC
+	ASSERT_BULK_THREAD;
+	
+	ASSERT_DEBUG(Operational());
+	
+	CRcpBrowsingCommandHandler* handler = CRcpBrowsingCommandHandler::NewL(*this, *iRouter, iPlayerInfoManager, aBTDevice);
+	CleanupStack::PushL(handler);
+	
+	iBrowseHandlers.AppendL(handler);
+	
+	CleanupStack::Pop(handler);
+	}
+	
+void CAvrcpBulkBearer::ConnectIndicate(const TBTDevAddr& aBTDevice)
+	{
+	LOG_FUNC
+	// If we failed to allocate a handler for this connection the router will
+	// not be able to find it when it checks, and will tell AVCTP that we're 
+	// not interested in this connection.
+	TRAP_IGNORE(DoConnectIndicateL(aBTDevice));
+	}
+
+void CAvrcpBulkBearer::ConnectConfirm(const TBTDevAddr& IF_FLOGGING(aBTDevice), TInt IF_FLOGGING(aError))
+	{
+	LOG_FUNC
+	LOGBTDEVADDR(aBTDevice);
+	LOG1(_L("\taError = %d"), aError);
+	
+	// Outlandish!  We did not ask for this!
+	__ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpConnectConfirmOnBrowseChannel));
+	}
+
+void CAvrcpBulkBearer::DisconnectIndicate(const TBTDevAddr& aBTDevice)
+	{
+	LOG_FUNC
+	ASSERT_BULK_THREAD;
+	
+	CRcpBrowsingCommandHandler* handler = NULL;
+	TInt ix = iBrowseHandlers.Find(aBTDevice, CAvrcpBulkBearer::CompareBrowsingCommandHandlerByBDAddr);
+	if(ix >= 0)
+		{
+		handler = iBrowseHandlers[ix];
+		delete handler;
+		iBrowseHandlers.Remove(ix);
+		}
+	else
+		{
+		ASSERT_DEBUG(EFalse);
+		}
+	}
+
+void CAvrcpBulkBearer::DisconnectConfirm(const TBTDevAddr& IF_FLOGGING(aBTDevice), TInt IF_FLOGGING(aError))
+	{
+	LOG_FUNC
+	LOGBTDEVADDR(aBTDevice);
+	LOG1(_L("\taError = %d"), aError);
+	
+	// Also outlandish!  Connections on browse channel are all passive.
+	__ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpDisconnectConfirmOnBrowseChannel));
+	}
+
+void CAvrcpBulkBearer::MrcciNewCommand(CAvrcpCommand& aCommand)
+	{
+	LOG_FUNC
+
+	DoNewCommand(aCommand, KNullClientId);
+	}
+
+// This overload is used when we want to address a stateless command that may
+// be interleaved with commands from other controllers.  The only command
+// this is currently used for is the internal UidCounterUpdate command.
+void CAvrcpBulkBearer::MrcciNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId)
+	{
+	LOG_FUNC
+	// Verify that it's an internal command
+	__ASSERT_DEBUG(aCommand.RemoteAddress() == TBTDevAddr(0), AvrcpUtils::Panic(ESpecificAddressUsedForBrowsingCommand));
+		
+	DoNewCommand(aCommand, aClientId);
+	}
+
+void CAvrcpBulkBearer::DoNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId)
+	{
+	LOG_FUNC
+
+	// Need to put the command on the queue straight
+	// away in case RemCon collects it synchronously
+	iReadyBrowseCommands.AddLast(aCommand);
+	aCommand.IncrementUsers();
+	
+	TRemConAddress remAddr;
+	AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr);
+	
+	TInt err = (aClientId == KNullClientId) ? iObserver->NewCommand(remAddr) : iObserver->NewCommand(remAddr, aClientId);
+		
+	if(err != KErrNone)
+		{
+		TUid interfaceUid;
+		TUint remconId, operationId;
+		RBuf8 commandData;
+		TBTDevAddr btAddr;
+		
+		// Calling GetCommandInfo transfers ownership of the command data.  
+		aCommand.GetCommandInfo(interfaceUid, remconId, operationId, commandData, btAddr);
+		MrcbbiSendReject(interfaceUid, operationId, remconId, remAddr);
+		commandData.Close();
+
+		// RemCon is not going to pick this command up
+		aCommand.iReadyLink.Deque();
+		aCommand.DecrementUsers();
+		}
+	}
+
+TUint CAvrcpBulkBearer::MrcciNewTransactionId()
+	{
+	LOG_FUNC
+	return iObserver->NewTransactionId();
+	}
+
+void CAvrcpBulkBearer::MrcciCommandExpired(TUint aTransactionId)
+    {
+    LOG_FUNC
+    iObserver->CommandExpired(aTransactionId);
+    }
+
+TInt CAvrcpBulkBearer::MrcbciSetAddressedClient(const TRemConAddress& aAddr, const TRemConClientId& aClient)
+	{
+	LOG_FUNC
+	return iObserver->SetAddressedClient(aAddr, aClient);
+	}
+
+void CAvrcpBulkBearer::MrcbciRemoveAddressing(const TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+	iObserver->RemoveAddressing(aAddr);
+	}
+
+TInt CAvrcpBulkBearer::MrcbbiGetCommand(TUid& aInterfaceUid, 
+	TUint& aTransactionId, 
+	TUint& aOperationId, 
+	RBuf8& aData, 
+	TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+	TInt result = KErrNotFound;
+	
+	if(!iReadyBrowseCommands.IsEmpty())
+		{
+		CAvrcpCommand* command = iReadyBrowseCommands.First();
+
+		// Calling GetCommandInfo transfers the command data to RemCon.  This means
+		// once we have called it we are committed to returning KErrNone.
+		TBTDevAddr btAddr;
+		command->GetCommandInfo(aInterfaceUid, aTransactionId, aOperationId, aData, btAddr);
+		AvrcpUtils::BTToRemConAddr(btAddr, aAddr);
+		
+		// Remove command from queue first because calling
+		// DecrementUsers() may delete command
+		command->iReadyLink.Deque();
+		command->DecrementUsers();
+		result = KErrNone;
+		}
+	else
+		{
+		__DEBUGGER();
+		}
+	
+	return result;
+	}
+
+TInt CAvrcpBulkBearer::MrcbbiSendResponse(TUid aInterfaceUid, 
+	TUint /*aOperationId*/, 
+	TUint aTransactionId, 
+	RBuf8& aData, 
+	const TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+	TBTDevAddr btAddr;
+	TInt err = KErrNone;
+	
+	err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr);
+	__ASSERT_DEBUG(err == KErrNone, AvrcpUtils::Panic(EInvalidBtAddrInResponse));
+	
+	if(btAddr != TBTDevAddr(0))
+		{
+		MIncomingCommandHandler* handler = IncomingHandler(btAddr);
+		__ASSERT_ALWAYS(handler, AVRCP_PANIC(EAvrcpNotConnected));
+
+		err = handler->SendRemConResponse(aInterfaceUid, aTransactionId, aData);
+		}
+	else
+		{
+		err = iInternalHandler->SendRemConResponse(aInterfaceUid, aTransactionId, aData);
+		}
+		
+	return err;
+	}
+
+void CAvrcpBulkBearer::MrcbbiSendReject(TUid aInterfaceUid, 
+	TUint /*aOperationId*/, 
+	TUint aTransactionId, 
+	const TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+	
+	TBTDevAddr btAddr;
+	TInt err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr);
+	__ASSERT_DEBUG(err == KErrNone, AvrcpUtils::Panic(EInvalidBtAddrInResponse));
+
+	if(btAddr != TBTDevAddr(0))
+		{
+		IncomingHandler(btAddr)->SendReject(aInterfaceUid, aTransactionId);
+		}
+	else
+		{
+		iInternalHandler->SendReject(aInterfaceUid, aTransactionId);
+		}
+	}
+
+TInt CAvrcpBulkBearer::MrcbbiStartBulk(MRemConBearerBulkObserver& aObserver)
+	{
+	LOG_FUNC
+	iObserver = &aObserver;
+	TRAPD(err, DoStartBulkL());
+	if(err != KErrNone)
+		{
+		MrcbbiStopBulk();
+		}
+	return err;
+	}
+
+void CAvrcpBulkBearer::DoStartBulkL()
+	{
+	LOG_FUNC
+	LEAVEIFERRORL(Dll::SetTls(reinterpret_cast<TAny*>(EBulkThread)));
+	iInternalHandler = iPlayerInfoManager.BulkStartedL(*this);
+	iRouter = CBulkRouter::NewL(iAvctp, *this);
+	}
+
+void CAvrcpBulkBearer::MrcbbiStopBulk()
+	{
+	LOG_FUNC
+	WEAK_ASSERT_BULK_THREAD;
+	
+	iPlayerInfoManager.BulkStopped();
+	iInternalHandler = NULL;
+	
+	delete iRouter;
+	iRouter = NULL;
+	
+	iBrowseHandlers.ResetAndDestroy();
+	
+	iObserver = NULL; // the observer is no longer valid.
+	
+	Dll::FreeTls();
+	}
+
+TBool CAvrcpBulkBearer::Operational() const
+	{
+	LOG_FUNC
+	ASSERT_DEBUG(!iRouter == !iObserver); // internal consistency check
+	return !!iRouter;
+	}
+
+void CAvrcpBulkBearer::MrcbbiBulkClientAvailable(const TRemConClientId& aId)
+	{
+	LOG_FUNC
+	iPlayerInfoManager.BulkClientAvailable(aId);
+	}
+
+void CAvrcpBulkBearer::MrcbbiBulkClientNotAvailable(const TRemConClientId& aId)
+	{
+	LOG_FUNC
+	iPlayerInfoManager.BulkClientNotAvailable(aId);
+	}
+
+
+TBool CAvrcpBulkBearer::CompareBrowsingCommandHandlerByBDAddr(const TBTDevAddr* aKey, const CRcpBrowsingCommandHandler& aHandler)
+	{
+	LOG_STATIC_FUNC
+	return aKey && aHandler.BtAddr() == *aKey;
+	}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/controlcommand.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,1686 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+#include <avcframe.h>
+#include <e32base.h>
+#include <remcon/remconbearerobserver.h>
+#include <remcon/remconconverterplugin.h>
+#include <remcon/messagetype.h>
+#include <remconbeareravrcp.h>
+
+#include <absolutevolumeapi.h>
+#include <absolutevolumeutils.h>
+#include <remcon/avrcpspec.h>
+#include "controlcommand.h"
+#include "avrcpcommandframer.h"
+#include "avrcpfragmenter.h"
+#include "avrcpinternalinterface.h"
+#include "avrcpipc.h"
+#include "avrcplog.h"
+#include "avrcputils.h"
+#include "avrcpincomingcommandhandler.h"
+#include "avrcp.h"
+#include "mediabrowse.h"
+#include "mediainformation.h"
+#include "nowplaying.h"
+#include "playerinformation.h"
+#include "remconbattery.h"
+#include "remcongroupnavigation.h"
+
+//---------------------------------------------------------------------
+// Outgoing command construction
+//---------------------------------------------------------------------
+
+/** Factory function.
+
+@param aInterfaceUid The RemCon interface uid of this command.
+@param aCommand The operation id of this command within the interface defined
+				by aInterface Uid.
+@param aRemConId The RemCon transaction label.
+@param aTransactionLabel The AVCTP transaction label.
+@param aCommandData The RemCon command data associated with this command.
+@param aIsClick Whether this command is a button click (ie RemCon believes
+				that this and the other part of the click constitute one
+				command.
+@param aAddr The bluetooth address to send this command to.
+@return A fully constructed CControlCommand.
+@leave System wide error codes.
+*/
+CControlCommand* CControlCommand::NewL(TUid aInterfaceUid,
+	TUint aCommand, 
+	TUint aRemConId, 
+	SymbianAvctp::TTransactionLabel aTransactionLabel, 
+	RBuf8& aCommandData, 
+	TBool aIsClick, 
+	const TBTDevAddr& aAddr,
+	TBool aKnownToBearer)
+	{
+	LOG_STATIC_FUNC
+	CControlCommand* command = new (ELeave) CControlCommand(aInterfaceUid, aCommand, 
+			aRemConId, aTransactionLabel, aCommandData, aIsClick, aAddr, aKnownToBearer);
+	CleanupStack::PushL(command);
+	command->ConstructL();
+	CleanupStack::Pop(command);
+	return command;
+	}
+
+/** Constructor.
+
+@param aInterfaceUid The RemCon interface uid of this command.
+@param aCommand The operation id of this command within the interface defined
+				by aInterface Uid.
+@param aRemConId The RemCon transaction label.
+@param aTransactionLabel The AVCTP transaction label.
+@param aCommandData The RemCon command data associated with this command.
+@param aIsClick Whether this command is a button click (ie RemCon believes
+				that this and the other part of the click constitute one
+				command.
+@param aAddr The bluetooth address to send this command to.
+@return A constructed CControlCommand.
+@leave System wide error codes.
+*/
+CControlCommand::CControlCommand(TUid aInterfaceUid,
+	TUint aCommand,
+	TUint aRemConId, 
+	SymbianAvctp::TTransactionLabel aTransactionLabel, 
+	RBuf8& aCommandData,
+	TBool aIsClick,
+	const TBTDevAddr& aAddr,
+	TBool aKnownToBearer) 
+	: CAvrcpCommand(aRemConId, aTransactionLabel, aAddr)
+	{
+	LOG_FUNC
+	
+	iIsClick = aIsClick;
+	iInterfaceUid = aInterfaceUid;
+	iOperationId = aCommand;
+	iKnownToBearer = aKnownToBearer;
+	
+	iCommandData.Assign(aCommandData);
+	aCommandData.Assign(NULL);
+	iPlayerInfoManager = NULL;
+	}
+	
+//---------------------------------------------------------------------
+// Incoming command construction
+//---------------------------------------------------------------------
+
+/** Factory function.
+
+@param aMessageInformation A buffer containing AV/C frame this command is to represent.
+@param aRemConId The RemCon transaction label.
+@param aTransLabel The AVCTP transaction label.
+@param aAddr The bluetooth address to send the response to.
+@param aClientId The RemCon client that should receive this command
+@return A fully constructed CControlCommand.
+@leave System wide error codes.
+*/
+CControlCommand* CControlCommand::NewL(CAVCFrame* aFrame, 
+	TUint aRemConId, 
+	SymbianAvctp::TTransactionLabel aTransLabel, 
+	const TBTDevAddr& aAddr,
+	const TRemConClientId& aClientId,
+	CAvrcpPlayerInfoManager* aPlayerInfoManager)
+	{
+	LOG_STATIC_FUNC
+	CControlCommand* command = new(ELeave)CControlCommand(aFrame, aRemConId, aTransLabel, aAddr, aClientId, aPlayerInfoManager);
+	CleanupStack::PushL(command);
+	command->ConstructL();
+	CleanupStack::Pop(command);
+	return command;
+	}
+
+/** Constructor.
+
+@param aRemConId The RemCon transaction label.
+@param aTransLabel The AVCTP transaction label.
+@param aAddr The bluetooth address to send the response to.
+@param aClientId The RemCon client that should receive this command
+@return A partially constructed CControlCommand.
+@leave System wide error codes.
+*/	
+CControlCommand::CControlCommand(CAVCFrame* aFrame, 
+	TUint aRemConId, 
+	SymbianAvctp::TTransactionLabel aTransLabel, 
+	const TBTDevAddr& aAddr,
+	const TRemConClientId& aClientId,
+	CAvrcpPlayerInfoManager* aPlayerInfoManager) 
+	: CAvrcpCommand(aRemConId, aTransLabel, aAddr)
+	, iFrame(aFrame)
+	, iClientId(aClientId)
+	{
+	LOG_FUNC
+
+	iIsClick = ETrue; // Assume click until we know otherwise
+	iPlayerInfoManager = aPlayerInfoManager;
+	}
+
+//---------------------------------------------------------------------
+// Generic construction/destruction
+//---------------------------------------------------------------------
+
+/** Destructor.
+*/
+CControlCommand::~CControlCommand()
+	{
+	LOG_FUNC
+	__ASSERT_DEBUG(iUsers == 0, AvrcpUtils::Panic(EAvrcpCommandStillInUse));
+	__ASSERT_ALWAYS(!iHandlingLink.IsQueued(), AvrcpUtils::Panic(EAvrcpCommandStillQueuedForHandling));
+	__ASSERT_ALWAYS(!iReadyLink.IsQueued(), AvrcpUtils::Panic(EAvrcpCommandStillQueuedAsReady));
+	__ASSERT_ALWAYS(!iSendLink.IsQueued(), AvrcpUtils::Panic(EAvrcpCommandStillQueuedForSending));
+	delete iFrame;
+	iCommandData.Close();
+	delete iTimerEntry;
+	delete iTimerExpiryInfo;
+	}
+	
+/** Second phase construction.
+
+@leave System wide error codes.
+*/
+void CControlCommand::ConstructL()
+	{
+	LOG_FUNC
+
+	// Allocate these now so we know we have the memory.  Info is
+	// irrelevant as we won't add to the timer's queue without 
+	// setting the true info.
+	TCallBack callback(DummyCallback, NULL);
+	iTimerEntry = new(ELeave)TDeltaTimerEntry(callback);
+	iTimerExpiryInfo = new(ELeave)TAvrcpTimerExpiryInfo(NULL, *this);
+	}
+	
+//------------------------------------------------------------------------------------
+// From MRcpTimerNotify
+//------------------------------------------------------------------------------------	
+
+/** Get the timer entry.
+
+@return Timer entry.
+*/
+TDeltaTimerEntry* CControlCommand::TimerEntry()
+	{
+	return iTimerEntry;
+	}
+	
+/** Get the timer expiry info.
+
+@return Timer expiry info.
+*/
+TAvrcpTimerExpiryInfo* CControlCommand::TimerExpiryInfo()
+	{
+	return iTimerExpiryInfo;
+	}
+
+/** Remove this command's timer entry from the queue.
+
+@param aTimer The timer queue to remove this from.
+*/	
+void CControlCommand::CancelTimer(CDeltaTimer& aTimer)
+	{
+	LOG_FUNC
+
+	aTimer.Remove(*iTimerEntry);
+	}
+	
+//------------------------------------------------------------------------------------
+// Called by bearer
+//------------------------------------------------------------------------------------
+
+const TRemConClientId& CControlCommand::ClientId() const
+	{
+	return iClientId;
+	}
+//------------------------------------------------------------------------------------
+// Called by handlers
+//------------------------------------------------------------------------------------
+
+/** Creates iFrame.
+
+This function must be called between creating this command and using it.
+
+@param aInterfaceUid	The RemCon interface this command came from.
+@param aCommand			The command id within the interface identified by aInterfaceUid.
+@param aCommandData		Data supplied with this command by RemCon.  The format of this
+						data is defined by RemCon and is dependent on aInterfaceUid and 
+						aCommand.
+@leave System wide error code if parsing could not complete.
+*/
+void CControlCommand::ProcessOutgoingCommandL(MRemConBearerObserver& aObserver)
+	{
+	LOG_FUNC
+			
+	switch(iInterfaceUid.iUid)
+		{
+		//Process the absolute volume controller api
+		case KRemConAbsoluteVolumeControllerApiUid:
+			{
+			switch (iOperationId)
+			    {
+			    //Registers absolute volume changed
+			    case KRemConAbsoluteVolumeNotification:
+			        {
+					iFrame = AvrcpCommandFramer::NotifyVolumeChangeCommandL();
+			        break;
+			        }
+			    //Sets absolute volume.
+			    case KRemConSetAbsoluteVolume:
+			    	{
+			    	//Gets the absolute volume to be set.
+			    	RRemConAbsoluteVolumeRequest setAbsVol;
+			    	CleanupClosePushL(setAbsVol);
+					setAbsVol.ReadL(iCommandData);
+					
+					__ASSERT_ALWAYS(setAbsVol.iVolume <= setAbsVol.iMaxVolume, 
+							AvrcpUtils::Panic(EAvrcpVolumeBeyondMaxVolume));
+					
+					TUint8 absVol = KAvrcpMaxAbsoluteVolume * setAbsVol.iVolume / setAbsVol.iMaxVolume;
+					iFrame = AvrcpCommandFramer::SetAbsoluteVolumeCommandL(absVol);	
+					CleanupStack::PopAndDestroy(&setAbsVol);					
+			    	break;
+			    	}
+			    default:
+			    	{
+			    	User::Leave(KErrNotSupported);
+			    	}
+			    
+			    }			
+			break;
+			}
+		case KRemConCoreApiUid:
+			{
+			// Default interface - all commands are passthrough
+			AVCPanel::TOperationId avrcpOp;
+			
+			if((RemConToAvrcpOperation(iOperationId, avrcpOp) != KErrNone) ||
+			   (iCommandData.Length() < KRemConCoreApiButtonDataLength))
+				{
+				User::Leave(KErrCorrupt);
+				}
+			else
+				{
+				TInt remConButtonAct;
+				AvrcpUtils::ReadCommandDataToInt(iCommandData, 
+					KRemConCoreApiCommandDataOffset + KRemConCoreApiButtonDataOffset,
+					KRemConCoreApiButtonDataLength, remConButtonAct);
+		
+				AVCPanel::TButtonAction buttonAct = (remConButtonAct == ERemConCoreApiButtonPress) ? 
+					AVCPanel::EButtonPress : AVCPanel::EButtonRelease;
+
+				iFrame = AvrcpCommandFramer::PassthroughL(avrcpOp, buttonAct);
+				if(iIsClick)
+					{
+					// restore our mangled command data
+					AvrcpUtils::SetCommandDataFromInt(iCommandData, 
+						KRemConCoreApiCommandDataOffset + KRemConCoreApiButtonDataOffset,
+						KRemConCoreApiButtonDataLength, ERemConCoreApiButtonClick);
+					}
+				}
+			break;
+			}	
+		default:
+			{
+			RBuf8 buf;
+			buf.CreateMaxL(KAVCFrameMaxLength);
+			User::LeaveIfError(aObserver.InterfaceToBearer(TUid::Uid(KRemConBearerAvrcpImplementationUid), 
+				iInterfaceUid, iOperationId, iCommandData, ERemConCommand, buf));
+
+			CleanupClosePushL(buf);
+			iFrame = CAVCFrame::NewL(buf, AVC::ECommand);
+			CleanupStack::PopAndDestroy(&buf);
+			break;
+			}
+		};
+	}
+	
+/** Fills in command info from iFrame.
+
+This must be called by the command handler before handling this
+command.
+
+This functions sets iInterfaceUid, iOperationId and iCommandData
+to the correct values according to iFrame.  The format of iCommandData
+is defined by RemCon and is dependent on iInterfaceUid and iOperationId.
+
+@return KErrNone				If the frame has been parsed successfully.
+@return KErrNotSupported		This frame represents a command for which a
+								RemCon converter or client side interface
+								cannot be found.
+@return KErrAvrcpInvalidCType	The CType specified in this frame is invalid.
+@return KErrAvrcpMetadataInvalidCommand		The AVRCP command is invalid.
+@return KErrAvrcpMetadataInvalidParameter	The AVRCP parameter is invalid.
+@return KErrAvrcpMetadataParameterNotFound	The AVRCP parameter was not found.
+@return KErrAvrcpMetadataInternalError		An AVRCP internal error occurred (such as out-of-memory,
+											or an inter-process communication error)
+@return KErrCorrupt	        	If the frame is corrupted(e.g invalid Operation Id).
+@return	System wide error code.
+*/
+TInt CControlCommand::ParseIncomingCommandL(MRemConBearerObserver& aObserver, CAVRCPFragmenter& aFragmenter)
+	{
+	LOG_FUNC
+	TInt err = KErrNotSupported;
+	
+	switch(iFrame->Type())
+		{
+		// check it isn't a reponse
+		case AVC::ENotImplemented:
+		case AVC::EAccepted:
+		case AVC::ERejected:
+		case AVC::EInTransition:
+		case AVC::EImplemented:
+		case AVC::EChanged:
+		case AVC::EInterim:
+		case 0x0E:	// not given a enum for SC reasons; reserved response code in spec
+			{
+			// We were told this was a command, can't go using response
+			// CTypes here matey
+			err = KErrAvrcpInvalidCType;
+			break;
+			}
+		case AVC::EGeneralEnquiry:
+		case AVC::ESpecificEnquiry:
+			{
+			err = KErrNotSupported;
+			break;
+			}
+		default:
+			if (iFrame->Opcode() == AVC::EVendorDependent)
+				{
+				err = ParseIncomingVendorCommandL(aObserver, aFragmenter);
+				}
+			
+			else
+				{
+				// give off to the regular processor
+				err = ParseIncomingKnownOpcodeL(aObserver);
+				}
+			break;
+		};
+
+
+	return err;
+	}
+	
+/** Processes an incoming response.
+
+This function may not fail.  We always need to generate something
+to RemCon.
+
+@param aObserver Observer to use for retrieving converter.
+@param aFrame The AV/C frame containing the response.
+*/
+TInt CControlCommand::ParseIncomingResponse(MRemConBearerObserver& aObserver, const CAVCFrame& aFrame)
+	{
+	LOG_FUNC	
+	TInt error = KErrNone;
+	
+	// Compare Opcode with that of the sent frame rather than the
+	// received one because we trust that more.  Should be the same
+	// as this is matched by AVCTP transaction label, but who knows
+	// what those illicit remote devices could be up to.
+	if(iFrame->Opcode() == AVC::EPassThrough)
+		{
+		switch(aFrame.Type())
+			{		
+			case AVC::EAccepted:
+				{
+				InsertCoreResult(KErrNone);
+				break;
+				}
+			case AVC::ENotImplemented:
+				{
+				InsertCoreResult(KErrNotSupported);
+				break;
+				}
+			default:
+				{
+				InsertCoreResult(KErrGeneral);
+				break;
+				}
+			}
+		}	
+	else if (iFrame->Opcode() == AVC::EVendorDependent)
+		{
+		TPtrC8 payloadData;
+		AVC::TAVCVendorId vID;
+		//Get the PDU ID with that of the sent frame rather than the received one,
+		//the reason is the same to above comments.
+		payloadData.Set(CAVCVendorDependentCommand::GetPayloadAndVID(*iFrame, vID));
+		if (vID == KBluetoothSIGVendorId)
+			{
+			TMetadataTransferPDUID metadataPDUID = MetadataTransferParser::GetPDUID(payloadData);
+			switch ( metadataPDUID )
+			    {
+			    case ESetAbsoluteVolume://Response for setting absolute volume.
+			    	{
+			    	error = SetSetAbsoluteVolumeResult(aFrame);
+			    	break;
+			    	}
+			    case ERegisterNotification:
+			    	{
+			    	//Get notify event ID with the sent frame rather than the received one
+			    	//because there is a big possibility that the received one is an error response, e.g. rejected,notimplemented.
+			    	//In order to make sure this is an absolute volume response even if the response is an error response, 
+			    	//we have to use the sent frame, and then we can process absolute volume specifically.
+			    	TMetadataTransferNotifyEventID eventID = MetadataTransferParser::GetNotifyEventID(payloadData);
+			    	
+			    	__ASSERT_ALWAYS(eventID == ERegisterNotificationVolumeChanged,
+			    			AvrcpUtils::Panic(EAvrcpInvalidEventId));
+			    	
+			    	if (eventID == ERegisterNotificationVolumeChanged)
+			    		{
+			    		error = SetNotifyVolumeChangeResult(aFrame);
+			    		}
+			    	break;
+			    	}
+			    default:
+			    	{
+			    	// Should never hit here
+			    	AvrcpUtils::Panic(EAvrcpResponseToUnknownCommand);
+			        break;
+			    	}
+			    }
+			}
+		else
+			{
+			ParseIncomingUnknownResponse(aObserver, aFrame);
+			}
+		}
+	else
+		{
+		ParseIncomingUnknownResponse(aObserver, aFrame);
+		}
+	
+	return error;
+	}
+
+/** Processes an outgoing response.
+
+This should only be called for vendor dependent commands as
+we respond to passthrough commands internally.
+
+@param aObserver Observer to use for retrieving converter.
+@param aFrame The command data for the response.
+*/
+TInt CControlCommand::ProcessOutgoingResponse(MRemConBearerObserver& aObserver,
+//											TRemConMessageType aMessageType,
+											RBuf8& aResponseData,
+											CAVRCPFragmenter& aFragmenter)
+	{
+	TRAPD(err, DoProcessOutgoingResponseL(aObserver,aResponseData, aFragmenter));
+	return err;
+	}
+
+void CControlCommand::DoProcessOutgoingResponseL(MRemConBearerObserver& aObserver,
+											 RBuf8& aResponseData,
+											 CAVRCPFragmenter& aFragmenter)
+	{
+	LOG_FUNC
+	
+	// Payload size may be increased in GenerateMetadataResponsePayload
+	// if there's a very large response which needs fragmenting
+	RBuf8 payload;
+	payload.CreateL(KAVCFrameMaxLength);
+	CleanupClosePushL(payload);
+
+	if(( iInterfaceUid.iUid == KRemConMediaInformationApiUid ) 
+		|| ( iInterfaceUid.iUid == KRemConPlayerInformationUid )
+		|| ( iInterfaceUid.iUid == KRemConAbsoluteVolumeTargetApiUid )
+		|| ( iInterfaceUid.iUid == KRemConNowPlayingApiUid )
+		|| ( iInterfaceUid.iUid == KUidAvrcpInternalInterface))
+		{
+		// metadata
+		// "this" is the command for which the response lurks in aCommandData
+		// GenerateMetadataResponsePayload() MUST set PDU id, fragmentation stauts
+		// and paramlen (4 bytes total) - check this in ASSERT_DEBUG
+		User::LeaveIfError(GenerateMetadataResponsePayload(aObserver, payload, aResponseData));
+		__ASSERT_DEBUG(payload.Length() >= KAVRCPMinVendorDependentResponseLen, AvrcpUtils::Panic(EAvrcpFunnyLengthData));
+		aResponseData.Close();
+		
+		if (payload.Length() > KAVCMaxVendorDependentPayload)
+			{
+			// Fragment response (in payload) and queue fragments ready
+			// for sending when CT sends a CONTINUE request. If any other
+			// request is received (other than pass-through) then throw
+			// away our fragmented packet, as the CT has aborted.
+			aFragmenter.AssignPayload(payload);
+			payload.Assign(NULL);
+			payload.Close();
+			
+			// Re-allocate this back to a sensible size
+			// from the much larger size, which has now been
+			// assigned to fragmenter (avoids copying payload)
+			payload.CreateL(KAVCFrameMaxLength);
+			payload.Append(aFragmenter.GetNextFragmentHeader());
+			payload.Append(aFragmenter.GetNextFragment());
+			}
+			
+		CAVCFrame* frame = CAVCVendorDependentResponse::NewL(KBluetoothSIGVendorId);
+		frame->Append(payload);
+		frame->SetType(iFrame->Type());
+		delete iFrame;
+		iFrame = frame;
+		}
+	else
+		{
+		User::LeaveIfError(aObserver.InterfaceToBearer(TUid::Uid(KRemConBearerAvrcpImplementationUid),
+							iInterfaceUid, iOperationId,
+							aResponseData, /*ERemConCommand*/ERemConResponse, payload));
+		aResponseData.Close();
+		CAVCFrame* frame = CAVCFrame::NewL(payload, AVC::EResponse);
+		delete iFrame;
+		iFrame = frame;
+		}
+		
+	CleanupStack::PopAndDestroy(&payload);
+	}
+
+/** Set the response type in the AV/C frame.
+
+@param aErr The result of processing the operation. KErrNone if 
+			successful. KErrNotsupported if this operation is not
+			implemented, eg because no converter was found.
+*/
+void CControlCommand::SetResponseType(TInt aErr)
+	{
+	LOG_FUNC
+	AVC::TCType cType = iFrame->Type();
+	switch(aErr)
+		{
+		case KErrNone:
+		case KErrCompletion:
+		case KErrAvrcpHandledInternallyRespondNow:
+			if (cType == AVC::EControl)
+				{
+				iFrame->SetType(AVC::EAccepted);
+				}
+			else if (cType == AVC::ENotify)
+				{
+				iFrame->SetType(AVC::EInterim);
+				}
+			else if (cType == AVC::EInterim)
+				{
+				iFrame->SetType(AVC::EChanged);
+				}
+			else if (cType == AVC::EStatus)
+				{
+				iFrame->SetType(AVC::EStable);
+				}
+			else 
+				{
+				iFrame->SetType(AVC::EImplemented);
+				}
+			break;
+		case KErrAvrcpMetadataInvalidCommand:
+		case KErrAvrcpMetadataInvalidParameter:
+		case KErrAvrcpMetadataParameterNotFound:
+		case KErrAvrcpMetadataInternalError:
+		case KErrAvrcpAirInvalidCommand:
+		case KErrAvrcpAirInvalidParameter:
+		case KErrAvrcpAirParameterNotFound:
+		case KErrAvrcpAirInternalError:
+		case KErrAvrcpAirSuccess:
+		case KErrAvrcpAirUidChanged:
+		case KErrAvrcpAirReserved:
+		case KErrAvrcpAirInvalidDirection:
+		case KErrAvrcpAirNotADirectory:
+		case KErrAvrcpAirDoesNotExist:
+		case KErrAvrcpAirInvalidScope:
+		case KErrAvrcpAirRangeOutOfBounds:
+		case KErrAvrcpAirUidIsADirectory:
+		case KErrAvrcpAirMediaInUse:
+		case KErrAvrcpAirNowPlayingListFull:
+		case KErrAvrcpAirSearchNotSupported:
+		case KErrAvrcpAirSearchInProgress:
+		case KErrAvrcpAirInvalidPlayerId:
+		case KErrAvrcpAirPlayerNotBrowesable:
+		case KErrAvrcpAirPlayerNotAddressed:
+		case KErrAvrcpAirNoValidSearchResults:
+		case KErrAvrcpAirNoAvailablePlayers:
+		case KErrAvrcpAirAddressedPlayerChanged:
+			{
+			// If this fails, we're OOM (it only contains a NewL)
+			// so we can't send the error response - just give up
+			TRAPD(err, GenerateMetadataRejectPayloadL(aErr));
+			err = err;  // avoid warning about not using this
+			break;
+			}
+		default:
+			iFrame->SetType(AVC::ENotImplemented);
+		}
+	iFrame->SetFrameType(AVC::EResponse);	
+	}
+
+/** Gets this command's AV/C frame.
+@return the AV/C frame for this command
+*/	
+const CAVCFrame& CControlCommand::Frame() const
+	{
+	LOG_FUNC
+	return *iFrame;
+	}
+
+const TDesC8& CControlCommand::Data() const
+	{
+	LOG_FUNC
+	return iFrame->Data();
+	}
+
+SymbianAvctp::TMessageType CControlCommand::MessageType() const
+	{
+	LOG_FUNC
+	return (iFrame->FrameType() == AVC::ECommand) ? SymbianAvctp::ECommand : SymbianAvctp::EResponse;
+	}
+
+/** Gets the button action from this command's AV/C frame.
+This is only valid on passthrough commands.
+
+@return The button action.
+*/
+AVCPanel::TButtonAction CControlCommand::ButtonAct() const
+	{
+	LOG_FUNC
+	AVCPanel::TButtonAction act;
+	iFrame->ButtonAct(act);
+	return act;
+	}
+
+/** Gets whether this command is currently assumed to be a click.
+
+This is used to support the click facility offered by RemCon, which
+is not offered by AVRCP.  As such AVRCP internally simulates outgoing
+clicks by generating a press and release for one RemCon click.  When
+responses are received we know that if a command is a click we should
+send only one response up to RemCon.
+
+Incoming passthrough press commands are assumed to be click until
+the hold timer expires.  When a matching release is received we can
+then tell whether we need to send a single click up to RemCon, or 
+a release to match the press that was sent when the hold timer expired.
+
+@return ETrue is this is a click. EFalse if not.
+*/
+TBool CControlCommand::Click() const
+	{
+	LOG_FUNC
+	return iIsClick;
+	}
+
+/** Sets whether this command is currently assumed to be a click
+or not.
+
+@see CRcpcommand::Click()
+@param aIsClick ETrue to set this as click. EFalse to set this as 
+				not click.
+*/	
+void CControlCommand::SetClick(TBool aIsClick)
+	{
+	LOG_FUNC
+	iIsClick = aIsClick;
+	}
+
+/** Sets the RemCon data to indicate what button action this 
+command is.  This function is only valid for commands in the
+core api.
+
+@param aButtonAct The RemCon button action for this command.
+@param aCommand Whether this is a command. This is needed
+				because the command data is at a different offset for
+				commands and responses.
+*/
+void CControlCommand::SetCoreButtonAction(TRemConCoreApiButtonAction aButtonAct, TBool aCommand)
+	{
+	LOG_FUNC
+	
+	TInt offset = aCommand ? KRemConCoreApiButtonDataOffset + KRemConCoreApiCommandDataOffset
+						   : KRemConCoreApiButtonDataOffset + KRemConCoreApiResponseDataOffset;
+						   
+	AvrcpUtils::SetCommandDataFromInt(iCommandData, offset, 
+						  KRemConCoreApiButtonDataLength, aButtonAct);
+	}
+/** ReSets the RemCon data to indicate what button action this 
+command is. This function is called when we the command is being re-used to generate a 
+new command to remconServ.
+
+@param aButtonAct The RemCon button action for this command.
+@param aCommand Whether this is a command. This is needed
+				because the command data is at a different offset for
+				commands and responses.
+*/
+void CControlCommand::ReSetCoreButtonActionL(TRemConCoreApiButtonAction aButtonAct, TBool aCommand)
+	{
+	LOG_FUNC
+	
+	if (iCommandData.MaxLength() < KRemConCoreApiButtonDataLength)
+		{
+		iCommandData.Close();
+		iCommandData.CreateMaxL(KRemConCoreApiButtonDataLength);
+		}
+	
+	SetCoreButtonAction(aButtonAct, aCommand);
+	}
+
+/** Inserts the results at the beginning of this command's data.
+If the data buffer is not large enough it will be ReAlloced to 
+allow the insertion.
+
+@return The result to pass to RemCon. KErrNone for an AV/C accepted.
+		KErrNotSupported for an AV/C not implemented. KErrGeneral
+		for an AV/C rejected. 
+*/
+TInt CControlCommand::InsertCoreResult(TInt aResult)
+	{
+	LOG_FUNC
+	TInt err = KErrNone;
+	TInt requiredLength = KRemConCoreApiResultDataLength + iCommandData.Length();
+	
+	if(iCommandData.Length() >= requiredLength)
+		{
+		// Insert data to write result into
+		iCommandData.Insert(0, KRemConCoreApiResultPad);
+		}
+	else
+		{
+		// need longer buffer
+		err = iCommandData.ReAlloc(requiredLength);
+		if(!err)
+			{
+			iCommandData.Insert(0, KRemConCoreApiResultPad);
+			}
+		else
+			{
+			return err;
+			}
+		}
+
+	AvrcpUtils::SetCommandDataFromInt(iCommandData, 0, 
+						  KRemConCoreApiResultDataLength, aResult);
+	return err;
+	}
+
+/**
+Sets the result of set absolute volume response into this command's data
+*/
+TInt CControlCommand::SetSetAbsoluteVolumeResult(const CAVCFrame& aFrame)
+	{
+	TInt err = KErrNone;
+    TRAP(err, DoSetAbsoluteVolumeResultL(aFrame));
+    if (err != KErrNone)
+    	{
+    	// Ensure the client can receive an error in case of 
+    	// DoSetAbsoluteVolumeResultL leaves out.
+    	iCommandData.Zero();
+    	TPckgBuf<TInt> errBuf(err);
+    	iCommandData.Append(errBuf);
+    	iCommandData.SetLength(iCommandData.MaxLength());
+    	}
+    return err;
+	}
+
+void CControlCommand::DoSetAbsoluteVolumeResultL(const CAVCFrame& aFrame)
+	{
+	RRemConAbsoluteVolumeResponse absVol;	
+	absVol.iError = KErrGeneral;
+	absVol.iMaxVolume = KAvrcpMaxAbsoluteVolume;
+	
+	CleanupClosePushL(absVol);	
+	
+	switch(aFrame.Type())
+        {
+        case AVC::EAccepted:
+	        {
+	        if (aFrame.Data().Length() == KLengthSetAbsoluteVolumeResponse)
+		        {
+		        absVol.iError = KErrNone;
+		        TUint volumeOffset = KLengthSetAbsoluteVolumeResponse - 1;
+		        absVol.iVolume = KAbsoluteVolumeMask & aFrame.Data()[volumeOffset];
+		        }
+		    break;
+		    }
+        case AVC::ERejected: // fall through
+        case AVC::ENotImplemented:
+        	break;
+	    default:
+	    	break;
+        }
+	
+	absVol.WriteL(iCommandData);
+	CleanupStack::PopAndDestroy(&absVol);
+	}
+/**
+Sets the result of volume changed notification response into this command's 
+data.
+*/
+TInt CControlCommand::SetNotifyVolumeChangeResult(const CAVCFrame& aFrame)
+	{
+	TInt err = KErrNone;
+	TRAP(err, DoSetNotifyVolumeChangeResultL(aFrame));
+    if (err == KErrNone)
+    	{
+    	// Through AVC::TCType the RemCon sever can know whether the response
+    	// is an Interim or Changed or any other responses, so the RemCon 
+    	// server can decide to remove the notify command from its 
+    	// outgoingsent queue or not.
+    	iFrame->SetType(aFrame.Type());
+    	}
+    else
+    	{
+    	// Ensure the client can receive an error in case of 
+    	// DoSetNotifyVolumeChangeResultL leaves out.
+    	iCommandData.Zero();
+    	TPckgBuf<TInt> errBuf(KErrGeneral);
+    	iCommandData.Append(errBuf);
+    	iCommandData.SetLength(iCommandData.MaxLength());
+    	
+    	// Setting AVC::TCType to ERejected is intended to let the RemCon
+    	// server to remove the notify command from its outgoingsent queue
+    	// in case of DoSetNotifyVolumeChangeResultL leaves out.
+    	iFrame->SetType(AVC::ERejected);
+    	}
+    
+    return err;
+	}
+
+void CControlCommand::DoSetNotifyVolumeChangeResultL(const CAVCFrame& aFrame)
+	{
+	if (iCommandData.MaxLength() < KAbsoluteVolumeResponseDataSize)
+		{
+		iCommandData.Close();
+		iCommandData.CreateL(KAbsoluteVolumeResponseDataSize);
+		}
+	
+	RRemConAbsoluteVolumeResponse absVol;
+	absVol.iError = KErrGeneral;
+	absVol.iMaxVolume = KAvrcpMaxAbsoluteVolume;
+	
+	CleanupClosePushL(absVol);	
+	
+	switch(aFrame.Type())
+        {
+	    case AVC::EInterim:
+	    case AVC::EChanged:
+		    {
+		    if (aFrame.Data().Length() == KLengthNotifyVolumeChangeResponse)
+		    	{
+		    	absVol.iError = KErrNone;
+		    	TUint volumeOffset = KLengthNotifyVolumeChangeResponse - 1;
+		    	absVol.iVolume = KAbsoluteVolumeMask & aFrame.Data()[volumeOffset];			    	
+		    	}		    
+		    break;
+		    }
+	    case AVC::ERejected: // fall through
+	    case AVC::ENotImplemented:
+	    	break;
+	    default:
+	    	break;
+        }
+	absVol.WriteL(iCommandData);
+	CleanupStack::PopAndDestroy(&absVol);
+	}
+//------------------------------------------------------------------------------------
+// Internal utility functions
+//------------------------------------------------------------------------------------
+
+/** Fills in command info from an AVC Control.
+
+This functions sets iInterfaceUid, iOperationId and iCommandData
+to the correct values according to iFrame.  The format of iCommandData
+is defined by RemCon and is dependent on iInterfaceUid and iOperationId.
+
+@return KErrNone				If the frame has been parsed successfully.
+@return KErrNotSupported		This frame represents a command for which a
+								RemCon converter or client side interface
+								cannot be found.
+@return	System wide error code.
+*/
+TInt CControlCommand::ParseIncomingKnownOpcodeL(MRemConBearerObserver& aObserver)
+	{
+	LOG_FUNC
+	TInt err = KErrNotSupported;
+	
+	AVC::TCType cType = iFrame->Type();
+	
+	switch(iFrame->Opcode())
+		{
+		case AVC::EPassThrough:
+			{
+			if(iFrame->Data().Length() < KAVCPassthroughFrameLength)
+				{
+				LEAVEL(KErrCorrupt);
+				}
+			if (iFrame->SubunitType() != AVC::EPanel)
+				{
+				LEAVEL(KErrNotSupported);
+				}
+	
+			TUint8 avrcpOp;			
+			if (cType != AVC::EGeneralEnquiry && cType == AVC::EControl)
+				{
+				iCommandData.CreateMaxL(KRemConCoreApiButtonDataLength);
+				err = iFrame->OperationId(avrcpOp);
+				if (err == KErrNone)
+					{
+					if (avrcpOp!=AVCPanel::EVendorUnique)
+						{
+						err = AvrcpToRemConOperation(avrcpOp, iOperationId, iInterfaceUid);
+						}
+					else
+						{
+						err = ParseVendorUniquePassthroughCommand(aObserver);
+						}
+					}
+				
+				if (err!=KErrNone)
+					{
+					err = KErrAvrcpInvalidOperationId;
+					}
+				}
+			else
+				{
+				iCommandData.Close();
+				iCommandData.CreateL(KAVCFrameMaxLength);
+				TRemConMessageType message = ERemConCommand;
+				err = aObserver.BearerToInterface(TUid::Uid(KRemConBearerAvrcpImplementationUid),
+													iFrame->Data(),
+													iFrame->Data(),
+													iInterfaceUid,
+													iOperationId,
+													message,
+													iCommandData);
+				}
+			break;
+			}
+		case AVC::EUnitInfo:
+			{
+			if (iFrame->Type() == AVC::EStatus)
+				{
+				CAVCFrame* resp = AvrcpCommandFramer::UnitInfoResponseL();
+				delete iFrame;
+				iFrame = resp;
+				err = KErrCompletion; // since bearer has done its job without client needed
+				}
+			else
+				{
+				err = KErrAvrcpInvalidCType;
+				}
+			break;
+			}
+		case AVC::ESubunitInfo:
+			{
+			if (iFrame->Type() == AVC::EStatus)
+				{
+				CAVCFrame* resp = AvrcpCommandFramer::SubunitInfoResponseL();
+				delete iFrame;
+				iFrame = resp;
+				err = KErrCompletion; // since bearer has done its job without client needed
+				}
+			else
+				{
+				err = KErrAvrcpInvalidCType;
+				}
+			break;
+			}
+
+		default:
+			{
+			iCommandData.Close();
+			iCommandData.CreateL(KAVCFrameMaxLength);
+			TRemConMessageType message = ERemConCommand;
+			err = aObserver.BearerToInterface(TUid::Uid(KRemConBearerAvrcpImplementationUid),
+												iFrame->Data(),
+												iFrame->Data(),
+												iInterfaceUid,
+												iOperationId,
+												message,
+												iCommandData);
+			break;
+			}
+		}
+		
+	return err;
+	}
+	
+
+/** Fills in command info from an AVC Vendor Dependent message.
+
+This functions sets iInterfaceUid, iOperationId and iCommandData
+to the correct values according to iFrame.  The format of iCommandData
+is defined by RemCon and is dependent on iInterfaceUid and iOperationId.
+The AVC frame's length is checked that it at least contains the vendor id.
+
+@param aObserver An observer to be used to obtain a converter.
+@return KErrNone				If the frame has been parsed successfully.
+@return KErrNotSupported		This frame represents a command for which a
+								RemCon converter or client side interface
+								cannot be found.
+@return KErrAvrcpInvalidCType	The CType specified in this frame is invalid.
+@return KErrAvrcpMetadataInvalidCommand		The AVRCP command is invalid.
+@return KErrAvrcpMetadataInvalidParameter	The AVRCP parameter is invalid.
+@return KErrAvrcpMetadataParameterNotFound	The AVRCP parameter was not found.
+@return KErrAvrcpMetadataInternalError		An AVRCP internal error occurred (such as out-of-memory,
+											or an inter-process communication error)
+@return	System wide error code.
+*/	
+TInt CControlCommand::ParseIncomingVendorCommandL(MRemConBearerObserver& aObserver, CAVRCPFragmenter& aFragmenter)
+	{
+	LOG_FUNC
+	TInt err = KErrNone;
+
+	SetVendorInfoL(EFalse); // set id and payload; leaves if not enough space available
+	
+	if (iVendorId!=KBluetoothSIGVendorId)
+		{
+		iCommandData.Close();
+		iCommandData.CreateL(KAVCFrameMaxLength);
+	
+		TRemConMessageType message = ERemConCommand;
+		
+		err = aObserver.BearerToInterface(TUid::Uid(KRemConBearerAvrcpImplementationUid),
+											iFrame->Data(),
+											iFrame->Data(),
+											iInterfaceUid,
+											iOperationId,
+											message,
+											iCommandData);
+		}
+	else
+		{
+		// process v>1.0 version of AVRCP
+		// which use vendor dependent frames to extend v1.0 of AVRCP
+		// the vendor code has the value for the BT SIG
+		if (iFrame->SubunitType() != AVC::EPanel)
+			{
+			// this is for Control not Metadata
+			return KErrNotSupported;
+			}
+		
+		err = ParseMetadataTransferVendorCommand(aFragmenter);
+		if (err == KErrNone)
+			{
+			// Check that the interface UID is non-zero
+			__ASSERT_DEBUG(iInterfaceUid != TUid::Uid(0), AvrcpUtils::Panic(EAvrcpInterfaceUidNotSet));
+			}
+		}
+	return err;
+	}
+
+
+/** Creates RemCon command information from iFrame.
+
+This functions sets iInterfaceUid, iOperationId and iCommandData
+to the correct values according to iFrame.  The format of iCommandData
+is defined by the interface, iInterfaceUid and is dependent on 
+iOperationId.  A converter should be able to be found as this response
+is a result of an outgoing command on this interface.
+
+@param aObserver An observer used to get a converter.
+@param aFrame The AV/C frame for this command.
+*/
+void CControlCommand::ParseIncomingUnknownResponse(MRemConBearerObserver& aObserver, 
+	const CAVCFrame& aFrame)
+	{
+	LOG_FUNC
+	// We need to pass a response up to RemCon even if we can't get a
+	// converter to generate a decent response so we don't 
+
+	iCommandData.Close();
+	TInt err = iCommandData.Create(KAVCFrameMaxLength);
+	if(!err)
+		{
+		TRemConMessageType type = ERemConResponse; // output param
+		err = aObserver.BearerToInterface(TUid::Uid(KRemConBearerAvrcpImplementationUid),
+			aFrame.Data(), aFrame.Data(), iInterfaceUid, iOperationId, type, iCommandData);
+		}
+	}
+
+/** Translates from an AVC operation id to RemCon's core interface.
+
+@param aAvrcpOp		The AVC passthrough operation id.
+@param aRemConOp	On return the RemCon operation id within the core interface.
+@return KErrNone	If the operation has been translated successfully.
+@return KErrNotSupported	If the operation does not correspond to one
+							in the RemCon core interface.
+*/
+TInt CControlCommand::AvrcpToRemConOperation(TUint aAvrcpOp, TUint& aRemConOp, TUid& aRemConIf)
+	{
+	LOG_STATIC_FUNC
+	TInt err = KErrNone;
+
+	//TBH setting here as most are for the Core API
+	//some cases will override
+	aRemConIf = TUid::Uid(KRemConCoreApiUid);
+
+	switch(aAvrcpOp)	
+		{
+		case AVCPanel::ESelect:
+			aRemConOp = ERemConCoreApiSelect;
+			break;
+		case AVCPanel::EUp:
+			aRemConOp = ERemConCoreApiUp;
+			break;
+		case AVCPanel::EDown:
+			aRemConOp = ERemConCoreApiDown;
+			break;
+		case AVCPanel::ELeft:
+			aRemConOp = ERemConCoreApiLeft;
+			break;
+		case AVCPanel::ERight:
+			aRemConOp = ERemConCoreApiRight;
+			break;
+		case AVCPanel::ERightUp:
+			aRemConOp = ERemConCoreApiRightUp;
+			break;
+		case AVCPanel::ERightDown:
+			aRemConOp = ERemConCoreApiRightDown;
+			break;
+		case AVCPanel::ELeftUp:
+			aRemConOp = ERemConCoreApiLeftUp;
+			break;
+		case AVCPanel::ELeftDown:
+			aRemConOp = ERemConCoreApiLeftDown;
+			break;
+		case AVCPanel::ERootMenu:
+			aRemConOp = ERemConCoreApiRootMenu;
+			break;
+		case AVCPanel::ESetupMenu:
+			aRemConOp = ERemConCoreApiSetupMenu;
+			break;
+		case AVCPanel::EContentsMenu:
+			aRemConOp = ERemConCoreApiContentsMenu;
+			break;
+		case AVCPanel::EFavoriteMenu:
+			aRemConOp = ERemConCoreApiFavoriteMenu;
+			break;
+		case AVCPanel::EExit:
+			aRemConOp = ERemConCoreApiExit;
+			break;
+		case AVCPanel::E0:
+			aRemConOp = ERemConCoreApi0;
+			break;
+		case AVCPanel::E1:
+			aRemConOp = ERemConCoreApi1;
+			break;
+		case AVCPanel::E2:
+			aRemConOp = ERemConCoreApi2;
+			break;
+		case AVCPanel::E3:
+			aRemConOp = ERemConCoreApi3;
+			break;
+		case AVCPanel::E4:
+			aRemConOp = ERemConCoreApi4;
+			break;
+		case AVCPanel::E5:
+			aRemConOp = ERemConCoreApi5;
+			break;
+		case AVCPanel::E6:
+			aRemConOp = ERemConCoreApi6;
+			break;
+		case AVCPanel::E7:
+			aRemConOp = ERemConCoreApi7;
+			break;
+		case AVCPanel::E8:
+			aRemConOp = ERemConCoreApi8;
+			break;
+		case AVCPanel::E9:
+			aRemConOp = ERemConCoreApi9;
+			break;
+		case AVCPanel::EDot:
+			aRemConOp = ERemConCoreApiDot;
+			break;
+		case AVCPanel::EEnter:
+			aRemConOp = ERemConCoreApiEnter;
+			break;
+		case AVCPanel::EClear:
+			aRemConOp = ERemConCoreApiClear;
+			break;
+		case AVCPanel::EChannelUp:
+			aRemConOp = ERemConCoreApiChannelUp;
+			break;
+		case AVCPanel::EChannelDown:
+			aRemConOp = ERemConCoreApiChannelDown;
+			break;
+		case AVCPanel::EPreviousChannel:
+			aRemConOp = ERemConCoreApiPreviousChannel;
+			break;
+		case AVCPanel::ESoundSelect:
+			aRemConOp = ERemConCoreApiSoundSelect;
+			break;
+		case AVCPanel::EInputSelect:
+			aRemConOp = ERemConCoreApiInputSelect;
+			break;
+		case AVCPanel::EDisplayInformation:
+			aRemConOp = ERemConCoreApiDisplayInformation;
+			break;
+		case AVCPanel::EHelp:
+			aRemConOp = ERemConCoreApiHelp;
+			break;
+		case AVCPanel::EPageUp:
+			aRemConOp = ERemConCoreApiPageUp;
+			break;
+		case AVCPanel::EPageDown:
+			aRemConOp = ERemConCoreApiPageDown;
+			break;
+		case AVCPanel::EPower:
+			aRemConOp = ERemConCoreApiPower;
+			break;
+		case AVCPanel::EVolumeUp:
+			aRemConOp = ERemConCoreApiVolumeUp;
+			break;
+		case AVCPanel::EVolumeDown:
+			aRemConOp = ERemConCoreApiVolumeDown;
+			break;
+		case AVCPanel::EMute:
+			aRemConOp = ERemConCoreApiMute;
+			break;
+		case AVCPanel::EPlay:
+			aRemConOp = ERemConCoreApiPlay;
+			break;
+		case AVCPanel::EStop:
+			aRemConOp = ERemConCoreApiStop;
+			break;
+		case AVCPanel::EPause:
+			aRemConOp = ERemConCoreApiPause;
+			break;
+		case AVCPanel::ERecord:
+			aRemConOp = ERemConCoreApiRecord;
+			break;
+		case AVCPanel::ERewind:
+			aRemConOp = ERemConCoreApiRewind;
+			break;
+		case AVCPanel::EFastForward:
+			aRemConOp = ERemConCoreApiFastForward;
+			break;
+		case AVCPanel::EEject:
+			aRemConOp = ERemConCoreApiEject;
+			break;
+		case AVCPanel::EForward:
+			aRemConOp = ERemConCoreApiForward;
+			break;
+		case AVCPanel::EBackward:
+			aRemConOp = ERemConCoreApiBackward;
+			break;
+		case AVCPanel::EAngle:
+			aRemConOp = ERemConCoreApiAngle;
+			break;
+		case AVCPanel::ESubpicture:
+			aRemConOp = ERemConCoreApiSubpicture;
+			break;
+		case AVCPanel::EF1:
+			aRemConOp = ERemConCoreApiF1;
+			break;
+		case AVCPanel::EF2:
+			aRemConOp = ERemConCoreApiF2;
+			break;
+		case AVCPanel::EF3:
+			aRemConOp = ERemConCoreApiF3;
+			break;
+		case AVCPanel::EF4:
+			aRemConOp = ERemConCoreApiF4;
+			break;
+		case AVCPanel::EF5:
+			aRemConOp = ERemConCoreApiF5;
+			break;
+		case AVCPanel::EVendorUnique:
+		default:
+			err = KErrNotSupported;
+		}
+		
+	return err;
+	}
+	
+
+TInt CControlCommand::ParseVendorUniquePassthroughCommand(MRemConBearerObserver& aObserver)
+	{
+	TInt err = KErrNone;
+	TRAP(err, SetVendorInfoL(ETrue)); // set id and payload; leaves if not enough space available
+	
+	if (err == KErrNone && iVendorId == KBluetoothSIGVendorId)
+		{
+		// it's one of the v1.3 (or later!) MT commands
+		err = ParseMetadataTransferPassthroughCommand();
+		}
+	else
+		{
+		iCommandData.Close();
+		TRAP(err, iCommandData.CreateL(KAVCFrameMaxLength));
+		if(err == KErrNone)
+			{
+			TRemConMessageType message = ERemConCommand;
+			err = aObserver.BearerToInterface(TUid::Uid(KRemConBearerAvrcpImplementationUid),
+											  iFrame->Data(),
+											  iFrame->Data(),
+											  iInterfaceUid,
+											  iOperationId,
+											  message,
+											  iCommandData);
+			}
+		}
+
+	return err;
+	}
+	
+/** Translates from RemCon's core interface to an AVC operation id.
+
+@param aRemConOp	The RemCon operation id within the core interface.
+@param aAvrcpOp		On return the AVC passthrough operation id.
+@return KErrNone	If the operation has been translated successfully.
+@return KErrNotSupported	If the operation does not correspond to one
+							provided by AVRCP.
+*/
+TInt CControlCommand::RemConToAvrcpOperation(TUint aRemConOp, AVCPanel::TOperationId& aAvrcpOp)
+	{
+	LOG_STATIC_FUNC
+	TInt err = KErrNone;
+	switch(aRemConOp)	
+		{
+		case ERemConCoreApiSelect:
+			aAvrcpOp = AVCPanel::ESelect;
+			break;
+		case ERemConCoreApiUp:
+			aAvrcpOp = AVCPanel::EUp;
+			break;
+		case ERemConCoreApiDown:
+			aAvrcpOp = AVCPanel::EDown;
+			break;
+		case ERemConCoreApiLeft:
+			aAvrcpOp = AVCPanel::ELeft;
+			break;
+		case ERemConCoreApiRight:
+			aAvrcpOp = AVCPanel::ERight;
+			break;
+		case ERemConCoreApiRightUp:
+			aAvrcpOp = AVCPanel::ERightUp;
+			break;
+		case ERemConCoreApiRightDown:
+			aAvrcpOp = AVCPanel::ERightDown;
+			break;
+		case ERemConCoreApiLeftUp:
+			aAvrcpOp = AVCPanel::ELeftUp;
+			break;
+		case ERemConCoreApiLeftDown:
+			aAvrcpOp = AVCPanel::ELeftDown;
+			break;
+		case ERemConCoreApiRootMenu:
+			aAvrcpOp = AVCPanel::ERootMenu;
+			break;
+		case ERemConCoreApiSetupMenu:
+			aAvrcpOp = AVCPanel::ESetupMenu;
+			break;
+		case ERemConCoreApiContentsMenu:
+			aAvrcpOp = AVCPanel::EContentsMenu;
+			break;
+		case ERemConCoreApiFavoriteMenu:
+			aAvrcpOp = AVCPanel::EFavoriteMenu;
+			break;
+		case ERemConCoreApiExit:
+			aAvrcpOp = AVCPanel::EExit;
+			break;
+		case ERemConCoreApi0:
+			aAvrcpOp = AVCPanel::E0;
+			break;
+		case ERemConCoreApi1:
+			aAvrcpOp = AVCPanel::E1;
+			break;
+		case ERemConCoreApi2:
+			aAvrcpOp = AVCPanel::E2;
+			break;
+		case ERemConCoreApi3:
+			aAvrcpOp = AVCPanel::E3;
+			break;
+		case ERemConCoreApi4:
+			aAvrcpOp = AVCPanel::E4;
+			break;
+		case ERemConCoreApi5:
+			aAvrcpOp = AVCPanel::E5;
+			break;
+		case ERemConCoreApi6:
+			aAvrcpOp = AVCPanel::E6;
+			break;
+		case ERemConCoreApi7:
+			aAvrcpOp = AVCPanel::E7;
+			break;
+		case ERemConCoreApi8:
+			aAvrcpOp = AVCPanel::E8;
+			break;
+		case ERemConCoreApi9:
+			aAvrcpOp = AVCPanel::E9;
+			break;
+		case ERemConCoreApiDot:
+			aAvrcpOp = AVCPanel::EDot;
+			break;
+		case ERemConCoreApiEnter:
+			aAvrcpOp = AVCPanel::EEnter;
+			break;
+		case ERemConCoreApiClear:
+			aAvrcpOp = AVCPanel::EClear;
+			break;
+		case ERemConCoreApiChannelUp:
+			aAvrcpOp = AVCPanel::EChannelUp;
+			break;
+		case ERemConCoreApiChannelDown:
+			aAvrcpOp = AVCPanel::EChannelDown;
+			break;
+		case ERemConCoreApiPreviousChannel:
+			aAvrcpOp = AVCPanel::EPreviousChannel;
+			break;
+		case ERemConCoreApiSoundSelect:
+			aAvrcpOp = AVCPanel::ESoundSelect;
+			break;
+		case ERemConCoreApiInputSelect:
+			aAvrcpOp = AVCPanel::EInputSelect;
+			break;
+		case ERemConCoreApiDisplayInformation:
+			aAvrcpOp = AVCPanel::EDisplayInformation;
+			break;
+		case ERemConCoreApiHelp:
+			aAvrcpOp = AVCPanel::EHelp;
+			break;
+		case ERemConCoreApiPageUp:
+			aAvrcpOp = AVCPanel::EPageUp;
+			break;
+		case ERemConCoreApiPageDown:
+			aAvrcpOp = AVCPanel::EPageDown;
+			break;
+		case ERemConCoreApiPower:
+			aAvrcpOp = AVCPanel::EPower;
+			break;
+		case ERemConCoreApiVolumeUp:
+			aAvrcpOp = AVCPanel::EVolumeUp;
+			break;
+		case ERemConCoreApiVolumeDown:
+			aAvrcpOp = AVCPanel::EVolumeDown;
+			break;
+		case ERemConCoreApiMute:
+			aAvrcpOp = AVCPanel::EMute;
+			break;
+		case ERemConCoreApiPlay:
+			aAvrcpOp = AVCPanel::EPlay;
+			break;
+		case ERemConCoreApiStop:
+			aAvrcpOp = AVCPanel::EStop;
+			break;
+		case ERemConCoreApiPause:
+			aAvrcpOp = AVCPanel::EPause;
+			break;
+		case ERemConCoreApiRecord:
+			aAvrcpOp = AVCPanel::ERecord;
+			break;
+		case ERemConCoreApiRewind:
+			aAvrcpOp = AVCPanel::ERewind;
+			break;
+		case ERemConCoreApiFastForward:
+			aAvrcpOp = AVCPanel::EFastForward;
+			break;
+		case ERemConCoreApiEject:
+			aAvrcpOp = AVCPanel::EEject;
+			break;
+		case ERemConCoreApiForward:
+			aAvrcpOp = AVCPanel::EForward;
+			break;
+		case ERemConCoreApiBackward:
+			aAvrcpOp = AVCPanel::EBackward;
+			break;
+		case ERemConCoreApiAngle:
+			aAvrcpOp = AVCPanel::EAngle;
+			break;
+		case ERemConCoreApiSubpicture:
+			aAvrcpOp = AVCPanel::ESubpicture;
+			break;
+		case ERemConCoreApiF1:
+			aAvrcpOp = AVCPanel::EF1;
+			break;
+		case ERemConCoreApiF2:
+			aAvrcpOp = AVCPanel::EF2;
+			break;
+		case ERemConCoreApiF3:
+			aAvrcpOp = AVCPanel::EF3;
+			break;
+		case ERemConCoreApiF4:
+			aAvrcpOp = AVCPanel::EF4;
+			break;
+		case ERemConCoreApiF5:
+			aAvrcpOp = AVCPanel::EF5;
+			break;
+		default:
+			err = KErrNotSupported;
+		}
+	return err;
+	}
+
+TUint16 CControlCommand::Get16(const TPtrC8& aPtr)
+	{
+	return (aPtr[0]<<8) | aPtr[1];
+	}
+
+TInt CControlCommand::DummyCallback(TAny*)
+	{
+	// Should never be called- should be overwritten by a non-dummy callback 
+	// before it's ever requested let alone called.
+	AvrcpUtils::Panic(EAvrcpDummyCallbackCalled);
+	return KErrNone;
+	}
+
+void CControlCommand::SetVendorInfoL(TBool aIsPassthrough)
+	{
+	if (aIsPassthrough)
+		{
+		if (iFrame->DataLength() < KAVCVendorUniquePassthroughHeader)
+			{
+			User::Leave(KErrCorrupt);
+			}
+		iVendorPayloadData.Set(CAVCVendorUniquePassthroughCommand::GetPayloadAndVID(*iFrame, iVendorId));
+		}
+	else
+		{
+		if (iFrame->DataLength() < KAVCVendorIdLength)
+			{
+			User::Leave(KErrCorrupt);
+			}
+		iVendorPayloadData.Set(CAVCVendorDependentCommand::GetPayloadAndVID(*iFrame, iVendorId));
+		}
+	}
+
+TBool CControlCommand::IsAvrcpPassthrough() const
+	{
+	TBool isAvrcpPassthrough = EFalse;
+	
+	if(iInterfaceUid.iUid == KRemConCoreApiUid || iInterfaceUid.iUid == KRemConGroupNavigationApiUid)
+		{
+		isAvrcpPassthrough = ETrue;
+		}
+	
+	return isAvrcpPassthrough;
+	}
+
+TBool CControlCommand::IsPassthrough() const
+	{
+	return ((iFrame->Opcode() == AVC::EPassThrough) && (iFrame->SubunitType() == AVC::EPanel));
+	}
+
+TBool CControlCommand::PlayerSpecificNotify() const
+	{
+	TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(iOperationId);
+	TMetadataTransferPDU pduId = RAvrcpIPC::GetPDUIdFromIPCOperationId(iOperationId);
+
+	if(pduId != ERegisterNotification)
+		{
+		return EFalse;
+		}
+	
+	if(iInterfaceUid == TUid::Uid(KRemConPlayerInformationUid))
+		{
+		if((eventId == ERegisterNotificationPlaybackStatusChanged) ||
+		  (eventId == ERegisterNotificationTrackChanged) ||
+		  (eventId == ERegisterNotificationTrackReachedEnd) ||
+		  (eventId == ERegisterNotificationTrackReachedStart) ||
+		  (eventId == ERegisterNotificationPlaybackPosChanged) ||
+		  (eventId == ERegisterNotificationPlayerApplicationSettingChanged))
+			{
+			return ETrue;
+			}
+		}
+	else if(iInterfaceUid == TUid::Uid(KRemConNowPlayingApiUid))
+		{
+		if (eventId == ERegisterNotificationNowPlayingContentChanged)
+			{
+			return ETrue;
+			}
+		}
+	else 
+		{
+		return EFalse;
+		}
+	return EFalse;
+	}
+
+TBool CControlCommand::NormalCommand()
+	{
+	TBool ret = ETrue;
+	TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(iOperationId);
+	TMetadataTransferPDU pduId = RAvrcpIPC::GetPDUIdFromIPCOperationId(iOperationId);
+	
+	if((eventId == ERegisterNotificationAvailablePlayersChanged) ||
+	    (eventId == ERegisterNotificationAddressedPlayerChanged))
+		{
+		ret = EFalse;
+		}
+	return ret;
+	}
+/**
+@return Ownership of a CControlCommand representing an interim response to this command
+ */
+CControlCommand* CControlCommand::InterimResponseL()
+	{
+	CAVCFrame* frame = CAVCFrame::NewL(iFrame->Data(), AVC::EResponse);
+	CleanupStack::PushL(frame);
+	frame->SetType(AVC::EInterim);
+	
+	CControlCommand* finalResponse = CControlCommand::NewL(frame, iRemConId,
+			iTransactionLabel, iRemoteAddr, iClientId, iPlayerInfoManager);
+	CleanupStack::Pop(frame);
+	
+	finalResponse->iInterfaceUid = iInterfaceUid;
+	finalResponse->iOperationId = iOperationId;
+	
+	return finalResponse;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/internalcommand.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,96 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "internalcommand.h"
+#include "avrcputils.h"
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_BEARER);
+#endif
+
+/** Factory function.
+
+@param aFrame The frame this command is to represent.
+@param aRemConId The RemCon transaction label.
+@param aTransLabel The AVCTP transaction label.
+@param aAddr The bluetooth address to send this command to.
+@return A fully constructed CBrowseCommand.
+@leave System wide error codes.
+*/
+CInternalCommand* CInternalCommand::NewL(TUid aInterfaceUid, 
+		TUint aId, 
+		TUint aOperationId,
+		const TDesC8& aCommandData)
+	{
+	CInternalCommand* command = new(ELeave)CInternalCommand(aInterfaceUid, aId, aOperationId);
+	CleanupStack::PushL(command);
+	command->ConstructL(aCommandData);
+	CleanupStack::Pop(command);
+	return command;
+	}
+
+/** Constructor.
+
+@param aFrame The AV/C frame this command is to represent.
+@param aRemConId The RemCon transaction label.
+@param aTransLabel The AVCTP transaction label.
+@param aAddr The bluetooth address to send this command to.
+@return A partially constructed CBrowseCommand.
+@leave System wide error codes.
+*/	
+CInternalCommand::CInternalCommand(TUid aInterfaceUid, 
+		TUint aId, 
+		TUint aOperationId)
+	: CAvrcpCommand(aId, KDummyTransactionLabel, NULL)
+	{
+	LOG_FUNC
+	iInterfaceUid = aInterfaceUid;
+	iOperationId = aOperationId;
+	}
+
+/** Destructor.
+*/
+CInternalCommand::~CInternalCommand()
+	{
+	LOG_FUNC
+	__ASSERT_DEBUG(iUsers == 0, AvrcpUtils::Panic(EAvrcpCommandStillInUse));
+	iCommandData.Close();
+	}
+
+void CInternalCommand::ConstructL(const TDesC8& aCommandData)
+	{
+	iCommandData.CreateL(aCommandData);
+	}
+
+void CInternalCommand::ResetL(TUint& aId, const TDesC8& aCommandData)
+	{
+	iCommandData.Close();
+	iCommandData.CreateL(aCommandData);
+	iRemConId = aId;
+	}
+
+SymbianAvctp::TMessageType CInternalCommand::MessageType() const
+	{
+	// Should never be going out AVCTPwards
+	__ASSERT_DEBUG(EFalse, AvrcpUtils::Panic(EAvctpMessageTypeRequestedForInternalCommand));
+			
+	return SymbianAvctp::EUndefined;
+	}
+
+const TDesC8& CInternalCommand::Data() const
+	{
+	return iCommandData;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/passthroughhelper.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,443 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "avrcplog.h"
+#include "avrcprouter.h"
+#include "avrcputils.h"
+#include "controlcommand.h"
+#include "passthroughhelper.h"
+#include "controlbearer.h"
+
+
+CPassthroughHelper* CPassthroughHelper::NewL(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer)
+	{
+	CPassthroughHelper* helper = new(ELeave)CPassthroughHelper(aRouter, aCommandInterface, aTimer);
+	CleanupStack::PushL(helper);
+	helper->ConstructL();
+	CleanupStack::Pop(helper);
+	return helper;
+	}
+
+CPassthroughHelper::~CPassthroughHelper()
+	{
+	}
+	
+CPassthroughHelper::CPassthroughHelper(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer)
+	: iRouter(aRouter)
+	, iCommandInterface(aCommandInterface)
+	, iTimer(aTimer)
+	{
+	}
+
+void CPassthroughHelper::ConstructL()
+	{
+	}
+
+void CPassthroughHelper::Disconnect()
+	{
+	LOG_FUNC
+	
+	// We handle the last command as a special case to ensure the presses and
+	// releases are balanced from a clients' point of view.
+	if(iPreviousPassthrough)
+		{
+		iRouter.RemoveFromSendQueue(*iPreviousPassthrough);
+		BalanceHandledCommand(*iPreviousPassthrough);
+		}
+	}
+
+/** Sends a response to the remote device.
+
+Because of the 100ms timeout for responses we send a response to
+passthrough commands as soon as we receive them.  This means the real
+response from RemCon is currently ignored.  A real response is
+only sent if this is a vendor dependent command.
+
+@param aCommand The command to respond to.
+@param aErr The result of handling the command.  KErrNone if successful.
+			KErrNotSupported if this operation is not supported.
+*/		
+void CPassthroughHelper::Respond(CControlCommand& aCommand, TInt aErr)
+	{
+	LOG_FUNC
+	aCommand.SetResponseType(aErr);
+	iRouter.AddToSendQueue(aCommand);
+	}
+
+/** To be called on completion of command handling.
+
+This aggregates the handler's tidying up of a finished
+command.
+
+@param aCommand The command to tidy up.
+*/	
+void CPassthroughHelper::HandledCommand(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+
+	// If this was the previous passthrough reset it to NULL
+	if(iPreviousPassthrough == &aCommand)
+		{
+		iPreviousPassthrough = NULL;
+		}
+	
+	aCommand.CancelTimer(iTimer);
+	aCommand.DecrementUsers();
+	}
+
+/** Handles incoming passthrough command.
+
+How the command is handled is dependent on this and the previous command.
+
+Previous command	This command 	Behaviour
+Press_op1			Press_op1		discard
+Press_op1			Release_op1		press_op1 hold timer not expired - generate click_op1
+									press_op1 release timer not expired - generate release_op1
+Press_op1			Press_op2		generate release_op1, start hold timer for press_op2
+Press_op1			Release_op2		press_op1 hold timer not expired - generate click_op1, discard release_op2
+									press_op1 release timer not expired - generate release_op1, discard release_op2
+Release_op1			Press_op1		start hold timer for press_op1
+Release_op1			Release_op1		discard
+Release_op1			Press_op2		start hold timer for press_op2	
+Release_op1			Release_op2		discard
+
+@param aCommand The command to handle.
+@leave System wide error code.
+*/
+void CPassthroughHelper::HandlePassthrough(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	
+	// We can't map Vendor Unique passthrough command to clicks as we do
+	// not know how the button action is conveyed to the API.  All we can
+	// do is try and ensure that we try to generate a release if one is 
+	// missing by asking the convert.  We also need to consider them as
+	// part of the passthrough history for how other passthrough commands
+	// should be interpreted.
+	TUint8 thisOpId;
+	aCommand.Frame().OperationId(thisOpId);
+	if(!aCommand.IsAvrcpPassthrough())
+		{
+		aCommand.SetClick(EFalse);
+		}
+	
+	// Behaviour depends on previous command
+	TUint8 prevOpId;
+	if(iPreviousPassthrough)
+		{
+		__ASSERT_ALWAYS(iPreviousPassthrough->ButtonAct() == AVCPanel::EButtonPress,
+	 		AvrcpUtils::Panic(EAvrcpPressNotPreviousPassthroughCommand));
+
+		iPreviousPassthrough->Frame().OperationId(prevOpId);
+		}
+		
+	if(aCommand.ButtonAct() == AVCPanel::EButtonPress)
+		{
+		// Respond now so we can decrement users of aCommand at will
+		Respond(aCommand, KErrNone);		
+			
+		if(iPreviousPassthrough)
+			{
+			// previous is press, current is press
+			if(prevOpId == thisOpId)
+				{
+				// prevCommand is for same opId as this one.  Drop this
+				// command and reset release timer for prevCommand.
+				aCommand.DecrementUsers();
+				
+				iPreviousPassthrough->CancelTimer(iTimer);
+				// If still flagged as a click then the user won't have been notified
+				// of the press yet - so do it now.
+				if(iPreviousPassthrough->Click())
+					{
+					iPreviousPassthrough->SetClick(EFalse);
+					iPreviousPassthrough->SetCoreButtonAction(ERemConCoreApiButtonPress, ETrue);
+					iCommandInterface.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId());
+					}
+				StartReleaseTimer(*iPreviousPassthrough);
+				}
+			else if(iPreviousPassthrough->Click())
+				{
+				// prevCommand is click, Hold timer not expired.  Generate click
+				// to RemCon then start waiting for click.
+				iPreviousPassthrough->CancelTimer(iTimer);
+				iPreviousPassthrough->SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue);
+				iCommandInterface.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId());
+				
+				HandledCommand(*iPreviousPassthrough);
+									
+				// Start waiting for click (core api) or release (vendor unique)
+				NewPress(aCommand);
+				}
+			else
+				{
+				// prevCommand is not click, Release timer not expired.  Generate
+				// release to RemCon then start waiting for click.
+				BalanceHandledCommand(*iPreviousPassthrough);
+						
+				// Start waiting for click (core api) or release (vendor unique)
+				NewPress(aCommand);
+				}
+			}
+		else
+			{
+			// No previous command, current is press
+			
+			// Start waiting for click (core api) or release (vendor unique)
+			NewPress(aCommand);
+			}	
+		}
+	else if(iPreviousPassthrough)
+		{
+		// previous is press, current is release
+		if(prevOpId == thisOpId)
+			{
+			Respond(aCommand, KErrNone);
+					
+			if(iPreviousPassthrough->Click())
+				{
+				// Button release for same opId with hold timeout
+				aCommand.DecrementUsers(); // Drop this command.
+				
+				// Cancel hold timer and send the previous command as a click.
+				iPreviousPassthrough->CancelTimer(iTimer); 
+				iPreviousPassthrough->SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue);
+				iCommandInterface.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId());
+				
+				HandledCommand(*iPreviousPassthrough);
+				}
+			else
+				{
+				// Button release for same opId, hold timeout expired
+				iPreviousPassthrough->CancelTimer(iTimer);
+				HandledCommand(*iPreviousPassthrough);
+				
+				if(aCommand.IsAvrcpPassthrough())
+					{
+					aCommand.SetCoreButtonAction(ERemConCoreApiButtonRelease, ETrue);
+					}
+				iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId());
+				aCommand.DecrementUsers();
+				}
+			}
+		else
+			{
+			// Drop this release and continue waiting for release to
+			// prevCommand.
+			Respond(aCommand, KErrNone);
+			aCommand.DecrementUsers();
+			}
+		}
+	else
+		{
+		// No prevCommand, this is a release
+		// To get here either:
+		// - this is a spurious release
+		// - we've given up waiting for this
+		
+		// Because responses must be made within 100ms we respond before waiting
+		// to see what RemCon thinks.
+		Respond(aCommand, KErrNone);
+		aCommand.DecrementUsers();
+		}
+	}
+
+void CPassthroughHelper::NewPress(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	__ASSERT_DEBUG(!iPreviousPassthrough, AVRCP_PANIC(EPreviousPassthroughNonNullReplacing));
+	
+	iPreviousPassthrough = &aCommand;
+	
+	if(aCommand.IsAvrcpPassthrough())
+		{
+		StartHoldTimer(aCommand);
+		}
+	else
+		{
+		iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId());
+		StartReleaseTimer(aCommand);
+		}
+	}
+
+/** To be called on completion of command handling for an unbalanced press.
+
+This is a special version of the HandledCommand which which assumes the
+command has been notified to the user and so balances the notification
+of a press with a generated release command.
+
+@param aCommand The command to tidy up.
+*/
+void CPassthroughHelper::BalanceHandledCommand(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	// CancelTimer also frees the timer entries, so needs to be called
+	// here even though there's no pending entry.
+	aCommand.CancelTimer(iTimer);
+	
+	// If this was the previous passthrough reset it to NULL
+	if(iPreviousPassthrough == &aCommand)
+		{
+		iPreviousPassthrough = NULL;
+		}
+	
+	// Here we handle the case that a press has been informed but a release has yet
+	// to be reported, and if it hasn't we provide the notification.
+	if(aCommand.ButtonAct() == AVCPanel::EButtonPress && !aCommand.Click())
+		{
+		if(aCommand.IsAvrcpPassthrough())
+			{
+			// FIXME I think we might need a new transaction id here?
+			TRAPD(err, aCommand.ReSetCoreButtonActionL(ERemConCoreApiButtonRelease, ETrue));
+			if (err == KErrNone)
+				{
+				iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId());
+				}
+				else
+				{
+				// just silently drop this command, do not send command to remconserv
+				}
+			}
+		else
+			{
+			// Need see if we can get a valid release from the converter.  Pass
+			// it the same AVC Frame as the press, but with the button action 
+			// flipped to release.  If we can't do this then there's not a
+			// lot we can do.  
+			// FIXME
+			}
+		}
+	aCommand.iHandlingLink.Deque();
+	aCommand.DecrementUsers();
+	}
+
+
+//------------------------------------------------------------------------------------
+// Timer functions
+//------------------------------------------------------------------------------------
+
+/** Starts the hold timer (only applicable to press commands).
+
+This is the timer to determine whether a command will be passed to RemCon
+as a click.  If the timer expires before a matching release is received
+the press and release will be sent separately.  Otherwise,  a click is 
+sent.
+
+@param aCommand The command to start the timer for.
+*/	
+void CPassthroughHelper::StartHoldTimer(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	
+	// These cannot fail as we use placement new	
+	TAvrcpTimerExpiryInfo* timerInfo = new(aCommand.TimerExpiryInfo())TAvrcpTimerExpiryInfo(this, aCommand);
+	
+	TCallBack callback(HoldExpiry, timerInfo);
+	TDeltaTimerEntry* timerEntry = new(aCommand.TimerEntry())TDeltaTimerEntry(callback);
+	
+	iTimer.Queue(KRcpHoldThreshold, *timerEntry);
+	}
+
+/** Callback when hold timer expires.
+
+This is a static forwarding function.
+
+@param aExpiryInfo The information used by the real HoldExpiry to
+					deal with the timer expiry.
+*/	
+TInt CPassthroughHelper::HoldExpiry(TAny* aExpiryInfo)
+	{
+	LOG_STATIC_FUNC
+	TAvrcpTimerExpiryInfo *timerInfo = reinterpret_cast<TAvrcpTimerExpiryInfo*>(aExpiryInfo);
+	(reinterpret_cast<CPassthroughHelper*>(timerInfo->iHandler))->HoldExpiry(timerInfo->iCommand);
+	
+	return KErrNone;
+	}
+	
+/** Deals with expiry of hold timer.
+
+1) This is not a click.  Set click to false for this command.
+2) Inform RemCon of available press command
+3) Start release timer.
+
+@param aCommand	The CControlCommand that has expired.
+*/
+void CPassthroughHelper::HoldExpiry(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	__ASSERT_DEBUG((aCommand.ButtonAct() == AVCPanel::EButtonPress), AvrcpUtils::Panic(EAvrcpHoldExpiryForRelease));
+	
+	// We haven't received a release soon enough to treat this as
+	// a click.  Send the press on to RemCon and wait for a release.
+	// CancelTimer also frees the timer entries, so needs to be called
+	// here even though there's no pending entry.
+	aCommand.CancelTimer(iTimer);
+	aCommand.SetClick(EFalse);
+	aCommand.SetCoreButtonAction(ERemConCoreApiButtonPress, ETrue);
+	iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId());
+	StartReleaseTimer(aCommand);
+	}
+
+/** Starts the release timer (only applicable to press commands).
+
+If a release is not received quickly enough to treat this press as
+a click, the release timer is started.  2s after receiving a button
+press we should assume the release if we haven't received one.
+
+@param aCommand The command to start the timer for.
+*/		
+void CPassthroughHelper::StartReleaseTimer(CControlCommand& aCommand)
+	{
+	TAvrcpTimerExpiryInfo* timerInfo = new(aCommand.TimerExpiryInfo())TAvrcpTimerExpiryInfo(this, aCommand);
+
+	TCallBack callback(ReleaseExpiry, timerInfo);
+	TDeltaTimerEntry* timerEntry = new(aCommand.TimerEntry())TDeltaTimerEntry(callback);
+	
+	iTimer.Queue(KRcpIncomingButtonReleaseTimeout, *timerEntry);
+	}
+
+/** Callback when release timer expires.
+
+This is a static forwarding function.
+
+@param aExpiryInfo The information used by the real ReleaseExpiry to
+					deal with the timer expiry.
+*/	
+TInt CPassthroughHelper::ReleaseExpiry(TAny* aExpiryInfo)
+	{
+	LOG_STATIC_FUNC
+	TAvrcpTimerExpiryInfo *timerInfo = reinterpret_cast<TAvrcpTimerExpiryInfo*>(aExpiryInfo);
+	(reinterpret_cast<CPassthroughHelper*>(timerInfo->iHandler))->ReleaseExpiry(timerInfo->iCommand);
+	
+	return KErrNone;
+	}
+
+/** Deals with expiry of release timer.
+
+1) Generate release for this command.
+2) Inform RemCon of available release command.
+
+@param aCommand	The CControlCommand that has expired.
+*/
+void CPassthroughHelper::ReleaseExpiry(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	__ASSERT_DEBUG((aCommand.ButtonAct() == AVCPanel::EButtonPress), AvrcpUtils::Panic(EAvrcpReleaseExpiryForRelease));
+	__ASSERT_DEBUG(!aCommand.Click(), AvrcpUtils::Panic(EAvrcpReleaseExpiryForClick));
+	
+	// We haven't received a release within the allotted time.  Assume
+	// one and generate it to RemCon.
+	BalanceHandledCommand(aCommand);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/playerbitmasks.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,337 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// TPlayerFeatureBitmask.cpp
+//
+
+#include <remconcoreapi.h>
+#include "avrcplog.h"
+#include "avrcputils.h"
+#include "mediabrowse.h"
+#include "nowplaying.h"
+#include "playerbitmasks.h"
+#include "remcongroupnavigation.h"
+
+
+TPlayerFeatureBitmask::TPlayerFeatureBitmask()
+	{
+	iFeatureBitmask.FillZ(KFeatureBitmaskLength);
+	}
+
+TPlayerFeatureBitmask::TPlayerFeatureBitmask(const TPlayerFeatureBitmask& aFeatureBitmask)
+	{
+	iFeatureBitmask.Copy(aFeatureBitmask.FeatureBitmask());
+	}
+
+void TPlayerFeatureBitmask::SetCoreApiFeatures(const RArray<TUint>& aOperation)
+	{
+	if(aOperation.Count() > 0)
+		{
+		for(TInt j = 0; j< aOperation.Count() ; j++)
+			{
+			switch(aOperation[j])
+				{
+			case ERemConCoreApiSelect:
+				iFeatureBitmask[ESelectByteOffset] |= (1<<ESelectBitOffset);
+				break;
+			case ERemConCoreApiUp:
+				iFeatureBitmask[EUpByteOffset]|= (1<<EUpBitOffset);
+				break;
+			case ERemConCoreApiDown:
+				iFeatureBitmask[EDownByteOffset]|= (1<<EDownBitOffset);
+				break;
+			case ERemConCoreApiLeft:
+				iFeatureBitmask[ELeftByteOffset]|= (1<<ELeftBitOffset);
+				break;
+			case ERemConCoreApiRight:
+				iFeatureBitmask[ERightByteOffset]|= (1<<ERightBitOffset);
+				break;
+			case ERemConCoreApiRightUp:
+				iFeatureBitmask[ERightUpByteOffset]|= (1<<ERightUpBitOffset);
+				break;
+			case ERemConCoreApiRightDown:
+				iFeatureBitmask[ERightDownByteOffset]|= (1<<ERightDownBitOffset);
+				break;
+			case ERemConCoreApiLeftUp:
+				iFeatureBitmask[ELeftUpByteOffset]|= (1<<ELeftUpBitOffset);
+				break;
+			case ERemConCoreApiLeftDown:
+				iFeatureBitmask[ELeftDownByteOffset]|= (1<<ELeftDownBitOffset);
+				break;
+			case ERemConCoreApiRootMenu:
+				iFeatureBitmask[ERootMenuByteOffset]|= (1<<ERootMenuBitOffset);
+				break;
+			case ERemConCoreApiSetupMenu:
+				iFeatureBitmask[ESetupMenuByteOffset]|= (1<<ESetupMenuBitOffset);
+				break;
+			case ERemConCoreApiContentsMenu:
+				iFeatureBitmask[EContentsMenuByteOffset]|= (1<<EContentsMenuBitOffset);
+				break;
+			case ERemConCoreApiFavoriteMenu:
+				iFeatureBitmask[EFavoriteMenuByteOffset]|= (1<<EFavoriteMenuBitOffset);
+				break;
+			case ERemConCoreApiExit:
+				iFeatureBitmask[EExitByteOffset]|= (1<<EExitBitOffset);
+				break;
+			case ERemConCoreApi0:
+				iFeatureBitmask[E0ByteOffset]|= (1<<E0BitOffset);
+				break;
+			case ERemConCoreApi1:
+				iFeatureBitmask[E1ByteOffset]|= (1<<E1BitOffset);
+				break;
+			case ERemConCoreApi2:
+				iFeatureBitmask[E2ByteOffset]|= (1<<E2BitOffset);
+				break;
+			case ERemConCoreApi3:
+				iFeatureBitmask[E3ByteOffset]|= (1<<E3BitOffset);
+				break;
+			case ERemConCoreApi4:
+				iFeatureBitmask[E4ByteOffset]|= (1<<E4BitOffset);
+				break;
+			case ERemConCoreApi5:
+				iFeatureBitmask[E5ByteOffset]|= (1<<E5BitOffset);
+				break;
+			case ERemConCoreApi6:
+				iFeatureBitmask[E6ByteOffset]|= (1<<E6BitOffset);
+				break;
+			case ERemConCoreApi7:
+				iFeatureBitmask[E7ByteOffset]|= (1<<E7BitOffset);
+				break;
+			case ERemConCoreApi8:
+				iFeatureBitmask[E8ByteOffset]|= (1<<E8BitOffset);
+				break;	
+			case ERemConCoreApi9:
+				iFeatureBitmask[E9ByteOffset]|= (1<<E9BitOffset);
+				break;
+			case ERemConCoreApiDot:
+				iFeatureBitmask[EDotByteOffset]|= (1<<EDotBitOffset);
+				break;
+			case ERemConCoreApiEnter:
+				iFeatureBitmask[EEnterByteOffset]|= (1<<EEnterBitOffset);
+				break;
+			case ERemConCoreApiClear:
+				iFeatureBitmask[EClearByteOffset]|= (1<<EClearBitOffset);
+				break;
+			case ERemConCoreApiChannelUp:
+				iFeatureBitmask[EChannelUpByteOffset]|= (1<<EChannelUpBitOffset);
+				break;
+			case ERemConCoreApiChannelDown:
+				iFeatureBitmask[EChannelDownByteOffset]|= (1<<EChannelDownBitOffset);
+				break;
+			case ERemConCoreApiPreviousChannel:
+				iFeatureBitmask[EPreviousChannelByteOffset]|= (1<<EPreviousChannelBitOffset);
+				break;
+			case ERemConCoreApiSoundSelect:
+				iFeatureBitmask[ESoundSelectByteOffset]|= (1<<ESoundSelectBitOffset);
+				break;
+			case ERemConCoreApiInputSelect:
+				iFeatureBitmask[EInputSelectByteOffset]|= (1<<EInputSelectBitOffset);
+				break;
+			case ERemConCoreApiDisplayInformation:
+				iFeatureBitmask[EDisplayInformationByteOffset]|= (1<<EDisplayInformationBitOffset);
+				break;
+			case ERemConCoreApiHelp:
+				iFeatureBitmask[EHelpByteOffset]|= (1<<EHelpBitOffset);
+				break;
+			case ERemConCoreApiPageUp:
+				iFeatureBitmask[EPageUpByteOffset]|= (1<<EPageUpBitOffset);
+				break;
+			case ERemConCoreApiPageDown:
+				iFeatureBitmask[EPageDownByteOffset]|= (1<<EPageDownBitOffset);
+				break;
+			case ERemConCoreApiPower:
+				iFeatureBitmask[EPowerByteOffset]|= (1<<EPowerBitOffset);
+				break;
+			case ERemConCoreApiVolumeUp:
+				iFeatureBitmask[EVolumeUpByteOffset]|= (1<<EVolumeUpBitOffset);
+				break;
+			case ERemConCoreApiVolumeDown:
+				iFeatureBitmask[EVolumeDownByteOffset]|= (1<<EVolumeDownBitOffset);
+				break;
+			case ERemConCoreApiMute:
+				iFeatureBitmask[EMuteByteOffset]|= (1<<EMuteBitOffset);
+				break;
+			case ERemConCoreApiPlay:
+				iFeatureBitmask[EPlayByteOffset]|= (1<<EPlayBitOffset);
+				break;
+			case ERemConCoreApiStop:
+				iFeatureBitmask[EStopByteOffset]|= (1<<EStopBitOffset);
+				break;
+			case ERemConCoreApiPause:
+				iFeatureBitmask[EPauseByteOffset]|= (1<<EPauseBitOffset);
+				break;
+			case ERemConCoreApiRecord:
+				iFeatureBitmask[ERecordByteOffset]|= (1<<ERecordBitOffset);
+				break;
+			case ERemConCoreApiRewind:
+				iFeatureBitmask[ERewindByteOffset]|= (1<<ERewindBitOffset);
+				break;
+			case ERemConCoreApiFastForward:
+				iFeatureBitmask[EFastForwardByteOffset]|= (1<<EFastForwardBitOffset);
+				break;
+			case ERemConCoreApiEject:
+				iFeatureBitmask[EEjectByteOffset]|= (1<<EEjectBitOffset);
+				break;
+			case ERemConCoreApiForward:
+				iFeatureBitmask[EForwardByteOffset]|= (1<<EForwardBitOffset);
+				break;
+			case ERemConCoreApiBackward:
+				iFeatureBitmask[EBackwardByteOffset]|= (1<<EBackwardBitOffset);
+				break;
+			case ERemConCoreApiAngle:
+				iFeatureBitmask[EAngleByteOffset]|= (1<<EAngleBitOffset);
+				break;
+			case ERemConCoreApiSubpicture:
+				iFeatureBitmask[ESubpictureByteOffset]|= (1<<ESubpictureBitOffset);
+				break;
+			case ERemConCoreApiF1:
+				iFeatureBitmask[EF1ByteOffset]|= (1<<EF1BitOffset);
+				break;
+			case ERemConCoreApiF2:
+				iFeatureBitmask[EF2ByteOffset]|= (1<<EF2BitOffset);
+				break;
+			case ERemConCoreApiF3:
+				iFeatureBitmask[EF3ByteOffset]|= (1<<EF3BitOffset);
+				break;
+			case ERemConCoreApiF4:
+				iFeatureBitmask[EF4ByteOffset]|= (1<<EF4BitOffset);
+				break;
+			case ERemConCoreApiF5:
+				iFeatureBitmask[EF5ByteOffset]|= (1<<EF5BitOffset);
+				break;
+			default:
+				// Ignore operations that aren't recorded in feature bitmask
+				break;
+				}
+			}
+		}
+	else
+		{
+		// Don't know specific info, set all operations
+		SetCoreApiFeatures();
+		}
+	}
+
+void TPlayerFeatureBitmask::SetCoreApiFeatures()
+	{
+	iFeatureBitmask[ESelectByteOffset] |= (1<<ESelectBitOffset);
+	iFeatureBitmask[EUpByteOffset]|= (1<<EUpBitOffset);
+	iFeatureBitmask[EDownByteOffset]|= (1<<EDownBitOffset);
+	iFeatureBitmask[ELeftByteOffset]|= (1<<ELeftBitOffset);
+	iFeatureBitmask[ERightByteOffset]|= (1<<ERightBitOffset);
+	iFeatureBitmask[ERightUpByteOffset]|= (1<<ERightUpBitOffset);
+	iFeatureBitmask[ERightDownByteOffset]|= (1<<ERightDownBitOffset);
+	iFeatureBitmask[ELeftUpByteOffset]|= (1<<ELeftUpBitOffset);
+	iFeatureBitmask[ELeftDownByteOffset]|= (1<<ELeftDownBitOffset);
+	iFeatureBitmask[ERootMenuByteOffset]|= (1<<ERootMenuBitOffset);
+	iFeatureBitmask[ESetupMenuByteOffset]|= (1<<ESetupMenuBitOffset);
+	iFeatureBitmask[EContentsMenuByteOffset]|= (1<<EContentsMenuBitOffset);
+	iFeatureBitmask[EFavoriteMenuByteOffset]|= (1<<EFavoriteMenuBitOffset);
+	iFeatureBitmask[EExitByteOffset]|= (1<<EExitBitOffset);
+	iFeatureBitmask[E0ByteOffset]|= (1<<E0BitOffset);
+	iFeatureBitmask[E1ByteOffset]|= (1<<E1BitOffset);
+	iFeatureBitmask[E2ByteOffset]|= (1<<E2BitOffset);
+	iFeatureBitmask[E3ByteOffset]|= (1<<E3BitOffset);
+	iFeatureBitmask[E4ByteOffset]|= (1<<E4BitOffset);
+	iFeatureBitmask[E5ByteOffset]|= (1<<E5BitOffset);
+	iFeatureBitmask[E6ByteOffset]|= (1<<E6BitOffset);
+	iFeatureBitmask[E7ByteOffset]|= (1<<E7BitOffset);
+	iFeatureBitmask[E8ByteOffset]|= (1<<E8BitOffset);
+	iFeatureBitmask[E9ByteOffset]|= (1<<E9BitOffset);
+	iFeatureBitmask[EDotByteOffset]|= (1<<EDotBitOffset);
+	iFeatureBitmask[EEnterByteOffset]|= (1<<EEnterBitOffset);
+	iFeatureBitmask[EClearByteOffset]|= (1<<EClearBitOffset);
+	iFeatureBitmask[EChannelUpByteOffset]|= (1<<EChannelUpBitOffset);
+	iFeatureBitmask[EChannelDownByteOffset]|= (1<<EChannelDownBitOffset);
+	iFeatureBitmask[EPreviousChannelByteOffset]|= (1<<EPreviousChannelBitOffset);
+	iFeatureBitmask[ESoundSelectByteOffset]|= (1<<ESoundSelectBitOffset);
+	iFeatureBitmask[EInputSelectByteOffset]|= (1<<EInputSelectBitOffset);
+	iFeatureBitmask[EDisplayInformationByteOffset]|= (1<<EDisplayInformationBitOffset);
+	iFeatureBitmask[EHelpByteOffset]|= (1<<EHelpBitOffset);
+	iFeatureBitmask[EPageUpByteOffset]|= (1<<EPageUpBitOffset);
+	iFeatureBitmask[EPageDownByteOffset]|= (1<<EPageDownBitOffset);
+	iFeatureBitmask[EPowerByteOffset]|= (1<<EPowerBitOffset);
+	iFeatureBitmask[EVolumeUpByteOffset]|= (1<<EVolumeUpBitOffset);
+	iFeatureBitmask[EVolumeDownByteOffset]|= (1<<EVolumeDownBitOffset);
+	iFeatureBitmask[EMuteByteOffset]|= (1<<EMuteBitOffset);
+	iFeatureBitmask[EPlayByteOffset]|= (1<<EPlayBitOffset);
+	iFeatureBitmask[EStopByteOffset]|= (1<<EStopBitOffset);
+	iFeatureBitmask[EPauseByteOffset]|= (1<<EPauseBitOffset);
+	iFeatureBitmask[ERecordByteOffset]|= (1<<ERecordBitOffset);
+	iFeatureBitmask[ERewindByteOffset]|= (1<<ERewindBitOffset);
+	iFeatureBitmask[EFastForwardByteOffset]|= (1<<EFastForwardBitOffset);
+	iFeatureBitmask[EEjectByteOffset]|= (1<<EEjectBitOffset);
+	iFeatureBitmask[EForwardByteOffset]|= (1<<EForwardBitOffset);
+	iFeatureBitmask[EBackwardByteOffset]|= (1<<EBackwardBitOffset);
+	iFeatureBitmask[EAngleByteOffset]|= (1<<EAngleBitOffset);
+	iFeatureBitmask[ESubpictureByteOffset]|= (1<<ESubpictureBitOffset);
+	iFeatureBitmask[EF1ByteOffset]|= (1<<EF1BitOffset);
+	iFeatureBitmask[EF2ByteOffset]|= (1<<EF2BitOffset);
+	iFeatureBitmask[EF3ByteOffset]|= (1<<EF3BitOffset);
+	iFeatureBitmask[EF4ByteOffset]|= (1<<EF4BitOffset);
+	iFeatureBitmask[EF5ByteOffset]|= (1<<EF5BitOffset);
+	}
+
+void TPlayerFeatureBitmask::SetAbsoluteVolumeApiFeatures(const RArray<TUint>& aOperation)
+	{
+	if(aOperation.Count())
+		{
+		iFeatureBitmask[EAdvancedControlPlayerByteOffset] |= (1<<EAdvancedControlPlayerBitOffset);
+		}
+	}
+
+void TPlayerFeatureBitmask::SetGroupNavigationApiFeatures(const RArray<TUint>& aOperation)
+	{
+	if(aOperation.Count())
+		{
+		iFeatureBitmask[EVendorUniqueByteOffset] |= (1<<EVendorUniqueBitOffset);
+		iFeatureBitmask[EGroupNavigationByteOffset] |=  (1<<EGroupNavigationBitOffset);
+		}
+	}
+
+void TPlayerFeatureBitmask::SetNowPlayingApiFeatures(const RArray<TUint>& aOperation)
+	{
+	if(aOperation.Count())
+		{
+		iFeatureBitmask[EAdvancedControlPlayerByteOffset] |= (1<<EAdvancedControlPlayerBitOffset);
+		iFeatureBitmask[ENowPlayingByteOffset] |= (1<<ENowPlayingBitOffset);
+		
+		if(aOperation.Find(EAddToNowPlaying) >= 0)
+			{
+			iFeatureBitmask[EAddToNowPlayingByteOffset] |= (1<<EAddToNowPlayingBitOffset);
+			}
+		}
+	}
+
+void TPlayerFeatureBitmask::SetMediaBrowseApiFeatures(const RArray<TUint>& aOperation)
+	{
+	if(aOperation.Count())
+		{
+		iFeatureBitmask[EAdvancedControlPlayerByteOffset] |= (1<<EAdvancedControlPlayerBitOffset);
+		iFeatureBitmask[ENowPlayingByteOffset] |= (1<<ENowPlayingBitOffset);
+		iFeatureBitmask[EBrowsingByteOffset] |= (1<<EBrowsingBitOffset);
+
+		if(aOperation.Find(ESearchOperationId) >= 0)
+			{
+			iFeatureBitmask[ESearchByteOffset] |= (1<<ESearchBitOffset);
+			}
+		
+		if(aOperation.Find(EUIDPersistency) >= 0)
+			{
+			iFeatureBitmask[EUidPersistencyByteOffset] |= (1<<EUidPersistencyBitOffset);
+			iFeatureBitmask[EDatabaseAwareByteOffset] |= (1<<EDatabaseAwareBitOffset);
+			}
+		}
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/playerstatewatcher.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,311 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "mediabrowse.h"
+#include "avrcputils.h"
+#include "commandhandlerinterface.h"
+#include "internalcommand.h"
+#include "mediabrowse.h"
+#include "playerstatewatcher.h"
+#include "remconcommandinterface.h"
+#include "avrcplog.h"
+#include "playerinformation.h"
+
+CPlayerWatcherBase::CPlayerWatcherBase(MRemConCommandInterface& aCommandInterface)
+	: iCommandInterface(aCommandInterface), iCommands()
+	{
+	LOG_FUNC;
+	}
+
+CPlayerWatcherBase::~CPlayerWatcherBase()
+	{
+	LOG_FUNC;
+	}
+
+void CPlayerWatcherBase::StopWatchingPlayer(TRemConClientId aClientId)
+	{
+	LOG_FUNC;
+	CInternalCommand** cmdPtr = iCommands.Find(aClientId);
+	if (cmdPtr) // This may be NULL if we've already stopped watching the player as a result of reciving a reject
+	    {
+        CInternalCommand* cmd = *cmdPtr;
+        
+        TUint transId = cmd->RemConCommandId();
+        iCommandInterface.MrcciCommandExpired(transId);
+    
+        iCommands.Remove(aClientId);
+        cmd->DecrementUsers();
+	    }
+	}
+
+void CPlayerWatcherBase::MessageSent(CAvrcpCommand& /*aCommand*/, TInt /*aSendResult*/)
+	{
+	LOG_FUNC;
+	__DEBUG_ONLY(AVRCP_PANIC(ELowerInterfaceUsedOnInternalHandler));
+	}
+
+void CPlayerWatcherBase::MaxPacketSize(TInt /*aMtu*/)
+	{
+	LOG_FUNC;
+	__DEBUG_ONLY(AVRCP_PANIC(ELowerInterfaceUsedOnInternalHandler));
+	}
+
+void CPlayerWatcherBase::ReceiveCommandL(const TDesC8& /*aMessageInformation*/, SymbianAvctp::TTransactionLabel /*aTransLabel*/, const TBTDevAddr& /*aAddr*/)
+	{
+	LOG_FUNC;
+	__DEBUG_ONLY(AVRCP_PANIC(ELowerInterfaceUsedOnInternalHandler));
+	}
+
+CInternalCommand& CPlayerWatcherBase::FindCommand(TUid __DEBUG_ONLY(aInterfaceUid),
+		TUint aTransactionId, TRemConClientId& aFoundClientId)
+	{
+	__ASSERT_DEBUG(aInterfaceUid == TUid::Uid(KRemConPlayerInformationUid) || aInterfaceUid == TUid::Uid(KRemConMediaBrowseApiUid), AVRCP_PANIC(EResponseForWrongInterface));
+	THashMapIter<TRemConClientId, CInternalCommand*> commandIter(iCommands);
+
+	CInternalCommand* command = NULL;
+	while(commandIter.NextValue())
+		{
+		command = *commandIter.CurrentValue();
+		if(command->RemConCommandId() == aTransactionId)
+			{
+			aFoundClientId = *commandIter.CurrentKey();
+			break;
+			}
+		}
+
+	// If command is NULL we reached the end of our iter without finding the match
+	__ASSERT_DEBUG(command, AVRCP_PANIC(EUnmatchedResponseFromRemCon));
+
+	return *command;
+	}
+
+TInt CPlayerWatcherBase::SendRemConResponse(TUid aInterfaceUid, TUint aTransactionId, RBuf8& aData)
+	{
+	LOG_FUNC;
+
+	TRemConClientId clientId;
+	CInternalCommand& command = FindCommand(aInterfaceUid, aTransactionId, clientId);
+
+	ReceiveUpdate(command, clientId, aData);
+
+	return KErrNone;
+	}
+
+void CPlayerWatcherBase::SendReject(TUid aInterfaceUid, TUint aTransactionId)
+	{
+	TRemConClientId clientId;
+	(void)FindCommand(aInterfaceUid, aTransactionId, clientId);
+
+	ReceiveReject(clientId);
+	}
+
+void CPlayerWatcherBase::Disconnect()
+	{
+	LOG_FUNC;
+	}
+
+CPlayStatusWatcher* CPlayStatusWatcher::NewL(MPlayStatusObserver& aObserver, MRemConCommandInterface& aCommandInterface)
+	{
+	LOG_STATIC_FUNC;
+	CPlayStatusWatcher* watcher = new(ELeave)CPlayStatusWatcher(aObserver, aCommandInterface);
+	return watcher;
+	}
+
+CPlayStatusWatcher::CPlayStatusWatcher(MPlayStatusObserver& aObserver,
+		MRemConCommandInterface& aCommandInterface)
+	: CPlayerWatcherBase(aCommandInterface), iObserver(aObserver)
+	{
+	LOG_FUNC;
+	}
+
+CPlayStatusWatcher::~CPlayStatusWatcher()
+	{
+	LOG_FUNC;
+	}
+
+void CPlayStatusWatcher::StartWatchingPlayerL(TRemConClientId aClientId)
+	{
+	LOG_FUNC;
+	__ASSERT_DEBUG(!iCommands.Find(aClientId), AVRCP_PANIC(EAlreadyWatchingPlayer));
+
+	CInternalCommand* command = CInternalCommand::NewL(TUid::Uid(KRemConPlayerInformationUid),
+			0,
+			EGetPlayStatusUpdate,
+			KNullDesC8);
+
+	CleanupStack::PushL(command);
+	iCommands.InsertL(aClientId, command);
+	CleanupStack::Pop(command);
+	command->IncrementUsers();
+
+	// Initially request uid notification relative to stopped
+	SendPlayStatusUpdateRequest(*command, aClientId, MPlayerEventsObserver::EStopped);
+	}
+
+void CPlayStatusWatcher::SendPlayStatusUpdateRequest(CInternalCommand& aCommand, TRemConClientId& aClientId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus)
+	{
+	LOG_FUNC;
+
+	RRemConPlayerInformationGetPlayStatusUpdateRequest request;
+	request.iStatus = aPlaybackStatus;
+
+	TBuf8<sizeof(MPlayerEventsObserver::TPlaybackStatus)> buf;
+	TRAPD(err, request.WriteL(buf));
+
+	// We know how big the request is so this should never fail
+	__ASSERT_DEBUG(err == KErrNone, AVRCP_PANIC(EUidUpdateRequestWriteFailure));
+
+	TUint transId = iCommandInterface.MrcciNewTransactionId();
+	TRAP(err, aCommand.ResetL(transId, buf));
+
+	if(err == KErrNone)
+		{
+		iCommandInterface.MrcciNewCommand(aCommand, aClientId);
+		}
+	else
+		{
+		// Doom
+		iObserver.MpsoError(aClientId);
+		}
+	}
+
+void CPlayStatusWatcher::ReceiveUpdate(CInternalCommand& aCommand, TRemConClientId aClientId, RBuf8& aData)
+	{
+	LOG_FUNC;
+
+	// Read 4 byte Big-Endian error code before the payload
+	RAvrcpIPCError errorResponse;
+	TRAPD(err, errorResponse.ReadL(aData));
+	err = err ? err : errorResponse.iError;
+
+	RRemConPlayerInformationGetPlayStatusUpdateResponse response;
+	if(!err)
+		{
+		// Parse the rest of the response (minus error code)
+		TRAP(err, response.ReadL(aData.RightTPtr(aData.Length() - KLengthErrorResponse)));
+		}
+
+	aData.Close(); // data has been used now
+
+	if(!err)
+		{
+		iObserver.MpsoPlayStatusChanged(aClientId, response.iStatus);
+		SendPlayStatusUpdateRequest(aCommand, aClientId, response.iStatus);
+		}
+	else
+		{
+		// Should never get here with a valid player.  This client is
+		// sending us junk.
+		iObserver.MpsoError(aClientId);
+		}
+	}
+
+void CPlayStatusWatcher::ReceiveReject(TRemConClientId aClientId)
+	{
+	LOG_FUNC;
+	iObserver.MpsoError(aClientId);
+	}
+
+CUidWatcher* CUidWatcher::NewL(MUidObserver& aObserver,
+		MRemConCommandInterface& aCommandInterface)
+	{
+	LOG_STATIC_FUNC;
+	CUidWatcher* watcher = new(ELeave)CUidWatcher(aObserver, aCommandInterface);
+	return watcher;
+	}
+
+CUidWatcher::CUidWatcher(MUidObserver& aObserver,
+		MRemConCommandInterface& aCommandInterface)
+	: CPlayerWatcherBase(aCommandInterface), iObserver(aObserver)
+	{
+	LOG_FUNC;
+	}
+
+CUidWatcher::~CUidWatcher()
+	{
+	LOG_FUNC;
+	}
+
+void CUidWatcher::StartWatchingPlayerL(TRemConClientId aClientId)
+	{
+	LOG_FUNC;
+	__ASSERT_DEBUG(!iCommands.Find(aClientId), AVRCP_PANIC(EAlreadyWatchingPlayer));
+
+	CInternalCommand* command = CInternalCommand::NewL(TUid::Uid(KRemConMediaBrowseApiUid),
+			0,
+			EMediaLibraryStateCookieUpdateOperationId,
+			KNullDesC8);
+
+	CleanupStack::PushL(command);
+	iCommands.InsertL(aClientId, command);
+	CleanupStack::Pop(command);
+	command->IncrementUsers();
+
+	// Initially request uid notification relative to 0 uid counter
+	SendUidUpdateRequest(*command, aClientId, 0);
+	}
+
+void CUidWatcher::SendUidUpdateRequest(CInternalCommand& aCommand, TRemConClientId& aClientId, TUint16 aUidCounter)
+	{
+	LOG_FUNC;
+	RRemConUidsChangedRequest request;
+	request.iInitialUidCounter = aUidCounter;
+	TBuf8<sizeof(TUint16)> buf;
+	TRAPD(err, request.WriteL(buf));
+	// We know how big the request is so this should never fail
+	__ASSERT_DEBUG(err == KErrNone, AVRCP_PANIC(EUidUpdateRequestWriteFailure));
+
+	TUint transId = iCommandInterface.MrcciNewTransactionId();
+	TRAP(err, aCommand.ResetL(transId, buf));
+
+	if(err == KErrNone)
+		{
+		iCommandInterface.MrcciNewCommand(aCommand, aClientId);
+		}
+	else
+		{
+		// Doom
+		iObserver.MuoError(aClientId);
+		}
+	}
+
+void CUidWatcher::ReceiveUpdate(CInternalCommand& aCommand, TRemConClientId aClientId, RBuf8& aData)
+	{
+	LOG_FUNC;
+	RRemConUidsChangedResponse response;
+	TRAPD(err, response.ReadL(aData));
+	aData.Close(); // data has been used now
+
+	if(!err)
+		{
+		iObserver.MuoUidChanged(aClientId, response.iUidCounter);
+		SendUidUpdateRequest(aCommand, aClientId, response.iUidCounter);
+		}
+	else
+		{
+		// Should never get here with a valid player.  This client is
+		// sending us junk.
+		iObserver.MuoError(aClientId);
+		}
+	}
+
+void CUidWatcher::ReceiveReject(TRemConClientId aClientId)
+	{
+	LOG_FUNC;
+	iObserver.MuoError(aClientId);
+	}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,1221 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <avctpservices.h>
+#include <bttypes.h>
+#include <e32base.h>
+#include <remconaddress.h>
+#include <remconbeareravrcp.h>
+#include <remcon/remconbearerobserver.h>
+#include "controlcommand.h"
+#include "browsecommand.h"
+#include "avrcpbrowsingcommandhandler.h"
+#include "avrcpincomingcommandhandler.h"
+#include "avrcpoutgoingcommandhandler.h"
+#include "avrcpremotedevice.h"
+#include "avrcprouter.h"
+#include "avrcputils.h"
+#include "avrcpplayerinfomanager.h"
+#include "bulkbearer.h"
+#include "controlbearer.h"
+#include "mediabrowse.h"
+#include "nowplaying.h"
+
+#include "avrcplog.h"
+
+
+
+/** Allocates and constructs a new CRemConBearerAvrcp object.
+
+@param aParams Bearer construction params used for base class construction.
+@return A new CRemConBearerAvrcp object.
+@leave System wide error code
+*/
+CRemConBearerAvrcp* CRemConBearerAvrcp::NewL(TBearerParams& aParams)
+	{
+	LOG_STATIC_FUNC
+	CRemConBearerAvrcp* bearer = new(ELeave) CRemConBearerAvrcp(aParams);
+	CleanupStack::PushL(bearer);
+	
+	TRAPD(err, bearer->ConstructL());
+	
+	if(err == KErrNoMemory)
+		{
+		User::Leave(err);
+		}
+	// else KErrNone or some other error -- swallow it.
+	
+	CleanupStack::Pop(bearer);
+	return bearer;
+	}
+
+/** Constructor.
+
+@param aParams Bearer construction params used for base class construction.
+*/
+CRemConBearerAvrcp::CRemConBearerAvrcp(TBearerParams& aParams) : 
+	CRemConBearerPlugin(aParams), iRemotes(_FOFF(CRcpRemoteDevice, iLink)),
+	iReadyCommands(_FOFF(CAvrcpCommand, iReadyLink)), iReadyResponses(_FOFF(CAvrcpCommand, iReadyLink)),
+	iReadyNotifyResponses(_FOFF(CControlCommand, iReadyLink)), 
+	iReadyNotifyCommands(_FOFF(CAvrcpCommand, iReadyLink))
+	{
+	LOG_FUNC
+	}
+
+/** Second phase construction.
+
+@leave System wide error code
+*/	
+void CRemConBearerAvrcp::ConstructL()
+	{
+	LOG_FUNC
+	
+	// Set-up TLS
+	LEAVEIFERRORL(Dll::SetTls(reinterpret_cast<TAny*>(EControlThread)));
+	
+	// New up a router.  This opens and uses the RAvctp.
+	// On initialisation it should begin listening.
+	iRouter = CControlRouter::NewL(iAvctp, *this);
+	iTimer = CDeltaTimer::NewL(CActive::EPriorityStandard);
+	iPlayerInfoManager = CAvrcpPlayerInfoManager::NewL(Observer(), *this);
+	iInternalHandler = &iPlayerInfoManager->InternalCommandHandler();
+	
+	// Create the bulk bearer - actual usage occurs in the bulk thread.
+	iBulkBearer = CAvrcpBulkBearer::NewL(iAvctp, *iPlayerInfoManager);
+	iConstructionComplete = ETrue;
+	}
+
+/** Destructor.
+*/
+CRemConBearerAvrcp::~CRemConBearerAvrcp()
+	{
+	LOG_FUNC
+	
+	while (!iRemotes.IsEmpty())
+		{
+		CRcpRemoteDevice* remote = iRemotes.First();
+		remote->iLink.Deque();
+		remote->Disconnect(EFalse);
+		delete remote;
+		}
+	
+	delete iRouter;
+	
+	delete iBulkBearer;
+	
+	// Delete the timer last as pending events
+	// are cancelled in remote->Disconnect
+	
+	delete iTimer;
+	
+	delete iPlayerInfoManager;
+	
+	Dll::FreeTls();
+	}
+
+//---------------------------------------------------------------------
+// RemConBearer control functions
+//---------------------------------------------------------------------	
+
+/** Called by RemCon to retrieve a response on a connection. 
+
+This must only be called as a result of a NewResponse upcall.
+
+@param aInterfaceUid The UID of the outer-layer client API specifying the response.
+@param aId The command identifier used as a cookie for command/response matching.
+@param aOperationId The ID of the response operation in the outer-layer client API.
+@param aData API-specific message data. On success, ownership is returned.
+@param aAddr The connection.
+*/	
+TInt CRemConBearerAvrcp::GetResponse(TUid& aInterfaceUid, 
+		TUint& aId, 
+		TUint& aOperationId, 
+		RBuf8& aCommandData, 
+		TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+	
+	// If object only partially constructed, swallow the request
+	__ASSERT_DEBUG(iConstructionComplete, AVRCP_PANIC(EAvrcpNoResponsesAvailable));	
+	
+	
+	TInt result = KErrNotFound;
+	
+	if(!iReadyResponses.IsEmpty())
+		{
+		CAvrcpCommand* command = iReadyResponses.First();
+		TBTDevAddr btAddr;
+		command->GetCommandInfo(aInterfaceUid, aId, aOperationId, aCommandData, btAddr);
+		AvrcpUtils::BTToRemConAddr(btAddr, aAddr);
+		
+		// Remove command from queue first because calling
+		// DecrementUsers() may delete command
+		command->iReadyLink.Deque();
+		command->DecrementUsers();
+		result = KErrNone;
+		}
+	else
+		{
+		// RemCon is trying to pick up a response we don't think we have
+		__ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpNoResponsesAvailable));	
+		}
+		
+	return result;
+	}
+
+/** Called by RemCon to retrieve a response on a connection. 
+
+This must only be called as a result of a NewResponse upcall.
+
+@param aInterfaceUid The UID of the outer-layer client API specifying the response.
+@param aId The command identifier used as a cookie for command/response matching.
+@param aOperationId The ID of the response operation in the outer-layer client API.
+@param aData API-specific message data. On success, ownership is returned.
+@param aAddr The connection.
+*/	
+TInt CRemConBearerAvrcp::GetNotifyResponse(TUid& aInterfaceUid, 
+		TUint& aId, 
+		TUint& aOperationId, 
+		RBuf8& aCommandData, 
+		TRemConAddress& aAddr,
+		TRemConMessageSubType& aSubMessageType)
+	{
+	LOG_FUNC
+	
+	// If object only partially constructed, swallow the request
+	__ASSERT_DEBUG(iConstructionComplete, AVRCP_PANIC(EAvrcpNoResponsesAvailable));	
+	
+	
+	TInt result = KErrNotFound;
+	
+	if(!iReadyNotifyResponses.IsEmpty())
+		{
+		CControlCommand* command = iReadyNotifyResponses.First();
+		TBTDevAddr btAddr;
+		command->GetCommandInfo(aInterfaceUid, aId, aOperationId, aCommandData, btAddr);
+		AvrcpUtils::BTToRemConAddr(btAddr, aAddr);
+	
+		switch ( command->Frame().Type() )
+	        {
+	        case AVC::EInterim:
+			    aSubMessageType = ERemConNotifyResponseInterim;
+	            break;
+		    case AVC::EChanged: 
+	            aSubMessageType = ERemConNotifyResponseChanged;
+		        break;
+		    case AVC::ERejected: // fall into default
+		    case AVC::ENotImplemented:// fall into default
+		    default:
+		        aSubMessageType = ERemConMessageDefault;
+		        break;
+		    }
+
+		// Remove command from queue first because calling
+		// DecrementUsers() may delete command
+		command->iReadyLink.Deque();
+		command->DecrementUsers();
+		result = KErrNone;
+		}
+	else
+		{
+		// RemCon is trying to pick up a response we don't think we have
+		__ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpNoResponsesAvailable));	
+		}
+		
+	return result;
+	}
+	
+/** Called by RemCon to send a command on a connection. 
+
+@param aInterfaceUid The UID of the outer-layer client API specifying the command.
+@param aOperationId The ID of the command operation in the outer-layer client API.
+@param aId The command identifier used as a cookie for command/response matching.
+@param aData API-specific message data. On success, ownership is passed. 
+@param aAddr The connection.
+@return Error. This request is synchronous. It returns KErrNone when AVRCP has
+taken responsibility for sending the message. This involves checking that the message
+is well-formed and adding it to the send queue.
+*/
+TInt CRemConBearerAvrcp::SendCommand(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint aId,  
+		RBuf8& aData, 
+		const TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+	// RemCon retains ownership of the data in aData until
+	// this function returns KErrNone.
+	
+	if (!iConstructionComplete)
+		{
+		// Object only partially constructed, swallow the request
+		return KErrNotSupported;
+		}
+	
+	
+	TBTDevAddr btAddr;
+	TInt err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr);
+
+	if(err == KErrNone)
+		{
+		CRcpRemoteDevice* remote = RemoteDevice(btAddr);
+		__ASSERT_ALWAYS(remote, AVRCP_PANIC(EAvrcpNotConnected));
+		
+		TRAP(err, remote->OutgoingHandler().SendCommandL(aInterfaceUid, 
+				aOperationId,
+				aId, 
+				aData, 
+				btAddr));
+		}
+
+	return err;
+	}
+
+
+/** Called by RemCon to retrieve a command on a connection. 
+
+This must only be called as a result of a NewCommand upcall.
+
+@param aInterfaceUid The UID of the outer-layer client API specifying the command.
+@param aId The command identifier used as a cookie for command/response matching.
+@param aOperationId The ID of the command operation in the outer-layer client API.
+@param aData API-specific message data. On success, ownership is returned.
+@param aAddr The connection.
+*/	
+TInt CRemConBearerAvrcp::GetCommand(TUid& aInterfaceUid, 
+		TUint& aId, 
+		TUint& aOperationId, 
+		RBuf8& aCommandData, 
+		TRemConAddress& aAddr)
+	{
+	TInt result = KErrNotFound;
+	
+	if(!iReadyCommands.IsEmpty())
+		{
+		CAvrcpCommand* command = GetFirstCommand(iReadyCommands, aInterfaceUid, aId, aOperationId, aCommandData, aAddr);
+		if(command)
+			{
+			// Remove command from queue first because calling
+			// DecrementUsers() may delete command
+			command->iReadyLink.Deque();
+			command->DecrementUsers();
+			result = KErrNone;
+			}
+		}
+	else
+		{
+		__DEBUGGER();
+		}
+	
+	return result;
+	}
+
+/** Called by RemCon to retrieve a notify command on a connection. 
+
+This must only be called as a result of a NewNotifyCommand upcall.
+
+@param aInterfaceUid The UID of the outer-layer client API specifying the command.
+@param aId The command identifier used as a cookie for command/response matching.
+@param aOperationId The ID of the command operation in the outer-layer client API.
+@param aData API-specific message data. On success, ownership is returned.
+@param aAddr The connection.
+*/	
+TInt CRemConBearerAvrcp::GetNotifyCommand(TUid& aInterfaceUid, 
+		TUint& aId, 
+		TUint& aOperationId, 
+		RBuf8& aCommandData, 
+		TRemConAddress& aAddr)
+	{
+	TInt result = KErrNotFound;
+	
+	CAvrcpCommand* command = GetFirstCommand(iReadyNotifyCommands, aInterfaceUid, aId, aOperationId, aCommandData, aAddr);
+	if(command)
+		{		
+		// Remove command from queue first because calling
+		// DecrementUsers() may delete command
+		command->iReadyLink.Deque();
+		command->DecrementUsers();
+		result = KErrNone;
+		}
+	
+	return result;
+	}
+
+/**
+Internal method, called by GetCommand() and GetNotifyCommand()
+
+@return The first command from the Queue.  NULL if the queue is empty.  The command remains 
+		on the queue.
+*/
+CAvrcpCommand* CRemConBearerAvrcp::GetFirstCommand(TDblQue<CAvrcpCommand>& aQue, TUid& aInterfaceUid, 
+		TUint& aId, 
+		TUint& aOperationId, 
+		RBuf8& aCommandData, 
+		TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+
+	// If object only partially constructed, swallow the request
+	__ASSERT_DEBUG(iConstructionComplete, AVRCP_PANIC(EAvrcpNoResponsesAvailable));	
+	
+	CAvrcpCommand* command = NULL;
+	
+	if(! aQue.IsEmpty())
+		{
+		command = aQue.First();
+
+		// Calling GetCommandInfo transfers the command data to RemCon.  This means
+		// once we have called it we are committed to returning KErrNone.
+		TBTDevAddr btAddr;
+		command->GetCommandInfo(aInterfaceUid, aId, aOperationId, aCommandData, btAddr);
+		AvrcpUtils::BTToRemConAddr(btAddr, aAddr);
+		}
+	else
+		{
+		// RemCon is trying to pick up a command we don't think we have
+		__ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpNoResponsesAvailable));
+		}
+		
+	return command;
+	}
+/** Called by RemCon to send a response on a connection. 
+
+@param aInterfaceUid The UID of the outer-layer client API specifying the response.
+@param aOperationId The ID of the response operation in the outer-layer client API.
+@param aId The command identifier used as a cookie for command/response matching
+@param aData API-specific message data. On success, ownership is passed.
+@param aAddr The connection.
+@return Error. This request is synchronous. It is completed by AVRCP when it has 
+taken responsibility for sending the message. This involves checking that the message 
+is well-formed and adding it to the send queue.
+*/	
+TInt CRemConBearerAvrcp::SendResponse(TUid aInterfaceUid, 
+		TUint /*aOperationId*/, 
+		TUint aId, 
+		RBuf8& aData, 
+		const TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+	// RemCon retains ownership of the data in aData until
+	// this function returns KErrNone.
+	
+	if (!iConstructionComplete)
+		{
+		// Object only partially constructed, swallow the request
+		return KErrNotSupported;
+		}
+	
+	
+	TBTDevAddr btAddr;
+	TInt err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr);
+	__ASSERT_DEBUG(err == KErrNone, AVRCP_PANIC(EInvalidBtAddrInResponse));
+	
+	if(btAddr != TBTDevAddr(0))
+		{
+		CRcpRemoteDevice* remote = RemoteDevice(btAddr);
+		__ASSERT_ALWAYS(remote, AVRCP_PANIC(EAvrcpNotConnected));
+
+		err = remote->IncomingHandler().SendRemConResponse(aInterfaceUid, aId, aData);
+		}
+	else
+		{
+		err = iInternalHandler->SendRemConResponse(aInterfaceUid, aId, aData);
+		}
+		
+	return err;
+	}
+
+/**	Called by RemCon when either
+	a) The TSP does not address a command to any clients
+	b) The TSP does not permit the response from any commands
+	c) All the clients disconnect from remcon before the response is sent
+	to send a null response on a connection. The connection must already
+	exist
+	@param aInterfaceUid The UID of the outer-layer client API that the command
+	was sent to
+	@param aOperationId The ID of the command operation sent to remcon
+	@param aId The command identifier used as a cookie for command/response 
+	matching.
+	@param aAddr The connection.
+	*/
+
+void CRemConBearerAvrcp::SendReject(TUid aInterfaceUid,
+		TUint /* aOperationId */,
+		TUint aTransactionId,
+		const TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+	
+	__ASSERT_DEBUG(iConstructionComplete, AVRCP_PANIC(EAvrcpNotFullyConstructed));
+	
+	TBTDevAddr btAddr;
+	__DEBUG_ONLY(TInt err = )AvrcpUtils::RemConToBTAddr(aAddr, btAddr);
+	__ASSERT_DEBUG(err == KErrNone, AVRCP_PANIC(EInvalidBtAddrInResponse));
+	
+	if(btAddr != TBTDevAddr(0))
+		{
+		CRcpRemoteDevice* remote = RemoteDevice(btAddr);
+		__ASSERT_ALWAYS(remote, AVRCP_PANIC(EAvrcpNotConnected));
+
+		remote->IncomingHandler().SendReject(aInterfaceUid, aTransactionId);
+		}
+	else
+		{
+		iInternalHandler->SendReject(aInterfaceUid, aTransactionId);
+		}
+
+	}
+
+/** Called by RemCon to establish a bearer-level connection to another party.
+ 
+Completion is signalled back in ConnectConfirm.
+
+@param aAddr The RemCon address to connect to.
+*/	
+void CRemConBearerAvrcp::ConnectRequest(const TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+
+	if (!iConstructionComplete)
+		{
+		// Object only partially constructed, error the request
+		Observer().ConnectConfirm(aAddr, KErrNotSupported);
+		return;
+		}
+	
+	
+	// Get a bluetooth address from the TRemConAddr
+	TBTDevAddr btAddr;
+	TInt convErr = AvrcpUtils::RemConToBTAddr(aAddr, btAddr);
+	if(convErr != KErrNone)
+		{
+		Observer().ConnectConfirm(aAddr, convErr);
+		return;
+		}
+
+	// Address for internal commands
+	if(btAddr == TBTDevAddr(0))
+		{
+		Observer().ConnectConfirm(aAddr, KErrNone);
+		return;
+		}
+	
+	CRcpRemoteDevice* remote = RemoteDevice(btAddr);
+	if(remote)
+		{
+		// Already have a connection to this address
+		Observer().ConnectConfirm(aAddr, KErrNone);
+		return;
+		}
+	
+	TRAPD(devErr, remote = CRcpRemoteDevice::NewL(btAddr, *iRouter, *this, Observer(), *iTimer, *iPlayerInfoManager));
+	if(devErr)
+		{
+		Observer().ConnectConfirm(aAddr, devErr);
+		return;
+		}
+
+	iRemotes.AddLast(*remote);
+	devErr = iRouter->ConnectRequest(btAddr);
+	if(devErr != KErrNone)
+		{
+		remote->iLink.Deque();
+		delete remote;
+
+		// Error with connect, generate errored ConnectConfirm.
+		Observer().ConnectConfirm(aAddr, devErr);
+		return;
+		}
+	
+	return;
+	}
+
+/** Called by RemCon to destroy a bearer-level connection to another party. 
+
+Completion is signalled back in DisconnectConfirm.
+
+@param aAddr The RemCon address to disconnect from.
+*/	
+void CRemConBearerAvrcp::DisconnectRequest(const TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+
+	__ASSERT_DEBUG(iConstructionComplete, AVRCP_PANIC(EAvrcpDisconnectRequestWhilePartiallyConstructed));
+	
+	TBTDevAddr btAddr;
+	TInt err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr);
+	
+	if(!err)
+		{
+		// Address for internal commands
+		if(btAddr == TBTDevAddr(0))
+			{
+			Observer().DisconnectConfirm(aAddr, KErrNone);
+			}
+		else
+			{
+			CRcpRemoteDevice *remote = RemoteDevice(btAddr);
+			if(remote)
+				{
+				// calling disconnect gives the remote the opportunity
+				// to do anything necessary to commands still on its 
+				// queue before we delete it.
+				remote->Disconnect(ETrue);
+				remote->iLink.Deque();
+				delete remote;
+				
+				err = iRouter->DisconnectRequest(btAddr);
+				// If this failed generate an errored DisconnectConfirm now,
+				// otherwise we'll be prodded with a DisconnectConfirm from
+				// the router at a later date.
+				if(err != KErrNone)
+					{
+					Observer().DisconnectConfirm(aAddr, err);
+					}
+				}
+			else
+				{
+				__ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpMismatchedConnectDisconnect));
+				Observer().DisconnectConfirm(aAddr, KErrNotFound);
+				}
+			}
+		}
+	else
+		{
+		Observer().DisconnectConfirm(aAddr, err);
+		}
+	}
+
+/** Called by RemCon to get the security policy.
+
+This is the list of capabilities required to make/destroy connections 
+over the bearer, and to send and receive messages over the bearer.
+
+@return The bearer's security policy.
+*/
+TSecurityPolicy CRemConBearerAvrcp::SecurityPolicy() const
+	{
+	LOG_FUNC
+	return TSecurityPolicy(ECapabilityLocalServices);
+	}
+
+/** Called by RemCon when either (a) the number of controller clients changes 
+from 0 to 1 or from 1 to 0, or (b) the number of target clients changes 
+from 0 to 1 or from 1 to 0.
+
+@param aControllerPresent Whether there are any controller clients connected.
+@param aTargetPresent Whether there are any target clients connected.
+*/	
+void CRemConBearerAvrcp::ClientStatus(TBool aControllerPresent, TBool aTargetPresent)
+	{
+	LOG_FUNC
+
+	if (!iConstructionComplete)
+		{
+		// Object only partially constructed, swallow the request
+		return;
+		}
+	
+	iPlayerInfoManager->ClientStatus(aControllerPresent, aTargetPresent);
+	}
+
+/**
+Called by RemCon when a client has become available for addressing.  Once this
+call has been made the bearer may use the provided TRemConClientId to address
+incoming commands and notifys to this client until RemCon calls ClientNotAvailable
+with this TRemConClientId.
+
+@param aId A unique identifier for this client, that can be used when addressing 
+incoming commands.
+@param aClientType The basic type of this client
+@param aClientSubType More detailed type information on this client
+@param aName The name of this client in UTF-8.
+*/
+void CRemConBearerAvrcp::ClientAvailable(TRemConClientId& aId, TPlayerType aClientType, TPlayerSubType aClientSubType, const TDesC8& aName)
+	{
+	LOG_FUNC
+
+	if (!iConstructionComplete)
+		{
+		// Object only partially constructed, swallow the request
+		return;
+		}
+	
+	iPlayerInfoManager->ClientAvailable(aId, aClientType, aClientSubType, aName);
+	}
+
+/**
+Called by RemCon when a client is no longer available for addressing.  Once this
+call has been made the bearer shall not use this client id when addressing incoming
+commands and notifys until informed that the client is available again via
+ClientAvailable.
+
+@param aId The client that has ceased to be available.
+*/
+void CRemConBearerAvrcp::ClientNotAvailable(TRemConClientId& aId)
+	{
+	LOG_FUNC
+
+	if (!iConstructionComplete)
+		{
+		// Object only partially constructed, swallow the request
+		return;
+		}
+	
+	iPlayerInfoManager->ClientNotAvailable(aId);
+	}
+
+TInt CRemConBearerAvrcp::SetLocalAddressedClient(TRemConClientId& aId)
+	{
+	LOG_FUNC
+
+	if (!iConstructionComplete)
+		{
+		// Object only partially constructed, swallow the request
+		return KErrNotSupported;
+		}
+	
+	return iPlayerInfoManager->SetLocalAddressedClient(aId);
+	}
+
+void CRemConBearerAvrcp::TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName)
+    {
+    LOG_FUNC
+    
+    if (!iConstructionComplete)
+        {
+        // Object only partially constructed, swallow the request
+        return;
+        }
+    
+    iPlayerInfoManager->TargetFeaturesUpdated(aId, aPlayerType, aPlayerSubType, aName);
+    }
+
+void CRemConBearerAvrcp::ControllerFeaturesUpdated(RArray<TUid>& aSupportedInterfaces)
+	{
+	LOG_FUNC
+	
+	if(!iConstructionComplete)
+		{
+		// Object only partially constructed, swallow the request
+		return;
+		}
+	
+	// This is a best effort attempt at keeping the sdp record accurate.  If we
+	// failed to update it then just live with it.
+	TRAP_IGNORE(iPlayerInfoManager->ControllerFeaturesUpdatedL(aSupportedInterfaces));
+	}
+
+//---------------------------------------------------------------------
+// Data notifications from the command handlers
+//---------------------------------------------------------------------
+
+/** Called from incoming handlers to notify that a command
+is ready for Remcon.
+
+@param aCommand The command that is ready.
+*/
+void CRemConBearerAvrcp::MrcciNewCommand(CAvrcpCommand& aCommand)
+	{
+	LOG_FUNC
+	
+	// Need to put the command on the queue straight
+	// away in case RemCon collects it synchronously
+	iReadyCommands.AddLast(aCommand);
+	aCommand.IncrementUsers();
+	
+	TRemConAddress remAddr;
+	AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr);
+	
+	// Unaddressed variant
+	TInt err =  Observer().NewCommand(remAddr);
+		
+	if(err != KErrNone)
+		{
+		HandleUndeliveredCommand(aCommand, remAddr);
+		}
+	}
+
+/** Called from incoming handlers to notify that a command
+is ready for Remcon.
+
+@param aCommand The command that is ready.
+*/
+void CRemConBearerAvrcp::MrcciNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId)
+	{
+	LOG_FUNC
+	
+	// Need to put the command on the queue straight
+	// away in case RemCon collects it synchronously
+	iReadyCommands.AddLast(aCommand);
+	aCommand.IncrementUsers();
+	
+	TRemConAddress remAddr;
+	AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr);
+	
+	// if this is the null client id then RemCon will address it
+	TInt err =  Observer().NewCommand(remAddr, aClientId);
+		
+	if(err != KErrNone)
+		{
+		HandleUndeliveredCommand(aCommand, remAddr);
+		}
+	}
+
+/** Called from incoming handlers to notify that a notify command
+is ready for Remcon.
+
+@param aCommand The command that is ready.
+*/
+void CRemConBearerAvrcp::MrccciNewNotifyCommand(CAvrcpCommand& aCommand)
+	{
+	LOG_FUNC
+	
+	// Need to put the command on the queue straight
+	// away in case RemCon collects it synchronously
+	iReadyNotifyCommands.AddLast(aCommand);
+	aCommand.IncrementUsers();
+	
+	TRemConAddress remAddr;
+	AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr);
+		
+	// Will be addressed by RemCon
+	TInt err = Observer().NewNotifyCommand(remAddr);
+		
+	if(err != KErrNone)
+		{
+		HandleUndeliveredCommand(aCommand, remAddr);
+		}
+	}
+
+/** Called from incoming handlers to notify that a notify command
+is ready for Remcon.
+
+@param aCommand The command that is ready.
+*/
+void CRemConBearerAvrcp::MrccciNewNotifyCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId)
+	{
+	LOG_FUNC
+	
+	// Need to put the command on the queue straight
+	// away in case RemCon collects it synchronously
+	iReadyNotifyCommands.AddLast(aCommand);
+	aCommand.IncrementUsers();
+	
+	TRemConAddress remAddr;
+	AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr);
+		
+	// if this is the null client id then RemCon will address it
+	TInt err = Observer().NewNotifyCommand(remAddr, aClientId);
+		
+	if(err != KErrNone)
+		{
+		HandleUndeliveredCommand(aCommand, remAddr);
+		}
+	}
+
+
+/** Called from outgoing handlers to notify that a response
+is ready for RemCon.
+
+@param aCommand The response that is ready.
+*/
+void CRemConBearerAvrcp::MrccciNewResponse(CAvrcpCommand& aCommand)
+	{
+	LOG_FUNC
+	
+	// Need to put the response on the queue straight
+	// away in case RemCon collects it synchronously
+	iReadyResponses.AddLast(aCommand);
+	aCommand.IncrementUsers();
+	
+	TRemConAddress remAddr;
+	AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr);
+	TInt err = Observer().NewResponse(remAddr);
+	
+	if(err != KErrNone)
+		{
+		// RemCon is not going to pick this response up
+		aCommand.iReadyLink.Deque();
+		aCommand.DecrementUsers();
+		}
+	}
+
+/** Get a new transaction id for an incoming command.
+
+@return The new command id.
+*/
+TUint CRemConBearerAvrcp::MrcciNewTransactionId()
+	{
+	LOG_FUNC
+	return Observer().NewTransactionId();
+	}
+
+void CRemConBearerAvrcp::MrcciCommandExpired(TUint aTransactionId)
+    {
+    LOG_FUNC
+    Observer().CommandExpired(aTransactionId);
+    }
+
+void CRemConBearerAvrcp::MrccciSetAddressedClient(const TRemConClientId& aClientId)
+	{
+	LOG_FUNC
+	Observer().SetRemoteAddressedClient(TUid::Uid(KRemConBearerAvrcpImplementationUid), aClientId);
+	}
+
+void CRemConBearerAvrcp::MrccciRegisterForLocalAddressedClientUpdates()
+	{
+	// Addressed player observers are registered with RemCon on a per-bearer basis
+	// so we aggregate interest from remote here
+	iRemotesInterestedInLocalAddressedClient++;
+	if(iRemotesInterestedInLocalAddressedClient == 1)
+		{
+		// Weren't any registered before, tell RemCon we care
+		Observer().RegisterLocalAddressedClientObserver(TUid::Uid(KRemConBearerAvrcpImplementationUid));
+		}
+	
+#ifdef __DEBUG
+	TInt numRemotes = 0;
+	CRcpRemoteDevice* remote = NULL;
+	
+	TDblQueIter<CRcpRemoteDevice> iter(iRemotes);
+	while (iter++)
+		{
+		numRemotes++;
+		}
+	__ASSERT_DEBUG(iRemotesInterestedInLocalAddressedClient <= numRemotes, AVRCP_PANIC(ETooManyRemotesRegisterForLocalAddressedPlayerUpdates));
+#endif
+	}
+
+void CRemConBearerAvrcp::MrccciUnregisterForLocalAddressedClientUpdates()
+	{
+#ifdef __DEBUG
+	TInt numRemotes = 0;
+	CRcpRemoteDevice* remote = NULL;
+	
+	TDblQueIter<CRcpRemoteDevice> iter(iRemotes);
+	while (iter++)
+		{
+		numRemotes++;
+		}
+	__ASSERT_DEBUG(iRemotesInterestedInLocalAddressedClient <= numRemotes, AVRCP_PANIC(ETooManyRemotesRegisterForLocalAddressedPlayerUpdates));
+	__ASSERT_DEBUG(iRemotesInterestedInLocalAddressedClient > 0, AVRCP_PANIC(ETooFewRemotesRegisterForLocalAddressedPlayerUpdates));
+#endif
+
+	iRemotesInterestedInLocalAddressedClient--;
+	if(iRemotesInterestedInLocalAddressedClient == 0)
+		{
+		// No-one left who cares.  Tell RemCon not to bother updating
+		// us anymore.
+		Observer().UnregisterLocalAddressedClientObserver(TUid::Uid(KRemConBearerAvrcpImplementationUid));
+		}
+	}
+
+/** Called from outgoing handlers to notify that a response
+for a notify command is ready for RemCon. 
+
+@param aCommand The response that is ready.
+*/
+void CRemConBearerAvrcp::MrccciNewNotifyResponse(CControlCommand& aCommand)
+	{
+	LOG_FUNC
+	
+	// Need to put the response on the queue straight
+	// away in case RemCon collects it synchronously
+	iReadyNotifyResponses.AddLast(aCommand);
+	aCommand.IncrementUsers();
+	
+	TRemConAddress remAddr;
+	AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr);
+	TInt err = Observer().NewNotifyResponse(remAddr);
+	
+	if(err != KErrNone)
+		{
+		// RemCon is not going to pick this response up
+		aCommand.iReadyLink.Deque();
+		aCommand.DecrementUsers();
+		}
+	}
+	
+/** Called by RemCon to send a notify command on a connection. 
+
+@param aInterfaceUid The UID of the outer-layer client API specifying the command.
+@param aOperationId The ID of the command operation in the outer-layer client API.
+@param aId The command identifier used as a cookie for command/response matching, the transaction ID.
+@param aData API-specific message data. On success, ownership is passed. 
+@param aAddr The connection.
+@return Error. This request is synchronous. It returns KErrNone when AVRCP has
+taken responsibility for sending the message. This involves checking that the message
+is well-formed and adding it to the send queue.
+*/
+TInt CRemConBearerAvrcp::SendNotifyCommand(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint aId,  
+		RBuf8& aData, 
+		const TRemConAddress& aAddr)
+	{
+	LOG_FUNC
+	// RemCon retains ownership of the data in aData until
+	// this function returns KErrNone.
+	
+	if (!iConstructionComplete)
+		{
+		// Object only partially constructed, swallow the request
+		return KErrNotSupported;
+		}
+	
+	
+	TBTDevAddr btAddr;
+	TInt err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr);
+
+	if(err == KErrNone)
+		{
+		CRcpRemoteDevice* remote = RemoteDevice(btAddr);
+		__ASSERT_ALWAYS(remote, AVRCP_PANIC(EAvrcpNotConnected));
+		
+		TRAP(err, remote->OutgoingHandler().SendNotifyCommandL(aInterfaceUid, 
+				aOperationId,
+				aId, 
+				aData, 
+				btAddr));
+		}
+
+	return err;
+	}
+
+//---------------------------------------------------------------------
+// Control notifications from the router
+//---------------------------------------------------------------------
+
+/** Called when a connection comes in from a remote.
+
+@param aBTDevice The address of the device initiating the connection.
+*/
+void CRemConBearerAvrcp::ConnectIndicate(const TBTDevAddr& aBTDevice)
+	{
+	LOG_FUNC
+	CRcpRemoteDevice *remote = NULL;
+	// We new up the device here even though we may end up deleting it
+	// later in the function because we need to know if we've successfully
+	// got a remote before we can tell RemCon.  RemCon may optionally
+	// drop the connection in which case we delete remote straight away.
+	TRAPD(devErr, remote = CRcpRemoteDevice::NewL(aBTDevice, *iRouter, *this, Observer(), *iTimer, *iPlayerInfoManager));
+	if(!devErr)
+		{
+		iRemotes.AddLast(*remote);
+		
+		TRemConAddress remoteAddr;
+		AvrcpUtils::BTToRemConAddr(aBTDevice, remoteAddr);
+
+		TInt err = Observer().ConnectIndicate(remoteAddr);
+		if(err)
+			{
+			// We need to drop this connection.  Disconnect and delete
+			// the remote NOW.  When we get the disconnect confirm we
+			// will then know that we shouldn't tell RemCon.
+			remote->Disconnect(ETrue);
+			remote->iLink.Deque();
+			delete remote;
+			
+			err = iRouter->DisconnectRequest(aBTDevice);
+			}
+		}
+	}
+
+/** Called to confirm an outgoing connection.
+
+@param aBTDevice The device the outgoing connection is to.
+@param aError The result of the connection attempt.
+*/	
+void CRemConBearerAvrcp::ConnectConfirm(const TBTDevAddr& aBTDevice, TInt aError)
+	{
+	LOG_FUNC
+	TRemConAddress remoteAddr;
+	AvrcpUtils::BTToRemConAddr(aBTDevice, remoteAddr);
+	
+	if(aError != KErrNone)
+		{
+		CRcpRemoteDevice *remote = RemoteDevice(aBTDevice);
+		if(remote)
+			{
+			// calling disconnect gives the remote the opportunity
+			// to do anything necessary to commands still on its 
+			// queue before we delete it.
+			remote->Disconnect(ETrue);
+			remote->iLink.Deque();
+			delete remote;
+			}
+		}
+
+	Observer().ConnectConfirm(remoteAddr, aError);
+	}
+
+/** Called when a remote disconnects.
+
+@param aBTDevice The address of the remote that has disconnected.
+*/	
+void CRemConBearerAvrcp::DisconnectIndicate(const TBTDevAddr& aBTDevice)
+	{
+	LOG_FUNC
+	TRemConAddress remoteAddr;
+	AvrcpUtils::BTToRemConAddr(aBTDevice, remoteAddr);
+	
+	CRcpRemoteDevice *remote = RemoteDevice(aBTDevice);
+	if(remote)
+		{
+		// calling disconnect gives the remote the opportunity
+		// to do anything necessary to commands still on its 
+		// queue before we delete it.
+		remote->Disconnect(ETrue);
+		remote->iLink.Deque();
+		delete remote;
+		}
+
+	Observer().DisconnectIndicate(remoteAddr);
+	}
+
+/** Called to confirm a locally initiated disconnect.
+
+@param aBTDevice The address of the disconnected remote.
+@param aError The result of the disconnect attempt.
+*/	
+void CRemConBearerAvrcp::DisconnectConfirm(const TBTDevAddr& aBTDevice, TInt aError)
+	{
+	LOG_FUNC
+	TRemConAddress remoteAddr;
+	AvrcpUtils::BTToRemConAddr(aBTDevice, remoteAddr);
+
+	Observer().DisconnectConfirm(remoteAddr, aError);
+	}
+
+/** Called to get a bearer interface.
+
+@param aUid The uid of the desired interface.
+@return An instance of the desired interface, NULL if
+		one could not be found.
+*/	
+TAny* CRemConBearerAvrcp::GetInterface(TUid aUid)
+	{
+	LOG_FUNC
+	
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConBearerInterface1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConBearerInterface*>(this)
+			);
+		}
+	else if ( aUid == TUid::Uid(KRemConBearerInterface2) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConBearerInterfaceV2*>(this)
+			);
+		}
+	else if ( aUid == TUid::Uid(KRemConBearerInterface3) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConBearerInterfaceV3*>(this)
+			);
+		}
+	else if ( aUid == TUid::Uid(KRemConBearerBulkInterface1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConBearerBulkInterface*>(iBulkBearer)
+			);
+		}
+
+	return ret;
+	}
+
+//---------------------------------------------------------------------
+// Utility functions
+//---------------------------------------------------------------------
+
+MIncomingCommandHandler* CRemConBearerAvrcp::IncomingHandler(const TBTDevAddr& aAddr)
+	{
+	CRcpRemoteDevice* remote = RemoteDevice(aAddr);
+	if(remote)
+		{
+		return &remote->IncomingHandler();
+		}
+	else
+		{
+		return NULL;
+		}
+	}
+
+MOutgoingCommandHandler* CRemConBearerAvrcp::OutgoingHandler(const TBTDevAddr& aAddr)
+	{
+	CRcpRemoteDevice* remote = RemoteDevice(aAddr);
+	if(remote)
+		{
+		return &remote->OutgoingHandler();
+		}
+	else
+		{
+		return NULL;
+		}
+	}
+
+/** Utility function to get the CRcpRemoteDevice that
+handles a given BT address.
+
+@param aAddr The address to get the CRcpRemoteDevice for.
+@return A pointer to a remote device, or NULL if not found.
+*/
+CRcpRemoteDevice* CRemConBearerAvrcp::RemoteDevice(const TBTDevAddr& aAddr)
+	{
+	LOG_FUNC
+	
+	CRcpRemoteDevice* remote = NULL;
+	
+	TDblQueIter<CRcpRemoteDevice> iter(iRemotes);
+	while (iter)
+		{
+		remote = iter++;
+		if(remote->RemoteAddress() == aAddr)
+			{
+			break;
+			}
+		remote = NULL;
+		}
+	
+	return remote;
+	}
+
+void CRemConBearerAvrcp::HandleUndeliveredCommand(CAvrcpCommand& aCommand, const TRemConAddress& aAddr)
+	{
+	TUid interfaceUid;
+	TUint remconId, operationId;
+	RBuf8 commandData;
+	TBTDevAddr btAddr;
+	
+	// Calling GetCommandInfo transfers the command data to us. 
+	aCommand.GetCommandInfo(interfaceUid, remconId, operationId, commandData, btAddr);
+	SendReject(interfaceUid, operationId, remconId, aAddr);
+	commandData.Close();
+
+	// RemCon is not going to pick this command up
+	aCommand.iReadyLink.Deque();
+	aCommand.DecrementUsers();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusclient/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconstatusapi.mmp
+
+PRJ_EXPORTS
+remconstatusapicontroller.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconstatusapicontroller.h)
+remconstatusapicontrollerobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconstatusapicontrollerobserver.h)
+
+//
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusclient/remconstatusapi.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,49 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconstatusapi.dll Remote Control status API- an outer-layer client
+// side library providing access to AV/C status commands.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET			remconstatusapi.dll //Recommended unpaged
+TARGETPATH		/system/libs
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID				0x1000008d 0x10207ea5
+VENDORID		0x70000001
+
+SOURCEPATH		.
+SOURCE			statusapicontroller.cpp remconstatusapicontrollerobserver.cpp
+
+USERINCLUDE		../common
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY			euser.lib
+LIBRARY			remconinterfacebase.lib
+
+#include <bluetooth/btlogger.mmh>
+
+//
+// End of file
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusclient/remconstatusapicontroller.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,89 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONSTATUSAPICONTROLLER_H
+#define REMCONSTATUSAPICONTROLLER_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+
+_LIT(KStatusApiPanicName, "Status Api Panic");
+
+class MRemConStatusApiControllerObserver;
+class CRemConInterfaceSelector;
+
+/**
+A controller which sends Status API commands.
+@publishedAll
+@released
+*/
+NONSHARABLE_CLASS(CRemConStatusApiController) : public CRemConInterfaceBase,
+								                public MRemConInterfaceIf
+	{
+private:
+	enum TStatusApiPanic
+		{
+		EStatusApiCommandDataSectionTooLong,
+		};
+
+public:
+	IMPORT_C static CRemConStatusApiController* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConStatusApiControllerObserver& aObserver);
+	IMPORT_C ~CRemConStatusApiController();
+
+	// Commands
+	IMPORT_C void UnitInfo(TRequestStatus& aStatus, TUint& aNumRemotes);
+	IMPORT_C void SubunitInfo(TRequestStatus& aStatus, TUint& aNumRemotes);
+
+private:
+	CRemConStatusApiController(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConStatusApiControllerObserver& aObserver);
+
+	// from CRemConInterfaceBase
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+	TAny* GetInterfaceIf(TUid aUid);
+	
+	// Utility functions
+	void SetUnitInfoResponseData(const TDesC8& aCommandData,
+		TInt& aVendorId, 
+		TInt& aUnit, 
+		TInt& aUnitType, 
+		TInt& aExtendedUnitType);
+		
+	void SetSubunitInfoResponseData(const TDesC8& aCommandData,
+		TInt& aPage, 
+		TInt& aExtension, 
+		TPtrC8& aPageData);
+		
+	void ReadCommandDataToInt(const TDesC8& aCommandData, 
+		TInt aOffset, 
+		TInt aLength, 
+		TInt& aValue);
+		
+	static void Panic(TStatusApiPanic aPanic);
+
+private:
+	MRemConStatusApiControllerObserver& iObserver;
+	RBuf8 iOutData; // There is no command data for any commands in this API
+	};
+
+#endif // REMCONSTATUSAPICONTROLLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusclient/remconstatusapicontrollerobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,32 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <remconstatusapicontrollerobserver.h>
+
+/**
+This virtual function allows the M- class to be extended in future in a binary
+compatible way by providing a method that clients can override in future to
+allow extra callbacks to be made via aObject.
+*/
+EXPORT_C void MRemConStatusApiControllerObserver::Mrcsaco_ExtensionInterfaceL(TUid /*aInterface*/, void*& aObject)
+	{
+	aObject = NULL;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusclient/remconstatusapicontrollerobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,81 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONSTATUSAPICONTROLLEROBSERVER_H
+#define REMCONSTATUSAPICONTROLLEROBSERVER_H
+
+#include <e32std.h>
+
+/**
+Interface to observe responses from a Status API controller.
+@publishedAll
+@released
+*/
+class MRemConStatusApiControllerObserver
+	{
+public:
+	/**	A UnitInfo response has been received. 
+	
+	For details on the meanings on the fields please refer to the 
+	AV/C Digital Interface Command Set General Specification, 
+	section 11.2.1.
+	
+	If all values are zero there was an error with the command.
+	@param aVendorId The VendorId
+	@param aUnit Unit
+	@param aUnitType UnitType
+	@param aExtendedUnitType Extended Unit type. This data is only 
+		valid if Unit type is 0x1e. The second byte is only valid 
+		if the first byte is 0xff.
+	*/
+	virtual void MrcsacoUnitInfoResponse(TInt aVendorId, 
+		TInt aUnit, 
+		TInt aUnitType, 
+		TInt aExtendedUnitType) = 0;
+
+	/** A SubunitInfo response has been received. 
+	
+	For details on the meanings on the fields please
+	refer to the AV/C Digital Interface Command Set
+	General Specification, section 11.2.2.
+	
+	If all values are zero there was an error with the command.
+	@param aPage Page
+	@param aExtension Extension.
+	@param aPageData Page Data. This data remains valid only for
+		the duration of this call.  If the client wishes to store
+		the data it must be copied.
+	*/
+	virtual void MrcsacoSubunitInfoResponse(TInt aPage,
+		TInt aExtension,
+		TDesC8& aPageData) = 0;
+		
+	/**
+ 	 Returns a null aObject if the extension is not implemented, or 
+ 	 a pointer to another interface if it is.
+ 	 
+	 @param aInterface UID of the interface to return
+	 @param aObject the container for another interface as specified by aInterface
+	 */
+	IMPORT_C virtual void Mrcsaco_ExtensionInterfaceL(TUid aInterface, void*& aObject);
+	};
+
+#endif // REMCONSTATUSAPICONTROLLEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusclient/statusapicontroller.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,259 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#include <bluetooth/logger.h>
+#include <remconstatusapicontroller.h>
+#include <remconstatusapicontrollerobserver.h>
+#include <remconinterfaceselector.h>
+#include "remconstatusapi.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_STATUS);
+#endif
+
+/** Creates new Status Api Controller.
+
+@param aInterfaceSelector An interface selector for use with this interface.
+@param aObserver An observer to be notified of responses to commands issued
+				to this interface.
+@return A fully constructed CRemConStatusApiController
+*/
+EXPORT_C CRemConStatusApiController* CRemConStatusApiController::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+											  MRemConStatusApiControllerObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConStatusApiController* self = new(ELeave) CRemConStatusApiController(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->BaseConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+/** Constructs this interface.
+
+@param aInterfaceSelector An interface selector for use with this interface.
+@param aObserver An observer to be notified of responses to commands issued
+				to this interface.
+@internalComponent
+@released
+*/
+CRemConStatusApiController::CRemConStatusApiController(CRemConInterfaceSelector& aInterfaceSelector, 
+							   MRemConStatusApiControllerObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConStatusApiUid), 
+						 KRemConStatusApiMaxOperationSpecificDataSize, 
+						 aInterfaceSelector,
+						 ERemConClientTypeController),
+	iObserver(aObserver)
+	{
+	iOutData.Assign(NULL);
+	}
+
+/** Destructor.
+*/
+EXPORT_C CRemConStatusApiController::~CRemConStatusApiController()
+	{
+	}
+
+/** Gets a pointer to a specific interface version.
+
+@return A pointer to the interface, NULL if not supported.
+@internalComponent
+@released
+*/
+TAny* CRemConStatusApiController::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+/** New message from RemCon.
+
+@internalComponent
+@released
+*/
+void CRemConStatusApiController::MrcibNewMessage(TUint aOperationId, const TDesC8& aData)
+	{
+	LOG_FUNC
+
+	switch ( aOperationId )
+		{
+	case ERemConStatusApiUnitInfo:
+		{
+		TInt vendorId, unit, unitType, extendedUnitType;
+		SetUnitInfoResponseData(aData, vendorId, unit, unitType, extendedUnitType);
+		
+		iObserver.MrcsacoUnitInfoResponse(vendorId, unit, unitType, extendedUnitType);
+		break;
+		}
+	case ERemConStatusApiSubunitInfo:
+		{
+		TInt page, extension;
+		TPtrC8 pageData;
+		SetSubunitInfoResponseData(aData, page, extension, pageData);
+		
+		iObserver.MrcsacoSubunitInfoResponse(page, extension, pageData);
+		break;
+		}
+	default:
+		break;
+		}
+	}
+
+/** Parses command data from the buffer.
+
+@param aCommandData The buffer from which to read the data.
+@param aVendorId On return, the vendor id
+@param aUnit On return, the unit
+@param aUnitType On return, the unit type 
+@param aExtendedUnitType On return, the extended unit type
+
+@internalComponent
+@released
+*/
+void CRemConStatusApiController::SetUnitInfoResponseData(const TDesC8& aCommandData,
+	TInt& aVendorId, TInt& aUnit, TInt& aUnitType, TInt& aExtendedUnitType)
+	{
+	if(aCommandData.Length())
+		{
+		ReadCommandDataToInt(aCommandData, KRemConStatusApiVendorIdOffset, 
+			KRemConStatusApiVendorIdLength, aVendorId);
+		ReadCommandDataToInt(aCommandData, KRemConStatusApiUnitOffset, 
+			KRemConStatusApiUnitLength, aUnit);
+		ReadCommandDataToInt(aCommandData, KRemConStatusApiUnitTypeOffset, 
+			KRemConStatusApiUnitTypeLength, aUnitType);
+		ReadCommandDataToInt(aCommandData, KRemConStatusApiExtendedUnitTypeOffset, 
+			KRemConStatusApiExtendedUnitTypeLength, aExtendedUnitType);
+		}
+	else
+		{
+		// On error set all fields to 0
+		aVendorId = aUnit = aUnitType = aExtendedUnitType = 0;
+		}
+	}
+
+/** Parses command data from the buffer.
+
+@param aCommandData The buffer from which to read the data.
+@param aPage On return, the page
+@param aExtension On return, the extension
+@param aPageData On return, the page data
+
+@internalComponent
+@released
+*/
+void CRemConStatusApiController::SetSubunitInfoResponseData(const TDesC8& aCommandData,
+	TInt& aPage, TInt& aExtension, TPtrC8& aPageData)
+	{
+	if(aCommandData.Length())
+		{
+		ReadCommandDataToInt(aCommandData, KRemConStatusApiPageOffset, 
+			KRemConStatusApiPageLength, aPage);
+		ReadCommandDataToInt(aCommandData, KRemConStatusApiExtensionOffset, 
+			KRemConStatusApiExtensionLength, aExtension);
+
+		aPageData.Set(aCommandData.Mid(KRemConStatusApiPageDataOffset));
+		}
+	else
+		{
+		// On error set all fields to 0
+		aPage = aExtension = 0;
+		aPageData.Set(KNullDesC8());
+		}
+	}
+	
+/** Reads command data from the buffer to an int.
+
+@param aCommandData The buffer from which to read the data.
+@param aOffset The offset within aCommandData read from.
+@param aLength The length of data to read.  This must not be
+				more than 4.
+@param aValue On return, the value of the specified data section.
+
+@internalComponent
+@released
+*/	
+void CRemConStatusApiController::ReadCommandDataToInt(const TDesC8& aCommandData, 
+	TInt aOffset, TInt aLength, TInt& aValue)
+	{
+	__ASSERT_ALWAYS(aLength <= 4, CRemConStatusApiController::Panic(EStatusApiCommandDataSectionTooLong));
+	
+	aValue = 0;
+	
+	for(TInt i = 0 ; i < aLength; i++)
+		{
+		aValue |= aCommandData[i+aOffset]<<(8*i);
+		}
+	}
+
+/** Issue UnitInfo command.
+Only one command per controller session can be outstanding at any one time.
+@param aStatus Status to be completed with the result of issuing this command.
+@param aNumRemotes On completion, the number of remotes this command was issued to.
+*/
+EXPORT_C void CRemConStatusApiController::UnitInfo(TRequestStatus& aStatus, TUint& aNumRemotes)
+	{
+	LOG_FUNC
+
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConStatusApiUid),
+		(TUint)ERemConStatusApiUnitInfo, 
+		aNumRemotes,
+		ERemConCommand,
+		iOutData);
+	}
+
+/** Issue SubUnitInfo command.
+Only one command per controller session can be outstanding at any one time.
+@param aStatus Status to be completed with the result of issuing this command.
+@param aNumRemotes On completion, the number of remotes this command was issued to.
+*/
+EXPORT_C void CRemConStatusApiController::SubunitInfo(TRequestStatus& aStatus, TUint& aNumRemotes)
+	{
+	LOG_FUNC
+
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConStatusApiUid), 
+		(TUint)ERemConStatusApiSubunitInfo, 
+		aNumRemotes,
+		ERemConCommand);
+	}
+	
+/** Utility Status Converter panic function.
+
+@param aPanic The panic number.
+@internalComponent
+@released
+*/
+void CRemConStatusApiController::Panic(TStatusApiPanic aPanic)
+	{
+	User::Panic(KStatusApiPanicName, aPanic);
+	}
+
+//
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusconverter/10207ea3.rss	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x10207ea3;
+	interfaces =
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x10205C43;
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x10207ea4;
+					version_no = 1;
+					display_name = "RemConAvrcpStatusConverter";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
+
+//
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusconverter/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,25 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconavrcpstatusconverter.mmp
+
+//
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusconverter/remconavrcpstatusconverter.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,551 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+ @released
+*/
+
+#include <avcframe.h>
+#include <remconbeareravrcp.h>
+
+#include "remconstatusapi.h"
+#include "remconavrcpstatusconverter.h"
+
+/** Factory function.
+
+@return Ownership of a new CRemConAvrcpStatusConverter.
+*/
+CRemConAvrcpStatusConverter* CRemConAvrcpStatusConverter::NewL()
+	{
+	CRemConAvrcpStatusConverter* self = new(ELeave) CRemConAvrcpStatusConverter;
+	return self;
+	}
+
+/** Destructor.
+*/
+CRemConAvrcpStatusConverter::~CRemConAvrcpStatusConverter()
+	{
+	}
+
+/** Constructor.
+*/
+CRemConAvrcpStatusConverter::CRemConAvrcpStatusConverter()
+	{
+	}
+
+/** Called to get a converter interface.
+
+@param aUid The uid of the desired interface.
+@return An instance of the desired interface, NULL if
+		one could not be found.
+*/
+TAny* CRemConAvrcpStatusConverter::GetInterface(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConConverterInterface1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConConverterInterface*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+/** Decides whether this converter supports this interface.
+
+This converter supports only the AVRCP bearer and Status API.
+This function checks whether the Uids provided match AVRCP and
+Status.
+
+@param aInterfaceData The Uid of the originating RemCon interface.
+@param aBearerUid The Uid of the bearer this data is destined for.
+@return Whether this data can be converted.	
+*/
+TBool CRemConAvrcpStatusConverter::SupportedUids(const TUid& aInterfaceUid, const TUid& aBearerUid) const
+	{
+	return (aInterfaceUid == TUid::Uid(KRemConStatusApiUid) &&
+	   aBearerUid == TUid::Uid(KRemConBearerAvrcpImplementationUid));
+	}
+
+/** Decides whether this converter supports this interface.
+
+This converter supports only the AVRCP bearer.  That bearer publishes
+interface data in the format of an AV/C frame.  This function 
+checks that aBearerUid is that of AVRCP, and if so examines the AV/C
+frame in aInterfaceData to see if it is a supported command.
+
+@param aInterfaceData Data in the format of the bearer identified by
+					  aBearerUid.  
+@param aBearerUid The Uid of the bearer this data originates from.
+@return Whether this data can be converted.
+*/	
+TBool CRemConAvrcpStatusConverter::SupportedInterface(const TDesC8& aInterfaceData, const TUid& aBearerUid) const
+	{
+	TInt supported = EFalse;
+	if(aBearerUid == TUid::Uid(KRemConBearerAvrcpImplementationUid))
+		{
+		AVC::TOpcode opcode = AVC::EPower; // arbitrary initialisation to avoid compiler warning
+		TRAPD(err, opcode = CAVCFrame::OpcodeL(aInterfaceData));
+		
+		if (		err == KErrNone
+			&&		( opcode == AVC::EUnitInfo || opcode == AVC::ESubunitInfo )
+			)
+			{
+			supported = ETrue;
+			}
+		}
+		
+	return supported;
+	}
+
+/** Convert data from the API's form (as we're given it by RemCon) to 
+bearer-specific form.
+
+We only deal with the AVRCP bearer.  This requires us to produce a
+CAVCFrame.
+
+The supported commands are Unit Info and Subunit Info.
+
+@param aInterfaceUid The Uid of the originating RemCon interface.
+@param aOperationId The id of the operation within the interface.
+@param aData Data in the format defined by the RemCon interface.
+@param aMsgType Whether this is a command or response.
+@param aBearerData On return, an AV/C frame representing the operation.
+*/
+TInt CRemConAvrcpStatusConverter::InterfaceToBearer(TUid aInterfaceUid, 
+		TUint aOperationId,
+		const TDesC8& /*aData*/,
+		TRemConMessageType aMsgType, 
+		TDes8& aBearerData) const
+	{
+	__ASSERT_ALWAYS(aInterfaceUid.iUid == KRemConStatusApiUid, CRemConAvrcpStatusConverter::Panic(EStatusConverterWrongInterface));
+	TInt err = KErrCorrupt;
+	
+	switch(aOperationId)
+		{
+		case ERemConStatusApiUnitInfo:
+			{
+			if(aMsgType == ERemConCommand)
+				{
+				CAVCFrame* frame = NULL;
+				TRAP(err, frame = UnitInfoL());
+				if(!err)
+					{
+					aBearerData = frame->Data();
+					err = KErrNone;
+					delete frame;
+					}
+				}
+			else if(aMsgType == ERemConResponse)
+				{
+				// These should be generated within the bearer
+				// as it knows the manufacturer id
+				err = KErrNotSupported;
+				}
+			break;
+			}
+		case ERemConStatusApiSubunitInfo:
+			{
+			if(aMsgType == ERemConCommand)
+				{
+				CAVCFrame* frame = NULL;
+				TRAP(err, frame = SubunitInfoL());
+				if(!err)
+					{
+					aBearerData = frame->Data();
+					err = KErrNone;
+					delete frame;
+					}
+				}
+			else if(aMsgType == ERemConResponse)
+				{
+				// These should be generated within the bearer
+				// as it knows the manufacturer id
+				err = KErrNotSupported;
+				}
+			break;
+			}
+		default:
+			{
+			err = KErrNotSupported;
+			break;
+			}
+		}
+
+	return err;
+	}
+
+/** Produce a Unit Info AV/C frame.
+
+@return A new AV/C frame representing unit info.
+@leave System wide error.
+*/
+CAVCFrame* CRemConAvrcpStatusConverter::UnitInfoL()
+	{
+	CAVCFrame* frame = CAVCFrame::NewL(AVC::ECommand, AVC::EStatus, AVC::EUnit, AVC::EIgnore);
+	frame->Append(TChar(AVC::EUnitInfo));
+	frame->Append(TChar(0xff));
+	frame->Append(TChar(0xff));
+	frame->Append(TChar(0xff));
+	frame->Append(TChar(0xff));
+	frame->Append(TChar(0xff));
+	return frame;
+	}
+
+/** Produce a Subunit Info AV/C frame.
+
+@return A new AV/C frame representing subunit info.
+@leave System wide error.
+*/	
+CAVCFrame* CRemConAvrcpStatusConverter::SubunitInfoL()
+	{
+	CAVCFrame* frame = CAVCFrame::NewL(AVC::ECommand, AVC::EStatus, AVC::EUnit, AVC::EIgnore);
+	frame->Append(TChar(AVC::ESubunitInfo));
+	frame->Append(TChar(0x7));
+	frame->Append(TChar(0xff));
+	frame->Append(TChar(0xff));
+	frame->Append(TChar(0xff));
+	frame->Append(TChar(0xff));
+	return frame;
+	}
+
+/** Convert data from the bearer format to RemCon interface format.
+
+We only deal with the Status Api. The supported commands are Unit 
+Info response and Subunit Info response.
+
+Support of these commands is mandatory in the targets.  In the case
+where a remote sends us something rubbish, we'll just provide our
+client with the default info.
+
+@param aBearerData An AV/C frame to convert.
+@param aInterfaceUid On return, the Uid of the RemCon interface.
+@param aOperationId On return, the id of the operation within the 
+					interface.
+@param aMsgType Whether this is a command or response.
+@param aData On return, Data in the format defined by the RemCon interface.
+@return Whether the command was successfully converted.
+*/
+TInt CRemConAvrcpStatusConverter::BearerToInterface(const TDesC8& aBearerData,
+		TUid& aInterfaceUid, 
+		TUint& aOperationId,
+		TRemConMessageType& aMsgType, 
+		TDes8& aData) const
+	{
+	TInt err = KErrCorrupt;
+	
+	switch(aOperationId)
+		{
+		case ERemConStatusApiUnitInfo:
+			{
+			if(aMsgType == ERemConCommand)
+				{
+				// These should be generated within the bearer
+				// as it knows the manufacturer id
+				err = KErrNotSupported;
+				}
+			else if(aMsgType == ERemConResponse)
+				{
+				// We try to parse the data, but if what the remote's sent
+				// us is invalid we'll fill in sensible values later
+				TRAP(err, SetUnitInfoResponseDataL(aBearerData, aData));
+				aInterfaceUid = TUid::Uid(KRemConStatusApiUid);
+				aOperationId = ERemConStatusApiUnitInfo;
+
+				if(err == KErrCorrupt)
+					{
+					// The data is set to the correct length in SetUnitInfoResponseDataL
+					// Stick some default data in there 
+					SetCommandDataFromInt(aData, KRemConStatusApiUnitOffset, 
+						KRemConStatusApiUnitLength, AVC::EID0);
+
+					SetCommandDataFromInt(aData, KRemConStatusApiUnitTypeOffset, 
+						KRemConStatusApiUnitTypeLength, AVC::EPanel);
+				
+					SetCommandDataFromInt(aData, KRemConStatusApiExtendedUnitTypeOffset, 
+						KRemConStatusApiExtendedUnitTypeLength, 0);		
+							
+					SetCommandDataFromInt(aData, KRemConStatusApiVendorIdOffset, 
+						KRemConStatusApiVendorIdLength, KRemConStatusApiDefaultVendorId);
+
+					err = KErrNone;
+					}
+				}
+			break;
+			}
+		case ERemConStatusApiSubunitInfo:
+			{
+			if(aMsgType == ERemConCommand)
+				{
+				// These should be generated within the bearer
+				// as it knows the manufacturer id
+				err = KErrNotSupported;
+				}
+			else if(aMsgType == ERemConResponse)
+				{
+				// We try to parse the data, but if what the remote's sent
+				// us is invalid we'll fill in sensible values later
+				TRAP(err, SetSubunitInfoResponseDataL(aBearerData, aData));
+				aInterfaceUid = TUid::Uid(KRemConStatusApiUid);
+				aOperationId = ERemConStatusApiSubunitInfo;
+
+				if(err == KErrCorrupt)
+					{
+					// Subunit response data varies in length, so the length
+					// set in SetSubunitInfoResponseDataL may be wrong.
+					aData.FillZ(KRemConStatusApiPageLength + KRemConStatusApiExtensionLength + KRemConStatusApiDefaultPageDataLength);
+				
+					// Stick some default data in there 
+					SetCommandDataFromInt(aData, KRemConStatusApiPageOffset, 
+						KRemConStatusApiPageLength, 0);	
+						
+					SetCommandDataFromInt(aData, KRemConStatusApiExtensionOffset, 
+						KRemConStatusApiExtensionLength, AVC::EIgnore);	
+
+					SetCommandDataFromInt(aData, KRemConStatusApiPageDataOffset, 
+						KRemConStatusApiDefaultPageDataLength, KRemConStatusApiDefaultPageData);	
+
+					err = KErrNone;
+					}
+				}
+			break;
+			}
+		default:
+			{
+			err = KErrNotSupported;
+			break;
+			}
+		}
+
+	return err;
+	}
+	
+/** Parses command data from the buffer.
+
+@param aCommandData The buffer from which to read the data.
+@param aVendorId On return, the vendor id
+@param aUnit On return, the unit
+@param aUnitType On return, the unit type 
+@param aExtendedUnitType On return, the extended unit type
+
+@internalComponent
+@released
+*/
+void CRemConAvrcpStatusConverter::SetUnitInfoResponseDataL(const TDesC8& aBearerData,
+	TDes8& aRemConData)
+	{
+	// AVRCP should pass us a sensible sized buffer!
+	__ASSERT_ALWAYS(aRemConData.MaxLength() >= KUnitInfoResponseLength, CRemConAvrcpStatusConverter::Panic(EAvrcpPassedTooSmallABuffer));
+
+	// Get rid of any junk
+	aRemConData.FillZ(KRemConStatusApiUnitLength + KRemConStatusApiUnitTypeLength
+					  + KRemConStatusApiExtendedUnitTypeLength
+					  + KRemConStatusApiVendorIdLength);
+
+	// Get unit id if there's enough data for it
+	if(aBearerData.Length() < KUnitIdOffset + KUnitIdLength)
+		{
+		User::Leave(KErrCorrupt);
+		}
+	TInt unit;
+	ReadCommandDataToInt(aBearerData, KUnitIdOffset, KUnitIdLength, unit);
+	unit &= KAVCSubunitIDMask;
+	SetCommandDataFromInt(aRemConData, KRemConStatusApiUnitOffset, 
+		KRemConStatusApiUnitLength, unit);
+	
+	// Get unit type (maybe extended) if there's enough data
+	if(aBearerData.Length() < KUnitTypeOffset + KUnitTypeLength)
+		{
+		User::Leave(KErrCorrupt);
+		}
+	TInt unitType;
+	ReadCommandDataToInt(aBearerData, KUnitTypeOffset, KUnitTypeLength, unitType);
+	unitType &= KAVCSubunitTypeMask;
+	unitType >>= KUnitTypeShift;
+	SetCommandDataFromInt(aRemConData, KRemConStatusApiUnitTypeOffset, 
+		KRemConStatusApiUnitTypeLength, unitType);
+	
+	TInt unitTypeExtend = 0;
+	TInt vendorIdOffset = KVendorIdBaseOffset;
+	if(unitType == KUnitTypeExtend)
+		{
+		// Extended unit type.  VendorId is offset by 1
+		vendorIdOffset++;
+		
+		// Read the next byte if it's there
+		if(aBearerData.Length() < KUnitTypeExtendOffset + 1)
+			{
+			User::Leave(KErrCorrupt);
+			}
+		ReadCommandDataToInt(aBearerData, KUnitTypeExtendOffset, 1, unitTypeExtend);
+		unitTypeExtend <<= 8;
+		
+		// 	Double extended unit type. 
+		if(unitTypeExtend == KUnitTypeExtendExtend)
+			{
+			// VendorId is offset by 1
+			vendorIdOffset++;
+			
+			// Read the next byte
+			TInt unitTypeExtendExtend = 0;
+			if(aBearerData.Length() < KUnitTypeExtendExtendOffset + 1)
+				{
+				User::Leave(KErrCorrupt);
+				}
+			ReadCommandDataToInt(aBearerData, KUnitTypeExtendExtendOffset, 1, 
+								 unitTypeExtendExtend);	
+			unitTypeExtend |= unitTypeExtendExtend;
+			}
+
+		SetCommandDataFromInt(aRemConData, KRemConStatusApiExtendedUnitTypeOffset, 
+			KRemConStatusApiExtendedUnitTypeLength, unitTypeExtend);
+		}		
+
+	// Get vendor id
+	if(aBearerData.Length() < vendorIdOffset + KVendorIdLength)
+		{
+		User::Leave(KErrCorrupt);
+		}
+	TInt vendorId;
+	ReadCommandDataToInt(aBearerData, vendorIdOffset, KVendorIdLength, vendorId);				
+	SetCommandDataFromInt(aRemConData, KRemConStatusApiVendorIdOffset, 
+		KRemConStatusApiVendorIdLength, vendorId);
+	}
+
+/** Parses command data from the buffer.
+
+@param aCommandData The buffer from which to read the data.
+@param aPage On return, the page
+@param aExtension On return, the extension
+@param aPageData On return, the page data
+
+@internalComponent
+@released
+*/
+void CRemConAvrcpStatusConverter::SetSubunitInfoResponseDataL(const TDesC8& aBearerData,
+	TDes8& aRemConData)
+	{
+	// AVRCP should pass us a sensible sized buffer!
+	__ASSERT_ALWAYS(aRemConData.MaxLength() >= KUnitInfoResponseLength, CRemConAvrcpStatusConverter::Panic(EAvrcpPassedTooSmallABuffer));
+
+	CAVCFrame* frame = CAVCFrame::NewL(aBearerData, AVC::EResponse); //Qualified
+	CleanupStack::PushL(frame);		
+	TPtrC8 ptr = frame->Data();
+	
+	// Work out how long a buffer we need for the RemCon data.
+	// This is KRemConStatusApiPageLength + KRemConStatusApiExtensionLength
+	// + the length of the page data.
+	// We can work out the length of the page data from the frame - 
+	// it's the remainder of the frame after KSubunitPageDataOffset.
+	// This gives us:
+	TInt remConDataLen = KRemConStatusApiPageLength 
+						+ KRemConStatusApiPageLength 
+						+ (ptr.Length() - KSubunitPageDataOffset);
+
+	if(aRemConData.MaxLength() < remConDataLen)
+		{
+		User::Leave(KErrCorrupt);
+		}
+
+	// Get rid of any junk
+	aRemConData.FillZ(remConDataLen);
+	
+	// Get page
+	if(aBearerData.Length() < KSubunitPageOffset + KSubunitPageLength)
+		{
+		User::Leave(KErrCorrupt);
+		}
+	TInt page;
+	ReadCommandDataToInt(aBearerData, KSubunitPageOffset, KSubunitPageLength, page);
+	page &= KSubunitPageMask;
+	SetCommandDataFromInt(aRemConData, KRemConStatusApiPageOffset, 
+		KRemConStatusApiPageLength, page);	
+		
+	// Get extension code
+	if(aBearerData.Length() < KSubunitExtensionOffset + KSubunitExtensionLength)
+		{
+		User::Leave(KErrCorrupt);
+		}
+	TInt extensionCode;
+	ReadCommandDataToInt(aBearerData, KSubunitExtensionOffset, KSubunitExtensionLength, 
+		extensionCode);
+	extensionCode &= KSubunitExtensionMask;
+	SetCommandDataFromInt(aRemConData, KRemConStatusApiExtensionOffset, 
+		KRemConStatusApiExtensionLength, extensionCode);		
+		
+	// Get page data
+	TPtrC8 pageDataPtr = aBearerData.Mid(KSubunitPageDataOffset);
+	aRemConData.Replace(KRemConStatusApiPageDataOffset, pageDataPtr.Length(), pageDataPtr);
+	
+	CleanupStack::PopAndDestroy(frame);	
+	}
+	
+/** Reads command data from the buffer to an int.
+
+@param aCommandData The buffer from which to read the data.
+@param aOffset The offset within aCommandData read from.
+@param aLength The length of data to read.  This must not be
+				more than 4.
+@param aValue On return, the value of the specified data section.
+
+@internalComponent
+@released
+*/	
+void CRemConAvrcpStatusConverter::ReadCommandDataToInt(const TDesC8& aCommandData, 
+	TInt aOffset, TInt aLength, TInt& aValue)
+	{
+	__ASSERT_DEBUG(aLength <= 4, CRemConAvrcpStatusConverter::Panic(EStatusConverterDataTooShort));
+
+	aValue = 0;
+	
+	for(TInt i = 0 ; i < aLength; i++)
+		{
+		aValue |= aCommandData[aOffset+i]<<(8*i);
+		}
+	}
+	
+/** Set the command data.  This overwrites the current
+contents of the data buffer.
+
+@param aCommandData The buffer in which to set the data.
+@param aOffset The offset within aCommandData to set the data.
+@param aLength The length of data to replace.
+@param aValue The new value for the replaced data.
+*/
+void CRemConAvrcpStatusConverter::SetCommandDataFromInt(TDes8& aCommandData, 
+	TInt aOffset, TInt aLength, TInt aValue)
+	{
+	__ASSERT_DEBUG(aLength <= 4, CRemConAvrcpStatusConverter::Panic(EStatusConverterDataTooShort));
+	
+	for(TInt i = 0; i < aLength; i++)
+		{
+		aCommandData[aOffset+i] = aValue >> (8*i);
+		}
+	}
+
+/** Utility Status Converter panic function.
+
+@param aPanic The panic number.
+*/
+void CRemConAvrcpStatusConverter::Panic(TStatusConverterPanic aPanic)
+	{
+	User::Panic(KStatusConverterPanicName, aPanic);
+	}
+
+//
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusconverter/remconavrcpstatusconverter.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,114 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCONAVRCPSTATUSCONVERTER_H
+#define REMCONAVRCPSTATUSCONVERTER_H
+
+#include <e32base.h>
+#include <remcon/remconconverterinterface.h>
+#include <remcon/remconconverterplugin.h>
+
+// These values are in bytes
+const TUint KUnitIdOffset = 4;
+const TUint KUnitIdLength = 1;
+const TUint KUnitTypeOffset = 4;
+const TUint KUnitTypeLength =1;
+const TUint KUnitTypeExtendOffset = 5;
+const TUint KUnitTypeExtendExtendOffset = 6;
+const TUint KVendorIdBaseOffset = 5;
+const TUint KVendorIdLength = 3;
+const TUint KUnitInfoResponseLength = 8;
+const TUint KRemConStatusApiDefaultPageDataLength = 4;
+
+const TUint KSubunitPageOffset = 3;
+const TUint KSubunitPageLength = 1;
+const TUint KSubunitExtensionOffset = 3;
+const TUint KSubunitExtensionLength = 1;
+const TUint KSubunitPageDataOffset = 4;
+
+// These values are in bits
+const TUint KUnitTypeShift = 3;
+
+// Defined values for comparison
+const TUint KUnitTypeExtend = 0x1e;
+const TUint KUnitTypeExtendExtend = 0xff;
+const TUint KSubunitPageMask = 0xf8;
+const TUint KSubunitExtensionMask = 0x7;
+
+const TUint KRemConStatusApiDefaultVendorId = 0xffffff;
+const TUint KRemConStatusApiDefaultPageData = 0xffffff48;
+
+_LIT(KStatusConverterPanicName, "Stat Conv Panic");
+
+enum TStatusConverterPanic
+	{
+	EStatusConverterWrongInterface = 0,
+	EStatusConverterDataTooShort = 1,
+	EAvrcpPassedTooSmallABuffer = 2,
+	};
+
+class CAVCFrame;
+NONSHARABLE_CLASS(CRemConAvrcpStatusConverter) : public CRemConConverterPlugin, public MRemConConverterInterface
+	{
+public:
+	static CRemConAvrcpStatusConverter* NewL();
+	~CRemConAvrcpStatusConverter();
+
+private: // from CRemConConverterPlugin
+	TAny* GetInterface(TUid aUid);
+
+	// from MRemConConverterInterface
+	TInt InterfaceToBearer(TUid aInterfaceUid, 
+		TUint aOperationId,
+		const TDesC8& aData,
+		TRemConMessageType aMsgType, 
+		TDes8& aBearerData) const;
+	
+	TInt BearerToInterface(const TDesC8& aBearerData,
+		TUid& aInterfaceUid, 
+		TUint& aOperationId,
+		TRemConMessageType& aMsgType, 
+		TDes8& aData) const;
+
+	TBool SupportedUids(const TUid& aInterfaceUid, 
+		const TUid& aBearerUid) const;
+	TBool SupportedInterface(const TDesC8& aInterfaceData, 
+		const TUid& aBearerUid) const;
+
+private:
+	CRemConAvrcpStatusConverter();
+	
+	static CAVCFrame* UnitInfoL();
+	static CAVCFrame* SubunitInfoL();
+	
+	static void SetUnitInfoResponseDataL(const TDesC8& aBearerData,
+		TDes8& aRemConData);
+	static void SetSubunitInfoResponseDataL(const TDesC8& aBearerData, 
+		TDes8& aRemConData);
+	
+	static void ReadCommandDataToInt(const TDesC8& aCommandData, 
+		TInt aOffset, TInt aLength, TInt& aValue);
+	static void SetCommandDataFromInt(TDes8& aCommandData, 
+		TInt aOffset, TInt aLength, TInt aValue);
+	
+	static void Panic(TStatusConverterPanic aPanic);
+	};
+
+#endif // REMCONAVRCPSTATUSCONVERTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusconverter/remconavrcpstatusconverter.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,56 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconavrcpstatusconverter.dll Converter between RemCon Avrcp Status API and 
+// AVRCP bearer.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconservercaps.mmh>
+
+TARGET			remconavrcpstatusconverter.dll //Recommended unpaged
+TARGETPATH		/system/libs
+TARGETTYPE		PLUGIN
+// UID2 = 0x10009d8d for ECOM plugins.
+// UID3 = the 'DLL UID' (see resource file)
+UID				0x10009d8d 0x10207ea3
+VENDORID		0x70000001
+
+SOURCEPATH		.
+SOURCE			remconavrcpstatusconverter.cpp
+SOURCE			remconavrcpstatusconvertermain.cpp
+
+START RESOURCE 10207ea3.rss
+target remconavrcpstatusconverter.rsc
+END
+
+USERINCLUDE		.
+USERINCLUDE		../common
+
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY			euser.lib 
+LIBRARY			remconconverterplugin.lib 
+LIBRARY			avc.lib
+
+NOEXPORTLIBRARY
+
+//
+// End of file
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/avrcp/statusconverter/remconavrcpstatusconvertermain.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,38 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <ecom/implementationproxy.h>
+#include "remconavrcpstatusconverter.h"
+
+// Define the private interface UIDs
+const TImplementationProxy ImplementationTable[] =
+	{
+	IMPLEMENTATION_PROXY_ENTRY(0x10207ea4, CRemConAvrcpStatusConverter::NewL),
+	};
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
+
+//
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/bwins/remconbearerpluginU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,36 @@
+EXPORTS
+	??0CRemConBearerPlugin@@IAE@AAVTBearerParams@@@Z @ 1 NONAME ; CRemConBearerPlugin::CRemConBearerPlugin(class TBearerParams &)
+	??0TBearerParams@@QAE@VTUid@@AAVMRemConBearerObserver@@@Z @ 2 NONAME ; TBearerParams::TBearerParams(class TUid, class MRemConBearerObserver &)
+	??1CRemConBearerPlugin@@UAE@XZ @ 3 NONAME ; CRemConBearerPlugin::~CRemConBearerPlugin(void)
+	??1TBearerParams@@QAE@XZ @ 4 NONAME ; TBearerParams::~TBearerParams(void)
+	?BearerToInterface@MRemConBearerObserver@@QBEHVTUid@@ABVTDesC8@@1AAV2@AAIAAW4TRemConMessageType@@AAVTDes8@@@Z @ 5 NONAME ; int MRemConBearerObserver::BearerToInterface(class TUid, class TDesC8 const &, class TDesC8 const &, class TUid &, unsigned int &, enum TRemConMessageType &, class TDes8 &) const
+	?ConnectConfirm@MRemConBearerObserver@@QAEHABVTRemConAddress@@H@Z @ 6 NONAME ; int MRemConBearerObserver::ConnectConfirm(class TRemConAddress const &, int)
+	?ConnectIndicate@MRemConBearerObserver@@QAEHABVTRemConAddress@@@Z @ 7 NONAME ; int MRemConBearerObserver::ConnectIndicate(class TRemConAddress const &)
+	?DisconnectConfirm@MRemConBearerObserver@@QAEXABVTRemConAddress@@H@Z @ 8 NONAME ; void MRemConBearerObserver::DisconnectConfirm(class TRemConAddress const &, int)
+	?DisconnectIndicate@MRemConBearerObserver@@QAEXABVTRemConAddress@@@Z @ 9 NONAME ; void MRemConBearerObserver::DisconnectIndicate(class TRemConAddress const &)
+	?ImplementationUid@TBearerParams@@QBE?AVTUid@@XZ @ 10 NONAME ; class TUid TBearerParams::ImplementationUid(void) const
+	?InterfaceToBearer@MRemConBearerObserver@@QBEHVTUid@@0IABVTDesC8@@W4TRemConMessageType@@AAVTDes8@@@Z @ 11 NONAME ; int MRemConBearerObserver::InterfaceToBearer(class TUid, class TUid, unsigned int, class TDesC8 const &, enum TRemConMessageType, class TDes8 &) const
+	?NewCommand@MRemConBearerObserver@@QAEHABVTRemConAddress@@@Z @ 12 NONAME ; int MRemConBearerObserver::NewCommand(class TRemConAddress const &)
+	?NewL@CRemConBearerPlugin@@SAPAV1@AAVTBearerParams@@@Z @ 13 NONAME ; class CRemConBearerPlugin * CRemConBearerPlugin::NewL(class TBearerParams &)
+	?NewResponse@MRemConBearerObserver@@QAEHABVTRemConAddress@@@Z @ 14 NONAME ; int MRemConBearerObserver::NewResponse(class TRemConAddress const &)
+	?NewTransactionId@MRemConBearerObserver@@QAEIXZ @ 15 NONAME ; unsigned int MRemConBearerObserver::NewTransactionId(void)
+	?Observer@CRemConBearerPlugin@@IAEAAVMRemConBearerObserver@@XZ @ 16 NONAME ; class MRemConBearerObserver & CRemConBearerPlugin::Observer(void)
+	?Observer@TBearerParams@@QBEAAVMRemConBearerObserver@@XZ @ 17 NONAME ; class MRemConBearerObserver & TBearerParams::Observer(void) const
+	?Uid@CRemConBearerPlugin@@QBE?AVTUid@@XZ @ 18 NONAME ; class TUid CRemConBearerPlugin::Uid(void) const
+	?NewNotifyCommand@MRemConBearerObserver@@QAEHABVTRemConAddress@@@Z @ 19 NONAME ; int MRemConBearerObserver::NewNotifyCommand(class TRemConAddress const &)
+	?CommandExpired@MRemConBearerObserver@@QAEXI@Z @ 20 NONAME ; void MRemConBearerObserver::CommandExpired(unsigned int)
+	?NewNotifyResponse@MRemConBearerObserver@@QAEHABVTRemConAddress@@@Z @ 21 NONAME ; int MRemConBearerObserver::NewNotifyResponse(class TRemConAddress const &)
+	?NewCommand@MRemConBearerObserver@@QAEHABVTRemConAddress@@ABI@Z @ 22 NONAME ; int MRemConBearerObserver::NewCommand(class TRemConAddress const &, unsigned int const &)
+	?NewNotifyCommand@MRemConBearerObserver@@QAEHABVTRemConAddress@@ABI@Z @ 23 NONAME ; int MRemConBearerObserver::NewNotifyCommand(class TRemConAddress const &, unsigned int const &)
+	?SetRemoteAddressedClient@MRemConBearerObserver@@QAEXABVTUid@@ABI@Z @ 24 NONAME ; void MRemConBearerObserver::SetRemoteAddressedClient(class TUid const &, unsigned int const &)
+	?SupportedInterfaces@MRemConBearerObserver@@QAEHABIAAV?$RArray@VTUid@@@@@Z @ 25 NONAME ; int MRemConBearerObserver::SupportedInterfaces(unsigned int const &, class RArray<class TUid> &)
+	?SupportedOperations@MRemConBearerObserver@@QAEHABIVTUid@@AAV?$RArray@I@@@Z @ 26 NONAME ; int MRemConBearerObserver::SupportedOperations(unsigned int const &, class TUid, class RArray<unsigned int> &)
+	?NewCommand@MRemConBearerBulkObserver@@QAEHABVTRemConAddress@@@Z @ 27 NONAME ; int MRemConBearerBulkObserver::NewCommand(class TRemConAddress const &)
+	?CommandExpired@MRemConBearerBulkObserver@@QAEXI@Z @ 28 NONAME ; void MRemConBearerBulkObserver::CommandExpired(unsigned int)
+	?SetAddressedClient@MRemConBearerBulkObserver@@QAEHABVTRemConAddress@@ABI@Z @ 29 NONAME ; int MRemConBearerBulkObserver::SetAddressedClient(class TRemConAddress const &, unsigned int const &)
+	?NewTransactionId@MRemConBearerBulkObserver@@QAEIXZ @ 30 NONAME ; unsigned int MRemConBearerBulkObserver::NewTransactionId(void)
+	?NewCommand@MRemConBearerBulkObserver@@QAEHABVTRemConAddress@@ABI@Z @ 31 NONAME ; int MRemConBearerBulkObserver::NewCommand(class TRemConAddress const &, unsigned int const &)
+	?RemoveAddressing@MRemConBearerBulkObserver@@QAEHABVTRemConAddress@@@Z @ 32 NONAME ; int MRemConBearerBulkObserver::RemoveAddressing(class TRemConAddress const &)
+	?UnregisterLocalAddressedClientObserver@MRemConBearerObserver@@QAEHABVTUid@@@Z @ 33 NONAME ; int MRemConBearerObserver::UnregisterLocalAddressedClientObserver(class TUid const &)
+	?RegisterLocalAddressedClientObserver@MRemConBearerObserver@@QAEHABVTUid@@@Z @ 34 NONAME ; int MRemConBearerObserver::RegisterLocalAddressedClientObserver(class TUid const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/eabi/remconbearerpluginU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,42 @@
+EXPORTS
+	_ZN13TBearerParamsC1E4TUidR21MRemConBearerObserver @ 1 NONAME
+	_ZN13TBearerParamsC2E4TUidR21MRemConBearerObserver @ 2 NONAME
+	_ZN13TBearerParamsD1Ev @ 3 NONAME
+	_ZN13TBearerParamsD2Ev @ 4 NONAME
+	_ZN19CRemConBearerPlugin4NewLER13TBearerParams @ 5 NONAME
+	_ZN19CRemConBearerPlugin8ObserverEv @ 6 NONAME
+	_ZN19CRemConBearerPluginC2ER13TBearerParams @ 7 NONAME
+	_ZN19CRemConBearerPluginD0Ev @ 8 NONAME
+	_ZN19CRemConBearerPluginD1Ev @ 9 NONAME
+	_ZN19CRemConBearerPluginD2Ev @ 10 NONAME
+	_ZN21MRemConBearerObserver10NewCommandERK14TRemConAddress @ 11 NONAME
+	_ZN21MRemConBearerObserver11NewResponseERK14TRemConAddress @ 12 NONAME
+	_ZN21MRemConBearerObserver14ConnectConfirmERK14TRemConAddressi @ 13 NONAME
+	_ZN21MRemConBearerObserver15ConnectIndicateERK14TRemConAddress @ 14 NONAME
+	_ZN21MRemConBearerObserver16NewTransactionIdEv @ 15 NONAME
+	_ZN21MRemConBearerObserver17DisconnectConfirmERK14TRemConAddressi @ 16 NONAME
+	_ZN21MRemConBearerObserver18DisconnectIndicateERK14TRemConAddress @ 17 NONAME
+	_ZNK13TBearerParams17ImplementationUidEv @ 18 NONAME
+	_ZNK13TBearerParams8ObserverEv @ 19 NONAME
+	_ZNK19CRemConBearerPlugin3UidEv @ 20 NONAME
+	_ZNK21MRemConBearerObserver17BearerToInterfaceE4TUidRK6TDesC8S3_RS0_RjR18TRemConMessageTypeR5TDes8 @ 21 NONAME
+	_ZNK21MRemConBearerObserver17InterfaceToBearerE4TUidS0_jRK6TDesC818TRemConMessageTypeR5TDes8 @ 22 NONAME
+	_ZTI19CRemConBearerPlugin @ 23 NONAME ; #<TI>#
+	_ZTV19CRemConBearerPlugin @ 24 NONAME ; #<VT>#
+	_ZN21MRemConBearerObserver14CommandExpiredEj @ 25 NONAME
+	_ZN21MRemConBearerObserver16NewNotifyCommandERK14TRemConAddress @ 26 NONAME
+	_ZN21MRemConBearerObserver17NewNotifyResponseERK14TRemConAddress @ 27 NONAME
+	_ZN21MRemConBearerObserver10NewCommandERK14TRemConAddressRKj @ 28 NONAME
+	_ZN21MRemConBearerObserver16NewNotifyCommandERK14TRemConAddressRKj @ 29 NONAME
+	_ZN21MRemConBearerObserver19SupportedInterfacesERKjR6RArrayI4TUidE @ 30 NONAME
+	_ZN21MRemConBearerObserver19SupportedOperationsERKj4TUidR6RArrayIjE @ 31 NONAME
+	_ZN21MRemConBearerObserver24SetRemoteAddressedClientERK4TUidRKj @ 32 NONAME
+	_ZN25MRemConBearerBulkObserver10NewCommandERK14TRemConAddress @ 33 NONAME
+	_ZN25MRemConBearerBulkObserver14CommandExpiredEj @ 34 NONAME
+	_ZN25MRemConBearerBulkObserver16NewTransactionIdEv @ 35 NONAME
+	_ZN25MRemConBearerBulkObserver18SetAddressedClientERK14TRemConAddressRKj @ 36 NONAME
+	_ZN25MRemConBearerBulkObserver10NewCommandERK14TRemConAddressRKj @ 37 NONAME
+	_ZN25MRemConBearerBulkObserver16RemoveAddressingERK14TRemConAddress @ 38 NONAME
+	_ZN21MRemConBearerObserver36RegisterLocalAddressedClientObserverERK4TUid @ 39 NONAME
+	_ZN21MRemConBearerObserver38UnregisterLocalAddressedClientObserverERK4TUid @ 40 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,30 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconbearerplugin.mmp
+
+PRJ_EXPORTS
+../public/remconbearerobserver.h		SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconbearerobserver.h)
+../public/remconbearerplugin.h			SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconbearerplugin.h)
+../public/remconbearerinterface.h		SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconbearerinterface.h)
+../public/bearerparams.h				SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/bearerparams.h)
+../public/remconbearerbulkobserver.h		SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconbearerbulkobserver.h)
+../public/remconbearerbulkinterface.h		SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconbearerbulkinterface.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/group/remconbearerplugin.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,49 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconbearerplugin.dll Base DLL for bearer plugins to RemCon.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconservercaps.mmh>
+
+TARGET			remconbearerplugin.dll
+TARGETPATH		/system/libs
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			bearerparams.cpp
+SOURCE			remconbearerplugin.cpp
+SOURCE			remconbearerobserver.cpp 
+SOURCE			remconbearerbulkobserver.cpp
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		ecom.lib
+LIBRARY 		remcontypes.lib
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/public/bearerparams.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,72 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef BEARERPARAMS_H
+#define BEARERPARAMS_H
+
+#include <e32base.h>
+
+class MRemConBearerObserver;
+
+/**
+Struct for initialisation parameters for concrete bearer plugins. The derived 
+(concrete) plugin will receive an instance of this in its NewL. It should pass 
+it to the CRemConBearerPlugin base class constructor.
+*/
+class TBearerParams
+	{
+public:
+	/**
+	Constructor.
+	@param aImplementationUid The implementation UID of the bearer.
+	@param aObserver Observer.
+	*/
+	IMPORT_C TBearerParams(TUid aImplementationUid, MRemConBearerObserver& aObserver);
+
+	/** Destructor. */
+	IMPORT_C ~TBearerParams();
+
+public:
+	/** 
+	Accessor for the implementation UID.
+	@return Implementation UID.
+	*/
+	IMPORT_C TUid ImplementationUid() const;
+
+	/**
+	Accessor for the observer.
+	@return Observer.
+	*/
+	IMPORT_C MRemConBearerObserver& Observer() const;
+
+private: // owned
+	const TUid iImplementationUid;
+
+	/** 
+	Pad for BC-friendly future change.
+	*/
+	TUint32 iPad;
+
+private: // unowned
+	MRemConBearerObserver& iObserver;
+	};
+
+#endif // BEARERPARAMS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/public/remconbearerbulkinterface.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,137 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef REMCONBEARERBULKINTERFACE_H
+#define REMCONBEARERBULKINTERFACE_H
+
+#include <e32base.h>
+#include <remcon/clientid.h>
+
+class MRemConBearerBulkObserver;
+class TBearerParams;
+class TRemConAddress;
+
+/** 
+The UID of the bearer API. If the bearer API ever has to change, a new UID and 
+associated M class will be created. New implementations of CRemConBearerPlugin 
+may implement the new API. Old (non-updated) bearers will still work as long 
+as RemCon supports the old API.
+*/
+const TInt KRemConBearerBulkInterface1 = 0x102863fc;
+
+/**
+Mixin for the bearer API.
+*/
+class MRemConBearerBulkInterface
+	{
+public:
+	/** 
+	Called by RemCon to retrieve a command on a connection. Must only be 
+	called as a result of a NewCommand up-call.
+	@param aInterfaceUid The UID of the outer-layer client API specifying the 
+	command.
+	@param aTransactionId The command identifier used as a cookie for command/response 
+	matching.
+	@param aOperationId The ID of the command operation in the outer-layer 
+	client API.
+	@param aData API-specific message data. On success, ownership is 
+	returned.
+	@param aAddr The connection.
+	@return Error.
+	*/
+	virtual TInt MrcbbiGetCommand(TUid& aInterfaceUid, 
+		TUint& aTransactionId, 
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr) = 0;
+
+	/** 
+	Called by RemCon to send a response on a connection. The connection is not 
+	assumed to exist- the bearer is responsible for bringing up the requested 
+	connection if necessary.
+	@param aInterfaceUid The UID of the outer-layer client API specifying the 
+	response.
+	@param aOperationId The ID of the response operation in the outer-layer 
+	client API.
+	@param aTransactionId The command identifier used as a cookie for command/response 
+	matching
+	@param aData API-specific message data. On success, ownership is passed.
+	@param aAddr The connection.
+	@return Error. This request is synchronous. It should be completed by the 
+	bearer when it has taken responsibility for sending the message. This will 
+	involve checking that the message is well-formed, and possibly actually 
+	trying to send it, or adding it to a queue.
+	*/
+	virtual TInt MrcbbiSendResponse(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint aTransactionId, 
+		RBuf8& aData, 
+		const TRemConAddress& aAddr) = 0;
+	
+	/**
+	Called by RemCon when all appropriate clients disconnect from remcon before the 
+	response is sent.
+	@param aInterfaceUid The UID of the outer-layer client API that the command
+	was sent to
+	@param aOperationId The ID of the command operation sent to remcon
+	@param aId The command identifier used as a cookie for command/response 
+	matching.
+	@param aAddr The connection.
+	*/
+	virtual void MrcbbiSendReject(TUid aInterfaceUid, 
+			TUint aOperationId, 
+			TUint aTransactionId, 
+			const TRemConAddress& aAddr) = 0;
+	
+	/**
+	Called by RemCon to initialise the bulk service.  This call will be
+	made in the context of the bulk server thread.
+	@param aObserver The bulk bearer observer.
+	@return KErrNone if the bulk service was successfully intialised.
+			System wide error code otherwise.
+	*/
+	virtual TInt MrcbbiStartBulk(MRemConBearerBulkObserver& aObserver) = 0;
+	
+	/**
+	Called by RemCon to disable the bulk service.  This call will be made
+	in the context of the bulk server thread.
+	The bearer should use this opportunity to cancel any outstanding bulk
+	services. 
+	*/
+	virtual void MrcbbiStopBulk() = 0;
+	
+	/**
+	Called by RemCon when a bulk client becomes available.  The provided 
+	client ID will be shared with the associated control client.
+	@param aId The ID of the bulk client that has become available.
+	*/
+	virtual void MrcbbiBulkClientAvailable(const TRemConClientId& aId) = 0;
+	
+	/**
+	Called by RemCon when a bulk client is no longer available.
+	@param aId The ID of the bulk client that is no longer available.
+	*/
+	virtual void MrcbbiBulkClientNotAvailable(const TRemConClientId& aId) = 0;
+	};
+	
+#endif // REMCONBEARERBULKINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/public/remconbearerbulkobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,126 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef REMCONBEARERBULKOBSERVER_H
+#define REMCONBEARERBULKOBSERVER_H
+
+#include <e32base.h>
+#include <remcon/messagetype.h>
+#include <remcon/clientid.h>
+
+class TRemConAddress;
+
+/**
+Interface presented by RemCon down to bulk bearers.
+The public methods are non-virtual and exported, so that they can be added to 
+without breaking BC for existing (non-rebuilt) bearers.
+*/
+class MRemConBearerBulkObserver
+	{
+public:
+	/** 
+	Called when an incoming command from a remote is ready to be picked up by 
+	RemCon.
+	@param aAddr The address the command came from.
+	@return Error. If KErrNone, RemCon is committing to collecting the message 
+	using GetResponse. If non-KErrNone, the message will be dropped by the 
+	bearer.
+	*/
+	IMPORT_C TInt NewCommand(const TRemConAddress& aAddr);
+
+	/** 
+	Called when an incoming command from a remote is ready to be picked up by 
+	RemCon.  This overload is used when the command is for a stateless
+	interface and must be delivered to a particular client.
+	
+	@param aAddr The address the command came from.
+	@param aClientId The client to deliver the command to.
+	@return Error. If KErrNone, RemCon is committing to collecting the message 
+	using GetResponse. If non-KErrNone, the message will be dropped by the 
+	bearer.
+	*/
+	IMPORT_C TInt NewCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+	
+	/**
+	Called by a bearer when a new command has come in. RemCon returns a cookie 
+	(a transaction id), guaranteed to be unique, which the bearer may use for 
+	its own identification purposes.
+	@return A new transaction ID.
+	*/
+	IMPORT_C TUint NewTransactionId();
+	
+	/**
+	Called by a bearer when a command is no longer valid and should be removed
+	from RemCon's queues
+	@param aTransactionId The transaction ID of the expired command
+	*/
+	IMPORT_C void CommandExpired(TUint aTransactionId);
+
+	/**
+	Called by a bearer to select the client to which commands should be addressed.
+	@param aAddr	The address for received commands to be delivered to a specific client.
+	@param aClient	The client to which commands received from the given address should 
+					be delievered to.
+	*/
+	IMPORT_C TInt SetAddressedClient(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+	
+	/**
+	Called by a bearer to remove any addressing to particular clients for an address.
+	@param aAddr	The address of received commands that are no longer to be delivered to
+					specified clients.
+	*/
+	IMPORT_C TInt RemoveAddressing(const TRemConAddress& aAddr);
+	
+private:
+	/** 
+	@see NewCommand.
+	*/
+	virtual TInt MrcbboDoNewCommand(const TRemConAddress& aAddr) = 0;
+	
+	/** 
+	@see NewCommand.
+	*/
+	virtual TInt MrcbboDoNewCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient) = 0;
+	
+	/**
+	@see TransactionId.
+	*/
+	virtual TUint MrcbboDoNewTransactionId() = 0;	
+	
+	/**
+	@see CommandExpired.
+	*/
+	virtual void MrcbboDoCommandExpired(TUint aTransactionId) = 0;	
+	
+	/**
+	@see SetAddressedClient.
+	*/
+	virtual TInt MrcbboDoSetAddressedClient(const TRemConAddress& aAddr, const TRemConClientId& aClient) = 0;
+	
+	/**
+	@see RemoveAddressing.
+	*/
+	virtual TInt MrcbboDoRemoveAddressing(const TRemConAddress& aAddr) = 0;
+	};
+
+#endif // REMCONBEARERBULKOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/public/remconbearerinterface.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,323 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef REMCONBEARERINTERFACE_H
+#define REMCONBEARERINTERFACE_H
+
+#include <e32base.h>
+#include <remcon/clientid.h>
+#include <remcon/messagetype.h>
+#include <remcon/playertype.h>
+
+class MRemConBearerObserver;
+class TBearerParams;
+class TRemConAddress;
+
+/** 
+The UID of the bearer API. If the bearer API ever has to change, a new UID and 
+associated M class will be created. New implementations of CRemConBearerPlugin 
+may implement the new API. Old (non-updated) bearers will still work as long 
+as RemCon supports the old API.
+*/
+const TInt KRemConBearerInterface1 = 0x10208A78;
+
+/**
+Mixin for the bearer API.
+*/
+class MRemConBearerInterface
+	{
+public:
+	/** 
+	Called by RemCon to retrieve a response on a connection. Must only be 
+	called as a result of a NewResponse up-call.
+	@param aInterfaceUid The UID of the outer-layer client API specifying the 
+	response.
+	@param aTransactionId The command identifier used as a cookie for command/response 
+	matching.
+	@param aOperationId The ID of the response operation in the outer-layer 
+	client API.
+	@param aData API-specific message data. On success, ownership is 
+	returned.
+	@param aAddr The connection.
+	@return Error.
+	*/
+	virtual TInt GetResponse(TUid& aInterfaceUid, 
+		TUint& aTransactionId, 
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr) = 0;
+	
+	/** 
+	Called by RemCon to retrieve a command on a connection. Must only be 
+	called as a result of a NewCommand up-call.
+	@param aInterfaceUid The UID of the outer-layer client API specifying the 
+	command.
+	@param aTransactionId The command identifier used as a cookie for command/response 
+	matching.
+	@param aOperationId The ID of the command operation in the outer-layer 
+	client API.
+	@param aData API-specific message data. On success, ownership is 
+	returned.
+	@param aAddr The connection.
+	@return Error.
+	*/
+	virtual TInt GetCommand(TUid& aInterfaceUid, 
+		TUint& aTransactionId, 
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr) = 0;
+
+	/** 
+	Called by RemCon to send a command on a connection. The connection is not 
+	assumed to exist- the bearer is responsible for bringing up the requested 
+	connection if necessary.
+	@param aInterfaceUid The UID of the outer-layer client API specifying the 
+	command.
+	@param aOperationId The ID of the command operation in the outer-layer 
+	client API.
+	@param aTransactionId The command identifier used as a cookie for command/response 
+	matching.
+	@param aData API-specific message data. On success, ownership is passed. 
+	@param aAddr The connection.
+	@return Error. This request is synchronous. It should be completed by the 
+	bearer when it has taken responsibility for sending the message. This will 
+	involve checking that the message is well-formed, and possibly actually 
+	trying to send it, or adding it to a queue.
+	*/
+	virtual TInt SendCommand(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint aTransactionId,  
+		RBuf8& aData, 
+		const TRemConAddress& aAddr) = 0;
+	
+	/** 
+	Called by RemCon to send a response on a connection. The connection is not 
+	assumed to exist- the bearer is responsible for bringing up the requested 
+	connection if necessary.
+	@param aInterfaceUid The UID of the outer-layer client API specifying the 
+	response.
+	@param aOperationId The ID of the response operation in the outer-layer 
+	client API.
+	@param aTransactionId The command identifier used as a cookie for command/response 
+	matching
+	@param aData API-specific message data. On success, ownership is passed.
+	@param aAddr The connection.
+	@return Error. This request is synchronous. It should be completed by the 
+	bearer when it has taken responsibility for sending the message. This will 
+	involve checking that the message is well-formed, and possibly actually 
+	trying to send it, or adding it to a queue.
+	*/
+	virtual TInt SendResponse(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint aTransactionId, 
+		RBuf8& aData, 
+		const TRemConAddress& aAddr) = 0;
+	
+	/** 
+	Called by RemCon to establish a bearer-level connection to another party. 
+	Completion is signalled back in ConnectConfirm.
+	@param aAddr The RemCon address to connect to.
+	*/
+	virtual void ConnectRequest(const TRemConAddress& aAddr) = 0;
+	
+	/** 
+	Called by RemCon to destroy a bearer-level connection to another party. 
+	Completion is signalled back in DisconnectConfirm.
+	@param aAddr The RemCon address to disconnect from.
+	*/
+	virtual void DisconnectRequest(const TRemConAddress& aAddr) = 0;
+
+	/**
+	Called by RemCon when either (a) the number of controller clients changes 
+	from 0 to 1 or from 1 to 0, or (b) the number of target clients changes 
+	from 0 to 1 or from 1 to 0.
+	@param aControllerPresent Is true if any controllers are present, EFalse otherwise.
+	@param aTargetPresent Is true if any targets are present, EFalse otherwise.
+	*/
+	virtual void ClientStatus(TBool aControllerPresent, TBool aTargetPresent) = 0;
+
+	/**
+	Called by RemCon to get the capabilities required to make/destroy 
+	connections over the bearer, and to send and receive messages over the 
+	bearer.
+	@return The bearer's security policy.
+	*/
+	virtual TSecurityPolicy SecurityPolicy() const = 0;
+	};
+	
+	
+/** 
+The UID of the bearer API. If the bearer API ever has to change, a new UID and 
+associated M class will be created. New implementations of CRemConBearerPlugin 
+may implement the new API. Old (non-updated) bearers will still work as long 
+as RemCon supports the old API.
+*/
+const TInt KRemConBearerInterface2 = 0x10285AD9;
+
+	
+class MRemConBearerInterfaceV2 : public MRemConBearerInterface
+	{
+public:
+	/** 
+	Called by RemCon to retrieve a notify command on a connection. Must only be 
+	called as a result of a NewNotify up-call.
+	@param aInterfaceUid The UID of the outer-layer client API specifying the 
+	notify command.
+	@param aTransactionId The command identifier used as a cookie for command/response 
+	matching.
+	@param aOperationId The ID of the command operation in the outer-layer 
+	client API.
+	@param aData API-specific message data. On success, ownership is 
+	returned.
+	@param aAddr The connection.
+	*/
+	virtual TInt GetNotifyCommand(TUid& aInterfaceUid, 
+		TUint& aTransactionId, 
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr) = 0;
+	
+	/**
+	Called by RemCon when either
+	a) The TSP does not address a command to any clients
+	b) The TSP does not permit the response from any commands
+	c) All the clients disconnect from remcon before the response is sent,
+	to send a reject on a connection. RemCon will call this function after bringing
+	up the connection.
+	@param aInterfaceUid The UID of the outer-layer client API that the command
+	was sent to
+	@param aOperationId The ID of the command operation sent to remcon
+	@param aTransactionId The command identifier used as a cookie for command/response 
+	matching.
+	@param aAddr The connection.
+	*/
+	virtual void SendReject(TUid aInterfaceUid, 
+			TUint aOperationId, 
+			TUint aTransactionId, 
+			const TRemConAddress& aAddr) = 0; 
+	};	
+
+/** 
+The UID of the bearer API. If the bearer API ever has to change, a new UID and 
+associated M class will be created. New implementations of CRemConBearerPlugin 
+may implement the new API. Old (non-updated) bearers will still work as long 
+as RemCon supports the old API.
+*/
+const TInt KRemConBearerInterface3 = 0x10285ADB;
+
+class MRemConBearerInterfaceV3 : public MRemConBearerInterfaceV2
+	{
+public:
+	/** 
+	Called by RemCon to send a notify command on a connection. The connection is not 
+	assumed to exist- the bearer is responsible for bringing up the requested 
+	connection if necessary.
+	@param aInterfaceUid The UID of the outer-layer client API specifying the command.
+	@param aOperationId The ID of the command operation in the outer-layer client API.
+	@param aTransactionId The command identifier used as a cookie for command/response matching.
+	@param aData API-specific message data. On success, ownership is passed. 
+	@param aAddr The connection.
+	@return Error. This request is synchronous. It returns KErrNone when the 
+	bear has taken responsibility for sending the message. This will 
+	involve checking that the message is well-formed, and possibly actually 
+	trying to send it, or adding it to a queue.
+	*/
+	virtual TInt SendNotifyCommand(TUid aInterfaceUid, 
+			TUint aOperationId, 
+			TUint aTransactionId,  
+			RBuf8& aData, 
+			const TRemConAddress& aAddr) = 0;
+	
+	/** 
+	Called by RemCon to retrieve a notify response on a connection. Must only be 
+	called as a result of a NewNotifyResponseL up-call.
+	@param aInterfaceUid The UID of the outer-layer client API specifying the response.
+	@param aTransactionId The command identifier used as a cookie for command/response matching.
+	@param aOperationId The ID of the response operation in the outer-layer client API.
+	@param aData API-specific message data. On success, ownership is returned.
+	@param aAddr The connection.
+	@return Error.
+	*/
+	virtual TInt GetNotifyResponse(TUid& aInterfaceUid, 
+			TUint& aId, 
+			TUint& aOperationId, 
+			RBuf8& aCommandData, 
+			TRemConAddress& aAddr,
+			TRemConMessageSubType& aSubMessageType)=0;
+	
+	/**
+	Called by RemCon when a client has become available for addressing.  Once this
+	call has been made the bearer may use the provided TRemConClientId to address
+	incoming commands and notifys to this client until RemCon calls ClientNotAvailable
+	with this TRemConClientId.
+	
+	@param aId A unique identifier for this client, that can be used when addressing 
+	incoming commands.
+	@param aClientType The basic type of this client
+	@param aClientSubType More detailed type information on this client
+	@param aName The name of this client in UTF-8.  This remains valid until ClientNotAvailable 
+				 is called for this player.
+	*/
+	virtual void ClientAvailable(TRemConClientId& aId, TPlayerType aClientType, TPlayerSubType aClientSubType, const TDesC8& aName) = 0;
+	
+	/**
+	Called by RemCon when a client is no longer available for addressing.  Once this
+	call has been made the bearer shall not use this client id when addressing incoming
+	commands and notifys until informed that the client is available again via
+	ClientAvailable.
+	
+	@param aId The client that has ceased to be available.
+	*/
+	virtual void ClientNotAvailable(TRemConClientId& aId) = 0;
+	
+	/** 
+	Called by RemCon when the TSP has requested this bearer use a different addressed
+	client.
+	
+	@param aId The client to which this bearer should route addressed commands.
+	*/
+	virtual TInt SetLocalAddressedClient(TRemConClientId& aId) = 0;
+	
+	/**
+	Called by RemCon when a controller client is opened or closed to provide the 
+	current set of interfaces supported by controller sessions.  This is not
+	guaranteed to have changed since the last time the function was called.
+	
+	@param aSupportedInterfaces An RArray of interface UIDs.  Ownership is retained
+				by RemCon and its lifetime is not guaranteed to last beyond the scope
+				of this function.  Each supported interface appears once in the array
+				irrespective of how many controller sessions support that interface.
+	*/
+	virtual void ControllerFeaturesUpdated(RArray<TUid>& aSupportedInterfaces) = 0;
+	
+	/**
+	Called by RemCon when a target client registers new interfaces after being made available.
+
+	@param aId The target client that has regitered new interfaces.
+	@param aPlayerType The basic type of this client after registration of new interfaces.
+	@param aPlayerSubType More detailed type information on this client after registration of new interfaces.
+	@param aName The name of this client in UTF-8. This remains valid until ClientNotAvailable 
+				 is called for this player.
+	*/
+	virtual void TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) = 0;
+	};
+
+#endif // REMCONBEARERINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/public/remconbearerobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,393 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef REMCONBEAREROBSERVER_H
+#define REMCONBEAREROBSERVER_H
+
+#include <e32base.h>
+#include <remcon/messagetype.h>
+#include <remcon/clientid.h>
+
+class CRemConConverterPlugin;
+class TRemConAddress;
+
+/**
+Interface presented by RemCon down to bearers.
+The public methods are non-virtual and exported, so that they can be added to 
+without breaking BC for existing (non-rebuilt) bearers.
+*/
+class MRemConBearerObserver
+	{
+public:
+	/** 
+	Called when an incoming response from a remote is ready to be picked up by 
+	RemCon.
+	@param aAddr The address the response came from.
+	@return Error. If KErrNone, RemCon is committing to collecting the message 
+	using GetResponse. If non-KErrNone, the message will be dropped by the 
+	bearer.
+	*/
+	IMPORT_C TInt NewResponse(const TRemConAddress& aAddr);	
+	
+	/** 
+	Called when an incoming notify response from a remote is ready to be picked up by 
+	RemCon.
+	@param aAddr The address the response came from.
+	@return Error. If KErrNone, RemCon is committing to collecting the message 
+	using GetNotifyResponse. If non-KErrNone, the message will be dropped by the 
+	bearer.
+	*/
+	IMPORT_C TInt NewNotifyResponse(const TRemConAddress& aAddr);	
+	
+	/** 
+	Called when an incoming command from a remote is ready to be picked up by 
+	RemCon.
+	@param aAddr The address the command came from.
+	@return Error. If KErrNone, RemCon is committing to collecting the message 
+	using GetResponse. If non-KErrNone, the message will be dropped by the 
+	bearer.
+	*/
+	IMPORT_C TInt NewCommand(const TRemConAddress& aAddr);
+
+	/** 
+	Called when an incoming notify command from a remote is ready to be picked up by 
+	RemCon.  A Notify command is different to a normal command in that it doesn't
+	follow the standard request / response sequence.  Instead a notify is registered
+	to retrieve the current state value in an interim response, then when the state
+	has changed relative the interim response a second response is sent containing the
+	new, changed, state.
+	
+	Depending on the semantics of the bearer protocol it may be able to map its 
+	state observation commands to plain RemCon commands, however for a reliable 
+	mechanism without polling this NotifyCommand is provided.  
+	
+	@param aAddr The address the command came from.
+	@return Error. If KErrNone, RemCon is committing to collecting the message 
+	using GetResponse. If non-KErrNone, the message will be dropped by the 
+	bearer.
+	*/
+	IMPORT_C TInt NewNotifyCommand(const TRemConAddress& aAddr);
+	
+	/** 
+	Called by a bearer when an incoming connection has been established. 
+	@param aAddr The address of the connection.
+	@return Error. If RemCon cannot add the connection to its internal data, 
+	then the bearer must logically drop the connection.
+	*/
+	IMPORT_C TInt ConnectIndicate(const TRemConAddress& aAddr);
+	
+	/**
+	Called by a bearer when a connection has been disconnected from the remote 
+	end. 
+	The bearer should only call this function if either (a) ConnectIndicate 
+	has already been called for the connection aAddr (and KErrNone returned by 
+	RemCon), or (b) ConnectConfirm has been called with KErrNone for the 
+	connection aAddr (and KErrNone has been returned by RemCon).
+	@param aAddr The RemCon address of the connection.
+	*/
+	IMPORT_C void DisconnectIndicate(const TRemConAddress& aAddr);
+	
+	/**
+	Called by a bearer to indicate completion of an outgoing connection 
+	request (CRemConBearerPlugin::ConnectRequest).
+	@param aAddr The address of the connection in question.
+	@param aError The success status of the connection establishment. If 
+	KErrNone, the connection was established. If non-KErrNone, the connection 
+	was not established.
+	@return Error. If RemCon cannot add the connection to its internal data, 
+	then the bearer must logically drop the connection. If aError is not 
+	KErrNone, then this return value is irrelevant.
+	*/
+	IMPORT_C TInt ConnectConfirm(const TRemConAddress& aAddr, TInt aError);
+	
+	/**
+	Called by a bearer to indicate completion of a disconnection request 
+	(CRemConBearerPlugin::Disconnect).
+	@param aAddr The address of the connection in question.
+	@param aError The success status of the disconnection. If KErrNone, the 
+	disconnection occurred. If non-KErrNone, the connection still exists.
+	*/
+	IMPORT_C void DisconnectConfirm(const TRemConAddress& aAddr, TInt aError);
+
+	/**
+	Called by a bearer to convert a message from an outer-layer API format to 
+	the bearer's format. The bearer observer finds a converter to perform 
+	this. 
+	@param aBearerUid The UID of the bearer.
+	@param aInterfaceUid The UID of the outer layer API to which the message 
+	belongs.
+	@param aOperationId The operation ID of the message.
+	@param aData The operation-specific data of the message.
+	@param aMsgType The type of the message.
+	@param aBearerData On success, the message encoded in the bearer's format.
+	@return Error. If a converter could not be found, KErrNotSupported, 
+	indicating that the message/bearer combination is not supported by the 
+	system.
+	*/
+	IMPORT_C TInt InterfaceToBearer(TUid aBearerUid,
+		TUid aInterfaceUid, 
+		TUint aOperationId,
+		const TDesC8& aData,
+		TRemConMessageType aMsgType, 
+		TDes8& aBearerData) const;
+	
+	/**
+	Called by a bearer to convert a message from the bearer's format to that 
+	of an outer-layer API. The bearer observer finds a converter to perform 
+	this. 
+	@param aBearerUid The UID of the bearer.
+	@param aInterfaceData Data identifying the interface in bearer-specific 
+	format.
+	@param aBearerData The message encoded in the bearer's format.
+	@param aInterfaceUid On success, the UID of the outer layer API to which 
+	the message belongs.
+	@param aOperationId On success, the operation ID of the message.
+	@param aData On success, the operation-specific data of the message.
+	@param aMsgType On success, the type of the message.
+	@return Error. If a converter could not be found, KErrNotSupported, 
+	indicating that the message/bearer combination is not supported by the 
+	system.
+	*/
+	IMPORT_C TInt BearerToInterface(TUid aBearerUid,
+		const TDesC8& aInterfaceData, 
+		const TDesC8& aBearerData,
+		TUid& aInterfaceUid, 
+		TUint& aOperationId,
+		TRemConMessageType& aMsgType, 
+		TDes8& aData) const;
+
+	/**
+	Called by a bearer when a new command has come in. RemCon returns a cookie 
+	(a transaction id), guaranteed to be unique, which the bearer may use for 
+	its own identification purposes.
+	@return A new transaction ID.
+	*/
+	IMPORT_C TUint NewTransactionId();
+	
+	/**
+	Called by a bearer when a command is no longer valid and should be removed
+	from RemCon's queues
+	@param aTransactionId The transaction ID of the expired command
+	*/
+	IMPORT_C void CommandExpired(TUint aTransactionId);
+	
+	/** 
+	Called when an incoming command from a remote is ready to be picked up by 
+	RemCon.
+	
+	This overload is provided for the case where the bearer supports command 
+	addressing.
+	
+	@param aAddr The address the command came from.
+	@param aTarget The application to which the command is targeted
+	@return Error. If KErrNone, RemCon is committing to collecting the message 
+	using GetResponse. If non-KErrNone, the message will be dropped by the 
+	bearer.
+	*/
+	IMPORT_C TInt NewCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+
+	/** 
+	Called when an incoming notify command from a remote is ready to be picked up by 
+	RemCon.  A Notify command is different to a normal command in that it doesn't
+	follow the standard request / response sequence.  Instead a notify is registered
+	to retrieve the current state value in an interim response, then when the state
+	has changed relative the interim response a second response is sent containing the
+	new, changed, state.
+	
+	Depending on the semantics of the bearer protocol it may be able to map its 
+	state observation commands to plain RemCon commands, however for a reliable 
+	mechanism without polling this NotifyCommand is provided.  
+	
+	This overload is provided for the case where the bearer supports command
+	addressing.
+	
+	@param aAddr The address the command came from.
+	@param aTarget The application to which the command is targeted
+	@return Error. If KErrNone, RemCon is committing to collecting the message 
+	using GetResponse. If non-KErrNone, the message will be dropped by the 
+	bearer.
+	*/
+	IMPORT_C TInt NewNotifyCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+
+	/**
+	Called by the bearer when it want to retrieve which interfaces are supported by a 
+	specific client.
+	@param aId A unique identifier for this client
+	@param aUids An RArray to be populated with the supported UIDs.  On return with 
+			KErrNone this array is populated with the UIDs of the interfaces which 
+			this client supports.  Ownership of the RArray remains with the caller.
+			Any existing entries in the array will be removed.
+	@return KErrNone on successful retrieval of supported interfaces.  System wide
+			error code otherwise.
+	*/
+	IMPORT_C TInt SupportedInterfaces(const TRemConClientId& aId, RArray<TUid>& aUids) ;
+
+	/**
+	Called by the bearer when it wants to retrieve which operations within the interface
+	are supported by this client.  Note that this information is not available for all
+	interface and client combinations.
+	
+	@param aId A unique identifier for this client
+	@param aInterfaceUid The interface to return the supported operations for
+	@param aOperations An RArray to be populated with the supported operations.  
+			On return with KErrNone this array is populated with the operation
+			ids of each supported operations within the requested interface.  
+			Ownership of the RArray remains with the caller.  Any existing 
+			entries in the array will be removed.
+	@return KErrNone if the supported operations could be successfully retrieved.
+			KErrNotSupported if the operations could not be retrieved for this 
+			particular client/interface combination.  System wide error code
+			otherwise.
+	*/
+	IMPORT_C TInt SupportedOperations(const TRemConClientId& aId, TUid aInterfaceUid, RArray<TUint>& aOperations);
+
+	/** 
+	Called by the bearer to inform RemCon that remote user action means that
+	this bearer will now route addressed commands to the specified client.
+	This is valid until either the bearer calls SetRemoteAddressedPlayer again
+	or RemCon calls SetLocalAddressedPlayer.
+	
+	@param aBearerUid The Uid of this bearer
+	@param aId The client to which this bearer will route addressed commands.
+	*/
+	IMPORT_C void SetRemoteAddressedClient(const TUid& aBearerUid, const TRemConClientId& aId);
+	
+	/**
+	Called by the bearer to indicate it would like to be informed when the 
+	locally addressed client changes.
+	*/
+	IMPORT_C TInt RegisterLocalAddressedClientObserver(const TUid& aBearerUid);
+	
+	/**
+	Called by the bearer to indicate it would no longer like to be informed when 
+	the locally addressed client changes.
+	*/
+	IMPORT_C TInt UnregisterLocalAddressedClientObserver(const TUid& aBearerUid);
+	
+private:
+	/** 
+	@see NewResponse.
+	*/
+	virtual TInt MrcboDoNewResponse(const TRemConAddress& aAddr) = 0;	
+	
+	/** 
+	@see NewNotifyResponse.
+	*/
+	virtual TInt MrcboDoNewNotifyResponse(const TRemConAddress& aAddr) = 0;
+	
+	/** 
+	@see NewCommand.
+	*/
+	virtual TInt MrcboDoNewCommand(const TRemConAddress& aAddr) = 0;
+	
+	/** 
+	@see NewNotifyCommand.
+	*/
+	virtual TInt MrcboDoNewNotifyCommand(const TRemConAddress& aAddr) = 0;
+
+	/** 
+	@see ConnectIndicate.
+	*/
+	virtual TInt MrcboDoConnectIndicate(const TRemConAddress& aAddr) = 0;
+	
+	/**
+	@see DisconnectIndicate.
+	*/
+	virtual void MrcboDoDisconnectIndicate(const TRemConAddress& aAddr) = 0;
+	
+	/**
+	@see ConnectConfirm.
+	*/
+	virtual TInt MrcboDoConnectConfirm(const TRemConAddress& aAddr, TInt aError) = 0;
+	
+	/**
+	@see DisconnectConfirm.
+	*/
+	virtual void MrcboDoDisconnectConfirm(const TRemConAddress& aAddr, TInt aError) = 0;
+	
+	/**
+	@see InterfaceToBearer.
+	*/
+	virtual TInt MrcboDoInterfaceToBearer(TUid aBearerUid,
+		TUid aInterfaceUid, 
+		TUint aOperationId,
+		const TDesC8& aData,
+		TRemConMessageType aMsgType, 
+		TDes8& aBearerData) const = 0;
+	
+	/**
+	@see BearerToInterface.
+	*/
+	virtual TInt MrcboDoBearerToInterface(TUid aBearerUid,
+		const TDesC8& aInterfaceData, 
+		const TDesC8& aBearerData,
+		TUid& aInterfaceUid, 
+		TUint& aOperationId,
+		TRemConMessageType& aMsgType, 
+		TDes8& aData) const = 0;
+	
+	/**
+	@see TransactionId.
+	*/
+	virtual TUint MrcboDoNewTransactionId() = 0;	
+	
+	/**
+	@see CommandExpired.
+	*/
+	virtual void MrcboDoCommandExpired(TUint aTransactionId) = 0;	
+	
+	/**
+	@see NewCommand
+	*/
+	virtual TInt MrcboDoNewCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient) = 0;
+
+	/** 
+	@see NewNotifyCommand
+	*/
+	virtual TInt MrcboDoNewNotifyCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient) = 0;
+
+	/**
+	@see SupportedInterfaces
+	*/
+	virtual TInt MrcboDoSupportedInterfaces(const TRemConClientId& aId, RArray<TUid>& aUids) = 0;
+
+	/**
+	@see SupportedOperations
+	*/
+	virtual TInt MrcboDoSupportedOperations(const TRemConClientId& aId, TUid aInterfaceUid, RArray<TUint>& aOperations) = 0;
+
+	/**
+	@see SetRemoteAddressedClient
+	*/
+	virtual void MrcboDoSetRemoteAddressedClient(const TUid& aBearerUid, const TRemConClientId& aId) = 0;
+	
+	/**
+	@see RegisterLocalAddressedClientObserver
+	*/
+	virtual TInt MrcboDoRegisterLocalAddressedClientObserver(const TUid& aBearerUid) = 0;
+	
+	/**
+	@see UnregisterLocalAddressedClientObserver
+	*/
+	virtual TInt MrcboDoUnregisterLocalAddressedClientObserver(const TUid& aBearerUid) = 0;
+	};
+
+#endif // REMCONBEAREROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/public/remconbearerplugin.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,109 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef REMCONBEARERPLUGIN_H
+#define REMCONBEARERPLUGIN_H
+
+#include <e32base.h>
+
+class MRemConBearerObserver;
+class TBearerParams;
+class TRemConAddress;
+
+/** 
+The UID of the RemCon bearer interface. Implementors of new bearers are 
+implementing this interface. The bearer interface is simply a means of 
+supplying implementations of the 'bearer API' to RemCon. The bearer API may 
+change over time, so this extension pattern is used.
+*/
+const TInt KRemConBearerInterfaceUid = 0x10204546;
+
+/**
+Base class for bearer plugins.
+*/
+class CRemConBearerPlugin : public CBase
+	{
+public: // used by RemCon to create and destroy bearer instances
+	/** 
+	Constructor.
+	@param aParams Parameters from RemCon, used to initialise the 
+	implementation.
+	@return Ownership of a new bearer plugin.
+	*/
+	IMPORT_C static CRemConBearerPlugin* NewL(TBearerParams& aParams);
+
+	/** Destructor. */
+	IMPORT_C ~CRemConBearerPlugin();
+
+public:
+	/**
+	Called by RemCon server to get a pointer to an object which implements the 
+	bearer API with UID aUid. This is a mechanism for allowing future change 
+	to the bearer API without breaking BC in existing (non-updated) bearer 
+	plugins.
+	@param aUid The UID of a bearer API
+	@return A pointer to an object which implements the interface identified 
+	by aUid or NULL if the interface is not implemented.
+	*/
+	virtual TAny* GetInterface(TUid aUid) = 0;
+
+	/**
+	Called by RemCon to query the bearer's implementation UID.
+	@return The bearer's implementation UID.
+	*/
+	IMPORT_C TUid Uid() const;
+
+protected: // called by concrete bearer plugins
+	/** 
+	Constructor
+	@param aParams Parameters from RemCon, used to initialise the 
+	implementation.
+	*/
+	IMPORT_C CRemConBearerPlugin(TBearerParams& aParams);
+
+	/**
+	Accessor for the observer.
+	@return The observer.
+	*/
+	IMPORT_C MRemConBearerObserver& Observer();
+
+private: // unowned
+	MRemConBearerObserver& iObserver;
+
+private: // owned
+	/**
+	UID set by ECOM when the instance is created. Used when the instance is 
+	destroyed.
+	*/
+	TUid iInstanceId;
+
+	/**
+	Implementation UID of concrete instance.
+	*/
+	const TUid iImplementationUid;
+
+	/** 
+	Pad for BC-friendly future change.
+	*/
+	TAny* iPad;
+	};
+
+#endif // REMCONBEARERPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/src/bearerparams.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/bearerparams.h>
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+EXPORT_C TBearerParams::TBearerParams(TUid aImplementationUid, MRemConBearerObserver& aObserver)
+:	iImplementationUid(aImplementationUid),
+	iObserver(aObserver)
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C TBearerParams::~TBearerParams()
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C TUid TBearerParams::ImplementationUid() const
+	{
+	return iImplementationUid;
+	}
+
+EXPORT_C MRemConBearerObserver& TBearerParams::Observer() const
+	{
+	return iObserver;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/src/remconbearerbulkobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,54 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconbearerbulkobserver.h>
+
+EXPORT_C TInt MRemConBearerBulkObserver::NewCommand(const TRemConAddress& aAddr)
+	{
+	return MrcbboDoNewCommand(aAddr);
+	}
+
+EXPORT_C TInt MRemConBearerBulkObserver::NewCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient)
+	{
+	return MrcbboDoNewCommand(aAddr, aClient);
+	}
+
+EXPORT_C TUint MRemConBearerBulkObserver::NewTransactionId()
+	{
+	return MrcbboDoNewTransactionId();
+	}
+
+EXPORT_C void MRemConBearerBulkObserver::CommandExpired(TUint aTransactionId)
+	{
+	return MrcbboDoCommandExpired(aTransactionId);
+	}
+
+EXPORT_C TInt MRemConBearerBulkObserver::SetAddressedClient(const TRemConAddress& aAddr, const TRemConClientId& aClientId)
+	{
+	return MrcbboDoSetAddressedClient(aAddr, aClientId);
+	}
+
+EXPORT_C TInt MRemConBearerBulkObserver::RemoveAddressing(const TRemConAddress& aAddr)
+	{
+	return MrcbboDoRemoveAddressing(aAddr);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/src/remconbearerobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,141 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconbearerobserver.h>
+
+EXPORT_C TInt MRemConBearerObserver::NewResponse(const TRemConAddress& aAddr)
+	{
+	return MrcboDoNewResponse(aAddr);
+	}
+
+EXPORT_C TInt MRemConBearerObserver::NewNotifyResponse(const TRemConAddress& aAddr)
+	{
+	return MrcboDoNewNotifyResponse(aAddr);
+	}
+	
+EXPORT_C TInt MRemConBearerObserver::NewCommand(const TRemConAddress& aAddr)
+	{
+	return MrcboDoNewCommand(aAddr);
+	}
+
+EXPORT_C TInt MRemConBearerObserver::NewNotifyCommand(const TRemConAddress& aAddr)
+	{
+	return MrcboDoNewNotifyCommand(aAddr);
+	}
+
+
+EXPORT_C TInt MRemConBearerObserver::ConnectIndicate(const TRemConAddress& aAddr)
+	{
+	return MrcboDoConnectIndicate(aAddr);
+	}
+	
+EXPORT_C void MRemConBearerObserver::DisconnectIndicate(const TRemConAddress& aAddr)
+	{
+	MrcboDoDisconnectIndicate(aAddr);
+	}
+	
+EXPORT_C TInt MRemConBearerObserver::ConnectConfirm(const TRemConAddress& aAddr, TInt aError)
+	{
+	return MrcboDoConnectConfirm(aAddr, aError);
+	}
+	
+EXPORT_C void MRemConBearerObserver::DisconnectConfirm(const TRemConAddress& aAddr, TInt aError)
+	{
+	MrcboDoDisconnectConfirm(aAddr, aError);
+	}
+	
+EXPORT_C TInt MRemConBearerObserver::InterfaceToBearer(TUid aBearerUid,
+		TUid aInterfaceUid, 
+		TUint aOperationId,
+		const TDesC8& aData,
+		TRemConMessageType aMsgType, 
+		TDes8& aBearerData) const
+	{
+	return MrcboDoInterfaceToBearer(aBearerUid,
+		aInterfaceUid, 
+		aOperationId,
+		aData,
+		aMsgType, 
+		aBearerData);
+	}
+	
+EXPORT_C TInt MRemConBearerObserver::BearerToInterface(TUid aBearerUid,
+		const TDesC8& aInterfaceData, 
+		const TDesC8& aBearerData,
+		TUid& aInterfaceUid, 
+		TUint& aOperationId,
+		TRemConMessageType& aMsgType, 
+		TDes8& aData) const
+	{
+	return MrcboDoBearerToInterface(aBearerUid,
+		aInterfaceData,
+		aBearerData,
+		aInterfaceUid, 
+		aOperationId,
+		aMsgType, 
+		aData);
+	}
+	
+EXPORT_C TUint MRemConBearerObserver::NewTransactionId()
+	{
+	return MrcboDoNewTransactionId();
+	}
+
+EXPORT_C void MRemConBearerObserver::CommandExpired(TUint aTransactionId)
+	{
+	return MrcboDoCommandExpired(aTransactionId);
+	}
+
+EXPORT_C TInt MRemConBearerObserver::NewCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient)
+	{
+	return MrcboDoNewCommand(aAddr, aClient);
+	}
+
+EXPORT_C TInt MRemConBearerObserver::NewNotifyCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient)
+	{
+	return MrcboDoNewNotifyCommand(aAddr, aClient);
+	}
+
+EXPORT_C TInt MRemConBearerObserver::SupportedInterfaces(const TRemConClientId& aId, RArray<TUid>& aUids)
+	{
+	return MrcboDoSupportedInterfaces(aId, aUids);
+	}
+
+EXPORT_C TInt MRemConBearerObserver::SupportedOperations(const TRemConClientId& aId, TUid aInterfaceUid, RArray<TUint>& aOperations)
+	{
+	return MrcboDoSupportedOperations(aId, aInterfaceUid, aOperations);
+	}
+
+EXPORT_C void MRemConBearerObserver::SetRemoteAddressedClient(const TUid& aBearerUid, const TRemConClientId& aId)
+	{
+	MrcboDoSetRemoteAddressedClient(aBearerUid, aId);
+	}
+
+EXPORT_C TInt MRemConBearerObserver::RegisterLocalAddressedClientObserver(const TUid& aBearerUid)
+	{
+	return MrcboDoRegisterLocalAddressedClientObserver(aBearerUid);
+	}
+
+EXPORT_C TInt MRemConBearerObserver::UnregisterLocalAddressedClientObserver(const TUid& aBearerUid)
+	{
+	return MrcboDoUnregisterLocalAddressedClientObserver(aBearerUid);
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/bearerplugin/src/remconbearerplugin.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,65 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Implementation of Rem Con bearer plugin.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconbearerplugin.h>
+#include <ecom/ecom.h>
+#include <remcon/bearerparams.h>
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+EXPORT_C CRemConBearerPlugin::~CRemConBearerPlugin()
+	{
+	LOG_FUNC
+	REComSession::DestroyedImplementation(iInstanceId);
+	}
+
+EXPORT_C CRemConBearerPlugin::CRemConBearerPlugin(TBearerParams& aParams)
+:	iObserver(aParams.Observer()),
+	iImplementationUid(aParams.ImplementationUid())
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C CRemConBearerPlugin* CRemConBearerPlugin::NewL(TBearerParams& aParams)
+	{
+	CRemConBearerPlugin* self = reinterpret_cast<CRemConBearerPlugin*>(
+		REComSession::CreateImplementationL(
+			aParams.ImplementationUid(), 
+			_FOFF(CRemConBearerPlugin, iInstanceId),
+			(TAny*)&aParams)
+		);
+
+	return self;
+	}
+
+EXPORT_C MRemConBearerObserver& CRemConBearerPlugin::Observer()
+	{
+	return iObserver;
+	}
+
+EXPORT_C TUid CRemConBearerPlugin::Uid() const
+	{
+	return iImplementationUid;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,27 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// bld.inf for Rem Con client side.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "inner/group/bld.inf"
+#include "intermediate/group/bld.inf"
+#include "coreapi/group/bld.inf"
+#include "extapi1/group/bld.inf"
+#include "sidekeyapi/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/common/remconbulkclient.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,162 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Remote Control bulk client side.
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCONBULKCLIENT_H
+#define REMCONBULKCLIENT_H
+
+#include <e32base.h>
+#include <remcon/messagetype.h>
+#include "remconserver.h"
+
+/**
+The abstract base class for RemCon session handles.
+*/
+NONSHARABLE_CLASS(RRemConBulk) : public RSessionBase
+	{
+public:
+	IMPORT_C RRemConBulk();
+	
+	/**
+	Connect the handle to the server.
+	Must be called before all other methods (except Version and Close).
+	@return Error.
+	*/
+	IMPORT_C TInt Connect();
+
+	/**
+	Getter for the version of the server.
+	@return Version of the server.
+	*/
+	IMPORT_C TVersion Version() const;
+
+	/**
+	Sends a message (command or response) to the remote device.
+	Note that currently only responses are supported, but the API
+	is generic enough for both types of message.
+	@param aStatus TRequestStatus for asynchronous completion.
+	@param aInterfaceUid The UID of the interface to which the message 
+	belongs.
+	@param aOperationId The ID of the message. RemCon needs to know this, 
+	separately from the arbitrary data, so it can (a) match up any incoming 
+	response to this client (if the message is a command), and (b) match this 
+	message up to the target (if this message is a response).
+	@param aData Data associated with the message.
+	*/
+	IMPORT_C void Send(TRequestStatus& aStatus, 
+		TUid aInterfaceUid, 
+		TUint aOperationId, 
+		const TDesC8& aData = KNullDesC8());
+	
+	/**
+	Sends a message (command or response) unreliably to the remote device.
+	Note that currently only reponses are supported, by the API is 
+	generic enough for both types of message.
+	@param aInterfaceUid The UID of the interface to which the message 
+	belongs.
+	@param aOperationId The ID of the message. RemCon needs to know this, 
+	separately from the arbitrary data, so it can (a) match up any incoming 
+	response to this client (if the message is a command), and (b) match this 
+	message up to the target (if this message is a response).
+	@param aData Data associated with the message.
+	@return Error - this is the first point of error.  A message may error
+	after this function returns (that error will not be reported).
+	*/
+	IMPORT_C TInt SendUnreliable(TUid aInterfaceUid, 
+			TUint aOperationId,
+			const TDesC8& aData = KNullDesC8());
+
+	/**
+	Cancels interest in the completion of an outstanding Send operation.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt SendCancel();
+
+	/**
+	Receive a message (command or response) from the remote device. Note that 
+	RemCon server queues both commands and responses so that none are ever 
+	thrown away just because the client didn't have a Receive outstanding when 
+	they arrived.
+	@param aStatus TRequestStatus for asynchronous completion.
+	@param aInterfaceUid The UID of the interface to which the message 
+	belongs.
+	@param aOperationId The ID of the message.
+	@param aData Data associated with the message.
+	*/
+	IMPORT_C void Receive(TRequestStatus& aStatus, 
+		TUid& aInterfaceUid,
+		TUint& aOperationId,
+		TDes8& aData);
+
+	/**
+	Cancels interest in the completion of an outstanding Receive operation.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt ReceiveCancel();
+
+	/**
+	Marks the start of heap cell checking in the server's heap. In release 
+	builds, just returns KErrNone.
+	@return Error.
+	*/
+	IMPORT_C TInt __DbgMarkHeap();
+
+	/**
+	Checks that the number of allocated cells on the server's heap is correct. 
+	The server is panicked if not. In release builds, just returns KErrNone.
+	@param aCount The expected number of allocated heap cells.
+	@return Error.
+	*/
+	IMPORT_C TInt __DbgCheckHeap(TInt aCount);
+
+	/**
+	Marks the end of heap cell checking. Checks that the number of heap cells 
+	allocated since the last __DbgMarkHeap() is aCount; the most common value 
+	to pass here is zero. In release builds, just returns KErrNone.
+	@param aCount The expected number of allocated heap cells.
+	@return Error.
+	*/
+	IMPORT_C TInt __DbgMarkEnd(TInt aCount);
+
+	/**
+	Simulates memory allocation failure in the server. In release builds, just 
+	returns KErrNone.
+	@param aCount The number of allocations after which memory allocation 
+	should fail.
+	@return Error.
+	*/
+	IMPORT_C TInt __DbgFailNext(TInt aCount);
+
+private: // owned
+	/** 
+	Used by Send.
+	*/
+	TPckgBuf<TOperationInformation> iOpInfoPckg;
+	
+	/** 
+	Used by Receive.
+	*/
+	TPckg<TUint> iUidPckg;
+	TPckg<TUint> iOpIdPckg;
+	};
+
+#endif // REMCONBULKCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/common/remconclient.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,322 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Remote Control client side.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCONCLIENT_H
+#define REMCONCLIENT_H
+
+#include <remcon/clienttype.h>
+#include <remcon/messagetype.h>
+#include <remcon/playertype.h>
+#include "operationinformation.h"
+#include "remconserver.h"
+
+class TRemConAddress;
+
+/**
+The abstract base class for RemCon session handles.
+*/
+NONSHARABLE_CLASS(RRemCon) : public RSessionBase
+	{
+public:
+	/**
+	Connect the handle to the server.
+	Must be called before all other methods (except Version and Close).
+	@return Error.
+	*/
+	IMPORT_C TInt Connect();
+
+	/**
+	Connect the handle to the server.
+	Must be called before all other methods (except Version and Close).
+	@param aPlayerType  The type of client player
+	@param aPlayerSubType The sub-type of the client player
+	@param aName The name of client player
+	@return Error.
+	*/
+	IMPORT_C TInt Connect(const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName);
+	/**
+	Getter for the version of the server.
+	@return Version of the server.
+	*/
+	virtual TVersion Version() const = 0;
+
+	/**
+	Sends a message (command or response) to the remote device.
+	@param aStatus TRequestStatus for asynchronous completion.
+	@param aInterfaceUid The UID of the interface to which the message 
+	belongs.
+	@param aOperationId The ID of the message. RemCon needs to know this, 
+	separately from the arbitrary data, so it can (a) match up any incoming 
+	response to this client (if the message is a command), and (b) match this 
+	message up to the target (if this message is a response).
+	@param aNumRemotes On success only, the number of remotes the message was 
+	successfully sent to (at the bearer level). If the message is a command 
+	from a connection-oriented controller, then on success aNumRemotes will be 
+	1. [For consistency, this pattern holds if the message is a response, even 
+	though the information is redundant.] If the message is a command from a 
+	connectionless controller, then aNumRemotes will be zero or more, 
+	depending on what the TSP said should be done with the message and how 
+	many of the TSP-nominated bearers successfully sent the message.
+	@param aData Data associated with the message.
+	*/
+	IMPORT_C void Send(TRequestStatus& aStatus, 
+		TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint& aNumRemotes,
+		TRemConMessageSubType aSubType,
+		const TDesC8& aData = KNullDesC8());
+	
+	IMPORT_C void SendNotify(TRequestStatus& aStatus, 
+			TUid aInterfaceUid, 
+			TUint aOperationId, 
+			TRemConMessageSubType aSubType,
+			const TDesC8& aData = KNullDesC8());
+	
+	IMPORT_C TInt SendUnreliable(	TUid aInterfaceUid, 
+			TUint aOperationId,
+			TRemConMessageSubType aSubType,
+			const TDesC8& aData = KNullDesC8());
+
+	/**
+	Cancels interest in the completion of an outstanding Send operation.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt SendCancel();
+
+	/**
+	Receive a message (command or response) from the remote device. Note that 
+	RemCon server queues both commands and responses so that none are ever 
+	thrown away just because the client didn't have a Receive outstanding when 
+	they arrived.
+	@param aStatus TRequestStatus for asynchronous completion.
+	@param aReceivePackage A struct containing the received message.
+	@param aData Data associated with the message.
+	*/
+	IMPORT_C void Receive(TRequestStatus& aStatus, 
+		TRemConClientReceivePackage& aReceivePackage,
+		TDes8& aData);
+
+	/**
+	Cancels interest in the completion of an outstanding Receive operation.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt ReceiveCancel();
+
+	/**
+	Getter for the current set of connections in the system (not just those 
+	associated with this session). The client is responsible for cleaning up 
+	the collection- the addresses are on the client's heap.
+	@param aConnections A collection of remote addresses, representing all the 
+	currently extant connections. Must be empty when this function is called.
+	@return Error.
+	*/
+	IMPORT_C TInt GetConnections(TSglQue<TRemConAddress>& aConnections);
+
+	/**
+	Notification for changes in the set of connections.
+	This completes whenever the set of connections changes in some way. 
+	If they wish to know what specifically changed, the client must call 
+	GetConnections and do their own analysis of the results from that.
+	Changes to the connection history of the system are logged internally so 
+	that the client will not 'miss' any changes by not reposting the 
+	notification quickly enough. However, if more than one bearer-level 
+	connection change occurs in the server before the notification is reposted 
+	by the client, then the following notification completion may 'cover' more 
+	than one actual state change. 
+	@param aStatus TRequestStatus for asynchronous completion.
+	*/
+	IMPORT_C void NotifyConnectionsChange(TRequestStatus& aStatus);
+
+	/**
+	Cancels interest in the completion of an outstanding 
+	NotifyConnectionsChange operation.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt NotifyConnectionsChangeCancel();
+
+	/** 
+	 Tells the server in which APIs the client is interested. The server 
+	 will only deliver incoming commands of these APIs to the client.
+	 @param aNumAPIs The number of APIs to be registered
+	 @param aAPIs A concatenated string of UIDs for the interfaces present. 
+	 @return The error code returned from the server.
+	 */
+	IMPORT_C TInt RegisterInterestedAPIs(const TDesC8& aAPIs);
+	
+	/**
+	Marks the start of heap cell checking in the server's heap. In release 
+	builds, just returns KErrNone.
+	@return Error.
+	*/
+	IMPORT_C TInt __DbgMarkHeap();
+
+	/**
+	Checks that the number of allocated cells on the server's heap is correct. 
+	The server is panicked if not. In release builds, just returns KErrNone.
+	@param aCount The expected number of allocated heap cells.
+	@return Error.
+	*/
+	IMPORT_C TInt __DbgCheckHeap(TInt aCount);
+
+	/**
+	Marks the end of heap cell checking. Checks that the number of heap cells 
+	allocated since the last __DbgMarkHeap() is aCount; the most common value 
+	to pass here is zero. In release builds, just returns KErrNone.
+	@param aCount The expected number of allocated heap cells.
+	@return Error.
+	*/
+	IMPORT_C TInt __DbgMarkEnd(TInt aCount);
+
+	/**
+	Simulates memory allocation failure in the server. In release builds, just 
+	returns KErrNone.
+	@param aCount The number of allocations after which memory allocation 
+	should fail.
+	@return Error.
+	*/
+	IMPORT_C TInt __DbgFailNext(TInt aCount);
+
+protected:
+	/**
+	@param aType The type of the session.
+	*/
+	RRemCon(TRemConClientType aType);
+
+private: // utility
+	TInt DoConnect();
+	TInt SetPlayerType(const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName);
+
+private: // owned
+	const TRemConClientType iClientType;
+
+	/** 
+	Used by Send.
+	*/
+	TPckg<TUint> iNumRemotesPckg;
+	TPckgBuf<TOperationInformation> iOpInfoPckg;
+	
+	/** 
+	Used by Receive.
+	*/
+	TPckg<TRemConClientReceivePackage> iReceivePckg;
+	TPckgBuf<TPlayerTypeInformation> iPlayerTypePckg;
+	};
+
+/**
+The concrete session class for RemCon controllers.
+Controller sessions are connectionless when opened. This means that addressing 
+of commands is done by the Target Selector Plugin (TSP). A controller may 
+alternatively be connection-oriented, which means that addressing of commands 
+is done using a member of the server-side session which specifies a connection 
+to a remote device. [NB Just because a session 'points to' a connection in 
+this way does not means that the connection necessarily exists at the bearer 
+level or at any other level.]
+To make a controller session connection-oriented, call GoConnectionOriented. 
+On success, the session's remote address member will have been set to the 
+requested remote address.
+To make a session connectionless again, use GoConnectionless. On success, the 
+remote address member will be null, indicating that the TSP will be used to 
+address our commands.
+To control bearer-level connections, use ConnectBearer and DisconnectBearer. 
+Note that real connections may, depending on the bearer, be torn down by the 
+remote end outside of our control. Use GetConnections (and the associated 
+notification) to get information about the current state of the real 
+connections. Note however that the client is not _required_ to be interested 
+in this level of control as RemCon is responsible for making sure the required 
+connection exists at the bearer level before sending the message. The level of 
+control mentioned is provided to the client so that it can, for instance, 
+ensure adequate responsiveness of the first command sent.
+ConnectBearerCancel and DisconnectBearerCancel merely cancel interest in the 
+corresponding request. They do not change the state of the system, bearers, 
+connections, or member data in any other way. They operate as pure Symbian OS 
+asynchronous cancel methods.
+*/
+NONSHARABLE_CLASS(RRemConController) : public RRemCon
+	{
+public:
+	IMPORT_C RRemConController();
+
+	/**
+	Makes the session connection-oriented. On success, the given connection 
+	data will be used for sending commands.
+	@param aBearerUid The UID of the bearer to use.
+	@param aData Optional bearer-specific connection data.
+	@return Error.
+	*/
+	IMPORT_C TInt GoConnectionOriented(const TRemConAddress& aConnection);
+
+	/**
+	Makes the session connectionless. On success, the TSP will be used for 
+	sending commands.
+	@return Error.
+	*/
+	IMPORT_C TInt GoConnectionless();
+
+	/** 
+	Establish a bearer-level connection using the information supplied in 
+	GoConnectionOriented.
+	@param aStatus Used by the server to indicate completion of the request.
+	*/	
+	IMPORT_C void ConnectBearer(TRequestStatus& aStatus);
+
+	/**
+	Cancels interest in the completion of an outstanding ConnectBearer 
+	request. Does not affect the state of the bearer-level connection.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt ConnectBearerCancel();
+
+	/** 
+	Triggers bearer-level disconnection of the connection specified in 
+	GoConnectionOriented.
+	@param aStatus Used by the server to indicate completion of the request.
+	*/	
+	IMPORT_C void DisconnectBearer(TRequestStatus& aStatus);
+
+	/**
+	Cancels interest in the completion of an outstanding DisconnectBearer 
+	request. Does not affect the state of the bearer-level connection.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt DisconnectBearerCancel();
+
+	/** Returns the version of the RemCon server interface this session supports.
+	@return Supported version
+	*/
+	TVersion Version() const;
+	};
+
+/**
+The concrete session class for RemCon targets.
+*/
+NONSHARABLE_CLASS(RRemConTarget) : public RRemCon
+	{
+public:
+	IMPORT_C RRemConTarget();
+	
+	/** Returns the version of the RemCon server interface this session supports.
+	@return Supported version
+	*/
+	TVersion Version() const;
+	};
+
+#endif // REMCONCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/bwins/remconcoreapiU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,139 @@
+EXPORTS
+	??1CRemConCoreApiController@@UAE@XZ @ 1 NONAME ; CRemConCoreApiController::~CRemConCoreApiController(void)
+	??1CRemConCoreApiTarget@@UAE@XZ @ 2 NONAME ; CRemConCoreApiTarget::~CRemConCoreApiTarget(void)
+	?Angle@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 3 NONAME ; void CRemConCoreApiController::Angle(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?AngleResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 4 NONAME ; void CRemConCoreApiTarget::AngleResponse(class TRequestStatus &, int)
+	?Backward@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 5 NONAME ; void CRemConCoreApiController::Backward(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?BackwardResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 6 NONAME ; void CRemConCoreApiTarget::BackwardResponse(class TRequestStatus &, int)
+	?ChannelDown@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 7 NONAME ; void CRemConCoreApiController::ChannelDown(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?ChannelDownResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 8 NONAME ; void CRemConCoreApiTarget::ChannelDownResponse(class TRequestStatus &, int)
+	?ChannelUp@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 9 NONAME ; void CRemConCoreApiController::ChannelUp(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?ChannelUpResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 10 NONAME ; void CRemConCoreApiTarget::ChannelUpResponse(class TRequestStatus &, int)
+	?Clear@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 11 NONAME ; void CRemConCoreApiController::Clear(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?ClearResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 12 NONAME ; void CRemConCoreApiTarget::ClearResponse(class TRequestStatus &, int)
+	?ContentsMenu@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 13 NONAME ; void CRemConCoreApiController::ContentsMenu(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?ContentsMenuResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 14 NONAME ; void CRemConCoreApiTarget::ContentsMenuResponse(class TRequestStatus &, int)
+	?DisplayInformation@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 15 NONAME ; void CRemConCoreApiController::DisplayInformation(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?DisplayInformationResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 16 NONAME ; void CRemConCoreApiTarget::DisplayInformationResponse(class TRequestStatus &, int)
+	?Dot@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 17 NONAME ; void CRemConCoreApiController::Dot(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?DotResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 18 NONAME ; void CRemConCoreApiTarget::DotResponse(class TRequestStatus &, int)
+	?Down@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 19 NONAME ; void CRemConCoreApiController::Down(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?DownResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 20 NONAME ; void CRemConCoreApiTarget::DownResponse(class TRequestStatus &, int)
+	?Eject@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 21 NONAME ; void CRemConCoreApiController::Eject(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?EjectResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 22 NONAME ; void CRemConCoreApiTarget::EjectResponse(class TRequestStatus &, int)
+	?Enter@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 23 NONAME ; void CRemConCoreApiController::Enter(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?EnterResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 24 NONAME ; void CRemConCoreApiTarget::EnterResponse(class TRequestStatus &, int)
+	?Exit@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 25 NONAME ; void CRemConCoreApiController::Exit(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?ExitResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 26 NONAME ; void CRemConCoreApiTarget::ExitResponse(class TRequestStatus &, int)
+	?F1@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 27 NONAME ; void CRemConCoreApiController::F1(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?F1Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 28 NONAME ; void CRemConCoreApiTarget::F1Response(class TRequestStatus &, int)
+	?F2@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 29 NONAME ; void CRemConCoreApiController::F2(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?F2Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 30 NONAME ; void CRemConCoreApiTarget::F2Response(class TRequestStatus &, int)
+	?F3@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 31 NONAME ; void CRemConCoreApiController::F3(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?F3Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 32 NONAME ; void CRemConCoreApiTarget::F3Response(class TRequestStatus &, int)
+	?F4@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 33 NONAME ; void CRemConCoreApiController::F4(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?F4Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 34 NONAME ; void CRemConCoreApiTarget::F4Response(class TRequestStatus &, int)
+	?F5@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 35 NONAME ; void CRemConCoreApiController::F5(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?F5Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 36 NONAME ; void CRemConCoreApiTarget::F5Response(class TRequestStatus &, int)
+	?FastForward@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 37 NONAME ; void CRemConCoreApiController::FastForward(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?FastForwardResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 38 NONAME ; void CRemConCoreApiTarget::FastForwardResponse(class TRequestStatus &, int)
+	?FavoriteMenu@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 39 NONAME ; void CRemConCoreApiController::FavoriteMenu(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?FavoriteMenuResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 40 NONAME ; void CRemConCoreApiTarget::FavoriteMenuResponse(class TRequestStatus &, int)
+	?Forward@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 41 NONAME ; void CRemConCoreApiController::Forward(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?ForwardResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 42 NONAME ; void CRemConCoreApiTarget::ForwardResponse(class TRequestStatus &, int)
+	?Help@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 43 NONAME ; void CRemConCoreApiController::Help(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?HelpResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 44 NONAME ; void CRemConCoreApiTarget::HelpResponse(class TRequestStatus &, int)
+	?InputSelect@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 45 NONAME ; void CRemConCoreApiController::InputSelect(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?InputSelectResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 46 NONAME ; void CRemConCoreApiTarget::InputSelectResponse(class TRequestStatus &, int)
+	?Left@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 47 NONAME ; void CRemConCoreApiController::Left(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?LeftDown@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 48 NONAME ; void CRemConCoreApiController::LeftDown(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?LeftDownResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 49 NONAME ; void CRemConCoreApiTarget::LeftDownResponse(class TRequestStatus &, int)
+	?LeftResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 50 NONAME ; void CRemConCoreApiTarget::LeftResponse(class TRequestStatus &, int)
+	?LeftUp@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 51 NONAME ; void CRemConCoreApiController::LeftUp(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?LeftUpResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 52 NONAME ; void CRemConCoreApiTarget::LeftUpResponse(class TRequestStatus &, int)
+	?MrccacoResponse@MRemConCoreApiControllerObserver@@UAEXW4TRemConCoreApiOperationId@@H@Z @ 53 NONAME ; void MRemConCoreApiControllerObserver::MrccacoResponse(enum TRemConCoreApiOperationId, int)
+	?MrccatoCommand@MRemConCoreApiTargetObserver@@UAEXW4TRemConCoreApiOperationId@@W4TRemConCoreApiButtonAction@@@Z @ 54 NONAME ; void MRemConCoreApiTargetObserver::MrccatoCommand(enum TRemConCoreApiOperationId, enum TRemConCoreApiButtonAction)
+	?MrccatoPlay@MRemConCoreApiTargetObserver@@UAEXW4TRemConCoreApiPlaybackSpeed@@W4TRemConCoreApiButtonAction@@@Z @ 55 NONAME ; void MRemConCoreApiTargetObserver::MrccatoPlay(enum TRemConCoreApiPlaybackSpeed, enum TRemConCoreApiButtonAction)
+	?MrccatoSelectAudioInputFunction@MRemConCoreApiTargetObserver@@UAEXEW4TRemConCoreApiButtonAction@@@Z @ 56 NONAME ; void MRemConCoreApiTargetObserver::MrccatoSelectAudioInputFunction(unsigned char, enum TRemConCoreApiButtonAction)
+	?MrccatoSelectAvInputFunction@MRemConCoreApiTargetObserver@@UAEXEW4TRemConCoreApiButtonAction@@@Z @ 57 NONAME ; void MRemConCoreApiTargetObserver::MrccatoSelectAvInputFunction(unsigned char, enum TRemConCoreApiButtonAction)
+	?MrccatoSelectDiskFunction@MRemConCoreApiTargetObserver@@UAEXIW4TRemConCoreApiButtonAction@@@Z @ 58 NONAME ; void MRemConCoreApiTargetObserver::MrccatoSelectDiskFunction(unsigned int, enum TRemConCoreApiButtonAction)
+	?MrccatoTuneFunction@MRemConCoreApiTargetObserver@@UAEXHIIW4TRemConCoreApiButtonAction@@@Z @ 59 NONAME ; void MRemConCoreApiTargetObserver::MrccatoTuneFunction(int, unsigned int, unsigned int, enum TRemConCoreApiButtonAction)
+	?Mute@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 60 NONAME ; void CRemConCoreApiController::Mute(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?MuteResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 61 NONAME ; void CRemConCoreApiTarget::MuteResponse(class TRequestStatus &, int)
+	?NewL@CRemConCoreApiController@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConCoreApiControllerObserver@@@Z @ 62 NONAME ; class CRemConCoreApiController * CRemConCoreApiController::NewL(class CRemConInterfaceSelector &, class MRemConCoreApiControllerObserver &)
+	?NewL@CRemConCoreApiTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConCoreApiTargetObserver@@@Z @ 63 NONAME ; class CRemConCoreApiTarget * CRemConCoreApiTarget::NewL(class CRemConInterfaceSelector &, class MRemConCoreApiTargetObserver &)
+	?PageDown@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 64 NONAME ; void CRemConCoreApiController::PageDown(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?PageDownResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 65 NONAME ; void CRemConCoreApiTarget::PageDownResponse(class TRequestStatus &, int)
+	?PageUp@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 66 NONAME ; void CRemConCoreApiController::PageUp(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?PageUpResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 67 NONAME ; void CRemConCoreApiTarget::PageUpResponse(class TRequestStatus &, int)
+	?Pause@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 68 NONAME ; void CRemConCoreApiController::Pause(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?PausePlayFunction@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 69 NONAME ; void CRemConCoreApiController::PausePlayFunction(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?PausePlayFunctionResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 70 NONAME ; void CRemConCoreApiTarget::PausePlayFunctionResponse(class TRequestStatus &, int)
+	?PauseResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 71 NONAME ; void CRemConCoreApiTarget::PauseResponse(class TRequestStatus &, int)
+	?Play@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@W4TRemConCoreApiPlaybackSpeed@@@Z @ 72 NONAME ; void CRemConCoreApiController::Play(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction, enum TRemConCoreApiPlaybackSpeed)
+	?PlayResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 73 NONAME ; void CRemConCoreApiTarget::PlayResponse(class TRequestStatus &, int)
+	?Power@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 74 NONAME ; void CRemConCoreApiController::Power(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?PowerResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 75 NONAME ; void CRemConCoreApiTarget::PowerResponse(class TRequestStatus &, int)
+	?PreviousChannel@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 76 NONAME ; void CRemConCoreApiController::PreviousChannel(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?PreviousChannelResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 77 NONAME ; void CRemConCoreApiTarget::PreviousChannelResponse(class TRequestStatus &, int)
+	?Record@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 78 NONAME ; void CRemConCoreApiController::Record(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?RecordResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 79 NONAME ; void CRemConCoreApiTarget::RecordResponse(class TRequestStatus &, int)
+	?RestoreVolumeFunction@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 80 NONAME ; void CRemConCoreApiController::RestoreVolumeFunction(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?RestoreVolumeFunctionResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 81 NONAME ; void CRemConCoreApiTarget::RestoreVolumeFunctionResponse(class TRequestStatus &, int)
+	?Rewind@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 82 NONAME ; void CRemConCoreApiController::Rewind(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?RewindResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 83 NONAME ; void CRemConCoreApiTarget::RewindResponse(class TRequestStatus &, int)
+	?Right@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 84 NONAME ; void CRemConCoreApiController::Right(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?RightDown@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 85 NONAME ; void CRemConCoreApiController::RightDown(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?RightDownResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 86 NONAME ; void CRemConCoreApiTarget::RightDownResponse(class TRequestStatus &, int)
+	?RightResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 87 NONAME ; void CRemConCoreApiTarget::RightResponse(class TRequestStatus &, int)
+	?RightUp@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 88 NONAME ; void CRemConCoreApiController::RightUp(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?RightUpResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 89 NONAME ; void CRemConCoreApiTarget::RightUpResponse(class TRequestStatus &, int)
+	?RootMenu@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 90 NONAME ; void CRemConCoreApiController::RootMenu(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?RootMenuResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 91 NONAME ; void CRemConCoreApiTarget::RootMenuResponse(class TRequestStatus &, int)
+	?Select@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 92 NONAME ; void CRemConCoreApiController::Select(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?SelectAudioInputFunction@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIEW4TRemConCoreApiButtonAction@@@Z @ 93 NONAME ; void CRemConCoreApiController::SelectAudioInputFunction(class TRequestStatus &, unsigned int &, unsigned char, enum TRemConCoreApiButtonAction)
+	?SelectAudioInputFunctionResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 94 NONAME ; void CRemConCoreApiTarget::SelectAudioInputFunctionResponse(class TRequestStatus &, int)
+	?SelectAvInputFunction@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIEW4TRemConCoreApiButtonAction@@@Z @ 95 NONAME ; void CRemConCoreApiController::SelectAvInputFunction(class TRequestStatus &, unsigned int &, unsigned char, enum TRemConCoreApiButtonAction)
+	?SelectAvInputFunctionResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 96 NONAME ; void CRemConCoreApiTarget::SelectAvInputFunctionResponse(class TRequestStatus &, int)
+	?SelectDiskFunction@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIIW4TRemConCoreApiButtonAction@@@Z @ 97 NONAME ; void CRemConCoreApiController::SelectDiskFunction(class TRequestStatus &, unsigned int &, unsigned int, enum TRemConCoreApiButtonAction)
+	?SelectDiskFunctionResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 98 NONAME ; void CRemConCoreApiTarget::SelectDiskFunctionResponse(class TRequestStatus &, int)
+	?SelectResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 99 NONAME ; void CRemConCoreApiTarget::SelectResponse(class TRequestStatus &, int)
+	?SetupMenu@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 100 NONAME ; void CRemConCoreApiController::SetupMenu(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?SetupMenuResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 101 NONAME ; void CRemConCoreApiTarget::SetupMenuResponse(class TRequestStatus &, int)
+	?SoundSelect@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 102 NONAME ; void CRemConCoreApiController::SoundSelect(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?SoundSelectResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 103 NONAME ; void CRemConCoreApiTarget::SoundSelectResponse(class TRequestStatus &, int)
+	?Stop@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 104 NONAME ; void CRemConCoreApiController::Stop(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?StopResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 105 NONAME ; void CRemConCoreApiTarget::StopResponse(class TRequestStatus &, int)
+	?Subpicture@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 106 NONAME ; void CRemConCoreApiController::Subpicture(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?SubpictureResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 107 NONAME ; void CRemConCoreApiTarget::SubpictureResponse(class TRequestStatus &, int)
+	?TuneFunction@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIHIIW4TRemConCoreApiButtonAction@@@Z @ 108 NONAME ; void CRemConCoreApiController::TuneFunction(class TRequestStatus &, unsigned int &, int, unsigned int, unsigned int, enum TRemConCoreApiButtonAction)
+	?TuneFunctionResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 109 NONAME ; void CRemConCoreApiTarget::TuneFunctionResponse(class TRequestStatus &, int)
+	?Up@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 110 NONAME ; void CRemConCoreApiController::Up(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?UpResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 111 NONAME ; void CRemConCoreApiTarget::UpResponse(class TRequestStatus &, int)
+	?VolumeDown@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 112 NONAME ; void CRemConCoreApiController::VolumeDown(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?VolumeDownResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 113 NONAME ; void CRemConCoreApiTarget::VolumeDownResponse(class TRequestStatus &, int)
+	?VolumeUp@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 114 NONAME ; void CRemConCoreApiController::VolumeUp(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?VolumeUpResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 115 NONAME ; void CRemConCoreApiTarget::VolumeUpResponse(class TRequestStatus &, int)
+	?_0@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 116 NONAME ; void CRemConCoreApiController::_0(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?_0Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 117 NONAME ; void CRemConCoreApiTarget::_0Response(class TRequestStatus &, int)
+	?_1@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 118 NONAME ; void CRemConCoreApiController::_1(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?_1Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 119 NONAME ; void CRemConCoreApiTarget::_1Response(class TRequestStatus &, int)
+	?_2@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 120 NONAME ; void CRemConCoreApiController::_2(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?_2Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 121 NONAME ; void CRemConCoreApiTarget::_2Response(class TRequestStatus &, int)
+	?_3@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 122 NONAME ; void CRemConCoreApiController::_3(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?_3Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 123 NONAME ; void CRemConCoreApiTarget::_3Response(class TRequestStatus &, int)
+	?_4@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 124 NONAME ; void CRemConCoreApiController::_4(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?_4Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 125 NONAME ; void CRemConCoreApiTarget::_4Response(class TRequestStatus &, int)
+	?_5@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 126 NONAME ; void CRemConCoreApiController::_5(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?_5Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 127 NONAME ; void CRemConCoreApiTarget::_5Response(class TRequestStatus &, int)
+	?_6@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 128 NONAME ; void CRemConCoreApiController::_6(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?_6Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 129 NONAME ; void CRemConCoreApiTarget::_6Response(class TRequestStatus &, int)
+	?_7@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 130 NONAME ; void CRemConCoreApiController::_7(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?_7Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 131 NONAME ; void CRemConCoreApiTarget::_7Response(class TRequestStatus &, int)
+	?_8@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 132 NONAME ; void CRemConCoreApiController::_8(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?_8Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 133 NONAME ; void CRemConCoreApiTarget::_8Response(class TRequestStatus &, int)
+	?_9@CRemConCoreApiController@@QAEXAAVTRequestStatus@@AAIW4TRemConCoreApiButtonAction@@@Z @ 134 NONAME ; void CRemConCoreApiController::_9(class TRequestStatus &, unsigned int &, enum TRemConCoreApiButtonAction)
+	?_9Response@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@H@Z @ 135 NONAME ; void CRemConCoreApiTarget::_9Response(class TRequestStatus &, int)
+	?SendResponse@CRemConCoreApiTarget@@QAEXAAVTRequestStatus@@W4TRemConCoreApiOperationId@@H@Z @ 136 NONAME ; void CRemConCoreApiTarget::SendResponse(class TRequestStatus &, enum TRemConCoreApiOperationId, int)
+	?NewL@CRemConCoreApiTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConCoreApiTargetObserver@@ABV?$RArray@W4TRemConCoreApiOperationId@@@@@Z @ 137 NONAME ; class CRemConCoreApiTarget * CRemConCoreApiTarget::NewL(class CRemConInterfaceSelector &, class MRemConCoreApiTargetObserver &, class RArray<enum TRemConCoreApiOperationId> const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/eabi/remconcoreapiU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,147 @@
+EXPORTS
+	_ZN20CRemConCoreApiTarget10F1ResponseER14TRequestStatusi @ 1 NONAME
+	_ZN20CRemConCoreApiTarget10F2ResponseER14TRequestStatusi @ 2 NONAME
+	_ZN20CRemConCoreApiTarget10F3ResponseER14TRequestStatusi @ 3 NONAME
+	_ZN20CRemConCoreApiTarget10F4ResponseER14TRequestStatusi @ 4 NONAME
+	_ZN20CRemConCoreApiTarget10F5ResponseER14TRequestStatusi @ 5 NONAME
+	_ZN20CRemConCoreApiTarget10UpResponseER14TRequestStatusi @ 6 NONAME
+	_ZN20CRemConCoreApiTarget10_0ResponseER14TRequestStatusi @ 7 NONAME
+	_ZN20CRemConCoreApiTarget10_1ResponseER14TRequestStatusi @ 8 NONAME
+	_ZN20CRemConCoreApiTarget10_2ResponseER14TRequestStatusi @ 9 NONAME
+	_ZN20CRemConCoreApiTarget10_3ResponseER14TRequestStatusi @ 10 NONAME
+	_ZN20CRemConCoreApiTarget10_4ResponseER14TRequestStatusi @ 11 NONAME
+	_ZN20CRemConCoreApiTarget10_5ResponseER14TRequestStatusi @ 12 NONAME
+	_ZN20CRemConCoreApiTarget10_6ResponseER14TRequestStatusi @ 13 NONAME
+	_ZN20CRemConCoreApiTarget10_7ResponseER14TRequestStatusi @ 14 NONAME
+	_ZN20CRemConCoreApiTarget10_8ResponseER14TRequestStatusi @ 15 NONAME
+	_ZN20CRemConCoreApiTarget10_9ResponseER14TRequestStatusi @ 16 NONAME
+	_ZN20CRemConCoreApiTarget11DotResponseER14TRequestStatusi @ 17 NONAME
+	_ZN20CRemConCoreApiTarget12DownResponseER14TRequestStatusi @ 18 NONAME
+	_ZN20CRemConCoreApiTarget12ExitResponseER14TRequestStatusi @ 19 NONAME
+	_ZN20CRemConCoreApiTarget12HelpResponseER14TRequestStatusi @ 20 NONAME
+	_ZN20CRemConCoreApiTarget12LeftResponseER14TRequestStatusi @ 21 NONAME
+	_ZN20CRemConCoreApiTarget12MuteResponseER14TRequestStatusi @ 22 NONAME
+	_ZN20CRemConCoreApiTarget12PlayResponseER14TRequestStatusi @ 23 NONAME
+	_ZN20CRemConCoreApiTarget12StopResponseER14TRequestStatusi @ 24 NONAME
+	_ZN20CRemConCoreApiTarget13AngleResponseER14TRequestStatusi @ 25 NONAME
+	_ZN20CRemConCoreApiTarget13ClearResponseER14TRequestStatusi @ 26 NONAME
+	_ZN20CRemConCoreApiTarget13EjectResponseER14TRequestStatusi @ 27 NONAME
+	_ZN20CRemConCoreApiTarget13EnterResponseER14TRequestStatusi @ 28 NONAME
+	_ZN20CRemConCoreApiTarget13PauseResponseER14TRequestStatusi @ 29 NONAME
+	_ZN20CRemConCoreApiTarget13PowerResponseER14TRequestStatusi @ 30 NONAME
+	_ZN20CRemConCoreApiTarget13RightResponseER14TRequestStatusi @ 31 NONAME
+	_ZN20CRemConCoreApiTarget14LeftUpResponseER14TRequestStatusi @ 32 NONAME
+	_ZN20CRemConCoreApiTarget14PageUpResponseER14TRequestStatusi @ 33 NONAME
+	_ZN20CRemConCoreApiTarget14RecordResponseER14TRequestStatusi @ 34 NONAME
+	_ZN20CRemConCoreApiTarget14RewindResponseER14TRequestStatusi @ 35 NONAME
+	_ZN20CRemConCoreApiTarget14SelectResponseER14TRequestStatusi @ 36 NONAME
+	_ZN20CRemConCoreApiTarget15ForwardResponseER14TRequestStatusi @ 37 NONAME
+	_ZN20CRemConCoreApiTarget15RightUpResponseER14TRequestStatusi @ 38 NONAME
+	_ZN20CRemConCoreApiTarget16BackwardResponseER14TRequestStatusi @ 39 NONAME
+	_ZN20CRemConCoreApiTarget16LeftDownResponseER14TRequestStatusi @ 40 NONAME
+	_ZN20CRemConCoreApiTarget16PageDownResponseER14TRequestStatusi @ 41 NONAME
+	_ZN20CRemConCoreApiTarget16RootMenuResponseER14TRequestStatusi @ 42 NONAME
+	_ZN20CRemConCoreApiTarget16VolumeUpResponseER14TRequestStatusi @ 43 NONAME
+	_ZN20CRemConCoreApiTarget17ChannelUpResponseER14TRequestStatusi @ 44 NONAME
+	_ZN20CRemConCoreApiTarget17RightDownResponseER14TRequestStatusi @ 45 NONAME
+	_ZN20CRemConCoreApiTarget17SetupMenuResponseER14TRequestStatusi @ 46 NONAME
+	_ZN20CRemConCoreApiTarget18SubpictureResponseER14TRequestStatusi @ 47 NONAME
+	_ZN20CRemConCoreApiTarget18VolumeDownResponseER14TRequestStatusi @ 48 NONAME
+	_ZN20CRemConCoreApiTarget19ChannelDownResponseER14TRequestStatusi @ 49 NONAME
+	_ZN20CRemConCoreApiTarget19FastForwardResponseER14TRequestStatusi @ 50 NONAME
+	_ZN20CRemConCoreApiTarget19InputSelectResponseER14TRequestStatusi @ 51 NONAME
+	_ZN20CRemConCoreApiTarget19SoundSelectResponseER14TRequestStatusi @ 52 NONAME
+	_ZN20CRemConCoreApiTarget20ContentsMenuResponseER14TRequestStatusi @ 53 NONAME
+	_ZN20CRemConCoreApiTarget20FavoriteMenuResponseER14TRequestStatusi @ 54 NONAME
+	_ZN20CRemConCoreApiTarget20TuneFunctionResponseER14TRequestStatusi @ 55 NONAME
+	_ZN20CRemConCoreApiTarget23PreviousChannelResponseER14TRequestStatusi @ 56 NONAME
+	_ZN20CRemConCoreApiTarget25PausePlayFunctionResponseER14TRequestStatusi @ 57 NONAME
+	_ZN20CRemConCoreApiTarget26DisplayInformationResponseER14TRequestStatusi @ 58 NONAME
+	_ZN20CRemConCoreApiTarget26SelectDiskFunctionResponseER14TRequestStatusi @ 59 NONAME
+	_ZN20CRemConCoreApiTarget29RestoreVolumeFunctionResponseER14TRequestStatusi @ 60 NONAME
+	_ZN20CRemConCoreApiTarget29SelectAvInputFunctionResponseER14TRequestStatusi @ 61 NONAME
+	_ZN20CRemConCoreApiTarget32SelectAudioInputFunctionResponseER14TRequestStatusi @ 62 NONAME
+	_ZN20CRemConCoreApiTarget4NewLER24CRemConInterfaceSelectorR28MRemConCoreApiTargetObserver @ 63 NONAME
+	_ZN20CRemConCoreApiTargetD0Ev @ 64 NONAME
+	_ZN20CRemConCoreApiTargetD1Ev @ 65 NONAME
+	_ZN20CRemConCoreApiTargetD2Ev @ 66 NONAME
+	_ZN24CRemConCoreApiController10SubpictureER14TRequestStatusRj26TRemConCoreApiButtonAction @ 67 NONAME
+	_ZN24CRemConCoreApiController10VolumeDownER14TRequestStatusRj26TRemConCoreApiButtonAction @ 68 NONAME
+	_ZN24CRemConCoreApiController11ChannelDownER14TRequestStatusRj26TRemConCoreApiButtonAction @ 69 NONAME
+	_ZN24CRemConCoreApiController11FastForwardER14TRequestStatusRj26TRemConCoreApiButtonAction @ 70 NONAME
+	_ZN24CRemConCoreApiController11InputSelectER14TRequestStatusRj26TRemConCoreApiButtonAction @ 71 NONAME
+	_ZN24CRemConCoreApiController11SoundSelectER14TRequestStatusRj26TRemConCoreApiButtonAction @ 72 NONAME
+	_ZN24CRemConCoreApiController12ContentsMenuER14TRequestStatusRj26TRemConCoreApiButtonAction @ 73 NONAME
+	_ZN24CRemConCoreApiController12FavoriteMenuER14TRequestStatusRj26TRemConCoreApiButtonAction @ 74 NONAME
+	_ZN24CRemConCoreApiController12TuneFunctionER14TRequestStatusRjijj26TRemConCoreApiButtonAction @ 75 NONAME
+	_ZN24CRemConCoreApiController15PreviousChannelER14TRequestStatusRj26TRemConCoreApiButtonAction @ 76 NONAME
+	_ZN24CRemConCoreApiController17PausePlayFunctionER14TRequestStatusRj26TRemConCoreApiButtonAction @ 77 NONAME
+	_ZN24CRemConCoreApiController18DisplayInformationER14TRequestStatusRj26TRemConCoreApiButtonAction @ 78 NONAME
+	_ZN24CRemConCoreApiController18SelectDiskFunctionER14TRequestStatusRjj26TRemConCoreApiButtonAction @ 79 NONAME
+	_ZN24CRemConCoreApiController21RestoreVolumeFunctionER14TRequestStatusRj26TRemConCoreApiButtonAction @ 80 NONAME
+	_ZN24CRemConCoreApiController21SelectAvInputFunctionER14TRequestStatusRjh26TRemConCoreApiButtonAction @ 81 NONAME
+	_ZN24CRemConCoreApiController24SelectAudioInputFunctionER14TRequestStatusRjh26TRemConCoreApiButtonAction @ 82 NONAME
+	_ZN24CRemConCoreApiController2F1ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 83 NONAME
+	_ZN24CRemConCoreApiController2F2ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 84 NONAME
+	_ZN24CRemConCoreApiController2F3ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 85 NONAME
+	_ZN24CRemConCoreApiController2F4ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 86 NONAME
+	_ZN24CRemConCoreApiController2F5ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 87 NONAME
+	_ZN24CRemConCoreApiController2UpER14TRequestStatusRj26TRemConCoreApiButtonAction @ 88 NONAME
+	_ZN24CRemConCoreApiController2_0ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 89 NONAME
+	_ZN24CRemConCoreApiController2_1ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 90 NONAME
+	_ZN24CRemConCoreApiController2_2ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 91 NONAME
+	_ZN24CRemConCoreApiController2_3ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 92 NONAME
+	_ZN24CRemConCoreApiController2_4ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 93 NONAME
+	_ZN24CRemConCoreApiController2_5ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 94 NONAME
+	_ZN24CRemConCoreApiController2_6ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 95 NONAME
+	_ZN24CRemConCoreApiController2_7ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 96 NONAME
+	_ZN24CRemConCoreApiController2_8ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 97 NONAME
+	_ZN24CRemConCoreApiController2_9ER14TRequestStatusRj26TRemConCoreApiButtonAction @ 98 NONAME
+	_ZN24CRemConCoreApiController3DotER14TRequestStatusRj26TRemConCoreApiButtonAction @ 99 NONAME
+	_ZN24CRemConCoreApiController4DownER14TRequestStatusRj26TRemConCoreApiButtonAction @ 100 NONAME
+	_ZN24CRemConCoreApiController4ExitER14TRequestStatusRj26TRemConCoreApiButtonAction @ 101 NONAME
+	_ZN24CRemConCoreApiController4HelpER14TRequestStatusRj26TRemConCoreApiButtonAction @ 102 NONAME
+	_ZN24CRemConCoreApiController4LeftER14TRequestStatusRj26TRemConCoreApiButtonAction @ 103 NONAME
+	_ZN24CRemConCoreApiController4MuteER14TRequestStatusRj26TRemConCoreApiButtonAction @ 104 NONAME
+	_ZN24CRemConCoreApiController4NewLER24CRemConInterfaceSelectorR32MRemConCoreApiControllerObserver @ 105 NONAME
+	_ZN24CRemConCoreApiController4PlayER14TRequestStatusRj26TRemConCoreApiButtonAction27TRemConCoreApiPlaybackSpeed @ 106 NONAME
+	_ZN24CRemConCoreApiController4StopER14TRequestStatusRj26TRemConCoreApiButtonAction @ 107 NONAME
+	_ZN24CRemConCoreApiController5AngleER14TRequestStatusRj26TRemConCoreApiButtonAction @ 108 NONAME
+	_ZN24CRemConCoreApiController5ClearER14TRequestStatusRj26TRemConCoreApiButtonAction @ 109 NONAME
+	_ZN24CRemConCoreApiController5EjectER14TRequestStatusRj26TRemConCoreApiButtonAction @ 110 NONAME
+	_ZN24CRemConCoreApiController5EnterER14TRequestStatusRj26TRemConCoreApiButtonAction @ 111 NONAME
+	_ZN24CRemConCoreApiController5PauseER14TRequestStatusRj26TRemConCoreApiButtonAction @ 112 NONAME
+	_ZN24CRemConCoreApiController5PowerER14TRequestStatusRj26TRemConCoreApiButtonAction @ 113 NONAME
+	_ZN24CRemConCoreApiController5RightER14TRequestStatusRj26TRemConCoreApiButtonAction @ 114 NONAME
+	_ZN24CRemConCoreApiController6LeftUpER14TRequestStatusRj26TRemConCoreApiButtonAction @ 115 NONAME
+	_ZN24CRemConCoreApiController6PageUpER14TRequestStatusRj26TRemConCoreApiButtonAction @ 116 NONAME
+	_ZN24CRemConCoreApiController6RecordER14TRequestStatusRj26TRemConCoreApiButtonAction @ 117 NONAME
+	_ZN24CRemConCoreApiController6RewindER14TRequestStatusRj26TRemConCoreApiButtonAction @ 118 NONAME
+	_ZN24CRemConCoreApiController6SelectER14TRequestStatusRj26TRemConCoreApiButtonAction @ 119 NONAME
+	_ZN24CRemConCoreApiController7ForwardER14TRequestStatusRj26TRemConCoreApiButtonAction @ 120 NONAME
+	_ZN24CRemConCoreApiController7RightUpER14TRequestStatusRj26TRemConCoreApiButtonAction @ 121 NONAME
+	_ZN24CRemConCoreApiController8BackwardER14TRequestStatusRj26TRemConCoreApiButtonAction @ 122 NONAME
+	_ZN24CRemConCoreApiController8LeftDownER14TRequestStatusRj26TRemConCoreApiButtonAction @ 123 NONAME
+	_ZN24CRemConCoreApiController8PageDownER14TRequestStatusRj26TRemConCoreApiButtonAction @ 124 NONAME
+	_ZN24CRemConCoreApiController8RootMenuER14TRequestStatusRj26TRemConCoreApiButtonAction @ 125 NONAME
+	_ZN24CRemConCoreApiController8VolumeUpER14TRequestStatusRj26TRemConCoreApiButtonAction @ 126 NONAME
+	_ZN24CRemConCoreApiController9ChannelUpER14TRequestStatusRj26TRemConCoreApiButtonAction @ 127 NONAME
+	_ZN24CRemConCoreApiController9RightDownER14TRequestStatusRj26TRemConCoreApiButtonAction @ 128 NONAME
+	_ZN24CRemConCoreApiController9SetupMenuER14TRequestStatusRj26TRemConCoreApiButtonAction @ 129 NONAME
+	_ZN24CRemConCoreApiControllerD0Ev @ 130 NONAME
+	_ZN24CRemConCoreApiControllerD1Ev @ 131 NONAME
+	_ZN24CRemConCoreApiControllerD2Ev @ 132 NONAME
+	_ZN28MRemConCoreApiTargetObserver11MrccatoPlayE27TRemConCoreApiPlaybackSpeed26TRemConCoreApiButtonAction @ 133 NONAME
+	_ZN28MRemConCoreApiTargetObserver14MrccatoCommandE25TRemConCoreApiOperationId26TRemConCoreApiButtonAction @ 134 NONAME
+	_ZN28MRemConCoreApiTargetObserver19MrccatoTuneFunctionEijj26TRemConCoreApiButtonAction @ 135 NONAME
+	_ZN28MRemConCoreApiTargetObserver25MrccatoSelectDiskFunctionEj26TRemConCoreApiButtonAction @ 136 NONAME
+	_ZN28MRemConCoreApiTargetObserver28MrccatoSelectAvInputFunctionEh26TRemConCoreApiButtonAction @ 137 NONAME
+	_ZN28MRemConCoreApiTargetObserver31MrccatoSelectAudioInputFunctionEh26TRemConCoreApiButtonAction @ 138 NONAME
+	_ZN32MRemConCoreApiControllerObserver15MrccacoResponseE25TRemConCoreApiOperationIdi @ 139 NONAME
+	_ZTI28MRemConCoreApiTargetObserver @ 140 NONAME ; #<TI>#
+	_ZTI32MRemConCoreApiControllerObserver @ 141 NONAME ; #<TI>#
+	_ZTV28MRemConCoreApiTargetObserver @ 142 NONAME ; #<VT>#
+	_ZTV32MRemConCoreApiControllerObserver @ 143 NONAME ; #<VT>#
+	_ZN20CRemConCoreApiTarget12SendResponseER14TRequestStatus25TRemConCoreApiOperationIdi @ 144 NONAME
+	_ZN20CRemConCoreApiTarget4NewLER24CRemConInterfaceSelectorR28MRemConCoreApiTargetObserverRK6RArrayI25TRemConCoreApiOperationIdE @ 145 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconcoreapi.mmp
+
+PRJ_EXPORTS
+../public/remconcoreapi.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconcoreapi.h)
+../public/remconcoreapicontroller.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconcoreapicontroller.h)
+../public/remconcoreapicontrollerobserver.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconcoreapicontrollerobserver.h)
+../public/remconcoreapitarget.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconcoreapitarget.h)
+../public/remconcoreapitargetobserver.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconcoreapitargetobserver.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/group/remconcoreapi.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,51 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconcoreapi.dll Remote Control Core API- an outer-layer client 
+// side library.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET			remconcoreapi.dll
+TARGETPATH		/system/libs
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			coreapicontroller.cpp
+SOURCE			coreapitarget.cpp
+SOURCE			coreapicontrollerobserver.cpp
+SOURCE			coreapitargetobserver.cpp
+
+USERINCLUDE 	../../../common
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		remconinterfacebase.lib
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/public/remconcoreapi.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,316 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONCOREAPI_H
+#define REMCONCOREAPI_H
+
+#include <e32base.h>
+											
+/**
+The operation-specific data field for operations in the Core API has the 
+following format.
+For commands, there is 1 byte containing the button action. There is optional 
+further data, depending on the operation itself. For instance, Play carries an 
+extra 4 bytes of 'play speed' information. Hence the operation-specific data 
+for a Play command is 5 bytes long.
+For responses, there are 4 bytes of 'results' data. This is followed by 
+whatever operation-specific data was attached to the originating command (so 
+that the client can identify if necessary what the response is a response to). 
+Hence the operation-specific data for a Play response is 9 bytes long.
+*/
+
+/** A buffer size for Core API operations' operation-specific data. */
+const TUint KRemConCoreApiMaxOperationSpecificDataSize = 16;
+
+/** Length of the results data in bytes. */
+const TUint KRemConCoreApiResultDataLength = 4;
+
+/** String of same length as result data.*/
+_LIT8(KRemConCoreApiResultPad, "    ");
+
+/** Offset for operation data for commands */
+const TUint KRemConCoreApiCommandDataOffset = 0; 
+
+/** Offset for operation data for responses */
+const TUint KRemConCoreApiResponseDataOffset = KRemConCoreApiResultDataLength;
+
+/** Offset of button data from beginning of data section.
+ie the offset of the data for commands is KRemConCoreApiCommandDataOffset
++KRemConCoreApiButtonDataOffset. The offset of the button data for 
+responses is KRemConCoreApiResponseDataOffset+KRemConCoreApiButtonDataOffset.
+*/
+const TUint KRemConCoreApiButtonDataOffset = 0;
+
+/** Length of the button action data in bytes. */
+const TUint KRemConCoreApiButtonDataLength = 1;
+
+/** Button actions. */
+enum TRemConCoreApiButtonAction
+	{
+	/** A button has been pressed. */
+	ERemConCoreApiButtonPress		= 0,
+
+	/** A button has been released. */
+	ERemConCoreApiButtonRelease 	= 1,
+
+	/** A button has been clicked. */
+	ERemConCoreApiButtonClick		= 2,
+	};
+
+/** Button press refresh interval.
+If the client wants to emulate a button being held down, they send a press. 
+The client must re-post the press within this time, and continue to re-post 
+at least this frequently, otherwise the bearer may assume that the hold has 
+finished. The client may finish the hold by sending a release.*/
+const TUint KRemConCoreApiPressRefreshInterval = 1000000; 
+
+/**
+The UID identifying this outer-layer RemCon interface.
+*/
+const TInt KRemConCoreApiUid = 0x10205E60;
+
+/**
+Operation ids belonging to the Core API.
+These values are not numbered sequentially as a facility to AVRCP, which may 
+assume that they are numbered the same as the operation IDs in the AV/C Panel 
+Subunit Specification 1.21 Table 9.21.
+*/
+enum TRemConCoreApiOperationId
+	{
+	/** Select. */
+	ERemConCoreApiSelect						= 0x00,
+	/** Up. */
+	ERemConCoreApiUp							= 0x01,
+	/** Down. */
+	ERemConCoreApiDown							= 0x02,
+	/** Left. */
+	ERemConCoreApiLeft							= 0x03,
+	/** Right. */
+	ERemConCoreApiRight 						= 0x04,
+	/** RightUp. */
+	ERemConCoreApiRightUp						= 0x05,
+	/** RightDown. */
+	ERemConCoreApiRightDown 					= 0x06,
+	/** LeftUp. */
+	ERemConCoreApiLeftUp						= 0x07,
+	/** LeftDown. */
+	ERemConCoreApiLeftDown						= 0x08,
+	/** RootMenu. */
+	ERemConCoreApiRootMenu						= 0x09,
+	/** SetupMenu. */
+	ERemConCoreApiSetupMenu 					= 0x0a,
+	/** ContentsMenu. */
+	ERemConCoreApiContentsMenu					= 0x0b,
+	/** FavoriteMenu. */
+	ERemConCoreApiFavoriteMenu					= 0x0c,
+	/** Exit. */
+	ERemConCoreApiExit							= 0x0d,
+	/** 0. */
+	ERemConCoreApi0 							= 0x20,
+	/** 1. */
+	ERemConCoreApi1 							= 0x21,
+	/** 2. */
+	ERemConCoreApi2 							= 0x22,
+	/** 3. */
+	ERemConCoreApi3 							= 0x23,
+	/** 4. */
+	ERemConCoreApi4 							= 0x24,
+	/** 5. */
+	ERemConCoreApi5 							= 0x25,
+	/** 6. */
+	ERemConCoreApi6 							= 0x26,
+	/** 7. */
+	ERemConCoreApi7 							= 0x27,
+	/** 8. */
+	ERemConCoreApi8 							= 0x28,
+	/** 9. */
+	ERemConCoreApi9 							= 0x29,
+	/** Dot. */
+	ERemConCoreApiDot							= 0x2a,
+	/** Enter. */
+	ERemConCoreApiEnter 						= 0x2b,
+	/** Clear. */
+	ERemConCoreApiClear 						= 0x2c,
+	/** ChannelUp. */
+	ERemConCoreApiChannelUp 					= 0x30,
+	/** ChannelDown. */
+	ERemConCoreApiChannelDown					= 0x31,
+	/** PreviousChannel. */
+	ERemConCoreApiPreviousChannel				= 0x32,
+	/** SoundSelect. */
+	ERemConCoreApiSoundSelect					= 0x33,
+	/** InputSelect. */
+	ERemConCoreApiInputSelect					= 0x34,
+	/** DisplayInformation. */
+	ERemConCoreApiDisplayInformation			= 0x35,
+	/** Help. */
+	ERemConCoreApiHelp							= 0x36,
+	/** PageUp. */
+	ERemConCoreApiPageUp						= 0x37,
+	/** PageDown. */
+	ERemConCoreApiPageDown						= 0x38,
+	/** Power. */
+	ERemConCoreApiPower 						= 0x40,
+	/** VolumeUp. */
+	ERemConCoreApiVolumeUp						= 0x41,
+	/** VolumeDown. */
+	ERemConCoreApiVolumeDown					= 0x42, 
+	/** Mute. */
+	ERemConCoreApiMute							= 0x43, 
+	/** Play. */
+	ERemConCoreApiPlay							= 0x44,
+	/** Stop. */
+	ERemConCoreApiStop							= 0x45,
+	/** Pause. */
+	ERemConCoreApiPause 						= 0x46,
+	/** Record. */
+	ERemConCoreApiRecord						= 0x47,
+	/** Rewind. */
+	ERemConCoreApiRewind						= 0x48,
+	/** FastForward. */
+	ERemConCoreApiFastForward					= 0x49,
+	/** Eject. */
+	ERemConCoreApiEject 						= 0x4a,
+	/** Forward. */
+	ERemConCoreApiForward						= 0x4b,
+	/** Backward. */
+	ERemConCoreApiBackward						= 0x4c,
+	/** Angle. */
+	ERemConCoreApiAngle 						= 0x50,
+	/** Subpicture. */
+	ERemConCoreApiSubpicture					= 0x51,
+	/** PausePlayFunction. */
+	ERemConCoreApiPausePlayFunction 			= 0x61,
+	/** RestoreVolumeFunction. */
+	ERemConCoreApiRestoreVolumeFunction 		= 0x66,
+	/** TuneFunction. */
+	ERemConCoreApiTuneFunction					= 0x67,
+	/** SelectDiskFunction. */
+	ERemConCoreApiSelectDiskFunction			= 0x68,
+	/** SelectAvInputFunction. */
+	ERemConCoreApiSelectAvInputFunction 		= 0x69,
+	/** SelectAudioInputFunction. */
+	ERemConCoreApiSelectAudioInputFunction		= 0x6a,
+	/** F1. */
+	ERemConCoreApiF1							= 0x71,
+	/** F2. */
+	ERemConCoreApiF2							= 0x72,
+	/** F3. */
+	ERemConCoreApiF3							= 0x73,
+	/** F4. */
+	ERemConCoreApiF4							= 0x74,
+	/** F5. */
+	ERemConCoreApiF5							= 0x75,
+
+	/* No-operation */
+	ENop                                        = 0x76,
+	
+	/**
+	 * This enum is created for internal purpose to have the largest value in TRemConCoreApiOperationId.
+	 * If anyone needs an value for no-operation then we suggest to use 'ENop' instead. 
+	 * If new enums values are added in TRemConCoreApiOperationId then value of ELargestOperationId
+	 * may change resulting in a BC break. 
+	 * */
+	ELargestOperationId                         = 0x76,
+	};
+
+/** Speeds associated with Play APIs. 
+These values are not numbered sequentially as a facility to AVRCP, which may 
+assume that they are numbered the same as the playback speeds in the AV/C 
+Panel Subunit Specification 1.21 Table 9.26.
+*/
+enum TRemConCoreApiPlaybackSpeed
+	{
+	/** NextFrame. */
+	ERemConCoreApiPlaybackSpeedNextFrame		= 0x30,
+	/** SlowestForward. */
+	ERemConCoreApiPlaybackSpeedSlowestForward	= 0x31,
+	/** SlowForward6. */
+	ERemConCoreApiPlaybackSpeedSlowForward6 	= 0x32,
+	/** SlowForward5. */
+	ERemConCoreApiPlaybackSpeedSlowForward5 	= 0x33,
+	/** SlowForward4. */
+	ERemConCoreApiPlaybackSpeedSlowForward4 	= 0x34,
+	/** SlowForward3. */
+	ERemConCoreApiPlaybackSpeedSlowForward3 	= 0x35,
+	/** SlowForward2. */
+	ERemConCoreApiPlaybackSpeedSlowForward2 	= 0x36,
+	/** SlowForward1. */
+	ERemConCoreApiPlaybackSpeedSlowForward1 	= 0x37,
+	/** X1. */
+	ERemConCoreApiPlaybackSpeedX1				= 0x38,
+	/** FastForward1. */
+	ERemConCoreApiPlaybackSpeedFastForward1 	= 0x39,
+	/** FastForward2. */
+	ERemConCoreApiPlaybackSpeedFastForward2 	= 0x3a,
+	/** FastForward3. */
+	ERemConCoreApiPlaybackSpeedFastForward3 	= 0x3b,
+	/** FastForward4. */
+	ERemConCoreApiPlaybackSpeedFastForward4 	= 0x3c,
+	/** FastForward5. */
+	ERemConCoreApiPlaybackSpeedFastForward5 	= 0x3d,
+	/** FastForward6. */
+	ERemConCoreApiPlaybackSpeedFastForward6 	= 0x3e,
+	/** FastestForward. */
+	ERemConCoreApiPlaybackSpeedFastestForward	= 0x3f,
+	/** PreviousFrame. */
+	ERemConCoreApiPlaybackSpeedPreviousFrame	= 0x40,
+	/** SlowestReverse. */
+	ERemConCoreApiPlaybackSpeedSlowestReverse	= 0x41,
+	/** SlowReverse6. */
+	ERemConCoreApiPlaybackSpeedSlowReverse6 	= 0x42,
+	/** SlowReverse5. */
+	ERemConCoreApiPlaybackSpeedSlowReverse5 	= 0x43,
+	/** SlowReverse4. */
+	ERemConCoreApiPlaybackSpeedSlowReverse4 	= 0x44,
+	/** SlowReverse3. */
+	ERemConCoreApiPlaybackSpeedSlowReverse3 	= 0x45,
+	/** SlowReverse2. */
+	ERemConCoreApiPlaybackSpeedSlowReverse2 	= 0x46,
+	/** SlowReverse1. */
+	ERemConCoreApiPlaybackSpeedSlowReverse1 	= 0x47,
+	/** X1Reverse. */
+	ERemConCoreApiPlaybackSpeedX1Reverse		= 0x48,
+	/** FastReverse1. */
+	ERemConCoreApiPlaybackSpeedFastReverse1 	= 0x49,
+	/** FastReverse2. */
+	ERemConCoreApiPlaybackSpeedFastReverse2 	= 0x4a,
+	/** FastReverse3. */
+	ERemConCoreApiPlaybackSpeedFastReverse3 	= 0x4b,
+	/** FastReverse4. */
+	ERemConCoreApiPlaybackSpeedFastReverse4 	= 0x4c,
+	/** FastReverse5. */
+	ERemConCoreApiPlaybackSpeedFastReverse5 	= 0x4d,
+	/** FastReverse6. */
+	ERemConCoreApiPlaybackSpeedFastReverse6 	= 0x4e,
+	/** FastestReverse. */
+	ERemConCoreApiPlaybackSpeedFastestReverse	= 0x4f,
+	/** Reverse. */
+	ERemConCoreApiPlaybackSpeedReverse			= 0x65,
+	/** ReversePause. */
+	ERemConCoreApiPlaybackSpeedReversePause 	= 0x6d,
+	/** Forward. */
+	ERemConCoreApiPlaybackSpeedForward			= 0x75,
+	/** ForwardPause. */
+	ERemConCoreApiPlaybackSpeedForwardPause 	= 0x7d,
+	};
+
+#endif // REMCONCOREAPI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/public/remconcoreapicontroller.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,787 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONCOREAPICONTROLLER_H
+#define REMCONCOREAPICONTROLLER_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remconcoreapi.h>
+#include <remcon/remconinterfaceif.h>
+
+class MRemConCoreApiControllerObserver;
+class CRemConInterfaceSelector;
+
+/**
+Client-instantiable type supporting sending Core API commands.
+*/
+NONSHARABLE_CLASS(CRemConCoreApiController) : public CRemConInterfaceBase, 
+									          public MRemConInterfaceIf
+	{
+public:
+	/**
+	Factory function.
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@return A new CRemConCoreApiController, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConCoreApiController* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConCoreApiControllerObserver& aObserver);
+	
+	/** Destructor */
+	IMPORT_C ~CRemConCoreApiController();
+
+public:
+	/** Send a 'select' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Select(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send an 'up' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Up(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'down' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Down(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'left' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Left(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'right' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Right(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'right up' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void RightUp(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'right down' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void RightDown(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'left up' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void LeftUp(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'left down' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void LeftDown(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'root menu' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void RootMenu(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'setup menu' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void SetupMenu(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'contents menu' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void ContentsMenu(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'favorite menu' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void FavoriteMenu(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send an 'exit' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Exit(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a '0' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void _0(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a '1' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void _1(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a '2' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void _2(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a '3' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void _3(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a '4'command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void _4(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a '5' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void _5(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a '6' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void _6(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a '7' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void _7(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a '8' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void _8(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a '9' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void _9(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'dot' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Dot(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send an 'enter' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Enter(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'clear' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Clear(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'channel up' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void ChannelUp(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'channel down' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void ChannelDown(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'previous channel' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void PreviousChannel(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'sound select' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void SoundSelect(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'input select' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void InputSelect(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'display information' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void DisplayInformation(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'help' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Help(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'page up' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void PageUp(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'page down' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void PageDown(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'power' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Power(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'volume up' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void VolumeUp(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'volume down' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void VolumeDown(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'mute' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Mute(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'play' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	@param aSpeed The play speed.
+	*/
+	IMPORT_C void Play(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct,
+		TRemConCoreApiPlaybackSpeed aSpeed = ERemConCoreApiPlaybackSpeedX1);
+
+	/** Send a 'stop' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Stop(TRequestStatus& aStatus, 
+		TUint& aNumRemotes,
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'pause' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Pause(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'record' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Record(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'rewind' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Rewind(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'fast forward' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void FastForward(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send an 'eject' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Eject(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'forward' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Forward(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'backward' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Backward(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send an 'angle' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Angle(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'subpicture' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void Subpicture(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'pause play function' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void PausePlayFunction(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'restore volume function' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void RestoreVolumeFunction(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'tune function' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aTwoPart If EFalse, only aMajorChannel is being used to perform the 
+	tuning (aMinorChannel is ignored). Otherwise, both aMajorChannel and 
+	aMinorChannel are used.
+	@param aMajorChannel The major channel number.
+	@param aMinorChannel The minor channel number.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void TuneFunction(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TBool aTwoPart, 
+		TUint aMajorChannel, 
+		TUint aMinorChannel,
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'select disk function' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	@param aDisk The disk to select.
+	*/
+	IMPORT_C void SelectDiskFunction(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TUint aDisk,
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send a 'select AV input function' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	@param aAvInputSignalNumber AV input signal.
+	*/
+	IMPORT_C void SelectAvInputFunction(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TUint8 aAvInputSignalNumber,
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** Send a 'select audio input function' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	@param aAudioInputSignalNumber Audio input signal.
+	*/
+	IMPORT_C void SelectAudioInputFunction(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TUint8 aAudioInputSignalNumber,
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send an 'F1' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void F1(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send an 'F2' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void F2(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send an 'F3' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void F3(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send an 'F4' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void F4(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** Send an 'F5' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@param aButtonAct The button action to send.
+	*/
+	IMPORT_C void F5(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	@param aObserver The observer of this interface.
+	*/
+	CRemConCoreApiController(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConCoreApiControllerObserver& aObserver);
+
+private: // utility
+	/**
+	Utility to send a command with only the button action as operation-specific data.
+	@param aStatus TRequestStatus for the send operation.
+	@param aNumRemotes The number of remotes the command was sent to.
+	@param aButtonAct The button action.
+	@param aOperationId The operation ID.
+	*/
+	void SendGenericCommand(TRequestStatus& aStatus, 
+		TUint& aNumRemotes, 
+		TRemConCoreApiButtonAction aButtonAct, 
+		TRemConCoreApiOperationId aOperationId);
+
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+
+private: // unowned
+	MRemConCoreApiControllerObserver& iObserver;
+
+private: // owned
+	TBuf8<KRemConCoreApiMaxOperationSpecificDataSize> iCmdData;
+	};
+
+#endif // REMCONCOREAPICONTROLLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/public/remconcoreapicontrollerobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONCOREAPICONTROLLEROBSERVER_H
+#define REMCONCOREAPICONTROLLEROBSERVER_H
+
+#include <e32base.h>
+#include <remconcoreapi.h>
+
+/**
+Clients must implement this interface in order to instantiate objects of type 
+CRemConCoreApiController. This interface passes incoming responses from RemCon 
+to the client. 
+In order to minimise the number of virtual functions the client has to 
+implement, there's just one non-pure function which delivers all responses.
+*/
+class MRemConCoreApiControllerObserver
+	{
+public:
+	/** 
+	A response has been received. 
+	@param aOperationId The operation ID. The response is to a previous 
+	command of this type.
+	@param The response error.
+	*/
+	IMPORT_C virtual void MrccacoResponse(TRemConCoreApiOperationId aOperationId, TInt aError);
+	};
+
+#endif // REMCONCOREAPICONTROLLEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/public/remconcoreapitarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,553 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONCOREAPITARGET_H
+#define REMCONCOREAPITARGET_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remconcoreapi.h>
+#include <remcon/remconinterfaceif.h>
+
+class MRemConCoreApiTargetObserver;
+class CRemConInterfaceSelector;
+
+/**
+Client-instantiable type supporting sending Core API responses.
+*/
+NONSHARABLE_CLASS(CRemConCoreApiTarget) : public CRemConInterfaceBase, 
+								          public MRemConInterfaceIf
+	{
+public:
+	/**
+	Factory function.
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@return A new CRemConCoreApiTarget, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConCoreApiTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConCoreApiTargetObserver& aObserver);
+	/**
+	Factory function.
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@param aFeatureSupported The Array is used to stote features supportd by the client 
+	
+	@return A new CRemConCoreApiTarget, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConCoreApiTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+			MRemConCoreApiTargetObserver& aObserver,const RArray<TRemConCoreApiOperationId>& aFeatureSupported);
+	
+	/** Destructor */
+	IMPORT_C ~CRemConCoreApiTarget();
+
+public:
+	/** Send a 'select' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void SelectResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send an 'up' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void UpResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'down' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void DownResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'left' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void LeftResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'right' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void RightResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'right up' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void RightUpResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'right down' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void RightDownResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'left up' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void LeftUpResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'left down' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void LeftDownResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'root menu' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void RootMenuResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'setup menu' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void SetupMenuResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'contents menu' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void ContentsMenuResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'favorite menu' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void FavoriteMenuResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send an 'exit' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void ExitResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a '0' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void _0Response(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a '1' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void _1Response(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a '2' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void _2Response(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a '3' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void _3Response(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a '4'response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void _4Response(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a '5' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void _5Response(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a '6' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void _6Response(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a '7' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void _7Response(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a '8' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void _8Response(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a '9' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void _9Response(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'dot' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void DotResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send an 'enter' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void EnterResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'clear' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void ClearResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'channel up' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void ChannelUpResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'channel down' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void ChannelDownResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'previous channel' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void PreviousChannelResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'sound select' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void SoundSelectResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'input select' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void InputSelectResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'display information' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void DisplayInformationResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'help' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void HelpResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'page up' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void PageUpResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'page down' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void PageDownResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'power' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void PowerResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'volume up' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void VolumeUpResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'volume down' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void VolumeDownResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'mute' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void MuteResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a play response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the request.
+	@param aError The response error.
+	*/
+	IMPORT_C void PlayResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a stop response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the request.
+	@param aError The response error.
+	*/
+	IMPORT_C void StopResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'pause' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void PauseResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'record' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void RecordResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'rewind' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void RewindResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'fast forward' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void FastForwardResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send an 'eject' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void EjectResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'forward' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void ForwardResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'backward' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void BackwardResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send an 'angle' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void AngleResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'subpicture' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void SubpictureResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'pause play function' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void PausePlayFunctionResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'restore volume function' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void RestoreVolumeFunctionResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'tune function' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void TuneFunctionResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'select disk function' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void SelectDiskFunctionResponse(TRequestStatus& aStatus, TInt aError);
+	
+	/** Send a 'select AV input function' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void SelectAvInputFunctionResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a 'select audio input function' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void SelectAudioInputFunctionResponse(TRequestStatus& aStatus, TInt aError);
+
+	/** Send an 'F1' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void F1Response(TRequestStatus& aStatus, TInt aError);
+
+	/** Send an 'F2' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void F2Response(TRequestStatus& aStatus, TInt aError);
+
+	/** Send an 'F3' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void F3Response(TRequestStatus& aStatus, TInt aError);
+
+	/** Send an 'F4' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void F4Response(TRequestStatus& aStatus, TInt aError);
+
+	/** Send an 'F5' response.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aError The response error.
+	*/
+	IMPORT_C void F5Response(TRequestStatus& aStatus, TInt aError);
+
+	/** Send a response. 
+	Only one response per target session can be outstanding at any one time.
+	This function may be used to send a response when it is undesirable to use the 
+	'specific' response-sending methods (PlayResponse, StopResponse etc). 
+	@param aStatus Used by RemCon to indicate completion of the send request. 
+	@param aOperationId The operation ID of the command we are sending a response to. 
+	@param aError The response error. 
+	*/ 
+	IMPORT_C void SendResponse(TRequestStatus& aStatus, TRemConCoreApiOperationId aOperationId, TInt aError);
+	
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	@param aObserver The observer of this interface.
+	*/
+	CRemConCoreApiTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConCoreApiTargetObserver& aObserver);
+    void ConstructL(const RArray<TRemConCoreApiOperationId>& aFeaturesSupported);
+
+private: // utility
+	/**
+	Utility to send a response.
+	@param aStatus TRequestStatus for the send operation.
+	@param aOperationId The operation ID.
+	*/
+	void SendGenericResponse(TRequestStatus& aStatus, 
+		TRemConCoreApiOperationId aOperationId,
+		TInt aError);
+
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+
+private: // utility
+	void HandlePlay(const TDesC8& aData, TRemConCoreApiButtonAction aButton);
+	void HandleTuneFunction(const TDesC8& aData, TRemConCoreApiButtonAction aButton);
+	void HandleSelectDiskFunction(const TDesC8& aData, TRemConCoreApiButtonAction aButton);
+	void HandleSelectAvInputFunction(const TDesC8& aData, TRemConCoreApiButtonAction aButton);
+	void HandleSelectAudioInputFunction(const TDesC8& aData, TRemConCoreApiButtonAction aButton);
+private :
+	void RemConCoreSetFeatures(TBool* aFeatureSupported);
+
+private: // unowned
+	MRemConCoreApiTargetObserver& iObserver;
+
+private: // owned
+	TBuf8<KRemConCoreApiMaxOperationSpecificDataSize> iRspData;
+	TUint iNumRemotes;
+	TFixedArray<TBool,ELargestOperationId> iOutstandingOperations;	
+	};
+
+#endif // REMCONCOREAPITARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/public/remconcoreapitargetobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,101 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONCOREAPITARGETOBSERVER_H
+#define REMCONCOREAPITARGETOBSERVER_H
+
+#include <e32base.h>
+#include <remconcoreapi.h>
+
+/**
+Clients must implement this interface in order to instantiate objects of type 
+CRemConCoreApiTarget. This interface passes incoming commands from RemCon to 
+the client. 
+In order to minimise the number of virtual functions the client has to 
+implement, (a) they aren't pure, and (b) most commands are presented via 
+'Command' with an operation ID. 
+Commands which are associated with command-specific data come instead through 
+specific methods, e.g. 'Play', which comes with a play speed.
+Incoming commands are given to client via the MRemConCoreApiTargetObserver mixin. 
+Having received a command, the client is obliged to send a response.
+A client can only have one send outstanding at any time. 
+If commands come in quickly, the client is responsible for queueing its responses to them. 
+Note that each command delivered to a target involves memory allocated in the server’s heap, 
+which is only released on client closure or when a response is sent. 
+*/
+class MRemConCoreApiTargetObserver
+	{
+public:
+	/** 
+	A command has been received. 
+	@param aOperationId The operation ID of the command.
+	@param aButtonAct The button action associated with the command.
+	*/
+	IMPORT_C virtual void MrccatoCommand(TRemConCoreApiOperationId aOperationId, 
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** 
+	A 'play' command has been received. 
+	@param aSpeed The playback speed.
+	@param aButtonAct The button action associated with the command.
+	*/
+	IMPORT_C virtual void MrccatoPlay(TRemConCoreApiPlaybackSpeed aSpeed, 
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/**
+	A 'tune function' command has been received.
+	@param aTwoPart If EFalse, only aMajorChannel is to be used. Otherwise, 
+	both aMajorChannel and aMinorChannel are to be used.
+	@param aMajorChannel The major channel number.
+	@param aMinorChannel The minor channel number.
+	@param aButtonAct The button action associated with the command.
+	*/
+	IMPORT_C virtual void MrccatoTuneFunction(TBool aTwoPart, 
+		TUint aMajorChannel, 
+		TUint aMinorChannel,
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** 
+	A 'select disk function' has been received.
+	@param aDisk The disk.
+	@param aButtonAct The button action associated with the command.
+	*/
+	IMPORT_C virtual void MrccatoSelectDiskFunction(TUint aDisk,
+		TRemConCoreApiButtonAction aButtonAct);
+	
+	/** 
+	A 'select AV input function' has been received.
+	@param aAvInputSignalNumber The AV input.
+	@param aButtonAct The button action associated with the command.
+	*/
+	IMPORT_C virtual void MrccatoSelectAvInputFunction(TUint8 aAvInputSignalNumber,
+		TRemConCoreApiButtonAction aButtonAct);
+
+	/** 
+	A 'select audio input function' has been received.
+	@param aAudioInputSignalNumber The audio input.
+	@param aButtonAct The button action associated with the command.
+	*/
+	IMPORT_C virtual void MrccatoSelectAudioInputFunction(TUint8 aAudioInputSignalNumber,
+		TRemConCoreApiButtonAction aButtonAct);
+	};
+
+#endif // REMCONCOREAPITARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/src/coreapicontroller.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,770 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <remconcoreapicontroller.h>
+#include <remconcoreapicontrollerobserver.h>
+#include <remconinterfaceselector.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_CORE);
+#endif
+
+EXPORT_C CRemConCoreApiController* CRemConCoreApiController::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+											  MRemConCoreApiControllerObserver& aObserver)
+	{
+	LOG_STATIC_FUNC;
+
+	CRemConCoreApiController* self = new(ELeave) CRemConCoreApiController(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->BaseConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConCoreApiController::CRemConCoreApiController(CRemConInterfaceSelector& aInterfaceSelector, 
+							   MRemConCoreApiControllerObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConCoreApiUid), 
+						 KRemConCoreApiMaxOperationSpecificDataSize, 
+						 aInterfaceSelector,
+						 ERemConClientTypeController),
+	iObserver(aObserver)
+	{
+	}
+
+EXPORT_C CRemConCoreApiController::~CRemConCoreApiController()
+	{
+	LOG_FUNC;
+	}
+
+TAny* CRemConCoreApiController::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+void CRemConCoreApiController::MrcibNewMessage(TUint aOperationId, const TDesC8& aData)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	LOG1(_L("\taData.Length = %d"), aData.Length());
+
+	// Get the response error out of aData.
+	if ( aData.Length() < KRemConCoreApiResultDataLength )
+		{
+		LOG(_L("\tdropping response because results data not found"));
+		return; // ditch malformed messages
+		}
+	
+	__ASSERT_COMPILE(KRemConCoreApiResultDataLength <= 4);
+	TInt err = *reinterpret_cast<const TInt*>(aData.Ptr());
+
+	switch ( aOperationId )
+		{
+	case ERemConCoreApiSelect:
+	case ERemConCoreApiUp:
+	case ERemConCoreApiDown:
+	case ERemConCoreApiLeft:
+	case ERemConCoreApiRight:
+	case ERemConCoreApiRightUp:
+	case ERemConCoreApiRightDown:
+	case ERemConCoreApiLeftUp:
+	case ERemConCoreApiLeftDown:
+	case ERemConCoreApiRootMenu:
+	case ERemConCoreApiSetupMenu:
+	case ERemConCoreApiContentsMenu:
+	case ERemConCoreApiFavoriteMenu:
+	case ERemConCoreApiExit:
+	case ERemConCoreApi0:
+	case ERemConCoreApi1:
+	case ERemConCoreApi2:
+	case ERemConCoreApi3:
+	case ERemConCoreApi4:
+	case ERemConCoreApi5:
+	case ERemConCoreApi6:
+	case ERemConCoreApi7:
+	case ERemConCoreApi8:
+	case ERemConCoreApi9:
+	case ERemConCoreApiDot:
+	case ERemConCoreApiEnter:
+	case ERemConCoreApiClear:
+	case ERemConCoreApiChannelUp:
+	case ERemConCoreApiChannelDown:
+	case ERemConCoreApiPreviousChannel:
+	case ERemConCoreApiSoundSelect:
+	case ERemConCoreApiInputSelect:
+	case ERemConCoreApiDisplayInformation:
+	case ERemConCoreApiHelp:
+	case ERemConCoreApiPageUp:
+	case ERemConCoreApiPageDown:
+	case ERemConCoreApiPower:
+	case ERemConCoreApiVolumeUp:
+	case ERemConCoreApiVolumeDown:	
+	case ERemConCoreApiMute:	
+	case ERemConCoreApiPlay:
+	case ERemConCoreApiStop:
+	case ERemConCoreApiPause:
+	case ERemConCoreApiRecord:
+	case ERemConCoreApiRewind:
+	case ERemConCoreApiFastForward:
+	case ERemConCoreApiEject:
+	case ERemConCoreApiForward:
+	case ERemConCoreApiBackward:
+	case ERemConCoreApiAngle:
+	case ERemConCoreApiSubpicture:
+	case ERemConCoreApiPausePlayFunction:
+	case ERemConCoreApiRestoreVolumeFunction:
+	case ERemConCoreApiTuneFunction:
+	case ERemConCoreApiSelectDiskFunction:
+	case ERemConCoreApiSelectAvInputFunction:
+	case ERemConCoreApiSelectAudioInputFunction:
+	case ERemConCoreApiF1:
+	case ERemConCoreApiF2:
+	case ERemConCoreApiF3:
+	case ERemConCoreApiF4:
+	case ERemConCoreApiF5:
+		iObserver.MrccacoResponse((TRemConCoreApiOperationId)aOperationId, err);
+		break;
+
+	default:
+		break;
+		}
+	}
+
+void CRemConCoreApiController::SendGenericCommand(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct, 
+	TRemConCoreApiOperationId aOperationId)
+	{
+	iCmdData.Copy((TUint8*)&aButtonAct, KRemConCoreApiButtonDataLength);
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConCoreApiUid),
+		(TUint)aOperationId, 
+		aNumRemotes,
+		ERemConCommand,
+		iCmdData);
+	}
+
+EXPORT_C void CRemConCoreApiController::Select(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiSelect);
+	}
+
+EXPORT_C void CRemConCoreApiController::Up(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiUp);
+	}
+
+EXPORT_C void CRemConCoreApiController::Down(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiDown);
+	}
+
+EXPORT_C void CRemConCoreApiController::Left(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiLeft);
+	}
+
+EXPORT_C void CRemConCoreApiController::Right(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiRight);
+	}
+
+EXPORT_C void CRemConCoreApiController::RightUp(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiRightUp);
+	}
+
+EXPORT_C void CRemConCoreApiController::RightDown(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiRightDown);
+	}
+
+EXPORT_C void CRemConCoreApiController::LeftUp(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiLeftUp);
+	}
+
+EXPORT_C void CRemConCoreApiController::LeftDown(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiLeftDown);
+	}
+
+EXPORT_C void CRemConCoreApiController::RootMenu(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiRootMenu);
+	}
+
+EXPORT_C void CRemConCoreApiController::SetupMenu(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiSetupMenu);
+	}
+
+EXPORT_C void CRemConCoreApiController::ContentsMenu(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiContentsMenu);
+	}
+
+EXPORT_C void CRemConCoreApiController::FavoriteMenu(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiFavoriteMenu);
+	}
+
+EXPORT_C void CRemConCoreApiController::Exit(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiExit);
+	}
+
+EXPORT_C void CRemConCoreApiController::_0(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApi0);
+	}
+
+EXPORT_C void CRemConCoreApiController::_1(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApi1);
+	}
+
+EXPORT_C void CRemConCoreApiController::_2(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApi2);
+	}
+
+EXPORT_C void CRemConCoreApiController::_3(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApi3);
+	}
+
+EXPORT_C void CRemConCoreApiController::_4(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApi4);
+	}
+
+EXPORT_C void CRemConCoreApiController::_5(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApi5);
+	}
+
+EXPORT_C void CRemConCoreApiController::_6(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApi6);
+	}
+
+EXPORT_C void CRemConCoreApiController::_7(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApi7);
+	}
+
+EXPORT_C void CRemConCoreApiController::_8(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApi8);
+	}
+
+EXPORT_C void CRemConCoreApiController::_9(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApi9);
+	}
+
+EXPORT_C void CRemConCoreApiController::Dot(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiDot);
+	}
+
+EXPORT_C void CRemConCoreApiController::Enter(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiEnter);
+	}
+
+EXPORT_C void CRemConCoreApiController::Clear(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiClear);
+	}
+
+EXPORT_C void CRemConCoreApiController::ChannelUp(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiChannelUp);
+	}
+
+EXPORT_C void CRemConCoreApiController::ChannelDown(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiChannelDown);
+	}
+
+EXPORT_C void CRemConCoreApiController::PreviousChannel(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiPreviousChannel);
+	}
+
+EXPORT_C void CRemConCoreApiController::SoundSelect(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiSoundSelect);
+	}
+
+EXPORT_C void CRemConCoreApiController::InputSelect(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiInputSelect);
+	}
+
+EXPORT_C void CRemConCoreApiController::DisplayInformation(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiDisplayInformation);
+	}
+
+EXPORT_C void CRemConCoreApiController::Help(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiHelp);
+	}
+
+EXPORT_C void CRemConCoreApiController::PageUp(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiPageUp);
+	}
+
+EXPORT_C void CRemConCoreApiController::PageDown(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiPageDown);
+	}
+
+EXPORT_C void CRemConCoreApiController::Power(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiPower);
+	}
+
+EXPORT_C void CRemConCoreApiController::VolumeUp(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiVolumeUp);
+	}
+
+EXPORT_C void CRemConCoreApiController::VolumeDown(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiVolumeDown);
+	}
+
+EXPORT_C void CRemConCoreApiController::Mute(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiMute);
+	}
+
+EXPORT_C void CRemConCoreApiController::Play(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct,
+	TRemConCoreApiPlaybackSpeed aSpeed)
+	{
+	LOG_FUNC;
+	
+	iCmdData.Copy((TUint8*)&aButtonAct, KRemConCoreApiButtonDataLength);
+	iCmdData.AppendFormat(_L8("%04x"), aSpeed);
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConCoreApiUid),
+		(TUint)ERemConCoreApiPlay, 
+		aNumRemotes,
+		ERemConCommand,
+		iCmdData);
+	}
+
+EXPORT_C void CRemConCoreApiController::Stop(TRequestStatus& aStatus, 
+											 TUint& aNumRemotes,
+											 TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiStop);
+	}
+
+EXPORT_C void CRemConCoreApiController::Pause(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiPause);
+	}
+
+EXPORT_C void CRemConCoreApiController::Record(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiRecord);
+	}
+
+EXPORT_C void CRemConCoreApiController::Rewind(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiRewind);
+	}
+
+EXPORT_C void CRemConCoreApiController::FastForward(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiFastForward);
+	}
+
+EXPORT_C void CRemConCoreApiController::Eject(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiEject);
+	}
+
+EXPORT_C void CRemConCoreApiController::Forward(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiForward);
+	}
+
+EXPORT_C void CRemConCoreApiController::Backward(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiBackward);
+	}
+
+EXPORT_C void CRemConCoreApiController::Angle(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiAngle);
+	}
+
+EXPORT_C void CRemConCoreApiController::Subpicture(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiSubpicture);
+	}
+
+EXPORT_C void CRemConCoreApiController::PausePlayFunction(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiPausePlayFunction);
+	}
+
+EXPORT_C void CRemConCoreApiController::RestoreVolumeFunction(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiRestoreVolumeFunction);
+	}
+
+EXPORT_C void CRemConCoreApiController::TuneFunction(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TBool aTwoPart, 
+	TUint aMajorChannel, 
+	TUint aMinorChannel,
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+
+	iCmdData.Copy((TUint8*)&aButtonAct, KRemConCoreApiButtonDataLength);
+	iCmdData.AppendFormat(_L8("%d%d%d"), aTwoPart, aMajorChannel, aMinorChannel);
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConCoreApiUid),
+		(TUint)ERemConCoreApiTuneFunction, 
+		aNumRemotes,
+		ERemConCommand,
+		iCmdData);
+	}
+
+EXPORT_C void CRemConCoreApiController::SelectDiskFunction(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TUint aDisk,
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	iCmdData.Copy((TUint8*)&aButtonAct, KRemConCoreApiButtonDataLength);
+	iCmdData.AppendFormat(_L8("%d"), aDisk);
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConCoreApiUid),
+		(TUint)ERemConCoreApiSelectDiskFunction, 
+		aNumRemotes,
+		ERemConCommand,
+		iCmdData);
+	}
+
+EXPORT_C void CRemConCoreApiController::SelectAvInputFunction(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TUint8 aAvInputSignalNumber,
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	iCmdData.Copy((TUint8*)&aButtonAct, KRemConCoreApiButtonDataLength);
+	iCmdData.AppendFormat(_L8("%d"), aAvInputSignalNumber);
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConCoreApiUid),
+		(TUint)ERemConCoreApiSelectAvInputFunction, 
+		aNumRemotes,
+		ERemConCommand,
+		iCmdData);
+	}
+
+EXPORT_C void CRemConCoreApiController::SelectAudioInputFunction(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TUint8 aAudioInputSignalNumber,
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	iCmdData.Copy((TUint8*)&aButtonAct, KRemConCoreApiButtonDataLength);
+	iCmdData.AppendFormat(_L8("%d"), aAudioInputSignalNumber);
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConCoreApiUid),
+		(TUint)ERemConCoreApiSelectAudioInputFunction, 
+		aNumRemotes,
+		ERemConCommand,
+		iCmdData);
+	}
+
+EXPORT_C void CRemConCoreApiController::F1(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiF1);
+	}
+
+EXPORT_C void CRemConCoreApiController::F2(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiF2);
+	}
+
+EXPORT_C void CRemConCoreApiController::F3(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiF3);
+	}
+
+EXPORT_C void CRemConCoreApiController::F4(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiF4);
+	}
+
+EXPORT_C void CRemConCoreApiController::F5(TRequestStatus& aStatus, 
+	TUint& aNumRemotes, 
+	TRemConCoreApiButtonAction aButtonAct)
+	{
+	LOG_FUNC;
+	
+	SendGenericCommand(aStatus, aNumRemotes, aButtonAct, ERemConCoreApiF5);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/src/coreapicontrollerobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,25 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconcoreapicontrollerobserver.h>
+
+EXPORT_C void MRemConCoreApiControllerObserver::MrccacoResponse(TRemConCoreApiOperationId /*aOperationId*/, TInt /*aError*/)
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/src/coreapitarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,809 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <remconcoreapitarget.h>
+#include <remconcoreapitargetobserver.h>
+#include <remconinterfaceselector.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_CORE);
+#endif
+
+// Useful symbolic constant for navigating around data items.
+const TUint KDataItemLength = 4;
+
+EXPORT_C CRemConCoreApiTarget* CRemConCoreApiTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+											  MRemConCoreApiTargetObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConCoreApiTarget* self = new(ELeave) CRemConCoreApiTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->BaseConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+EXPORT_C CRemConCoreApiTarget* CRemConCoreApiTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+			MRemConCoreApiTargetObserver& aObserver, const RArray<TRemConCoreApiOperationId>& aFeatureSupported)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConCoreApiTarget* self = new(ELeave) CRemConCoreApiTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->ConstructL(aFeatureSupported);
+	CleanupStack::Pop(self);
+	return self;
+	}
+CRemConCoreApiTarget::CRemConCoreApiTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+							   MRemConCoreApiTargetObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConCoreApiUid), 
+						 KRemConCoreApiMaxOperationSpecificDataSize, 
+						 aInterfaceSelector,
+						 ERemConClientTypeTarget),
+	iObserver(aObserver)
+	{	
+	iOutstandingOperations.Reset();
+	}
+
+EXPORT_C CRemConCoreApiTarget::~CRemConCoreApiTarget()
+	{
+	LOG_FUNC
+	}
+
+TAny* CRemConCoreApiTarget::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+void CRemConCoreApiTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData)
+	{
+	LOG_FUNC
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	LOG1(_L("\taData.Length = %d"), aData.Length());
+
+	// Get the button action
+	if ( aData.Length() < KRemConCoreApiButtonDataLength )
+		{
+		LOG(_L("\tdropping command because button data not found"));
+		return; // ditch malformed messages
+		}
+	TRemConCoreApiButtonAction button = static_cast<TRemConCoreApiButtonAction>(aData.Ptr()[0]);
+	
+	if( aOperationId < ELargestOperationId ) 
+		{
+		/* If this command was received earlier and there was no response sent by 
+		 * the client (i.e. iOperations[aOperationId] is ETrue) then respond to the 
+		 * command so that remcon removes this command from 'Incoming Delivered'
+		 * queue
+		 */ 
+		if( iOutstandingOperations[aOperationId] )
+			{
+			/*This will send the response unreliably. iOutstandingOperations will not
+			 be altered so we do not need to set it again to ETrue for this incoming
+			 command*/
+			InterfaceSelector().SendUnreliable(TUid::Uid(KRemConCoreApiUid),
+												aOperationId,
+												ERemConResponse,
+												aData);
+			}
+		else
+			iOutstandingOperations[aOperationId] = ETrue;
+		}
+
+	switch ( aOperationId )
+		{
+	case ERemConCoreApiPlay:
+		HandlePlay(aData, button);
+		break;
+
+	case ERemConCoreApiSelect:
+	case ERemConCoreApiUp:
+	case ERemConCoreApiDown:
+	case ERemConCoreApiLeft:
+	case ERemConCoreApiRight:
+	case ERemConCoreApiRightUp:
+	case ERemConCoreApiRightDown:
+	case ERemConCoreApiLeftUp:
+	case ERemConCoreApiLeftDown:
+	case ERemConCoreApiRootMenu:
+	case ERemConCoreApiSetupMenu:
+	case ERemConCoreApiContentsMenu:
+	case ERemConCoreApiFavoriteMenu:
+	case ERemConCoreApiExit:
+	case ERemConCoreApi0:
+	case ERemConCoreApi1:
+	case ERemConCoreApi2:
+	case ERemConCoreApi3:
+	case ERemConCoreApi4:
+	case ERemConCoreApi5:
+	case ERemConCoreApi6:
+	case ERemConCoreApi7:
+	case ERemConCoreApi8:
+	case ERemConCoreApi9:
+	case ERemConCoreApiDot:
+	case ERemConCoreApiEnter:
+	case ERemConCoreApiClear:
+	case ERemConCoreApiChannelUp:
+	case ERemConCoreApiChannelDown:
+	case ERemConCoreApiPreviousChannel:
+	case ERemConCoreApiSoundSelect:
+	case ERemConCoreApiInputSelect:
+	case ERemConCoreApiDisplayInformation:
+	case ERemConCoreApiHelp:
+	case ERemConCoreApiPageUp:
+	case ERemConCoreApiPageDown:
+	case ERemConCoreApiPower:
+	case ERemConCoreApiVolumeUp:
+	case ERemConCoreApiVolumeDown:
+	case ERemConCoreApiMute:
+	case ERemConCoreApiStop:
+	case ERemConCoreApiPause:
+	case ERemConCoreApiRecord:
+	case ERemConCoreApiRewind:
+	case ERemConCoreApiFastForward:
+	case ERemConCoreApiEject:
+	case ERemConCoreApiForward:
+	case ERemConCoreApiBackward:
+	case ERemConCoreApiAngle:
+	case ERemConCoreApiSubpicture:
+	case ERemConCoreApiPausePlayFunction:
+	case ERemConCoreApiRestoreVolumeFunction:
+	case ERemConCoreApiF1:
+	case ERemConCoreApiF2:
+	case ERemConCoreApiF3:
+	case ERemConCoreApiF4:
+	case ERemConCoreApiF5:
+		iObserver.MrccatoCommand((TRemConCoreApiOperationId)aOperationId, button);
+		break;
+
+	case ERemConCoreApiTuneFunction:
+		HandleTuneFunction(aData, button);
+		break;
+
+	case ERemConCoreApiSelectDiskFunction:
+		HandleSelectDiskFunction(aData, button);
+		break;
+
+	case ERemConCoreApiSelectAvInputFunction:
+		HandleSelectAvInputFunction(aData, button);
+		break;
+
+	case ERemConCoreApiSelectAudioInputFunction:
+		HandleSelectAudioInputFunction(aData, button);
+		break;
+
+	default:
+		break;
+		}
+	}
+
+void CRemConCoreApiTarget::HandlePlay(const TDesC8& aData, TRemConCoreApiButtonAction aButton)
+	{
+	// Decompose aData to get the playback speed out of it
+	TUint speed;
+	if ( aData.Length() < KRemConCoreApiButtonDataLength + KDataItemLength )
+		{
+		LOG(_L("\tcommand lacks play speed data- using default"));
+		// If there's no play speed data, go with the default.
+		speed = ERemConCoreApiPlaybackSpeedX1;
+		}
+	else
+		{
+		TLex8 lex(aData.Mid(KRemConCoreApiButtonDataLength, KDataItemLength));
+		if ( lex.Val(speed, EHex) != KErrNone )
+			{
+			LOG(_L("\tdropping command because play speed data unreadable"));
+			// Play speed data was present, but unintelligible. This is a 
+			// malformed message- ditch it.
+			return;
+			}
+		}
+	iObserver.MrccatoPlay((TRemConCoreApiPlaybackSpeed)speed, aButton);
+	}
+
+void CRemConCoreApiTarget::HandleTuneFunction(const TDesC8& aData, TRemConCoreApiButtonAction aButton)
+	{
+	// Decompose aData to get the data out of it
+	// There are 3 items of tuning data.
+	if ( aData.Length() < KRemConCoreApiButtonDataLength + 3*KDataItemLength )
+		{
+		LOG(_L("\tdropping command because tune function data not found"));
+		return; // ditch malformed messages
+		}
+	TLex8 lex(aData.Mid(KRemConCoreApiButtonDataLength, KDataItemLength));
+	TUint twoPart;
+	if ( lex.Val(twoPart, EHex) == KErrNone )
+		{
+		TLex8 lex(aData.Mid(KRemConCoreApiButtonDataLength + KDataItemLength, KDataItemLength));
+		TUint major;
+		if ( lex.Val(major, EHex) == KErrNone )
+			{
+			TLex8 lex(aData.Mid(KRemConCoreApiButtonDataLength + 2*KDataItemLength, KDataItemLength));
+			TUint minor;
+			if ( lex.Val(minor, EHex) == KErrNone )
+				{							  
+				iObserver.MrccatoTuneFunction((TBool)twoPart, major, minor, aButton);
+				}
+			else
+				{
+				LOG(_L("\tdropping command because minor tune function data unreadable"));
+				}
+			}
+		else
+			{
+			LOG(_L("\tdropping command because major tune function data unreadable"));
+			}
+		}
+	else
+		{
+		LOG(_L("\tdropping command because 'two part' tune function data unreadable"));
+		}
+	}
+
+void CRemConCoreApiTarget::HandleSelectDiskFunction(const TDesC8& aData, TRemConCoreApiButtonAction aButton)
+	{
+	// Decompose aData
+	if ( aData.Length() < KRemConCoreApiButtonDataLength + KDataItemLength )
+		{
+		LOG(_L("\tdropping command because select disk function data not found"));
+		return; // ditch malformed messages
+		}
+	TLex8 lex(aData.Mid(KRemConCoreApiButtonDataLength, KDataItemLength));
+	TUint disk;
+	if ( lex.Val(disk, EHex) == KErrNone )
+		{
+		iObserver.MrccatoSelectDiskFunction(disk, aButton);
+		}
+	else
+		{
+		// Just ditch malformed messages.
+		LOG(_L("\tdropping command because select disk function data unreadable"));
+		}
+	}
+
+void CRemConCoreApiTarget::HandleSelectAvInputFunction(const TDesC8& aData, TRemConCoreApiButtonAction aButton)
+	{
+	// Decompose aData
+	if ( aData.Length() < KRemConCoreApiButtonDataLength + KDataItemLength )
+		{
+		LOG(_L("\tdropping command because select AV input function data not found"));
+		return; // ditch malformed messages
+		}
+	TLex8 lex(aData.Mid(KRemConCoreApiButtonDataLength, KDataItemLength));
+	TUint av;
+	if ( lex.Val(av, EHex) == KErrNone )
+		{
+		iObserver.MrccatoSelectAvInputFunction(av, aButton);
+		}
+	else
+		{
+		// Just ditch malformed messages.
+		LOG(_L("\tdropping command because select AV input function data unreadable"));
+		}
+	}
+
+void CRemConCoreApiTarget::HandleSelectAudioInputFunction(const TDesC8& aData, TRemConCoreApiButtonAction aButton)
+	{
+	// Decompose aData
+	if ( aData.Length() < KRemConCoreApiButtonDataLength + KDataItemLength )
+		{
+		LOG(_L("\tdropping command because select audio input function data not found"));
+		return; // ditch malformed messages
+		}
+	TLex8 lex(aData.Mid(KRemConCoreApiButtonDataLength, KDataItemLength));
+	TUint audio;
+	if ( lex.Val(audio, EHex) == KErrNone )
+		{
+		iObserver.MrccatoSelectAudioInputFunction(audio, aButton);
+		}
+	else
+		{
+		// Just ditch malformed messages.
+		LOG(_L("\tdropping command because select audio input function data unreadable"));
+		}
+	}
+
+void CRemConCoreApiTarget::SendGenericResponse(TRequestStatus& aStatus,
+											   TRemConCoreApiOperationId aOperationId,
+											   TInt aError)
+	{
+	iRspData.Copy((TUint8*)&aError, KRemConCoreApiResultDataLength);
+	
+	if( aOperationId >= 0 && aOperationId < ELargestOperationId ) 
+		{
+		iOutstandingOperations[aOperationId] = EFalse;
+		}
+	
+	// We pass iNumRemotes even though we're not interested in its value as 
+	// RemCon will write to this location and we need it to be somewhere safe.
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConCoreApiUid),
+		(TUint)aOperationId, 
+		iNumRemotes,
+		ERemConResponse,
+		iRspData);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::SelectResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiSelect, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::UpResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiUp, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::DownResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiDown, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::LeftResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiLeft, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::RightResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiRight, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::RightUpResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiRightUp, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::RightDownResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiRightDown, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::LeftUpResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiLeftUp, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::LeftDownResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiLeftDown, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::RootMenuResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiRootMenu, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::SetupMenuResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiSetupMenu, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::ContentsMenuResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiContentsMenu, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::FavoriteMenuResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiFavoriteMenu, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::ExitResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiExit, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::_0Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApi0, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::_1Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApi1, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::_2Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApi2, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::_3Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApi3, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::_4Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApi4, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::_5Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApi5, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::_6Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApi6, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::_7Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApi7, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::_8Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApi8, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::_9Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApi9, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::DotResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiDot, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::EnterResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiEnter, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::ClearResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiClear, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::ChannelUpResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiChannelUp, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::ChannelDownResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiChannelDown, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::PreviousChannelResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiPreviousChannel, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::SoundSelectResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiSoundSelect, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::InputSelectResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiInputSelect, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::DisplayInformationResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiDisplayInformation, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::HelpResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiHelp, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::PageUpResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiPageUp, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::PageDownResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiPageDown, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::PowerResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiPower, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::VolumeUpResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiVolumeUp, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::VolumeDownResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiVolumeDown, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::MuteResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiMute, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::PlayResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiPlay, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::StopResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiStop, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::PauseResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiPause, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::RecordResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiRecord, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::RewindResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiRewind, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::FastForwardResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiFastForward, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::EjectResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiEject, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::ForwardResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiForward, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::BackwardResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiBackward, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::AngleResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiAngle, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::SubpictureResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiSubpicture, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::PausePlayFunctionResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiPausePlayFunction, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::RestoreVolumeFunctionResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiRestoreVolumeFunction, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::TuneFunctionResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiTuneFunction, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::SelectDiskFunctionResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiSelectDiskFunction, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::SelectAvInputFunctionResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiSelectAvInputFunction, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::SelectAudioInputFunctionResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiSelectAudioInputFunction, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::F1Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiF1, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::F2Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiF2, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::F3Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiF3, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::F4Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiF4, aError);
+	}
+
+EXPORT_C void CRemConCoreApiTarget::F5Response(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, ERemConCoreApiF5, aError);
+	}
+	
+EXPORT_C void CRemConCoreApiTarget::SendResponse(TRequestStatus& aStatus, TRemConCoreApiOperationId aOperationId, TInt aError)
+	{
+	LOG_FUNC
+
+	SendGenericResponse(aStatus, aOperationId, aError);
+	}
+void CRemConCoreApiTarget::ConstructL(const RArray<TRemConCoreApiOperationId>& aFeaturesSupported)
+	{
+	LOG_FUNC
+	
+	RRemConInterfaceFeatures features;
+	LEAVEIFERRORL(features.Open());
+	CleanupClosePushL(features);
+
+	for(TInt i = 0 ; i < aFeaturesSupported.Count() ; i++)
+		{
+		features.AddOperationL(aFeaturesSupported[i]);
+		}
+	
+	BaseConstructL(features);
+	CleanupStack::PopAndDestroy(&features);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/coreapi/src/coreapitargetobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,53 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconcoreapitargetobserver.h>
+
+EXPORT_C void MRemConCoreApiTargetObserver::MrccatoCommand(TRemConCoreApiOperationId /*aOperationId*/, 
+		TRemConCoreApiButtonAction /*aButtonAct*/)
+	{
+	}
+	
+EXPORT_C void MRemConCoreApiTargetObserver::MrccatoPlay(TRemConCoreApiPlaybackSpeed /*aSpeed*/, 
+		TRemConCoreApiButtonAction /*aButtonAct*/)
+	{
+	}
+
+EXPORT_C void MRemConCoreApiTargetObserver::MrccatoTuneFunction(TBool /*aTwoPart*/, 
+		TUint /*aMajorChannel*/, 
+		TUint /*aMinorChannel*/,
+		TRemConCoreApiButtonAction /*aButtonAct*/)
+	{
+	}
+
+EXPORT_C void MRemConCoreApiTargetObserver::MrccatoSelectDiskFunction(TUint /*aDisk*/,
+		TRemConCoreApiButtonAction /*aButtonAct*/)
+	{
+	}
+	
+EXPORT_C void MRemConCoreApiTargetObserver::MrccatoSelectAvInputFunction(TUint8 /*aAvInputSignalNumber*/,
+		TRemConCoreApiButtonAction /*aButtonAct*/)
+	{
+	}
+
+EXPORT_C void MRemConCoreApiTargetObserver::MrccatoSelectAudioInputFunction(TUint8 /*aAudioInputSignalNumber*/,
+		TRemConCoreApiButtonAction /*aButtonAct*/)
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/bwins/remconextapi1U.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,26 @@
+EXPORTS
+	??1CRemConAbsVolController@@UAE@XZ @ 1 NONAME ; CRemConAbsVolController::~CRemConAbsVolController(void)
+	??1CRemConAbsVolTarget@@UAE@XZ @ 2 NONAME ; CRemConAbsVolTarget::~CRemConAbsVolTarget(void)
+	??1CRemConTrackInfoController@@UAE@XZ @ 3 NONAME ; CRemConTrackInfoController::~CRemConTrackInfoController(void)
+	??1CRemConTrackInfoTarget@@UAE@XZ @ 4 NONAME ; CRemConTrackInfoTarget::~CRemConTrackInfoTarget(void)
+	?GetAbsoluteVolume@CRemConAbsVolController@@QAEXAAVTRequestStatus@@AAI@Z @ 5 NONAME ; void CRemConAbsVolController::GetAbsoluteVolume(class TRequestStatus &, unsigned int &)
+	?GetAbsoluteVolumeResponse@CRemConAbsVolTarget@@QAEXAAVTRequestStatus@@IIH@Z @ 6 NONAME ; void CRemConAbsVolTarget::GetAbsoluteVolumeResponse(class TRequestStatus &, unsigned int, unsigned int, int)
+	?GetArtistResponse@CRemConTrackInfoTarget@@QAEXAAVTRequestStatus@@ABVTDesC16@@H@Z @ 7 NONAME ; void CRemConTrackInfoTarget::GetArtistResponse(class TRequestStatus &, class TDesC16 const &, int)
+	?GetTrackDurationResponse@CRemConTrackInfoTarget@@QAEXAAVTRequestStatus@@ABVTTime@@H@Z @ 8 NONAME ; void CRemConTrackInfoTarget::GetTrackDurationResponse(class TRequestStatus &, class TTime const &, int)
+	?GetTrackNameResponse@CRemConTrackInfoTarget@@QAEXAAVTRequestStatus@@ABVTDesC16@@H@Z @ 9 NONAME ; void CRemConTrackInfoTarget::GetTrackNameResponse(class TRequestStatus &, class TDesC16 const &, int)
+	?MrcavcoGetAbsoluteVolumeResponse@MRemConAbsVolControllerObserver@@UAEXIIH@Z @ 10 NONAME ; void MRemConAbsVolControllerObserver::MrcavcoGetAbsoluteVolumeResponse(unsigned int, unsigned int, int)
+	?MrcavcoSetAbsoluteVolumeResponse@MRemConAbsVolControllerObserver@@UAEXH@Z @ 11 NONAME ; void MRemConAbsVolControllerObserver::MrcavcoSetAbsoluteVolumeResponse(int)
+	?MrcavtoGetAbsoluteVolume@MRemConAbsVolTargetObserver@@UAEXXZ @ 12 NONAME ; void MRemConAbsVolTargetObserver::MrcavtoGetAbsoluteVolume(void)
+	?MrcavtoSetAbsoluteVolume@MRemConAbsVolTargetObserver@@UAEXII@Z @ 13 NONAME ; void MRemConAbsVolTargetObserver::MrcavtoSetAbsoluteVolume(unsigned int, unsigned int)
+	?MrcticoSetTrackNameResponse@MRemConTrackInfoControllerObserver@@UAEXH@Z @ 14 NONAME ; void MRemConTrackInfoControllerObserver::MrcticoSetTrackNameResponse(int)
+	?MrctitoGetArtist@MRemConTrackInfoTargetObserver@@UAEXXZ @ 15 NONAME ; void MRemConTrackInfoTargetObserver::MrctitoGetArtist(void)
+	?MrctitoGetTrackDuration@MRemConTrackInfoTargetObserver@@UAEXXZ @ 16 NONAME ; void MRemConTrackInfoTargetObserver::MrctitoGetTrackDuration(void)
+	?MrctitoGetTrackName@MRemConTrackInfoTargetObserver@@UAEXXZ @ 17 NONAME ; void MRemConTrackInfoTargetObserver::MrctitoGetTrackName(void)
+	?NewL@CRemConAbsVolController@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConAbsVolControllerObserver@@@Z @ 18 NONAME ; class CRemConAbsVolController * CRemConAbsVolController::NewL(class CRemConInterfaceSelector &, class MRemConAbsVolControllerObserver &)
+	?NewL@CRemConAbsVolTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConAbsVolTargetObserver@@@Z @ 19 NONAME ; class CRemConAbsVolTarget * CRemConAbsVolTarget::NewL(class CRemConInterfaceSelector &, class MRemConAbsVolTargetObserver &)
+	?NewL@CRemConTrackInfoController@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConTrackInfoControllerObserver@@@Z @ 20 NONAME ; class CRemConTrackInfoController * CRemConTrackInfoController::NewL(class CRemConInterfaceSelector &, class MRemConTrackInfoControllerObserver &)
+	?NewL@CRemConTrackInfoTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConTrackInfoTargetObserver@@@Z @ 21 NONAME ; class CRemConTrackInfoTarget * CRemConTrackInfoTarget::NewL(class CRemConInterfaceSelector &, class MRemConTrackInfoTargetObserver &)
+	?SetAbsoluteVolume@CRemConAbsVolController@@QAEXAAVTRequestStatus@@IIAAI@Z @ 22 NONAME ; void CRemConAbsVolController::SetAbsoluteVolume(class TRequestStatus &, unsigned int, unsigned int, unsigned int &)
+	?SetAbsoluteVolumeResponse@CRemConAbsVolTarget@@QAEXAAVTRequestStatus@@H@Z @ 23 NONAME ; void CRemConAbsVolTarget::SetAbsoluteVolumeResponse(class TRequestStatus &, int)
+	?SetTrackName@CRemConTrackInfoController@@QAEXAAVTRequestStatus@@ABVTDesC16@@AAI@Z @ 24 NONAME ; void CRemConTrackInfoController::SetTrackName(class TRequestStatus &, class TDesC16 const &, unsigned int &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/eabi/remconextapi1U.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,42 @@
+EXPORTS
+	_ZN19CRemConAbsVolTarget25GetAbsoluteVolumeResponseER14TRequestStatusjji @ 1 NONAME
+	_ZN19CRemConAbsVolTarget25SetAbsoluteVolumeResponseER14TRequestStatusi @ 2 NONAME
+	_ZN19CRemConAbsVolTarget4NewLER24CRemConInterfaceSelectorR27MRemConAbsVolTargetObserver @ 3 NONAME
+	_ZN19CRemConAbsVolTargetD0Ev @ 4 NONAME
+	_ZN19CRemConAbsVolTargetD1Ev @ 5 NONAME
+	_ZN19CRemConAbsVolTargetD2Ev @ 6 NONAME
+	_ZN22CRemConTrackInfoTarget17GetArtistResponseER14TRequestStatusRK7TDesC16i @ 7 NONAME
+	_ZN22CRemConTrackInfoTarget20GetTrackNameResponseER14TRequestStatusRK7TDesC16i @ 8 NONAME
+	_ZN22CRemConTrackInfoTarget24GetTrackDurationResponseER14TRequestStatusRK5TTimei @ 9 NONAME
+	_ZN22CRemConTrackInfoTarget4NewLER24CRemConInterfaceSelectorR30MRemConTrackInfoTargetObserver @ 10 NONAME
+	_ZN22CRemConTrackInfoTargetD0Ev @ 11 NONAME
+	_ZN22CRemConTrackInfoTargetD1Ev @ 12 NONAME
+	_ZN22CRemConTrackInfoTargetD2Ev @ 13 NONAME
+	_ZN23CRemConAbsVolController17GetAbsoluteVolumeER14TRequestStatusRj @ 14 NONAME
+	_ZN23CRemConAbsVolController17SetAbsoluteVolumeER14TRequestStatusjjRj @ 15 NONAME
+	_ZN23CRemConAbsVolController4NewLER24CRemConInterfaceSelectorR31MRemConAbsVolControllerObserver @ 16 NONAME
+	_ZN23CRemConAbsVolControllerD0Ev @ 17 NONAME
+	_ZN23CRemConAbsVolControllerD1Ev @ 18 NONAME
+	_ZN23CRemConAbsVolControllerD2Ev @ 19 NONAME
+	_ZN26CRemConTrackInfoController12SetTrackNameER14TRequestStatusRK7TDesC16Rj @ 20 NONAME
+	_ZN26CRemConTrackInfoController4NewLER24CRemConInterfaceSelectorR34MRemConTrackInfoControllerObserver @ 21 NONAME
+	_ZN26CRemConTrackInfoControllerD0Ev @ 22 NONAME
+	_ZN26CRemConTrackInfoControllerD1Ev @ 23 NONAME
+	_ZN26CRemConTrackInfoControllerD2Ev @ 24 NONAME
+	_ZN27MRemConAbsVolTargetObserver24MrcavtoGetAbsoluteVolumeEv @ 25 NONAME
+	_ZN27MRemConAbsVolTargetObserver24MrcavtoSetAbsoluteVolumeEjj @ 26 NONAME
+	_ZN30MRemConTrackInfoTargetObserver16MrctitoGetArtistEv @ 27 NONAME
+	_ZN30MRemConTrackInfoTargetObserver19MrctitoGetTrackNameEv @ 28 NONAME
+	_ZN30MRemConTrackInfoTargetObserver23MrctitoGetTrackDurationEv @ 29 NONAME
+	_ZN31MRemConAbsVolControllerObserver32MrcavcoGetAbsoluteVolumeResponseEjji @ 30 NONAME
+	_ZN31MRemConAbsVolControllerObserver32MrcavcoSetAbsoluteVolumeResponseEi @ 31 NONAME
+	_ZN34MRemConTrackInfoControllerObserver27MrcticoSetTrackNameResponseEi @ 32 NONAME
+	_ZTI27MRemConAbsVolTargetObserver @ 33 NONAME ; #<TI>#
+	_ZTI30MRemConTrackInfoTargetObserver @ 34 NONAME ; #<TI>#
+	_ZTI31MRemConAbsVolControllerObserver @ 35 NONAME ; #<TI>#
+	_ZTI34MRemConTrackInfoControllerObserver @ 36 NONAME ; #<TI>#
+	_ZTV27MRemConAbsVolTargetObserver @ 37 NONAME ; #<VT>#
+	_ZTV30MRemConTrackInfoTargetObserver @ 38 NONAME ; #<VT>#
+	_ZTV31MRemConAbsVolControllerObserver @ 39 NONAME ; #<VT>#
+	_ZTV34MRemConTrackInfoControllerObserver @ 40 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,33 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconextapi1.mmp
+
+PRJ_EXPORTS
+../public/remconextapi1.h						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconextapi1.h)
+../public/remcontrackinfocontroller.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remcontrackinfocontroller.h)
+../public/remcontrackinfocontrollerobserver.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remcontrackinfocontrollerobserver.h)
+../public/remcontrackinfotarget.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remcontrackinfotarget.h)
+../public/remcontrackinfotargetobserver.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remcontrackinfotargetobserver.h)
+../public/remconabsvolcontroller.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconabsvolcontroller.h)
+../public/remconabsvolcontrollerobserver.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconabsvolcontrollerobserver.h)
+../public/remconabsvoltarget.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconabsvoltarget.h)
+../public/remconabsvoltargetobserver.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconabsvoltargetobserver.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/group/remconextapi1.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,77 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconextapi1.dll An outer layer client side library facilitating 
+// Remote Control Track Info and Absolute Volume messages.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+
+TARGET			remconextapi1.dll //Recommended unpaged
+TARGETPATH		/system/libs
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+USERINCLUDE 	../inc
+
+
+// As part of DEF102064 extra exports and functionality were added to the
+// Track Info extension API to enable two copies of the Symbian stack to
+// be tested back to back.  This functionality is not included in built code
+// by default as it is not needed for the API's use cases.
+//
+// To enable this:
+//
+// 1. Uncomment the following MACRO definition.
+// 2. Rebuild the Track Info API.
+// 3. Refreeze the .def files for remconextapi1.dll (8 new exports should be appended).
+// 4. Update any test code that derives from the two M-class observers - 
+// MRemConTrackInfoControllerObserver and MRemConTrackInfoTargetObserver to handle the
+// four new virtual functions that this adds.
+// 5. Rebuild the test code.
+//MACRO			SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+
+
+SOURCEPATH		../src
+SOURCE			trackinfocontroller.cpp
+SOURCE			trackinfotarget.cpp
+SOURCE			absvolutils.cpp
+SOURCE			absvolcontroller.cpp
+SOURCE			absvoltarget.cpp
+SOURCE			trackinfocontrollerobserver.cpp
+SOURCE			trackinfotargetobserver.cpp
+SOURCE			absvolcontrollerobserver.cpp
+SOURCE			absvoltargetobserver.cpp
+
+
+USERINCLUDE 	../../../common
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		remconinterfacebase.lib
+
+#include <bluetooth/btlogger.mmh>
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/inc/absvolutils.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef ABSVOLUTILS_H
+#define ABSVOLUTILS_H
+
+#include <e32base.h>
+
+TInt GetAbsMaxVol(const TDesC8& aData, TUint& aAbsVol, TUint& aMaxVol);
+
+#endif // ABSVOLUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/public/remconabsvolcontroller.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,97 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONABSVOLCONTROLLER_H
+#define REMCONABSVOLCONTROLLER_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+
+class MRemConAbsVolControllerObserver;
+class CRemConInterfaceSelector;
+
+/**
+Client-instantiable type supporting sending AbsVol API responses.
+*/
+NONSHARABLE_CLASS(CRemConAbsVolController) : public CRemConInterfaceBase, 
+								             public MRemConInterfaceIf
+	{
+public:
+	/**
+	Factory function.
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@return A new CRemConAbsVolController, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConAbsVolController* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConAbsVolControllerObserver& aObserver);
+	
+	/** Destructor. */
+	IMPORT_C ~CRemConAbsVolController();
+
+public:
+	/**
+	Sends a 'get absolute volume' command. The absolute volume will be 
+	returned in response(s) via the observer interface.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request. 
+	@param aNumRemotes The number of remotes to which the command was sent.
+	*/
+	IMPORT_C void GetAbsoluteVolume(TRequestStatus& aStatus, TUint& aNumRemotes);
+
+	/**
+	Sends a 'set absolute volume' command. The volume is set to aAbsVol, on a 
+	range of zero to aMaxVol. Any responses will be returned via the observer 
+	interface.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aAbsVol The relative volume.
+	@param aMaxVol The maximum against which aAbsVol is relative.
+	@param aNumRemotes The number of remotes to which the command was sent.
+	*/
+	IMPORT_C void SetAbsoluteVolume(TRequestStatus& aStatus, TUint aAbsVol, TUint aMaxVol, TUint& aNumRemotes);
+
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	@param aObserver The observer of this interface.
+	*/
+	CRemConAbsVolController(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConAbsVolControllerObserver& aObserver);
+
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+
+private: // unowned
+	MRemConAbsVolControllerObserver& iObserver;
+
+private: // owned
+	static const TUint KMaxOperationDataSize = 0x20;
+	TBuf8<KMaxOperationDataSize> iOutData;
+	};
+
+#endif // REMCONABSVOLCONTROLLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/public/remconabsvolcontrollerobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONABSVOLCONTROLLEROBSERVER_H
+#define REMCONABSVOLCONTROLLEROBSERVER_H
+
+#include <e32base.h>
+
+/**
+Client-implemented mixin- notifies the client of incoming AbsVol commands.
+*/
+class MRemConAbsVolControllerObserver
+	{
+public:
+	/** 
+	A response to a 'get absolute volume' command has been received.
+	@param aAbsVol The relative volume.
+	@param aMaxVol The maximum against which aAbsVol is relative.
+	@param aError The response error.
+	*/
+	virtual void MrcavcoGetAbsoluteVolumeResponse(TUint aAbsVol, TUint aMaxVol, TInt aError);
+
+	/** 
+	A response to a 'set absolute volume' command has been received.
+	@param aError The response error.
+	*/
+	virtual void MrcavcoSetAbsoluteVolumeResponse(TInt aError);
+	};
+
+#endif // REMCONABSVOLCONTROLLEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/public/remconabsvoltarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,103 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONABSVOLTARGET_H
+#define REMCONABSVOLTARGET_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+
+class MRemConAbsVolTargetObserver;
+class CRemConInterfaceSelector;
+
+/**
+Client-instantiable type supporting sending AbsVol API responses.
+*/
+NONSHARABLE_CLASS(CRemConAbsVolTarget) : public CRemConInterfaceBase, 
+								         public MRemConInterfaceIf
+	{
+public:
+	/**
+	Factory function.
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@return A new CRemConAbsVolTarget, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConAbsVolTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConAbsVolTargetObserver& aObserver);
+	
+	/** Destructor. */
+	IMPORT_C ~CRemConAbsVolTarget();
+
+public:
+	/**
+	Sends a response to a 'get absolute volume' command.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aAbsVol The volume, on a scale of 0 to aMaxVol.
+	@param aMaxVol The maximum volume, to which aAbsVol is relative.
+	@param aError The response error.
+	*/
+	IMPORT_C void GetAbsoluteVolumeResponse(TRequestStatus& aStatus, 
+		TUint aAbsVol, 
+		TUint aMaxVol, 
+		TInt aError);
+
+	/**
+	Sends a response to a 'set absolute volume' command.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the request.
+	@param aError The response error.
+	*/
+	IMPORT_C void SetAbsoluteVolumeResponse(TRequestStatus& aStatus, 
+		TInt aError);
+
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	@param aObserver The observer of this interface.
+	*/
+	CRemConAbsVolTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConAbsVolTargetObserver& aObserver);
+
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+
+private: // unowned
+	MRemConAbsVolTargetObserver& iObserver;
+
+private: // owned
+	// For operation-specific data.
+	static const TUint KMaxOperationDataSize = 0x20;
+	TBuf8<KMaxOperationDataSize> iOutData;
+	
+	// not used by this class, but required for calling RRemCon::Send ...
+	TUint iNumRemotes;
+	
+	};
+
+#endif // REMCONABSVOLTARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/public/remconabsvoltargetobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,46 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONABSVOLTARGETOBSERVER_H
+#define REMCONABSVOLTARGETOBSERVER_H
+
+#include <e32base.h>
+
+/**
+Client-implemented mixin- notifies the client of incoming AbsVol commands.
+*/
+class MRemConAbsVolTargetObserver
+	{
+public:
+	/** 
+	A 'get absolute volume' command has been received.
+	*/
+	virtual void MrcavtoGetAbsoluteVolume();
+
+	/**
+	A 'set absolute volume' command has been received.
+	@param aAbsVol The volume on a scale of 0 to aMaxVol.
+	@param aMaxVol The volume aAbsVol is relative to.
+	*/
+	virtual void MrcavtoSetAbsoluteVolume(TUint aAbsVol, TUint aMaxVol);
+	};
+
+#endif // REMCONABSVOLTARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/public/remconextapi1.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,80 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef REMCONEXTAPI1_H
+#define REMCONEXTAPI1_H
+
+#include <e32base.h>
+
+// 'ExtApi1' constants apply to both interfaces within the ExtApi1 DLL, i.e. 
+// both the TrackInfo and AbsVol APIs.
+
+/** Offset in the operation-specific data of the 'result' (this field exists 
+in both commands and responses, but logically only applies to responses). */
+const TUint KRemConExtApi1ResultDataOffset = 0;
+
+/** Length of the results data/field in bytes. */
+const TUint KRemConExtApi1ResultDataLength = 4;
+
+/** Used for checking operation-specific data. The operation-specific data of 
+an ExtApi1 message must always contain at least a results field, so the length 
+of the results field is the minimum length of this 'packet'. */
+const TUint KRemConExtApi1MinimumDataLength = KRemConExtApi1ResultDataLength;
+
+/**
+The UID identifying the Track Info outer-layer RemCon interface.
+*/
+const TInt KRemConTrackInfoApiUid = 0x10206863;
+
+/**
+Operation ids belonging to the Track Info interface.
+These are public so bearers/converters can access them.
+*/
+enum TRemConTrackInfoOperationId
+	{
+	/** Get track name. */
+	ERemConGetTrackName			= 0x00,
+	/** Set track name. */
+	ERemConSetTrackName			= 0x01,
+	/** Get artist. */
+	ERemConGetArtist 			= 0x02,
+	/** Get track duration. */
+	ERemConGetTrackDuration		= 0x03,
+	};
+
+/**
+The UID identifying the Abs Vol outer-layer RemCon interface.
+*/
+const TInt KRemConAbsVolApiUid = 0x1020831D;
+
+/**
+Operation ids belonging to the Abs Vol interface.
+These are public so bearers/converters can access them.
+*/
+enum TRemConAbsVolOperationId
+	{
+	/** Get absolute volume. */
+	ERemConGetAbsoluteVolume 	= 0x00,
+	/** Set absolute volume. */
+	ERemConSetAbsoluteVolume 	= 0x01,
+	};
+
+#endif // REMCONEXTAPI1_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/public/remcontrackinfocontroller.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,132 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONTRACKINFOCONTROLLER_H
+#define REMCONTRACKINFOCONTROLLER_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+
+class MRemConTrackInfoControllerObserver;
+class CRemConInterfaceSelector;
+
+/**
+Client-instantiable type supporting sending TrackInfo API commands.
+*/
+NONSHARABLE_CLASS(CRemConTrackInfoController) : public CRemConInterfaceBase, 
+								       	        public MRemConInterfaceIf
+	{
+public:
+	/**
+	Factory function.
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@return A new CRemConTrackInfoController, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConTrackInfoController* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConTrackInfoControllerObserver& aObserver);
+	
+	/** Destructor. */
+	IMPORT_C ~CRemConTrackInfoController();
+
+public:
+	/** 
+	Sends a 'set track name' command.
+	Only one command per controller session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aTrackName The track name.
+	@param aNumRemotes On success, will contain the number of remotes the 
+	command was sent to.
+	@panic USER 23, if the length of aTrackName is greater than 58 Characters.
+	*/
+	IMPORT_C void SetTrackName(TRequestStatus& aStatus, const TDesC& aTrackName, TUint& aNumRemotes);
+
+/**
+The following section of code is included to allow internal back to back 
+testing of this component within Symbian Software Ltd. It will only be 
+compiled in specially configured test builds. It will never be available 
+in any release and so should never be used outside of Symbian owned test 
+code.
+*/
+#ifdef SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code.
+	*/
+	IMPORT_C void GetTrackName(TRequestStatus& aStatus, TUint& aNumRemotes);
+	
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code.
+	*/	
+	IMPORT_C void GetArtist(TRequestStatus& aStatus, TUint& aNumRemotes);
+	
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code.
+	*/
+	IMPORT_C void GetTrackDuration(TRequestStatus& aStatus, TUint& aNumRemotes);
+	
+private:
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code.
+	*/
+	void HandleGetTrackNameResponse(TInt aError, const TDesC8& aData);
+	
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code.
+	*/
+	void HandleGetArtistResponse(TInt aError, const TDesC8& aData);
+	
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code.
+	*/
+	void HandleGetTrackDurationResponse(TInt aError, const TDesC8& aData);	
+#endif //SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	@param aObserver The observer of this interface.
+	*/
+	CRemConTrackInfoController(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConTrackInfoControllerObserver& aObserver);
+
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+
+private: // unowned
+	MRemConTrackInfoControllerObserver& iObserver;
+
+private: // owned
+	TBuf8<KMaxName> iOutData;
+	};
+
+#endif // REMCONTRACKINFOCONTROLLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/public/remcontrackinfocontrollerobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,67 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONTRACKINFOCONTROLLEROBSERVER_H
+#define REMCONTRACKINFOCONTROLLEROBSERVER_H
+
+#include <e32base.h>
+
+/**
+Client-implemented mixin- notifies the client of incoming TrackInfo responses.
+*/
+class MRemConTrackInfoControllerObserver
+	{
+public:
+	/**
+	A response to a 'set track name' command has been received.
+	@param aError The response error.
+	*/
+	virtual void MrcticoSetTrackNameResponse(TInt aError);
+	
+/**
+The following section of code is included to allow internal back to back 
+testing of this component within Symbian Software Ltd. It will only be 
+compiled in specially configured test builds. It will never be available 
+in any release and so should never be used outside of Symbian owned test 
+code.
+*/
+#ifdef SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code.
+	*/
+	virtual void MrcticoGetTrackNameResponse(TInt aError, const TDesC& aTrackName);
+	
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code.  
+	*/
+	virtual void MrcticoGetArtistResponse(TInt aError, const TDesC& aArtist);
+	
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code.  
+	*/
+	virtual void MrcticoGetTrackDurationResponse(TInt aError, const TTime& aDuration);
+#endif //SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+	};
+
+#endif // REMCONTRACKINFOCONTROLLEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/public/remcontrackinfotarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,138 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONTRACKINFOTARGET_H
+#define REMCONTRACKINFOTARGET_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+
+class MRemConTrackInfoTargetObserver;
+class CRemConInterfaceSelector;
+
+/**
+Client-instantiable type supporting sending TrackInfo API responses.
+*/
+NONSHARABLE_CLASS(CRemConTrackInfoTarget) : public CRemConInterfaceBase, 
+								            public MRemConInterfaceIf
+	{
+public:
+	/**
+	Factory function.
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@return A new CRemConTrackInfoTarget, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConTrackInfoTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConTrackInfoTargetObserver& aObserver);
+	
+	/** Destructor. */
+	IMPORT_C ~CRemConTrackInfoTarget();
+
+public:
+	/**
+	Sends a response to a 'get track name' command.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aTrackName The track name.
+	@param aError The response error.
+	@panic USER 23, if the length of aTrackName is greater than 58 Characters. 
+	*/
+	IMPORT_C void GetTrackNameResponse(TRequestStatus& aStatus, 
+		const TDesC& aTrackName, 
+		TInt aError);
+
+	/**
+	Sends a response to a 'get artist' command.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aArtist The artist.
+	@param aError The response error.
+	@panic USER 23, if the length of aArtist is greater than 58 Characters. 
+	*/
+	IMPORT_C void GetArtistResponse(TRequestStatus& aStatus, 
+		const TDesC& aArtist, 
+		TInt aError);
+
+	/**
+	Sends a response to a 'get track duration' command.
+	Only one response per target session can be outstanding at any one time.
+	@param aStatus Used by RemCon to indicate completion of the send request.
+	@param aDuration The duration.
+	@param aError The response error.
+	*/
+	IMPORT_C void GetTrackDurationResponse(TRequestStatus& aStatus, 
+		const TTime& aDuration, 
+		TInt aError);
+
+/**
+The following section of code is included to allow internal back to back 
+testing of this component within Symbian Software Ltd. It will only be 
+compiled in specially configured test builds. It will never be available 
+in any release and so should never be used outside of Symbian owned test 
+code.
+*/
+#ifdef SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code.
+	*/
+	IMPORT_C void SetTrackNameResponse(TRequestStatus& aStatus,
+		TInt aError);
+
+private:
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code.
+	*/
+	void HandleSetTrackName(const TDesC8& aData);		
+#endif //SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	@param aObserver The observer of this interface.
+	*/
+	CRemConTrackInfoTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConTrackInfoTargetObserver& aObserver);
+
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+
+private: // unowned
+	MRemConTrackInfoTargetObserver& iObserver;
+
+private: // owned
+	// For operation-specific data.
+	TBuf8<KMaxName> iOutData;
+	
+	// not used by this class, but required for calling RRemCon::Send ...
+	TUint iNumRemotes;
+
+	};
+
+#endif // REMCONTRACKINFOTARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/public/remcontrackinfotargetobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,64 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONTRACKINFOTARGETOBSERVER_H
+#define REMCONTRACKINFOTARGETOBSERVER_H
+
+#include <e32base.h>
+
+/**
+Client-implemented mixin- notifies the client of incoming TrackInfo commands.
+*/
+class MRemConTrackInfoTargetObserver
+	{
+public:
+	/**
+	A 'get track name' command has been received.
+	*/
+	IMPORT_C virtual void MrctitoGetTrackName();
+
+	/**
+	A 'get artist' command has been received.
+	*/
+	IMPORT_C virtual void MrctitoGetArtist();
+
+	/**
+	A 'get track duration' command has been received. 
+	*/
+	IMPORT_C virtual void MrctitoGetTrackDuration();
+	
+/**
+The following section of code is included to allow internal back to back 
+testing of this component within Symbian Software Ltd. It will only be 
+compiled in specially configured test builds. It will never be available 
+in any release and so should never be used outside of Symbian owned test 
+code.
+*/
+#ifdef SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+	/**
+	This method is only available in specially configured test builds and will 
+	not be found in any released code. 
+	*/
+	IMPORT_C virtual void MrctitoSetTrackName(const TDesC& aTrackName);	
+#endif //SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+	};
+
+#endif // REMCONTRACKINFOTARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/src/absvolcontroller.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,149 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <e32base.h>
+#include <remcon/remconextapi1.h>
+#include <remconabsvolcontroller.h>
+#include <remconabsvolcontrollerobserver.h>
+#include <remconinterfaceselector.h>
+#include "absvolutils.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_EXTAPI1);
+#endif
+
+// Used to pad over the results field in the operation-specific data.
+_LIT8(KResultsPad, "    ");
+
+EXPORT_C CRemConAbsVolController* CRemConAbsVolController::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+																	MRemConAbsVolControllerObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConAbsVolController* self = new(ELeave) CRemConAbsVolController(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->BaseConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConAbsVolController::CRemConAbsVolController(CRemConInterfaceSelector& aInterfaceSelector, 
+													 MRemConAbsVolControllerObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConAbsVolApiUid), 
+						 KMaxOperationDataSize,
+						 aInterfaceSelector,
+						 ERemConClientTypeController),
+	iObserver(aObserver)
+	{
+	}
+
+EXPORT_C CRemConAbsVolController::~CRemConAbsVolController()
+	{
+	LOG_FUNC
+	}
+
+TAny* CRemConAbsVolController::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+void CRemConAbsVolController::MrcibNewMessage(TUint aOperationId, const TDesC8& aData)
+	{
+	LOG_FUNC
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	LOG1(_L("\taData.Length = %d"), aData.Length());
+
+	// Get the response error out of aData.
+	if ( aData.Length() < KRemConExtApi1MinimumDataLength )
+		{
+		return; // ditch malformed messages
+		}
+	TInt err = static_cast<TInt>(aData.Ptr()[0]);
+
+	switch ( aOperationId )
+		{
+	case ERemConGetAbsoluteVolume:
+		{
+		// 20 is the length of the abs volume data- 10 bytes for each of two 
+		// '0x%08x'-formatted fields.
+		if ( aData.Length() < KRemConExtApi1MinimumDataLength + 20 )
+			{
+			//Silently drop the message
+			LOG(_L("Warning: Message is dropped due to invalid length!"));
+			__DEBUGGER();
+			return;
+			}
+		TUint absVol;
+		TUint maxVol;
+		if ( GetAbsMaxVol(aData.Mid(KRemConExtApi1MinimumDataLength, 20), absVol, maxVol) == KErrNone )
+			{
+			iObserver.MrcavcoGetAbsoluteVolumeResponse(absVol, maxVol, err);
+			}
+		}
+		break;
+
+	case ERemConSetAbsoluteVolume:
+		iObserver.MrcavcoSetAbsoluteVolumeResponse(err);
+		break;
+
+	default:
+		break;
+		}
+	}
+
+EXPORT_C void CRemConAbsVolController::GetAbsoluteVolume(TRequestStatus& aStatus, 
+												   TUint& aNumRemotes)
+	{
+	LOG_FUNC
+
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConAbsVolApiUid), 
+		(TUint)ERemConGetAbsoluteVolume,
+		aNumRemotes,
+		ERemConCommand,
+		KNullDesC8());
+	}
+
+EXPORT_C void CRemConAbsVolController::SetAbsoluteVolume(TRequestStatus& aStatus, 
+												   TUint aAbsVol, 
+												   TUint aMaxVol,
+												   TUint& aNumRemotes)
+	{
+	LOG_FUNC
+
+	iOutData.Copy(KResultsPad());
+	iOutData.AppendFormat(_L8("0x%08x0x%08x"), aAbsVol, aMaxVol);
+
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConAbsVolApiUid), 
+		(TUint)ERemConSetAbsoluteVolume,
+		aNumRemotes,
+		ERemConCommand,
+		iOutData);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/src/absvolcontrollerobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconabsvolcontrollerobserver.h>
+
+EXPORT_C void MRemConAbsVolControllerObserver::MrcavcoGetAbsoluteVolumeResponse(TUint /*aAbsVol*/, TUint /*aMaxVol*/, TInt /*aError*/)
+	{
+	}
+
+EXPORT_C void MRemConAbsVolControllerObserver::MrcavcoSetAbsoluteVolumeResponse(TInt /*aError*/)
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/src/absvoltarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,139 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <e32base.h>
+#include <remcon/remconextapi1.h>
+#include <remconabsvoltarget.h>
+#include <remconabsvoltargetobserver.h>
+#include <remconinterfaceselector.h>
+#include "absvolutils.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_EXTAPI1);
+#endif
+
+EXPORT_C CRemConAbsVolTarget* CRemConAbsVolTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+																	MRemConAbsVolTargetObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConAbsVolTarget* self = new(ELeave) CRemConAbsVolTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->BaseConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConAbsVolTarget::CRemConAbsVolTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+													 MRemConAbsVolTargetObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConAbsVolApiUid), 
+						 KMaxOperationDataSize,
+						 aInterfaceSelector,
+						 ERemConClientTypeTarget),
+	iObserver(aObserver)
+	{
+	}
+
+EXPORT_C CRemConAbsVolTarget::~CRemConAbsVolTarget()
+	{
+	LOG_FUNC
+	}
+
+TAny* CRemConAbsVolTarget::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+void CRemConAbsVolTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData)
+	{
+	LOG_FUNC
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	LOG1(_L("\taData.Length = %d"), aData.Length());
+
+	switch ( aOperationId )
+		{
+	case ERemConGetAbsoluteVolume:
+		iObserver.MrcavtoGetAbsoluteVolume();
+		break;
+
+	case ERemConSetAbsoluteVolume:
+		{
+		TUint absVol;
+		TUint maxVol;
+		// 20 is the length of the abs vol data.
+		if(aData.Length()<KRemConExtApi1MinimumDataLength+20)
+			{
+			// Silently drop the message
+			LOG(_L("Warning: Message is dropped due to invalid length!"));
+			__DEBUGGER();
+			}
+		else if ( GetAbsMaxVol(aData.Mid(KRemConExtApi1MinimumDataLength, 20), absVol, maxVol) == KErrNone )
+			{
+			iObserver.MrcavtoSetAbsoluteVolume(absVol, maxVol);
+			}
+		break;
+		}
+
+	default:
+		break;
+		}
+	}
+
+EXPORT_C void CRemConAbsVolTarget::GetAbsoluteVolumeResponse(TRequestStatus& aStatus, TUint aAbsVol, TUint aMaxVol, TInt aError)
+	{
+	LOG_FUNC
+
+	iOutData.Copy((TUint8*)&aError, KRemConExtApi1ResultDataLength);
+	iOutData.AppendFormat(_L8("0x%08x0x%08x"), aAbsVol, aMaxVol);
+	
+	// We pass iNumRemotes even though we're not interested in its value but 
+	// RemCon will write to this location so we need it to be somewhere safe.
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConAbsVolApiUid), 
+		(TUint)ERemConGetAbsoluteVolume, 
+		iNumRemotes,
+		ERemConResponse,
+		iOutData);
+	}
+
+EXPORT_C void CRemConAbsVolTarget::SetAbsoluteVolumeResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+
+	iOutData.Copy((TUint8*)&aError, KRemConExtApi1ResultDataLength);
+	
+	// We pass iNumRemotes even though we're not interested in its value but 
+	// RemCon will write to this location so we need it to be somewhere safe.
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConAbsVolApiUid), 
+		(TUint)ERemConSetAbsoluteVolume, 
+		iNumRemotes,
+		ERemConResponse,
+		KNullDesC8());
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/src/absvoltargetobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconabsvoltargetobserver.h>
+
+EXPORT_C void MRemConAbsVolTargetObserver::MrcavtoGetAbsoluteVolume()
+	{
+	}
+
+EXPORT_C void MRemConAbsVolTargetObserver::MrcavtoSetAbsoluteVolume(TUint /*aAbsVol*/, TUint /*aMaxVol*/)
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/src/absvolutils.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,45 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#include "absvolutils.h"
+
+TInt GetAbsMaxVol(const TDesC8& aData, TUint& aAbsVol, TUint& aMaxVol)
+	{
+	// Decompose aData to get the absolute volume. It should be in the format 
+	// '0xAAAAAAAA0xBBBBBBBB' where AAAAAAAA is the absolute volume, and 
+	// BBBBBBBB is the maximum volume. If it isn't in this format, return 
+	// error.
+	TInt err = KErrArgument;
+
+	// 20 is the size we need for the following formatting.
+	if ( aData.Length() >= 20 )
+		{
+		TLex8 lex(aData.Mid(2, 8));
+		err = lex.Val(aAbsVol, EHex);
+		if ( err == KErrNone )
+			{
+			TLex8 lex(aData.Mid(12, 8));
+			err = lex.Val(aMaxVol, EHex);
+			}
+		}
+
+	return err;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/src/trackinfocontroller.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,259 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <e32base.h>
+#include <remcon/remconextapi1.h>
+#include <remcontrackinfocontroller.h>
+#include <remcontrackinfocontrollerobserver.h>
+#include <remconinterfaceselector.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_EXTAPI1);
+#endif
+
+// Used to pad over the results field in the operation-specific data.
+_LIT8(KResultsPad, "    ");
+
+EXPORT_C CRemConTrackInfoController* CRemConTrackInfoController::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+																	MRemConTrackInfoControllerObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConTrackInfoController* self = new(ELeave) CRemConTrackInfoController(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->BaseConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConTrackInfoController::CRemConTrackInfoController(CRemConInterfaceSelector& aInterfaceSelector, 
+													 MRemConTrackInfoControllerObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConTrackInfoApiUid), 
+						 KMaxName,
+						 aInterfaceSelector,
+						 ERemConClientTypeController),
+	iObserver(aObserver)
+	{
+	}
+
+EXPORT_C CRemConTrackInfoController::~CRemConTrackInfoController()
+	{
+	LOG_FUNC
+	}
+
+TAny* CRemConTrackInfoController::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+void CRemConTrackInfoController::MrcibNewMessage(TUint aOperationId, const TDesC8& aData)
+	{
+	LOG_FUNC
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	LOG1(_L("\taData.Length = %d"), aData.Length());
+	
+	// Get the response error out of aData.
+	if ( aData.Length() < KRemConExtApi1MinimumDataLength )
+		{
+		return; // ditch malformed messages
+		}
+		
+	TInt err = static_cast<TInt>(aData.Ptr()[0]);
+
+	switch ( aOperationId )
+		{
+	case ERemConSetTrackName:
+		iObserver.MrcticoSetTrackNameResponse(err);
+		break;
+
+//Only used in the pan-shared back to back test builds.
+#ifdef SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+	case ERemConGetTrackName:
+		HandleGetTrackNameResponse(err, aData);
+		break;
+	case ERemConGetArtist:
+		HandleGetArtistResponse(err, aData);
+		break;
+	case ERemConGetTrackDuration:
+		HandleGetTrackDurationResponse(err, aData);
+		break;
+#endif //SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+
+	default:
+		break;
+		}
+	}
+
+EXPORT_C void CRemConTrackInfoController::SetTrackName(TRequestStatus& aStatus, const TDesC& aTrackName, TUint& aNumRemotes)
+	{
+	LOG_FUNC
+
+	// First copy aTrackName into a specific descriptor type to 
+	// nail down the structure as we don't know what type of 
+	// descriptor has been passed in. 
+	
+	// TBuf is restricted to 58 characters, this relates to the 
+	// amount of available space in iOutData.
+	TBuf<58> temp;
+	temp.Copy(aTrackName);
+
+	iOutData.Copy(KResultsPad()); //leaves 124 bytes of space
+	
+	TPckgBuf<TName> buf(temp);
+	
+	//Set buf to minimum required length
+	//Size of iLength + Size of iMaxLength + Size of aTrackName
+	//      4 Bytes   +        4 Bytes     +(Max. 58x2) 116 Bytes 
+	//                                     = 124 Bytes Max Size
+	buf.SetLength(sizeof(TUint) + sizeof(TUint) + temp.Size());
+	iOutData.Append(buf);
+
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConTrackInfoApiUid),
+		(TUint)ERemConSetTrackName, 
+		aNumRemotes,
+		ERemConCommand,
+		iOutData);
+	}
+
+
+//Included for internal testing purposes only. Should never be in a released product.
+#ifdef SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+/**
+Sends a 'get track name' command.
+	
+@param aStatus Used by RemCon to indicate completion of the send request.
+@param aNumRemotes On success, will contain the number of remotes the 
+command was sent to.
+*/
+EXPORT_C void CRemConTrackInfoController::GetTrackName(TRequestStatus& aStatus, TUint& aNumRemotes)
+	{
+	LOG_FUNC
+
+	iOutData.Zero();
+	
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConTrackInfoApiUid),
+		(TUint)ERemConGetTrackName, 
+		aNumRemotes,
+		ERemConCommand,
+		iOutData);
+	}
+
+/**
+Sends a 'get artist' command.
+	
+@param aStatus Used by RemCon to indicate completion of the send request.
+@param aNumRemotes On success, will contain the number of remotes the 
+command was sent to.
+*/
+EXPORT_C void CRemConTrackInfoController::GetArtist(TRequestStatus& aStatus, TUint& aNumRemotes)
+	{
+	LOG_FUNC
+	
+	iOutData.Zero();
+	
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConTrackInfoApiUid),
+		(TUint)ERemConGetArtist, 
+		aNumRemotes,
+		ERemConCommand,
+		iOutData);
+	}
+
+/**
+Sends a 'get track duration' command.
+	
+@param aStatus Used by RemCon to indicate completion of the send request.
+@param aNumRemotes On success, will contain the number of remotes the 
+command was sent to.
+*/	
+EXPORT_C void CRemConTrackInfoController::GetTrackDuration(TRequestStatus& aStatus, TUint& aNumRemotes)
+	{
+	LOG_FUNC
+	
+	iOutData.Zero();
+	
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConTrackInfoApiUid),
+		(TUint)ERemConGetTrackDuration, 
+		aNumRemotes,
+		ERemConCommand,
+		iOutData);	
+	}
+	
+/**
+Extracts the track name from the 'get track name' response data and calls 
+the relevant mixin function on the observer.	
+	
+@param The data passed with the response.
+*/	
+void CRemConTrackInfoController::HandleGetTrackNameResponse(TInt aError, const TDesC8& aData)
+	{
+	LOG_FUNC	
+	
+	TPckgBuf<TName> buf;
+	buf.Copy((aData.Mid(KRemConExtApi1ResultDataLength)));
+	iObserver.MrcticoGetTrackNameResponse(aError, buf());
+	}
+
+/**
+Extracts the artist from the 'get artist' response data and calls 
+the relevant mixin function on the observer.	
+	
+@param The data passed with the response.
+*/	
+void CRemConTrackInfoController::HandleGetArtistResponse(TInt aError, const TDesC8& aData)
+	{
+	LOG_FUNC
+
+	TPckgBuf<TName> buf;
+	buf.Copy((aData.Mid(KRemConExtApi1ResultDataLength)));
+	iObserver.MrcticoGetArtistResponse(aError, buf());
+	}
+
+/**
+Extracts the track duration from the 'get track duration' response data and calls 
+the relevant mixin function on the observer.	
+	
+@param The data passed with the response.
+*/	
+void CRemConTrackInfoController::HandleGetTrackDurationResponse(TInt aError, const TDesC8& aData)
+	{
+	LOG_FUNC	
+	
+	TPckgBuf<TInt64> buf;
+	buf.Copy((aData.Mid(KRemConExtApi1ResultDataLength)));
+	TTime duration(buf());
+	iObserver.MrcticoGetTrackDurationResponse(aError, duration);
+	}
+
+#pragma message ("The remote control Track Info extension API is being built with the extra back to back test code functionality included.  This should only happen in DEBUG build and never be released.")
+
+#endif //SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/src/trackinfocontrollerobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,58 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcontrackinfocontrollerobserver.h>
+
+EXPORT_C void MRemConTrackInfoControllerObserver::MrcticoSetTrackNameResponse(TInt /*aError*/)
+	{
+	}
+
+//Only used in the internal pan-shared back to back test builds. Should never be in a released product.
+#ifdef SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+/**
+A response to a 'get track name' command has been received.
+	
+@param aError The response error.
+@param aTrackName The track name.
+*/
+EXPORT_C void MRemConTrackInfoControllerObserver::MrcticoGetTrackNameResponse(TInt /*aError*/, const TDesC& /*aTrackName*/)
+	{
+	}
+
+/**
+A response to a 'get artist' command has been received.
+	
+@param aError The response error.
+@param aArtist The artist.
+*/	
+EXPORT_C void MRemConTrackInfoControllerObserver::MrcticoGetArtistResponse(TInt /*aError*/, const TDesC& /*aArtist*/)
+	{
+	}
+
+/**
+A response to a 'get track duration' command has been received.
+	
+@param aError The response error.
+@param aDuration The track duration.
+*/	
+EXPORT_C void MRemConTrackInfoControllerObserver::MrcticoGetTrackDurationResponse(TInt /*aError*/, const TTime& /*aDuration*/)
+	{
+	}
+#endif //SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/src/trackinfotarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,231 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <e32base.h>
+#include <remcon/remconextapi1.h>
+#include <remcontrackinfotarget.h>
+#include <remcontrackinfotargetobserver.h>
+#include <remconinterfaceselector.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_EXTAPI1);
+#endif
+
+EXPORT_C CRemConTrackInfoTarget* CRemConTrackInfoTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+																	MRemConTrackInfoTargetObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConTrackInfoTarget* self = new(ELeave) CRemConTrackInfoTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->BaseConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConTrackInfoTarget::CRemConTrackInfoTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+													 MRemConTrackInfoTargetObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConTrackInfoApiUid), 
+						 KMaxName,
+						 aInterfaceSelector,
+						 ERemConClientTypeTarget),
+	iObserver(aObserver)
+	{
+	}
+
+EXPORT_C CRemConTrackInfoTarget::~CRemConTrackInfoTarget()
+	{
+	LOG_FUNC
+	}
+
+TAny* CRemConTrackInfoTarget::GetInterfaceIf(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+#ifdef SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+void CRemConTrackInfoTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData)
+#else
+void CRemConTrackInfoTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& /*aData*/)
+#endif //SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+	{
+	LOG_FUNC
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+
+	switch ( aOperationId )
+		{
+	case ERemConGetTrackName:
+		iObserver.MrctitoGetTrackName();
+		break;
+
+	case ERemConGetArtist:
+		iObserver.MrctitoGetArtist();
+		break;
+
+	case ERemConGetTrackDuration:
+		iObserver.MrctitoGetTrackDuration();
+		break;
+
+//Only used in the internal pan-shared back to back test builds. Should never be in a released product.
+#ifdef SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+	case ERemConSetTrackName:
+		HandleSetTrackName(aData);
+		break;
+#endif //SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+	
+	default:
+		break;
+		}
+	}
+
+EXPORT_C void CRemConTrackInfoTarget::GetTrackNameResponse(TRequestStatus& aStatus, const TDesC& aTrackName, TInt aError)
+	{
+	LOG_FUNC
+
+	// First copy aTrackName into a specific descriptor type to 
+	// nail down the structure as we don't know what type of 
+	// descriptor has been passed in. 
+	
+	// TBuf is restricted to 58 characters, this relates to the 
+	// amount of available space in iOutData.
+	TBuf<58> temp;
+	temp.Copy(aTrackName);
+
+	iOutData.Copy((TUint8*)&aError, KRemConExtApi1ResultDataLength);
+	
+	TPckgBuf<TName> buf(temp);
+	//Set buf to minimum required length
+	//Size of iLength + Size of iMaxLength + Size of aTrackName
+	//      4 Bytes   +        4 Bytes     +(Max. 58x2) 116 Bytes 
+	//                                     = 124 Bytes Max Size
+	buf.SetLength(sizeof(TUint) + sizeof(TUint) + temp.Size());
+	
+	iOutData.Append(buf);
+
+	// We pass iNumRemotes even though we're not interested in its value but 
+	// RemCon will write to this location so we need it to be somewhere safe.
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConTrackInfoApiUid),
+		(TUint)ERemConGetTrackName, 
+		iNumRemotes,
+		ERemConResponse,
+		iOutData);
+	}
+
+EXPORT_C void CRemConTrackInfoTarget::GetArtistResponse(TRequestStatus& aStatus, const TDesC& aArtist, TInt aError)
+	{
+	LOG_FUNC
+
+	// First copy aArtist into a specific descriptor type to 
+	// nail down the structure as we don't know what type of 
+	// descriptor has been passed in. 
+	
+	// TBuf is restricted to 58 characters, this relates to the 
+	// amount of available space in iOutData.
+	TBuf<58> temp;
+	temp.Copy(aArtist);
+
+	iOutData.Copy((TUint8*)&aError, KRemConExtApi1ResultDataLength);
+	
+	TPckgBuf<TName> buf(temp);
+	//Set buf to minimum required length
+	//Size of iLength + Size of iMaxLength + Size of aTrackName
+	//      4 Bytes   +        4 Bytes     +(Max. 58x2) 116 Bytes 
+	//                                     = 124 Bytes Max Size
+	buf.SetLength(sizeof(TUint) + sizeof(TUint) + temp.Size());
+	
+	iOutData.Append(buf);
+
+	// We pass iNumRemotes even though we're not interested in its value but 
+	// RemCon will write to this location so we need it to be somewhere safe.
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConTrackInfoApiUid),
+		(TUint)ERemConGetArtist, 
+		iNumRemotes,
+		ERemConResponse,
+		iOutData);
+	}
+
+EXPORT_C void CRemConTrackInfoTarget::GetTrackDurationResponse(TRequestStatus& aStatus, const TTime& aDuration, TInt aError)
+	{
+	LOG_FUNC
+
+	iOutData.Copy((TUint8*)&aError, KRemConExtApi1ResultDataLength);
+	TInt64 int64 = aDuration.Int64();
+	TPckgBuf<TInt64> buf(int64);
+	iOutData.Append(buf);
+
+	// We pass iNumRemotes even though we're not interested in its value but 
+	// RemCon will write to this location so we need it to be somewhere safe.
+	InterfaceSelector().Send(aStatus, 
+		TUid::Uid(KRemConTrackInfoApiUid),
+		(TUint)ERemConGetTrackDuration, 
+		iNumRemotes,
+		ERemConResponse,
+		iOutData);
+	}
+
+
+//Only used in the internal pan-shared back to back test builds. Should never be in a released product.
+#ifdef SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+/**
+Sends a response to a 'set track name' command.
+	
+@param aStatus Used by RemCon to indicate completion of the send request.
+@param aError The response error.
+*/
+EXPORT_C void CRemConTrackInfoTarget::SetTrackNameResponse(TRequestStatus& aStatus, TInt aError)
+	{
+	LOG_FUNC
+	
+	iOutData.Copy((TUint8*)&aError, KRemConExtApi1ResultDataLength);
+
+	InterfaceSelector().Send(aStatus,
+		TUid::Uid(KRemConTrackInfoApiUid),
+		(TUint)ERemConSetTrackName,
+		iNumRemotes,
+		ERemConResponse,
+		iOutData);	
+	}
+
+/**
+Extracts the track name from the 'set track name' command data and calls 
+the relevant mixin function on the observer.
+	
+@param aData The data passed with the command.
+*/	
+void CRemConTrackInfoTarget::HandleSetTrackName(const TDesC8& aData)
+	{
+	LOG_FUNC
+
+	TPckgBuf<TName> buf;
+	buf.Copy((aData.Mid(KRemConExtApi1ResultDataLength)));
+	iObserver.MrctitoSetTrackName(buf());
+	}
+#endif //SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/extapi1/src/trackinfotargetobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,45 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcontrackinfotargetobserver.h>
+
+EXPORT_C void MRemConTrackInfoTargetObserver::MrctitoGetTrackName()
+	{
+	}
+
+EXPORT_C void MRemConTrackInfoTargetObserver::MrctitoGetArtist()
+	{
+	}
+
+EXPORT_C void MRemConTrackInfoTargetObserver::MrctitoGetTrackDuration()
+	{
+	}
+
+//Only used in the internal pan-shared back to back test builds. Should never be in a released product.
+#ifdef SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
+/**
+A 'set track name' command has been received.
+	
+@param aTrackName The new track name from the controller.
+*/
+EXPORT_C void MRemConTrackInfoTargetObserver::MrctitoSetTrackName(const TDesC& /*aTrackName*/)
+	{
+	}
+#endif //SYMBIAN_ENABLE_TRACKINFO_BACKTOBACK_TEST_FUNCT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/inner/bwins/remconclientU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,38 @@
+EXPORTS
+	?__DbgCheckHeap@RRemConBulk@@QAEHH@Z @ 1 NONAME ; int RRemConBulk::__DbgCheckHeap(int)
+	??0RRemConBulk@@QAE@XZ @ 2 NONAME ; RRemConBulk::RRemConBulk(void)
+	?Receive@RRemCon@@QAEXAAVTRequestStatus@@AAUTRemConClientReceivePackage@@AAVTDes8@@@Z @ 3 NONAME ; void RRemCon::Receive(class TRequestStatus &, struct TRemConClientReceivePackage &, class TDes8 &)
+	?__DbgMarkHeap@RRemCon@@QAEHXZ @ 4 NONAME ; int RRemCon::__DbgMarkHeap(void)
+	?DisconnectBearerCancel@RRemConController@@QAEHXZ @ 5 NONAME ; int RRemConController::DisconnectBearerCancel(void)
+	?Receive@RRemConBulk@@QAEXAAVTRequestStatus@@AAVTUid@@AAIAAVTDes8@@@Z @ 6 NONAME ; void RRemConBulk::Receive(class TRequestStatus &, class TUid &, unsigned int &, class TDes8 &)
+	?SendCancel@RRemConBulk@@QAEHXZ @ 7 NONAME ; int RRemConBulk::SendCancel(void)
+	?ReceiveCancel@RRemConBulk@@QAEHXZ @ 8 NONAME ; int RRemConBulk::ReceiveCancel(void)
+	?ReceiveCancel@RRemCon@@QAEHXZ @ 9 NONAME ; int RRemCon::ReceiveCancel(void)
+	?Send@RRemConBulk@@QAEXAAVTRequestStatus@@VTUid@@IABVTDesC8@@@Z @ 10 NONAME ; void RRemConBulk::Send(class TRequestStatus &, class TUid, unsigned int, class TDesC8 const &)
+	?ConnectBearerCancel@RRemConController@@QAEHXZ @ 11 NONAME ; int RRemConController::ConnectBearerCancel(void)
+	?NotifyConnectionsChange@RRemCon@@QAEXAAVTRequestStatus@@@Z @ 12 NONAME ; void RRemCon::NotifyConnectionsChange(class TRequestStatus &)
+	?__DbgMarkEnd@RRemConBulk@@QAEHH@Z @ 13 NONAME ; int RRemConBulk::__DbgMarkEnd(int)
+	?RegisterInterestedAPIs@RRemCon@@QAEHABVTDesC8@@@Z @ 14 NONAME ; int RRemCon::RegisterInterestedAPIs(class TDesC8 const &)
+	?SendUnreliable@RRemConBulk@@QAEHVTUid@@IABVTDesC8@@@Z @ 15 NONAME ; int RRemConBulk::SendUnreliable(class TUid, unsigned int, class TDesC8 const &)
+	?Connect@RRemCon@@QAEHXZ @ 16 NONAME ; int RRemCon::Connect(void)
+	?Connect@RRemConBulk@@QAEHXZ @ 17 NONAME ; int RRemConBulk::Connect(void)
+	?DisconnectBearer@RRemConController@@QAEXAAVTRequestStatus@@@Z @ 18 NONAME ; void RRemConController::DisconnectBearer(class TRequestStatus &)
+	?GetConnections@RRemCon@@QAEHAAV?$TSglQue@VTRemConAddress@@@@@Z @ 19 NONAME ; int RRemCon::GetConnections(class TSglQue<class TRemConAddress> &)
+	?Connect@RRemCon@@QAEHABW4TPlayerType@@ABW4TPlayerSubType@@ABVTDesC8@@@Z @ 20 NONAME ; int RRemCon::Connect(enum TPlayerType const &, enum TPlayerSubType const &, class TDesC8 const &)
+	?Version@RRemConBulk@@QBE?AVTVersion@@XZ @ 21 NONAME ; class TVersion RRemConBulk::Version(void) const
+	?ConnectBearer@RRemConController@@QAEXAAVTRequestStatus@@@Z @ 22 NONAME ; void RRemConController::ConnectBearer(class TRequestStatus &)
+	??0RRemConTarget@@QAE@XZ @ 23 NONAME ; RRemConTarget::RRemConTarget(void)
+	?GoConnectionless@RRemConController@@QAEHXZ @ 24 NONAME ; int RRemConController::GoConnectionless(void)
+	?__DbgFailNext@RRemCon@@QAEHH@Z @ 25 NONAME ; int RRemCon::__DbgFailNext(int)
+	?__DbgFailNext@RRemConBulk@@QAEHH@Z @ 26 NONAME ; int RRemConBulk::__DbgFailNext(int)
+	?SendCancel@RRemCon@@QAEHXZ @ 27 NONAME ; int RRemCon::SendCancel(void)
+	?GoConnectionOriented@RRemConController@@QAEHABVTRemConAddress@@@Z @ 28 NONAME ; int RRemConController::GoConnectionOriented(class TRemConAddress const &)
+	?Send@RRemCon@@QAEXAAVTRequestStatus@@VTUid@@IAAIW4TRemConMessageSubType@@ABVTDesC8@@@Z @ 29 NONAME ; void RRemCon::Send(class TRequestStatus &, class TUid, unsigned int, unsigned int &, enum TRemConMessageSubType, class TDesC8 const &)
+	?NotifyConnectionsChangeCancel@RRemCon@@QAEHXZ @ 30 NONAME ; int RRemCon::NotifyConnectionsChangeCancel(void)
+	?__DbgMarkHeap@RRemConBulk@@QAEHXZ @ 31 NONAME ; int RRemConBulk::__DbgMarkHeap(void)
+	?SendNotify@RRemCon@@QAEXAAVTRequestStatus@@VTUid@@IW4TRemConMessageSubType@@ABVTDesC8@@@Z @ 32 NONAME ; void RRemCon::SendNotify(class TRequestStatus &, class TUid, unsigned int, enum TRemConMessageSubType, class TDesC8 const &)
+	?SendUnreliable@RRemCon@@QAEHVTUid@@IW4TRemConMessageSubType@@ABVTDesC8@@@Z @ 33 NONAME ; int RRemCon::SendUnreliable(class TUid, unsigned int, enum TRemConMessageSubType, class TDesC8 const &)
+	?__DbgMarkEnd@RRemCon@@QAEHH@Z @ 34 NONAME ; int RRemCon::__DbgMarkEnd(int)
+	??0RRemConController@@QAE@XZ @ 35 NONAME ; RRemConController::RRemConController(void)
+	?__DbgCheckHeap@RRemCon@@QAEHH@Z @ 36 NONAME ; int RRemCon::__DbgCheckHeap(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/inner/eabi/remconclientU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,40 @@
+EXPORTS
+	_ZN11RRemConBulk10SendCancelEv @ 1 NONAME
+	_ZN11RRemConBulk12__DbgMarkEndEi @ 2 NONAME
+	_ZN11RRemConBulk13ReceiveCancelEv @ 3 NONAME
+	_ZN11RRemConBulk13__DbgFailNextEi @ 4 NONAME
+	_ZN11RRemConBulk13__DbgMarkHeapEv @ 5 NONAME
+	_ZN11RRemConBulk14SendUnreliableE4TUidjRK6TDesC8 @ 6 NONAME
+	_ZN11RRemConBulk14__DbgCheckHeapEi @ 7 NONAME
+	_ZN11RRemConBulk4SendER14TRequestStatus4TUidjRK6TDesC8 @ 8 NONAME
+	_ZN11RRemConBulk7ConnectEv @ 9 NONAME
+	_ZN11RRemConBulk7ReceiveER14TRequestStatusR4TUidRjR5TDes8 @ 10 NONAME
+	_ZN11RRemConBulkC1Ev @ 11 NONAME
+	_ZN11RRemConBulkC2Ev @ 12 NONAME
+	_ZN13RRemConTargetC1Ev @ 13 NONAME
+	_ZN13RRemConTargetC2Ev @ 14 NONAME
+	_ZN17RRemConController13ConnectBearerER14TRequestStatus @ 15 NONAME
+	_ZN17RRemConController16DisconnectBearerER14TRequestStatus @ 16 NONAME
+	_ZN17RRemConController16GoConnectionlessEv @ 17 NONAME
+	_ZN17RRemConController19ConnectBearerCancelEv @ 18 NONAME
+	_ZN17RRemConController20GoConnectionOrientedERK14TRemConAddress @ 19 NONAME
+	_ZN17RRemConController22DisconnectBearerCancelEv @ 20 NONAME
+	_ZN17RRemConControllerC1Ev @ 21 NONAME
+	_ZN17RRemConControllerC2Ev @ 22 NONAME
+	_ZN7RRemCon10SendCancelEv @ 23 NONAME
+	_ZN7RRemCon10SendNotifyER14TRequestStatus4TUidj21TRemConMessageSubTypeRK6TDesC8 @ 24 NONAME
+	_ZN7RRemCon12__DbgMarkEndEi @ 25 NONAME
+	_ZN7RRemCon13ReceiveCancelEv @ 26 NONAME
+	_ZN7RRemCon13__DbgFailNextEi @ 27 NONAME
+	_ZN7RRemCon13__DbgMarkHeapEv @ 28 NONAME
+	_ZN7RRemCon14GetConnectionsER7TSglQueI14TRemConAddressE @ 29 NONAME
+	_ZN7RRemCon14SendUnreliableE4TUidj21TRemConMessageSubTypeRK6TDesC8 @ 30 NONAME
+	_ZN7RRemCon14__DbgCheckHeapEi @ 31 NONAME
+	_ZN7RRemCon22RegisterInterestedAPIsERK6TDesC8 @ 32 NONAME
+	_ZN7RRemCon23NotifyConnectionsChangeER14TRequestStatus @ 33 NONAME
+	_ZN7RRemCon29NotifyConnectionsChangeCancelEv @ 34 NONAME
+	_ZN7RRemCon4SendER14TRequestStatus4TUidjRj21TRemConMessageSubTypeRK6TDesC8 @ 35 NONAME
+	_ZN7RRemCon7ConnectERK11TPlayerTypeRK14TPlayerSubTypeRK6TDesC8 @ 36 NONAME
+	_ZN7RRemCon7ConnectEv @ 37 NONAME
+	_ZN7RRemCon7ReceiveER14TRequestStatusR27TRemConClientReceivePackageR5TDes8 @ 38 NONAME
+	_ZNK11RRemConBulk7VersionEv @ 39 NONAME
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/inner/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,25 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// bld.inf for Rem Con client side.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconclient.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/inner/group/remconclient.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,50 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconclient.dll Remote Control (inner) client side library.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET			remconclient.dll
+TARGETPATH		/system/libs
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			session.cpp
+SOURCE			bulksession.cpp
+
+
+USERINCLUDE 	../../../common
+USERINCLUDE 	../../common
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		remcontypes.lib
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/inner/src/bulksession.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,173 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <e32base.h>
+#include <bluetooth/logger.h>
+
+#include "remconbulkclient.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_INNER);
+#endif
+
+EXPORT_C RRemConBulk::RRemConBulk() 
+:	iUidPckg(0),
+	iOpIdPckg(0)
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C TVersion RRemConBulk::Version() const
+	{
+	LOG_FUNC
+	return(TVersion(	KRemConBulkSrvMajorVersionNumber,
+						KRemConBulkSrvMinorVersionNumber,
+						KRemConBulkSrvBuildNumber
+					)
+			);
+	}
+
+EXPORT_C TInt RRemConBulk::Connect()
+	{
+	LOG_FUNC
+	const TInt KNumberOfBulkSessionAsyncApis = 2;
+	return CreateSession(KRemConBulkServerName, Version(), KNumberOfBulkSessionAsyncApis);
+	}
+
+EXPORT_C TInt RRemConBulk::SendUnreliable(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		const TDesC8& aData)
+	{
+	LOG_FUNC
+	TIpcArgs args;
+	
+	args.Set(0, aInterfaceUid.iUid);
+	args.Set(1, aOperationId);
+	args.Set(2, &aData);
+	TInt err = SendReceive(ERemConBulkSendUnreliable, args); 
+	return err;
+	}
+
+
+EXPORT_C void RRemConBulk::Send(TRequestStatus& aStatus, 
+		TUid aInterfaceUid, 
+		TUint aOperationId, 
+		const TDesC8& aData)
+	{
+	LOG_FUNC
+
+	TIpcArgs args;
+	args.Set(0, aInterfaceUid.iUid);
+	args.Set(1, aOperationId);
+	args.Set(2, &aData);
+
+	SendReceive(ERemConBulkSend,
+		args,
+		aStatus
+		);
+	}
+	
+EXPORT_C TInt RRemConBulk::SendCancel()
+	{
+	LOG_FUNC
+	
+	//Ignore Return code because
+	// a) It'll mostly be other than KErrNone because the server has terminated, in which
+	//    case the original async request will have completed with the error anyway!
+	// b) It's meaningless to the client whatever the return code is.
+	(void)SendReceive(ERemConBulkSendCancel);
+	
+	return KErrNone; 
+	}
+
+EXPORT_C void RRemConBulk::Receive(TRequestStatus& aStatus, 
+							   TUid& aInterfaceUid,
+							   TUint& aOperationId,
+							   TDes8& aData)
+	{
+	LOG_FUNC
+
+	TIpcArgs args;
+	iUidPckg.Set((TUint8*)&aInterfaceUid.iUid, sizeof(TUint), sizeof(TUint));
+	args.Set(0, &iUidPckg);
+	iOpIdPckg.Set((TUint8*)&aOperationId, sizeof(TUint), sizeof(TUint));
+	args.Set(1, &iOpIdPckg);
+	args.Set(2, &aData);
+
+	SendReceive(ERemConBulkReceive, 
+		args,
+		aStatus);
+	}
+
+EXPORT_C TInt RRemConBulk::ReceiveCancel()
+	{
+	LOG_FUNC
+
+	// See RRemConBulk::SendCancel() for comment
+	(void)SendReceive(ERemConBulkReceiveCancel);
+	
+	return KErrNone;
+	}
+
+EXPORT_C TInt RRemConBulk::__DbgMarkHeap()
+	{
+	LOG_FUNC
+#ifdef _DEBUG
+	return SendReceive(ERemConBulkDbgMarkHeap);
+#else
+	return KErrNone;
+#endif
+	}
+
+EXPORT_C TInt RRemConBulk::__DbgCheckHeap(TInt aCount)
+	{
+	LOG_FUNC
+#ifdef _DEBUG
+	return SendReceive(ERemConBulkDbgCheckHeap, TIpcArgs(aCount));
+#else
+	(void)aCount;
+	return KErrNone;
+#endif
+	}
+
+EXPORT_C TInt RRemConBulk::__DbgMarkEnd(TInt aCount)
+	{
+	LOG_FUNC
+#ifdef _DEBUG
+	return SendReceive(ERemConBulkDbgMarkEnd, TIpcArgs(aCount));
+#else
+	(void)aCount;
+	return KErrNone;
+#endif
+	}
+
+EXPORT_C TInt RRemConBulk::__DbgFailNext(TInt aCount)
+	{
+	LOG_FUNC
+#ifdef _DEBUG
+	return SendReceive(ERemConBulkDbgFailNext, TIpcArgs(aCount));
+#else
+	(void)aCount;
+	return KErrNone;
+#endif
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/inner/src/session.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,497 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <e32base.h>
+#include "remconserver.h"
+#include <remconaddress.h>
+#include "remconclient.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_INNER);
+#endif
+
+/** 
+Starts the server process.
+*/
+static TInt StartServer()
+	{
+	LOG_STATIC_FUNC
+	const TUidType serverUid(KNullUid, KNullUid, KRemConSrvUid);
+
+	//
+	// EPOC and EKA2 is easy, we just create a new server process. Simultaneous
+	// launching of two such processes should be detected when the second one
+	// attempts to create the server object, failing with KErrAlreadyExists.
+	//
+	RProcess server;
+	TInt err = server.Create(KRemConServerImg, KNullDesC, serverUid);
+	
+	if ( err != KErrNone )
+		{
+		return err;
+		}
+
+	TRequestStatus stat;
+	server.Rendezvous(stat);
+	
+	if ( stat != KRequestPending )
+		{
+		server.Kill(0); 	// abort startup
+		}
+	else
+		{
+		server.Resume();	// logon OK - start the server
+		}
+
+	User::WaitForRequest(stat); 	// wait for start or death
+
+	// we can't use the 'exit reason' if the server panicked as this
+	// is the panic 'reason' and may be '0' which cannot be distinguished
+	// from KErrNone
+	err = (server.ExitType() == EExitPanic) ? KErrServerTerminated : stat.Int();
+
+	server.Close();
+
+	return err;
+	}
+
+RRemCon::RRemCon(TRemConClientType aClientType) 
+:	iClientType(aClientType),
+	iNumRemotesPckg(0),
+	iReceivePckg(TRemConClientReceivePackage())
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C TInt RRemCon::Connect()
+	{
+	LOG_FUNC
+
+	TInt err = DoConnect();
+
+	return err;
+	}
+
+EXPORT_C TInt RRemCon::Connect(const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName)
+	{
+	LOG_FUNC
+
+	TInt err = DoConnect();
+	if ( err == KErrNone )	
+		{
+		err = SetPlayerType(aPlayerType,aPlayerSubType,aName);
+		if ( err != KErrNone )
+			{
+			// For this API to be clean, we must clean up the session handle 
+			// already successfully created.
+			Close();
+			}
+		}
+	return err;
+	}
+/**
+Connects the session, starting the server if necessary. This involves two IPC 
+calls, the first to connect the session to the server, the second to set the 
+server-side session's type correctly (controller or target).
+@return Error.
+*/
+TInt RRemCon::DoConnect()
+	{
+	LOG_FUNC
+	TInt retry = 2;
+	
+	FOREVER
+		{
+		// 4 is the number of asynchronous APIs which may be outstanding 
+		// simultaneously.
+		TInt err = CreateSession(KRemConServerName, Version(), 4);
+
+		if ((err != KErrNotFound) && (err != KErrServerTerminated))
+			{
+			return err;
+			}
+
+		if (--retry == 0)
+			{
+			return err;
+			}
+
+		err = StartServer();
+
+		if ((err != KErrNone) && (err != KErrAlreadyExists))
+			{
+			return err;
+			}
+		}
+	}
+
+/**
+Does IPC with the server to set the type of the session from our member (set 
+at construction time).
+@return Error.
+*/
+TInt RRemCon::SetPlayerType(const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName)
+	{
+	LOG_FUNC
+	TIpcArgs args;
+	// Message slot 0 is not currently used
+	iPlayerTypePckg().iPlayerType = aPlayerType;
+	iPlayerTypePckg().iPlayerSubType = aPlayerSubType;
+	args.Set(1,&iPlayerTypePckg);
+	args.Set(2, &aName);
+	return SendReceive(ERemConSetPlayerType, args);
+	}
+
+EXPORT_C TInt RRemCon::SendUnreliable(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TRemConMessageSubType aSubType,
+		const TDesC8& aData)
+	{
+	LOG_FUNC
+	TIpcArgs args;
+	iOpInfoPckg().iOperationId = aOperationId;
+	iOpInfoPckg().iMessageSubType = aSubType;
+	
+	args.Set(0, aInterfaceUid.iUid);
+	args.Set(1, &iOpInfoPckg);
+	args.Set(3, &aData);
+	TInt err = SendReceive(ERemConSendUnreliable, args); 
+	return err;
+	}
+
+
+EXPORT_C void RRemCon::Send(TRequestStatus& aStatus, 
+		TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint& aNumRemotes,
+		TRemConMessageSubType aSubType,
+		const TDesC8& aData)
+	{
+	LOG_FUNC
+
+	TIpcArgs args;
+	iOpInfoPckg().iOperationId = aOperationId;
+	iOpInfoPckg().iMessageSubType = aSubType;
+	args.Set(0, aInterfaceUid.iUid);
+	args.Set(1, &iOpInfoPckg);
+	iNumRemotesPckg.Set((TUint8*)&aNumRemotes, sizeof(TUint), sizeof(TUint));
+	args.Set(2, &iNumRemotesPckg);
+	args.Set(3, &aData);
+
+	SendReceive(ERemConSend,
+		args,
+		aStatus
+		);
+	}
+
+/**
+Sends a notify command to the remote device.
+
+@see RRemCon::Send()
+*/
+EXPORT_C void RRemCon::SendNotify(TRequestStatus& aStatus, 
+		TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TRemConMessageSubType aSubType,
+		const TDesC8& aData)
+	{
+	LOG_FUNC
+
+	TIpcArgs args;
+	iOpInfoPckg().iOperationId = aOperationId;
+	iOpInfoPckg().iMessageSubType = aSubType;
+	args.Set(0, aInterfaceUid.iUid);
+	args.Set(1, &iOpInfoPckg);
+	args.Set(2, &aData);
+		
+	SendReceive(ERemConSendNotify,
+		args,
+		aStatus
+		);
+	}
+	
+EXPORT_C TInt RRemCon::SendCancel()
+	{
+	LOG_FUNC
+	
+	//Ignore Return code because
+	// a) It'll mostly be other than KErrNone because the server has terminated, in which
+	//    case the original async request will have completed with the error anyway!
+	// b) It's meaningless to the client whatever the return code is.
+	(void)SendReceive(ERemConSendCancel);
+	
+	return KErrNone; 
+	}
+
+EXPORT_C void RRemCon::Receive(TRequestStatus& aStatus, 
+							   TRemConClientReceivePackage& aReceivePackage,
+							   TDes8& aData)
+	{
+	LOG_FUNC
+
+	TIpcArgs args;
+	iReceivePckg.Set(reinterpret_cast<TUint8*>(&aReceivePackage), sizeof(TRemConClientReceivePackage), sizeof(TRemConClientReceivePackage));
+	args.Set(0, &iReceivePckg);
+	args.Set(1, &aData);
+
+	SendReceive(ERemConReceive, 
+		args,
+		aStatus);
+	}
+
+EXPORT_C TInt RRemCon::ReceiveCancel()
+	{
+	LOG_FUNC
+
+	// See RRemCon::SendCancel() for comment
+	(void)SendReceive(ERemConReceiveCancel);
+	
+	return KErrNone;
+	}
+
+EXPORT_C TInt RRemCon::GetConnections(TSglQue<TRemConAddress>& aConnections)
+	{
+	LOG_FUNC
+
+	// Plan: 
+	// 1/ Empty the given queue (in case of any subsequent error).
+	// 2/ First IPC call: get the current number of connections from the 
+	// server and allocate a buffer to read their statuses into. 
+	// 3/ Second IPC call: read the connections into that buffer, and translate 
+	// them into the client's queue.
+	// What if the set of connections changes between these 2 IPC calls? The 
+	// server-side session needs to remember the set of connection statuses at 
+	// the point in time of the 1st IPC call, to correctly answer the 2nd IPC 
+	// call. This means the server-side session has to queue connection state 
+	// changes that occur in the meantime, which can fail due to memory 
+	// allocation. This is OK because (a) they can fail a new connection 
+	// indication back to the bearer, and (b) they can make sure they can 
+	// handle a disconnection indication by pre-allocating (at connection 
+	// establishment time) enough memory to be able to remember its future 
+	// disconnection.
+
+	// 1/
+	aConnections.Reset();
+
+	// 2/
+	TUint connCount = 0;
+	TPckg<TUint> countBuf(connCount);
+	TInt err = SendReceive(ERemConGetConnectionCount, TIpcArgs(&countBuf));
+	// Only bother to get the statuses if there are some to get- otherwise 
+	// just give the client back their empty queue and KErrNone.
+	if ( err == KErrNone && connCount != 0 )
+		{
+		RBuf8 buf;
+		err = buf.Create(connCount * sizeof(TRemConAddress));
+		if ( err == KErrNone )
+			{
+			// 3/
+			err = SendReceive(ERemConGetConnections, TIpcArgs(&buf));
+			if ( err == KErrNone )
+				{
+				// Read the statuses into the client's array.
+				for ( TUint ii = 0 ; ii < connCount ; ii++ )
+					{
+					// Divide the data in to TRemConAddress portions
+					TRemConAddress* tempAddr = new TRemConAddress();
+					if (tempAddr)
+						{
+						Mem::Copy((TAny*)(tempAddr),(TAny*)(buf.Ptr()+(ii*sizeof(TRemConAddress))) , sizeof(TRemConAddress));	
+						aConnections.AddLast(*tempAddr);			
+						}
+					else
+						{
+						// Perform the cleanup in case of error
+						TSglQueIter<TRemConAddress> iter(aConnections);
+						iter.SetToFirst();
+						TRemConAddress* addr;
+						while (( addr = iter++ )  != NULL )
+							{
+							aConnections.Remove(*addr);
+							delete addr;	
+							};
+							
+						err = KErrNoMemory;
+						break;				
+						}
+					}
+				}
+			// The data that was in buf is passed into small appBuf's 
+			// and it is now owned by the client (via their TSglQue).
+			}
+		// Cleanup the allocated buffer for statuses info
+		buf.Close();
+		}
+	return err;
+	}
+
+EXPORT_C void RRemCon::NotifyConnectionsChange(TRequestStatus& aStatus)
+	{
+	LOG_FUNC
+
+	SendReceive(ERemConNotifyConnectionsChange, 
+		aStatus);
+	}
+
+EXPORT_C TInt RRemCon::NotifyConnectionsChangeCancel()
+	{
+	LOG_FUNC
+
+	// See RRemCon::SendCancel() for comment
+	(void)SendReceive(ERemConNotifyConnectionsChangeCancel);
+
+	return KErrNone;
+	}
+
+EXPORT_C TInt RRemCon::RegisterInterestedAPIs(const TDesC8& aAPIs)
+	{
+	LOG_FUNC
+	return SendReceive(ERemConRegisterInterestedAPIs, TIpcArgs(&aAPIs));
+	}
+
+EXPORT_C TInt RRemCon::__DbgMarkHeap()
+	{
+	LOG_FUNC
+#ifdef _DEBUG
+	return SendReceive(ERemConDbgMarkHeap);
+#else
+	return KErrNone;
+#endif
+	}
+
+EXPORT_C TInt RRemCon::__DbgCheckHeap(TInt aCount)
+	{
+	LOG_FUNC
+#ifdef _DEBUG
+	return SendReceive(ERemConDbgCheckHeap, TIpcArgs(aCount));
+#else
+	(void)aCount;
+	return KErrNone;
+#endif
+	}
+
+EXPORT_C TInt RRemCon::__DbgMarkEnd(TInt aCount)
+	{
+	LOG_FUNC
+#ifdef _DEBUG
+	return SendReceive(ERemConDbgMarkEnd, TIpcArgs(aCount));
+#else
+	(void)aCount;
+	return KErrNone;
+#endif
+	}
+
+EXPORT_C TInt RRemCon::__DbgFailNext(TInt aCount)
+	{
+	LOG_FUNC
+#ifdef _DEBUG
+	return SendReceive(ERemConDbgFailNext, TIpcArgs(aCount));
+#else
+	(void)aCount;
+	return KErrNone;
+#endif
+	}
+
+EXPORT_C RRemConController::RRemConController()
+:	RRemCon(ERemConClientTypeController)
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C TInt RRemConController::GoConnectionOriented(const TRemConAddress& aConnection)
+	{
+	LOG_FUNC
+
+	return SendReceive(ERemConGoConnectionOriented,
+			TIpcArgs(aConnection.BearerUid().iUid, 
+					&aConnection.Addr())
+		);
+	}
+
+EXPORT_C TInt RRemConController::GoConnectionless()
+	{
+	LOG_FUNC
+
+	return SendReceive(ERemConGoConnectionless);
+	}
+
+EXPORT_C void RRemConController::ConnectBearer(TRequestStatus& aStatus)
+	{
+	LOG_FUNC
+
+	SendReceive(ERemConConnectBearer, 
+		aStatus);
+	}
+
+EXPORT_C TInt RRemConController::ConnectBearerCancel()
+	{
+	LOG_FUNC
+
+	// See RRemCon::SendCancel() for comment
+	(void)SendReceive(ERemConConnectBearerCancel);
+	
+	return KErrNone;
+	}
+
+EXPORT_C void RRemConController::DisconnectBearer(TRequestStatus& aStatus)
+	{
+	LOG_FUNC
+
+	SendReceive(ERemConDisconnectBearer, 
+		aStatus);
+	}
+
+EXPORT_C TInt RRemConController::DisconnectBearerCancel()
+	{
+	LOG_FUNC
+
+	// See RRemCon::SendCancel() for comment
+	(void)SendReceive(ERemConDisconnectBearerCancel);
+
+	return KErrNone;
+	}
+
+TVersion RRemConController::Version() const
+	{
+	LOG_FUNC
+	return(TVersion(	KRemConSrvMajorVersionNumber,
+						KRemConSrvMinorVersionNumber,
+						KRemConSrvControllerSession
+					)
+			);
+	}
+
+EXPORT_C RRemConTarget::RRemConTarget()
+:	RRemCon(ERemConClientTypeTarget)
+	{
+	LOG_FUNC
+	}
+
+TVersion RRemConTarget::Version() const
+	{
+	LOG_FUNC
+	return(TVersion(	KRemConSrvMajorVersionNumber,
+						KRemConSrvMinorVersionNumber,
+						KRemConSrvTargetSession
+					)
+			);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/bwins/remconinterfacebaseU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,39 @@
+EXPORTS
+	??0CRemConInterfaceBase@@IAE@VTUid@@IAAVCRemConInterfaceSelector@@W4TRemConClientType@@@Z @ 1 NONAME ; CRemConInterfaceBase::CRemConInterfaceBase(class TUid, unsigned int, class CRemConInterfaceSelector &, enum TRemConClientType)
+	??1CRemConInterfaceBase@@UAE@XZ @ 2 NONAME ; CRemConInterfaceBase::~CRemConInterfaceBase(void)
+	??1CRemConInterfaceSelector@@UAE@XZ @ 3 NONAME ; CRemConInterfaceSelector::~CRemConInterfaceSelector(void)
+	?BaseConstructL@CRemConInterfaceBase@@IAEXXZ @ 4 NONAME ; void CRemConInterfaceBase::BaseConstructL(void)
+	?Cancel@CRemConInterfaceBase@@QAEHXZ @ 5 NONAME ; int CRemConInterfaceBase::Cancel(void)
+	?ConnectBearer@CRemConInterfaceSelector@@QAEXAAVTRequestStatus@@@Z @ 6 NONAME ; void CRemConInterfaceSelector::ConnectBearer(class TRequestStatus &)
+	?ConnectBearerCancel@CRemConInterfaceSelector@@QAEHXZ @ 7 NONAME ; int CRemConInterfaceSelector::ConnectBearerCancel(void)
+	?DisconnectBearer@CRemConInterfaceSelector@@QAEXAAVTRequestStatus@@@Z @ 8 NONAME ; void CRemConInterfaceSelector::DisconnectBearer(class TRequestStatus &)
+	?DisconnectBearerCancel@CRemConInterfaceSelector@@QAEHXZ @ 9 NONAME ; int CRemConInterfaceSelector::DisconnectBearerCancel(void)
+	?GetConnections@CRemConInterfaceSelector@@QAEHAAV?$TSglQue@VTRemConAddress@@@@@Z @ 10 NONAME ; int CRemConInterfaceSelector::GetConnections(class TSglQue<class TRemConAddress> &)
+	?GoConnectionOrientedL@CRemConInterfaceSelector@@QAEXABVTRemConAddress@@@Z @ 11 NONAME ; void CRemConInterfaceSelector::GoConnectionOrientedL(class TRemConAddress const &)
+	?GoConnectionlessL@CRemConInterfaceSelector@@QAEXXZ @ 12 NONAME ; void CRemConInterfaceSelector::GoConnectionlessL(void)
+	?InterfaceSelector@CRemConInterfaceBase@@IAEAAVCRemConInterfaceSelector@@XZ @ 13 NONAME ; class CRemConInterfaceSelector & CRemConInterfaceBase::InterfaceSelector(void)
+	?NewL@CRemConInterfaceSelector@@SAPAV1@XZ @ 14 NONAME ; class CRemConInterfaceSelector * CRemConInterfaceSelector::NewL(void)
+	?NotifyConnectionsChange@CRemConInterfaceSelector@@QAEXAAVTRequestStatus@@@Z @ 15 NONAME ; void CRemConInterfaceSelector::NotifyConnectionsChange(class TRequestStatus &)
+	?NotifyConnectionsChangeCancel@CRemConInterfaceSelector@@QAEHXZ @ 16 NONAME ; int CRemConInterfaceSelector::NotifyConnectionsChangeCancel(void)
+	?OpenControllerL@CRemConInterfaceSelector@@QAEXXZ @ 17 NONAME ; void CRemConInterfaceSelector::OpenControllerL(void)
+	?OpenTargetL@CRemConInterfaceSelector@@QAEXXZ @ 18 NONAME ; void CRemConInterfaceSelector::OpenTargetL(void)
+	?RegisterInterfaceL@CRemConInterfaceSelector@@QAEXAAVCRemConInterfaceBase@@@Z @ 19 NONAME ; void CRemConInterfaceSelector::RegisterInterfaceL(class CRemConInterfaceBase &)
+	?Send@CRemConInterfaceSelector@@QAEXAAVTRequestStatus@@VTUid@@IAAIW4TRemConMessageType@@ABVTDesC8@@@Z @ 20 NONAME ; void CRemConInterfaceSelector::Send(class TRequestStatus &, class TUid, unsigned int, unsigned int &, enum TRemConMessageType, class TDesC8 const &)
+	?SendCancel@CRemConInterfaceSelector@@QAEHW4TRemConMessageType@@@Z @ 21 NONAME ; int CRemConInterfaceSelector::SendCancel(enum TRemConMessageType)
+	?RegisterErrorObserver@CRemConInterfaceSelector@@QAEXPAVMRemConErrorObserver@@@Z @ 22 NONAME ; void CRemConInterfaceSelector::RegisterErrorObserver(class MRemConErrorObserver *)
+	?ControllerOpened@CRemConInterfaceSelector@@QBEHXZ @ 23 NONAME ; int CRemConInterfaceSelector::ControllerOpened(void) const
+	?TargetOpened@CRemConInterfaceSelector@@QBEHXZ @ 24 NONAME ; int CRemConInterfaceSelector::TargetOpened(void) const
+	?SendUnreliable@CRemConInterfaceSelector@@QAEHVTUid@@IW4TRemConMessageType@@ABVTDesC8@@@Z @ 25 NONAME ; int CRemConInterfaceSelector::SendUnreliable(class TUid, unsigned int, enum TRemConMessageType, class TDesC8 const &)
+	?Send@CRemConInterfaceSelector@@QAEXAAVTRequestStatus@@VTUid@@IAAIW4TRemConMessageType@@W4TRemConMessageSubType@@ABVTDesC8@@@Z @ 26 NONAME ; void CRemConInterfaceSelector::Send(class TRequestStatus &, class TUid, unsigned int, unsigned int &, enum TRemConMessageType, enum TRemConMessageSubType, class TDesC8 const &)
+	?SendUnreliable@CRemConInterfaceSelector@@QAEHVTUid@@IW4TRemConMessageType@@W4TRemConMessageSubType@@ABVTDesC8@@@Z @ 27 NONAME ; int CRemConInterfaceSelector::SendUnreliable(class TUid, unsigned int, enum TRemConMessageType, enum TRemConMessageSubType, class TDesC8 const &)
+	?OpenTargetL@CRemConInterfaceSelector@@QAEXW4TPlayerType@@W4TPlayerSubType@@ABVTDesC8@@@Z @ 28 NONAME ; void CRemConInterfaceSelector::OpenTargetL(enum TPlayerType, enum TPlayerSubType, class TDesC8 const &)
+	?Open@RRemConInterfaceFeatures@@QAEHXZ @ 29 NONAME ; int RRemConInterfaceFeatures::Open(void)
+	?BaseConstructL@CRemConInterfaceBase@@IAEXAAVRRemConInterfaceFeatures@@@Z @ 30 NONAME ; void CRemConInterfaceBase::BaseConstructL(class RRemConInterfaceFeatures &)
+	?Close@RRemConInterfaceFeatures@@QAEXXZ @ 31 NONAME ; void RRemConInterfaceFeatures::Close(void)
+	?AddOperationL@RRemConInterfaceFeatures@@QAEXI@Z @ 32 NONAME ; void RRemConInterfaceFeatures::AddOperationL(unsigned int)
+	?SendBulk@CRemConInterfaceSelector@@QAEXAAVTRequestStatus@@VTUid@@IABVTDesC8@@@Z @ 33 NONAME ; void CRemConInterfaceSelector::SendBulk(class TRequestStatus &, class TUid, unsigned int, class TDesC8 const &)
+	?SendBulkUnreliable@CRemConInterfaceSelector@@QAEHVTUid@@IABVTDesC8@@@Z @ 34 NONAME ; int CRemConInterfaceSelector::SendBulkUnreliable(class TUid, unsigned int, class TDesC8 const &)
+	?SendBulkCancel@CRemConInterfaceSelector@@QAEHXZ @ 35 NONAME ; int CRemConInterfaceSelector::SendBulkCancel(void)
+	?SendNotify@CRemConInterfaceSelector@@QAEXAAVTRequestStatus@@VTUid@@IW4TRemConMessageType@@W4TRemConMessageSubType@@ABVTDesC8@@@Z @ 36 NONAME ; void CRemConInterfaceSelector::SendNotify(class TRequestStatus &, class TUid, unsigned int, enum TRemConMessageType, enum TRemConMessageSubType, class TDesC8 const &)
+	?BaseConstructL@CRemConInterfaceBase@@IAEXAAVRRemConInterfaceFeatures@@H@Z @ 37 NONAME ; void CRemConInterfaceBase::BaseConstructL(class RRemConInterfaceFeatures &, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/eabi/remconinterfacebaseU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,45 @@
+EXPORTS
+	_ZN20CRemConInterfaceBase14BaseConstructLEv @ 1 NONAME
+	_ZN20CRemConInterfaceBase17InterfaceSelectorEv @ 2 NONAME
+	_ZN20CRemConInterfaceBase6CancelEv @ 3 NONAME
+	_ZN20CRemConInterfaceBaseC2E4TUidjR24CRemConInterfaceSelector17TRemConClientType @ 4 NONAME
+	_ZN20CRemConInterfaceBaseD0Ev @ 5 NONAME
+	_ZN20CRemConInterfaceBaseD1Ev @ 6 NONAME
+	_ZN20CRemConInterfaceBaseD2Ev @ 7 NONAME
+	_ZN24CRemConInterfaceSelector10SendCancelE18TRemConMessageType @ 8 NONAME
+	_ZN24CRemConInterfaceSelector11OpenTargetLEv @ 9 NONAME
+	_ZN24CRemConInterfaceSelector13ConnectBearerER14TRequestStatus @ 10 NONAME
+	_ZN24CRemConInterfaceSelector14GetConnectionsER7TSglQueI14TRemConAddressE @ 11 NONAME
+	_ZN24CRemConInterfaceSelector15OpenControllerLEv @ 12 NONAME
+	_ZN24CRemConInterfaceSelector16DisconnectBearerER14TRequestStatus @ 13 NONAME
+	_ZN24CRemConInterfaceSelector17GoConnectionlessLEv @ 14 NONAME
+	_ZN24CRemConInterfaceSelector18RegisterInterfaceLER20CRemConInterfaceBase @ 15 NONAME
+	_ZN24CRemConInterfaceSelector19ConnectBearerCancelEv @ 16 NONAME
+	_ZN24CRemConInterfaceSelector21GoConnectionOrientedLERK14TRemConAddress @ 17 NONAME
+	_ZN24CRemConInterfaceSelector22DisconnectBearerCancelEv @ 18 NONAME
+	_ZN24CRemConInterfaceSelector23NotifyConnectionsChangeER14TRequestStatus @ 19 NONAME
+	_ZN24CRemConInterfaceSelector29NotifyConnectionsChangeCancelEv @ 20 NONAME
+	_ZN24CRemConInterfaceSelector4NewLEv @ 21 NONAME
+	_ZN24CRemConInterfaceSelector4SendER14TRequestStatus4TUidjRj18TRemConMessageTypeRK6TDesC8 @ 22 NONAME
+	_ZN24CRemConInterfaceSelectorD0Ev @ 23 NONAME
+	_ZN24CRemConInterfaceSelectorD1Ev @ 24 NONAME
+	_ZN24CRemConInterfaceSelectorD2Ev @ 25 NONAME
+	_ZTI20CRemConInterfaceBase @ 26 NONAME ; #<TI>#
+	_ZTV20CRemConInterfaceBase @ 27 NONAME ; #<VT>#
+	_ZN24CRemConInterfaceSelector21RegisterErrorObserverEP20MRemConErrorObserver @ 28 NONAME
+	_ZNK24CRemConInterfaceSelector12TargetOpenedEv @ 29 NONAME
+	_ZNK24CRemConInterfaceSelector16ControllerOpenedEv @ 30 NONAME
+	_ZN24CRemConInterfaceSelector14SendUnreliableE4TUidj18TRemConMessageTypeRK6TDesC8 @ 31 NONAME
+	_ZN24CRemConInterfaceSelector14SendUnreliableE4TUidj18TRemConMessageType21TRemConMessageSubTypeRK6TDesC8 @ 32 NONAME
+	_ZN24CRemConInterfaceSelector4SendER14TRequestStatus4TUidjRj18TRemConMessageType21TRemConMessageSubTypeRK6TDesC8 @ 33 NONAME
+	_ZN20CRemConInterfaceBase14BaseConstructLER24RRemConInterfaceFeatures @ 34 NONAME
+	_ZN24CRemConInterfaceSelector11OpenTargetLE11TPlayerType14TPlayerSubTypeRK6TDesC8 @ 35 NONAME
+	_ZN24RRemConInterfaceFeatures13AddOperationLEj @ 36 NONAME
+	_ZN24RRemConInterfaceFeatures4OpenEv @ 37 NONAME
+	_ZN24RRemConInterfaceFeatures5CloseEv @ 38 NONAME
+	_ZN24CRemConInterfaceSelector10SendNotifyER14TRequestStatus4TUidj18TRemConMessageType21TRemConMessageSubTypeRK6TDesC8 @ 39 NONAME
+	_ZN24CRemConInterfaceSelector14SendBulkCancelEv @ 40 NONAME
+	_ZN24CRemConInterfaceSelector18SendBulkUnreliableE4TUidjRK6TDesC8 @ 41 NONAME
+	_ZN24CRemConInterfaceSelector8SendBulkER14TRequestStatus4TUidjRK6TDesC8 @ 42 NONAME
+	_ZN20CRemConInterfaceBase14BaseConstructLER24RRemConInterfaceFeaturesi @ 43 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconinterfacebase.mmp
+
+PRJ_EXPORTS
+../public/remconinterfaceselector.h 	SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconinterfaceselector.h)
+../public/remconinterfacebase.h 		SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remcon/remconinterfacebase.h)
+../public/remconinterfaceif.h 			SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remcon/remconinterfaceif.h)
+../public/remconerrorobserver.h 			SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconerrorobserver.h)
+../public/remconinterfacefeatures.h		SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remcon/remconinterfacefeatures.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/group/remconinterfacebase.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,61 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconinterfacebase.dll Remote Control (intermediate) client side 
+// library.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+TARGET			remconinterfacebase.dll
+TARGETPATH		/system/libs
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			interfaceselector.cpp
+SOURCE			interfacebase.cpp
+SOURCE			receiver.cpp
+SOURCE			remconinterfacefeatures.cpp
+SOURCE			bulkreceiver.cpp
+SOURCE			interfacebaseextension.cpp
+
+SOURCEPATH		../../../common
+SOURCE			utils.cpp
+
+
+USERINCLUDE 	../inc
+USERINCLUDE 	../../../common
+USERINCLUDE 	../../common
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		remconclient.lib
+LIBRARY 		remcontypes.lib
+LIBRARY			estor.lib
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/inc/bulkreceiver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,113 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef BULKRECEIVER_H
+#define BULKRECEIVER_H
+
+#include <e32base.h>
+#include <remconinterfaceselector.h>
+#include <remcon/messagetype.h>
+#include <e32msgqueue.h>
+#include "utils.h"
+
+class RRemConBulk;
+
+
+/**
+Active Object for receiving messages from an RRemConBulk 
+*/
+NONSHARABLE_CLASS(CBulkReceiver)
+	: public CActive
+	{
+public:
+	/**
+	Factory method.
+	@param aObserver Our observer.
+	@return Ownership of a new CBulkReceiver.
+	*/
+	static CBulkReceiver* NewL(CRemConInterfaceSelector& aObserver);
+	
+	~CBulkReceiver();
+	
+	/**
+	Indicates that the receiver needs to be initialised.
+	*/
+	TBool InitialisationRequired() const;
+
+	/**
+	Initialisation method.
+	@param aRemConBulk The session to receive on.
+	@param aMaxDataLength The size of the buffer to read operation-associated 
+	data into.
+	*/
+	void InitialiseL(RRemConBulk& aRemConBulk, TUint aMaxDataLength);
+	
+	/**
+	Called when the client wants to receive a message. On completion, 
+	notifies the observer and re-issues itself until the client destroys it. 
+	*/
+	void Receive();
+
+public:
+	/**
+	Called by the interface selector to connect the client session to the server.
+	*/
+	void WaitUntilConnectedL();
+
+private: // from CActive
+	void RunL();
+	void DoCancel();
+
+private:
+	CBulkReceiver(CRemConInterfaceSelector& aObserver);
+	void ConstructL();
+	
+	/**
+	Places the active object on the current active scheduler.
+	*/
+	void BindToCurrentThreadL();
+	void DoBindToCurrentThreadL();
+	
+	static TInt StaticConnect(TAny* aSelf);
+	TInt Connect();
+	
+private: // owned
+	// These are the members we pass to the inner client API to get messages 
+	// out of RemCon.
+	TUid			iInterfaceUid;
+	TUint			iOperationId;
+	RBuf8			iData;
+	
+	// These are the members related to co-ordinating the receiver which can
+	// be in a different thread.
+	TThreadId				iThreadId;		//<! The thread ID that the receiver is running in.
+	RSpecificThreadCallBack	iCancelCall;
+	RSpecificThreadCallBack	iConnectCall;
+	
+
+private: // unowned
+	RRemConBulk*				iRemConBulk;
+	CRemConInterfaceSelector&	iObserver;
+	};
+
+
+#endif // RECEIVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/inc/interfacebaseextension.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,40 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+@file
+@internalComponent
+*/
+
+#ifndef INTERFACEBASEEXTENSION_H
+#define INTERFACEBASEEXTENSION_H
+
+#include <e32base.h>
+
+NONSHARABLE_CLASS(CRemConInterfaceBaseExtension)
+	: public CBase
+	{
+public:
+	CRemConInterfaceBaseExtension();
+	~CRemConInterfaceBaseExtension();
+	
+	void SetBulk(TBool aBulk);
+	TBool Bulk() const;
+	
+private:
+	TBool iBulk;
+	};
+
+#endif // INTERFACEBASEEXTENSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/inc/receiver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,87 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef RECEIVER_H
+#define RECEIVER_H
+
+#include <e32base.h>
+#include <remconinterfaceselector.h>
+#include <remcon/messagetype.h>
+#include "remconserver.h"
+
+class RRemCon;
+
+/**
+Active Object for receiving messages from an RRemConController or 
+RRemConTarget.
+*/
+NONSHARABLE_CLASS(CReceiver) : public CActive
+	{
+public:
+	/**
+	Factory method.
+	@param aRemCon The session to receive on.
+	@param aObserver Our observer.
+	@param aMaxDataLength The size of the buffer to read operation-associated 
+	data into.	
+	@param aType The type of session aRemCon is. We pass this back up with new 
+	messages so the Interface Selector knows how to handle them.
+	@return Ownership of a new CReceiver.
+	*/
+	static CReceiver* NewL(RRemCon& aRemCon, 
+		CRemConInterfaceSelector& aObserver, 
+		TUint aMaxDataLength,
+		TRemConClientType aType);
+
+	/** Destructor. */
+	~CReceiver();
+
+public:
+	/** Called when the client wants to receive a message. On completion, 
+	notifies the observer and re-issues itself until the client destroys it. 
+	*/
+	void Receive();
+
+private: // from CActive
+	void RunL();
+	void DoCancel();
+
+private:
+	/** Constructor. */
+	CReceiver(RRemCon& aRemCon, 
+		CRemConInterfaceSelector& aObserver, 
+		TRemConClientType aType);
+
+	void ConstructL(TUint aMaxDataLength);
+
+private: // owned
+	// These are the members we pass to the inner client API to get messages 
+	// out of RemCon.
+	TRemConClientReceivePackage iReceivePackage;
+	RBuf8 iData;
+
+	const TRemConClientType iType;
+
+private: // unowned
+	RRemCon& iRemCon;
+	CRemConInterfaceSelector& iObserver;
+	};
+
+#endif // RECEIVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/public/remconerrorobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,55 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef REMCONERROROBSERVER_H
+#define REMCONERROROBSERVER_H
+
+/** 
+@file
+@publishedAll
+@released
+*/
+
+#include <e32base.h>
+
+/**
+This class defines an error notification interface.  This is
+intended for use in the situation where a client application
+needs to know about an error that has occurred passively.  
+This is not used in situations where a client application 
+makes a call that returns an error.
+
+The main use is where a target application is sitting waiting
+to receive commands and the server dies.  It needs to know if
+this has happened so that it can restart the server if it
+wishes.
+*/
+class MRemConErrorObserver
+	{
+public:
+	/**
+	This is called in the case of a session error that has
+	occurred passively and cannot be notified via completion
+	of an outstanding call made by the client application.
+	
+	@param aError The error that has occurred.  If this is 
+		   KErrServerTerminated, the error is fatal and the 
+		   server must be restarted before any new 
+		   messages can be received.
+	*/
+	virtual void MrceoError(TInt aError) = 0;
+	};
+
+#endif // REMCONERROROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/public/remconinterfacebase.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,147 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONINTERFACEBASE_H
+#define REMCONINTERFACEBASE_H
+
+#include <e32base.h>
+#include <remcon/clienttype.h>
+#include <remcon/remconinterfacefeatures.h>
+
+class CRemConInterfaceSelector;
+class CRemConInterfaceBaseExtension;
+
+/**
+Base class for outer layer APIs. 
+*/
+class CRemConInterfaceBase : public CBase
+	{
+public: 
+	/** Destructor */
+	IMPORT_C ~CRemConInterfaceBase();
+
+public: // called by the ultimate client
+	/** 
+	Cancels the currently outstanding asynchronous send request. 
+	@return KErrNone.
+	*/
+	IMPORT_C TInt Cancel();
+
+public: // called by the interface selector
+	/**
+	Called by the interface selector to get a pointer to an object which 
+	implements the interface API with UID aUid. This is a mechanism for 
+	allowing future change to the interface API without breaking BC in 
+	existing (non-updated) interfaces.
+	*/
+	virtual TAny* GetInterfaceIf(TUid aUid) = 0;
+
+	/** 
+	Accessor for the interface's UID. 
+	@return The interface's UID.
+	*/
+	TUid InterfaceUid() const;
+
+	/** 
+	Accessor for the maximum length of operation-specific data in this 
+	interface. 
+	@return The size in bytes of a buffer needed to hold the largest single 
+	payload of operation-associated data in this interface.
+	*/
+	TUint MaxLength() const;
+
+	/**
+	Accessor for the type of the interface.
+	@return The interface type.
+	*/
+	TRemConClientType Type() const;
+	
+	/**
+	Determine whether this is a bulk or control interface.
+	@return ETrue if this interface is a bulk interface
+			EFalse if this interface is a control interface
+	*/
+	TBool Bulk() const;
+	
+	/**
+	Determine whether this is a target or controller interface.
+	@return ETrue if this interface is a target interface
+			EFalse if this interface is a controller interface
+	*/
+	static TBool Target(TRemConClientType aType);
+
+protected:
+	/** 
+	Constructor.
+	@param aInterfaceUid The UID of the interface.
+	@param aMaxLength The maximum length of any operation-specific data in the 
+	interface being registered.
+	@param aInterfaceSelector The interface selector.
+	*/
+	IMPORT_C CRemConInterfaceBase(TUid aInterfaceUid, 
+		TUint aMaxLength, 
+		CRemConInterfaceSelector& aInterfaceSelector,
+		TRemConClientType aType);
+
+	/** Must be called by concrete types at construction time. Registers the 
+	interface with the interface selector. */
+	IMPORT_C void BaseConstructL();
+
+	/** Must be called by concrete types at construction time. Registers the 
+	interface with the interface selector.
+	@param aRemConInterfaceFeatures Features associocated with the interface
+	*/
+	IMPORT_C void BaseConstructL(RRemConInterfaceFeatures& aRemConInterfaceFeatures);
+	
+	/** Must be called by concrete types at construction time. Registers the 
+		interface with the interface selector.
+	@param aRemConInterfaceFeatures Features associated with the interface
+	@param aBulkInterface Specifies whether this interface is a control or bulk interface
+	Only available for use by Outer Layer interfaces.
+	*/
+	IMPORT_C void BaseConstructL(RRemConInterfaceFeatures& aRemConInterfaceFeatures, TBool aBulkInterface);
+	
+	/** 
+	Accessor for the interface selector. 
+	@return The interface selector.
+	*/
+	IMPORT_C CRemConInterfaceSelector& InterfaceSelector();
+
+private: // owned
+	/** The UID of the concrete (derived) interface. */
+	TUid iInterfaceUid; 
+
+	/** Max length of operation-specific data in this interface. */
+	TUint iMaxLength; 
+
+	/** The type of the interface- controller or target. */
+	const TRemConClientType iType;
+
+	/** 
+	Extension instance for RemCon Interface Base.
+	*/
+	CRemConInterfaceBaseExtension* iExtension;
+
+private: // unowned
+	CRemConInterfaceSelector& iInterfaceSelector;
+	};
+
+#endif // REMCONINTERFACEBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/public/remconinterfacefeatures.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,38 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef REMCONINTERFACEFEATURES_H
+#define REMCONINTERFACEFEATURES_H
+
+#include <e32base.h>
+
+/**
+@publishedAll
+@released
+*/
+NONSHARABLE_CLASS(RRemConInterfaceFeatures)
+	{
+public:
+	IMPORT_C TInt Open();
+	IMPORT_C void Close();
+	
+	IMPORT_C void AddOperationL(TUint aOperationId);
+	const TDesC8& SupportedOperations() const;
+	
+private:
+	RBuf8 iOperations;
+	};
+
+#endif // REMCONINTERFACEFEATURES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/public/remconinterfaceif.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,114 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONINTERFACEIF_H
+#define REMCONINTERFACEIF_H
+
+#include <e32base.h>
+#include <remcon/messagetype.h>
+
+class TRemConAddress;
+
+/** 
+The UID of the interface between the interface selector and the outer layer 
+API. Currently this consists of a single 'new message' method. If in future it 
+changes (more methods are added) then a new M class and UID can be defined. 
+New outer layer APIs can implement that M class and be used by the interface 
+selector, without breaking existing outer layer APIs which still only 
+implement this version of the interface.
+*/
+const TInt KRemConInterfaceIf1 = 0x1020D409;
+
+/**
+Mixin for outer layer interfaces to be notified of incoming messages (commands and responses).
+Having received a command, the client is obliged to send a response.
+A client can only have one send outstanding at any time.
+If commands come in quickly, the client is responsible for queueing its responses to them.
+Note that each command delivered to a target involves memory allocated in the server’s heap,
+which is only released on client closure or when a response is sent.
+*/
+class MRemConInterfaceIf
+	{
+public: 
+	/**
+	Called when a message comes in for this interface.
+	@param aOperationId The interface-specific operation id.
+	@param aData Any operation-specific data.
+	*/
+	virtual void MrcibNewMessage(TUint aOperationId, const TDesC8& aData) = 0;
+	};
+	
+	
+/** 
+The UID of the interface between the interface selector and the outer layer 
+API. Currently this consists of a single 'new message' method. If in future it 
+changes (more methods are added) then a new M class and UID can be defined. 
+New outer layer APIs can implement that M class and be used by the interface 
+selector, without breaking existing outer layer APIs which still only 
+implement this version of the interface.
+*/
+const TInt KRemConInterfaceIf2 = 0x10285A37;
+		
+/**
+Mixin for outer layer interfaces to be notified of incoming messages. 
+*/
+class MRemConInterfaceIf2
+	{
+public: 
+	/**
+	Called when a message comes in for this interface.
+	@param aOperationId The interface-specific operation id.
+	@param aData Any operation-specific data.
+	@param aMessageSubType The message subtype.
+	*/
+	virtual void MrcibNewMessage(TUint aOperationId, const TDesC8& aData, TRemConMessageSubType aMessageSubType) = 0;
+	};
+
+	
+/** 
+The UID of the interface between the interface selector and the outer layer 
+API. Currently this consists of a single 'new message' method. If in future it 
+changes (more methods are added) then a new M class and UID can be defined. 
+New outer layer APIs can implement that M class and be used by the interface 
+selector, without breaking existing outer layer APIs which still only 
+implement this version of the interface.
+*/
+const TInt KRemConInterfaceIf3 = 0x10285DF1;
+		
+/**
+Mixin for outer layer interfaces to be notified of incoming messages. 
+*/
+class MRemConInterfaceIf3
+	{
+public: 
+	/**
+	Called when a message comes in for this interface.
+	@param aOperationId The interface-specific operation id.
+	@param aData Any operation-specific data.
+	@param aMessageSubType The message subtype.
+	@param aRemoteAddr The address of the remote that sent the message 
+	(includes the bearer UID).
+	*/
+	virtual void MrcibNewMessage(TUint aOperationId, const TDesC8& aData, TRemConMessageSubType aMessageSubType, const TRemConAddress& aRemoteAddr) = 0;
+	};
+
+	
+#endif // REMCONINTERFACEIF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/public/remconinterfaceselector.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,492 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONINTERFACESELECTOR_H
+#define REMCONINTERFACESELECTOR_H
+
+#include <e32base.h>
+#include <remcon/messagetype.h>
+#include <remcon/clienttype.h>
+#include <remcon/playertype.h>
+#include <remcon/remconinterfaceif.h>
+#include <remconaddress.h>
+
+class CRemConInterfaceBase;
+class CBulkReceiver;
+class CReceiver;
+class MRemConErrorObserver;
+class RRemConInterfaceFeatures;
+class RSpecificThreadCallBack;
+class CRemConInterfaceDetailsArray;
+class RNestableLock;
+class RRemConController;
+class RRemConTarget;
+class RRemConBulk;
+class RRemCon;
+
+// Panic information
+_LIT(KRemConIfSelPanicCat, "RemConIfSel");
+enum 
+	{
+	/** The client has given a bad message type. */
+	ERemConIfSelBadMessageType = 0,
+
+	/** The client has already called OpenTargetL successfully.
+		
+	This is no longer an illegal condition and so the panic will never
+	be raised.
+	*/
+	ERemConIfSelTargetSessionAlreadyExists = 1,
+
+	/** The client has already called OpenControllerL successfully.
+		
+	This is no longer an illegal condition and so the panic will never
+	be raised.
+	*/
+	ERemConIfSelControllerSessionAlreadyExists = 2,
+
+	/** The client has created (and registered) an outer layer interface of a 
+	type which is already registered. */
+	ERemConIfSelInterfaceOfThatTypeAlreadyRegistered = 3,
+	
+	/** The client has not offended- there is a defect in some layer of the 
+	Remote Control system. */
+	ERemConIfSelInternalError = 4,
+
+	/** An outer-layer interface has been instantiated (and registered with 
+	the intermediate layer) after OpenControllerL or OpenTargetL has been 
+	successfully called. */
+	ERemConIfSelTardyInterfaceRegistration = 5,
+
+	/** OpenControllerL has not successfully been called before using an API 
+	which expects a controller session to have been created. */
+	ERemConIfSelNoControllerSession = 6,
+
+	/** OpenTargetL has not successfully been called before using an API which 
+	expects a target session to have been created. */
+	ERemConIfSelNoTargetSession = 7,
+
+	/** Neither OpenControllerL not OpenTargetL has been successfully called 
+	before using an API which expects either a controller or a target session 
+	to have been created. */
+	ERemConIfSelNoSession = 8,
+
+	/** An outer layer DLL has instantiated CRemConInterfaceBase with an 
+	illegal client type. */
+	ERemConIfSelUndefinedClientType = 9,
+
+	/** An implementation of CRemConInterfaceBase::GetInterface does not 
+	provide an implementation of MRemConInterfaceIf. */
+	ERemConIfSelNoInterfaceImplementation = 10,
+	
+	/** A client has created bulk interfaces in multiple different threads,
+	all bulk interfaces must be created in the same thread*/
+	ERemConIfSelMultipleBulkInterfaceThreads = 11,
+	};
+
+/**
+CRemConInterfaceSelector is only instantiable via its NewL function. It is not 
+derivable.
+*/
+NONSHARABLE_CLASS(CRemConInterfaceSelector) : public CBase
+	{
+public: 
+	/**
+	Factory method.
+	@return Ownership of a new CRemConInterfaceSelector.
+	*/
+	IMPORT_C static CRemConInterfaceSelector* NewL();
+
+	/** Destructor. */
+	IMPORT_C ~CRemConInterfaceSelector();
+
+public:
+	/**
+	Register the interface with the selector. This is called by the 
+	interface's BaseConstructL. Takes ownership of aInterface.
+	 This function is not to be called outside of remconinterfacebase.dll. It is available for compatibility with previous
+	 versions, but it is intended to be called only by CRemConInterfaceBase::BaseConstructL.
+	 CRemConInterfaceBase-derived classes should indirectly perform a RegisterInterfaceL, by calling
+	 CRemConInterfaceBase::BaseConstructL from their construction functions.
+	@param aInterface The interface.
+	*/
+	IMPORT_C void RegisterInterfaceL(CRemConInterfaceBase& aInterface);
+	
+	/**
+	Register the interface with the selector. This is called by the 
+	interface's BaseConstructL. Takes ownership of aInterface.
+	 This function is not to be called outside of remconinterfacebase.dll. It is available for compatibility with previous
+	 versions, but it is intended to be called only by CRemConInterfaceBase::BaseConstructL.
+	 CRemConInterfaceBase-derived classes should indirectly perform a RegisterInterfaceL, by calling
+	 CRemConInterfaceBase::BaseConstructL from their construction functions.
+	@param aInterface The interface.
+	@param aRemConInterfaceFeatures The operation IDs of the interface.  Ownership is retained by the caller.  Any necessary
+			data will be copied by the interface selector.
+	*/
+	void RegisterInterfaceL(CRemConInterfaceBase& aInterface, RRemConInterfaceFeatures& aRemConInterfaceFeatures);
+	/** 
+	Register an error observer.  This is provided to allow the client to
+	discover when an error has occurred passively.
+	
+	@param aObserver An error observer to be notified on a passive error.
+					 NULL to stop receiving notifications.
+	*/
+	IMPORT_C void RegisterErrorObserver(MRemConErrorObserver* aObserver);
+
+	/**
+	Opens a controller session to RemCon. The session is connectionless until 
+	such time as GoConnectionOriented may be called.
+	@leave KErrInUse If a controller session is already open.
+	*/
+	IMPORT_C void OpenControllerL();
+
+	/**
+	Makes the controller session (which must already exist- use 
+	OpenControllerL) connection-oriented.
+	@param aConnection The remote to talk to. 
+	*/
+	IMPORT_C void GoConnectionOrientedL(const TRemConAddress& aConnection);
+
+	/**
+	Makes the controller session (which must already exist- use 
+	OpenControllerL) connectionless.
+	*/
+	IMPORT_C void GoConnectionlessL();
+
+	/**
+	Brings up a bearer-level connection.
+	The controller session must already exist (use OpenControllerL) and 
+	be connection-oriented.
+	@param aStatus TRequestStatus for asynchronous completion.
+	*/
+	IMPORT_C void ConnectBearer(TRequestStatus& aStatus);
+
+	/**
+	Cancels interest in the completion of a ConnectBearer request.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt ConnectBearerCancel();
+
+	/**
+	Destroys a bearer-level connection. 
+	The controller session must already exist (use OpenControllerL) and be 
+	connection-oriented.
+	@param aStatus TRequestStatus for asynchronous completion.
+	*/
+	IMPORT_C void DisconnectBearer(TRequestStatus& aStat);
+
+	/**
+	Cancels interest in the completion of a DisconnectBearer request.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt DisconnectBearerCancel();
+
+	/**
+	Opens a target session to RemCon.
+	@leave KErrInUse If a target session is already open.
+	*/
+	IMPORT_C void OpenTargetL();
+
+	/**
+	Opens a target session to RemCon.
+	@param aPlayerType The type of player
+	@param aPlayerSubType The sub-type of the player
+	@param aPlayerName  The name of the player in UTF-8.
+	@leave KErrInUse If a target session is already open.
+	*/
+	IMPORT_C void OpenTargetL(TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aPlayerName);
+	/**
+	Sends a message to the remote device(s).
+	There should be only one command and response outstanding at any one time.
+	Send cannot be called again until aStatus is completed.
+	@panic RemConClient 4 If a send is already outstanding
+	@param aStatus TRequestStatus for asynchronous completion.
+	@param aInterfaceUid The UID of the concrete (outer-layer) interface 
+	sending the message.
+	@param aOperationId The interface-specific operation identifier.
+	@param aNumRemotes On success, the number of remotes the message was 
+	successfully sent to.
+	@param aMsgType Whether the message is a command or a response.
+	@param aData Any associated message data in interface-specific format.
+	*/
+	IMPORT_C void Send(TRequestStatus& aStatus, 
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		TUint& aNumRemotes,
+		TRemConMessageType aMsgType,
+		const TDesC8& aData = KNullDesC8());
+
+	/**
+	Sends a message to the remote device(s).
+	@param aStatus TRequestStatus for asynchronous completion.
+	@param aInterfaceUid The UID of the concrete (outer-layer) interface 
+	sending the message.
+	@param aOperationId The interface-specific operation identifier.
+	@param aNumRemotes On success, the number of remotes the message was 
+	successfully sent to.
+	@param aMsgType Whether the message is a command or a response.
+	@param aMsgSubType The subtype of the command of response
+	@param aData Any associated message data in interface-specific format.
+	*/
+	IMPORT_C void Send(TRequestStatus& aStatus, 
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		TUint& aNumRemotes,
+		TRemConMessageType aMsgType,
+		TRemConMessageSubType aMsgSubType,
+		const TDesC8& aData = KNullDesC8());
+
+	/**
+	Sends a 
+	*/
+	IMPORT_C void SendNotify(TRequestStatus& aStatus, 
+			TUid aInterfaceUid,
+			TUint aOperationId, 
+			TRemConMessageType aMsgType,
+			TRemConMessageSubType aMsgSubType,
+			const TDesC8& aData = KNullDesC8());
+	
+	/**
+	This method is for internal sub-system use only and should be not be used otherwise.
+	Sends a message to the remote device(s), without waiting for the send to complete
+	@param aInterfaceUid The UID of the concrete (outer-layer) interface 
+	sending the message.
+	@param aOperationId The interface-specific operation identifier.
+	@param aMsgType Whether the message is a command or a response.
+	@param aData Any associated message data in interface-specific format.
+	*/
+	IMPORT_C TInt SendUnreliable(
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		TRemConMessageType aMsgType,
+		const TDesC8& aData = KNullDesC8());
+	
+	/**
+	This method is for internal sub-system use only and should be not be used otherwise.
+	Sends a message to the remote device(s), without waiting for the send to complete
+	@param aInterfaceUid The UID of the concrete (outer-layer) interface 
+	sending the message.
+	@param aOperationId The interface-specific operation identifier.
+	@param aMsgType Whether the message is a command or a response.
+	@param aMsgSubType The subtype of the command of response
+	@param aData Any associated message data in interface-specific format.
+	*/
+	IMPORT_C TInt SendUnreliable(
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		TRemConMessageType aMsgType,
+		TRemConMessageSubType aMsgSubType,
+		const TDesC8& aData = KNullDesC8());
+	
+	/**
+	Cancels interest in the completion of a Send request.
+	@param aMsgType The type of the message, the completion of the send of 
+	which we are not interested in. This is needed because a single 
+	CRemConInterfaceSelector may have two sends outstanding at once, one on 
+	a controller session and another on a target session.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt SendCancel(TRemConMessageType aMsgType);
+	
+	/**
+	This method is for internal sub-system use only and should be not be used otherwise.
+	Sends a message to the remote device(s) through the bulk path.
+	There should be only one response outstanding at any one time.
+	Send cannot be called again until aStatus is completed.
+	@panic RemConClient 4 If a send is already outstanding
+	@param aStatus TRequestStatus for asynchronous completion.
+	@param aInterfaceUid The UID of the concrete (outer-layer) interface 
+	sending the message.
+	@param aOperationId The interface-specific operation identifier.
+	@param aData Any associated message data in interface-specific format.
+	*/
+	IMPORT_C void SendBulk(TRequestStatus& aStatus, 
+		TUid aInterfaceUid,
+		TUint aOperationId,
+		const TDesC8& aData = KNullDesC8());
+	
+	/**
+	This method is for internal sub-system use only and should be not be used otherwise.
+	Sends a message to the remote device(s) through the bulk path, without 
+	waiting for the send to complete.
+	@param aInterfaceUid The UID of the concrete (outer-layer) interface 
+	sending the message.
+	@param aOperationId The interface-specific operation identifier.
+	@param aData Any associated message data in interface-specific format.
+	*/
+	IMPORT_C TInt SendBulkUnreliable(
+		TUid aInterfaceUid,
+		TUint aOperationId,
+		const TDesC8& aData = KNullDesC8());
+
+	/**
+	This method is for internal sub-system use only and should be not be used otherwise.
+	Cancels interest in the completion of a BulkSend request.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt SendBulkCancel();
+
+	/**
+	Only called internally, by the Active Object which sucks messages out of 
+	RemCon. Note that the message type is not given- it is interpolated from 
+	the type of the session doing the receiving.
+	@param aInterfaceUid Interface UID of the new message.
+	@param aOperationId Operation ID of the new message.
+	@param aMsgSubType The message subtype.
+	@param aRemoteAddress The address of the remote which sent the message.
+	@param aData Data associated with the new message.
+	@param aType The type of session which received the message (from which 
+	the type of the message can be interpolated).
+	*/
+	void ReceiveComplete(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TRemConMessageSubType aMsgSubType,
+		const TRemConAddress& aRemoteAddress,
+		const TDesC8& aData,
+		TRemConClientType aType);
+	
+	/**
+	Only called internally, by the Active Object which sucks messages out of 
+	RemCon. Note that the message type is not given- it is interpolated from 
+	the type of the session doing the receiving.
+	@param aInterfaceUid Interface UID of the new message.
+	@param aOperationId Operation ID of the new message.
+	@param aData Data associated with the new message.
+	*/
+	void BulkReceiveComplete(TUid aInterfaceUid, 
+		TUint aOperationId,
+		const TDesC8& aData);
+
+	/**
+	Only called internally, by the Active Object which sucks messages out of 
+	RemCon.  This is called in the case of a session error.
+	
+	@param The error that has occurred.  If this is KErrServerTerminated, the
+		   error is fatal and the session must be restarted before any new 
+		   messages can be received.
+	*/
+	void Error(TInt aError);
+	
+	/**
+	Only called internally, by the Active Object which sucks messages out of 
+	RemCon Bulk Server.  This is called in the case of a session error.
+	
+	@param The error that has occurred.  If this is KErrServerTerminated, the
+		   error is fatal and the session must be restarted before any new 
+		   messages can be received.
+	*/
+	void BulkError(TInt aError);
+	
+	/**
+	Only called internally, by the Active Object which sucks messages out of
+	RemCon (bulk server).
+	*/
+	void BulkSessionConnectL();
+
+	/**
+	Getter for the current set of connections in the system (not just those 
+	associated with this session). The client is responsible for cleaning up 
+	aConnections- the addresses will be on the heap.
+	@param aConnections A collection of remote addresses, representing all the 
+	currently extant connections.
+	@return Error.
+	*/
+	IMPORT_C TInt GetConnections(TSglQue<TRemConAddress>& aConnections);
+
+	/**
+	Notification for changes in the set of connections.
+	@param aStatus TRequestStatus for asynchronous completion.
+	*/
+	IMPORT_C void NotifyConnectionsChange(TRequestStatus& aStatus);
+
+	/**
+	Cancels interest in the completion of an outstanding 
+	NotifyConnectionsChange operation.
+	@return KErrNone.
+	*/
+	IMPORT_C TInt NotifyConnectionsChangeCancel();
+	
+	/**
+	To determine if a target session has been opened.
+	@return EFalse if no session has been opened, ETrue otherwise.
+	*/
+	IMPORT_C TBool TargetOpened() const;
+
+	/**
+	To determine if a controller session has been opened.
+	@return EFalse if no session has been opened, ETrue otherwise.
+	*/	
+	IMPORT_C TBool ControllerOpened() const;
+
+private:
+	CRemConInterfaceSelector();
+	void ConstructL();
+
+private: // utility
+	void AssertSession(RRemCon* aSess, TInt aPanicCode) const;
+	TInt TryToReconnect();
+	TInt TryToReconnectBulk();
+	void OpenTargetCommonL();
+	void RegisterInterfaceCommonL(CRemConInterfaceBase& aInterface, const TDesC8& aFeatures);
+	void RegisterInterestedApisL(TRemConClientType aType);
+	
+	void EstablishBulkThreadBindingL();
+	
+	static TInt StaticBulkCleanup(TAny* aSelf);
+	void BulkCleanup();
+	TBool BulkOpened() const;
+
+private: // owned
+	CRemConInterfaceDetailsArray* iInterfaces;
+
+	RRemConController* iControllerSession;
+	RRemConTarget* iTargetSession;
+	RRemConBulk* iBulkSession;
+
+	CReceiver* iTargetReceiver;
+	CReceiver* iControllerReceiver;
+	CBulkReceiver* iBulkReceiver;
+
+	/** For all registered interfaces, this is the size of the biggest 
+	operation-associated data lump. */
+	TUint iControlMaxDataLength;
+	TUint iBulkMaxDataLength;
+
+	// The session to use for NotifyConnectionsChange and 
+	// NotifyConnectionsChangeCancel. It doesn't matter which we use- just one 
+	// that's connected will do. The only interesting bit is that the session 
+	// we called NotifyConnectionsChange on should be the one we call 
+	// NotifyConnectionsChangeCancel on, but as sessions are only closed when 
+	// 'this' comes down that's not a complication.
+	RRemCon* iNotificationSession;
+	
+	TRemConAddress iAddress;
+	
+	RHeap* iBulkHeap;
+	RThread iBulkThread;
+	RHeap* iSharedThreadHeap;
+	RSpecificThreadCallBack* iBulkCleanupCall;
+	RNestableLock*	iLock;
+private: // unowned	
+	MRemConErrorObserver* iErrorObserver;
+	};
+
+#endif // REMCONINTERFACESELECTOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/src/bulkreceiver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,197 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <comms-infras/commsdebugutility.h>
+#include <e32atomics.h>
+#include "bulkreceiver.h"
+#include "remconclient.h"
+#include "remconbulkclient.h"
+#include "utils.h"
+
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_IF_BASE);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("bulkrecv");
+#endif // _DEBUG
+
+CBulkReceiver* CBulkReceiver::NewL(CRemConInterfaceSelector& aObserver)
+	{
+	LOG_STATIC_FUNC;
+	CBulkReceiver* self = new(ELeave) CBulkReceiver(aObserver);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CBulkReceiver::~CBulkReceiver()
+	{
+	LOG_FUNC;
+	Cancel();
+	iConnectCall.Close();
+	iData.Close();
+	}
+
+CBulkReceiver::CBulkReceiver(CRemConInterfaceSelector& aObserver)
+	: CActive(CActive::EPriorityStandard)
+	, iObserver(aObserver)
+	{
+	LOG_FUNC;
+	}
+
+void CBulkReceiver::ConstructL()
+	{
+	LOG_FUNC;
+	TCallBack connectCb(StaticConnect, this);
+	LEAVEIFERRORL(iConnectCall.Create(connectCb, EPriorityStandard));
+	BindToCurrentThreadL();
+	}
+
+void CBulkReceiver::BindToCurrentThreadL()
+	{
+	LOG_FUNC;
+	ASSERT_DEBUG(!IsAdded());
+	TRAPD(err, DoBindToCurrentThreadL());
+	if(err != KErrNone)
+		{
+		this->Deque();
+		LEAVEL(err);
+		}
+	}
+
+void CBulkReceiver::DoBindToCurrentThreadL()
+	{
+	LOG_FUNC;
+	CActiveScheduler::Add(this);
+	LEAVEIFERRORL(iConnectCall.Start());
+	iThreadId = RThread().Id();
+	}
+
+TBool CBulkReceiver::InitialisationRequired() const
+	{
+	LOG_FUNC;
+	return IsAdded();
+	}
+
+TInt CBulkReceiver::StaticConnect(TAny* aSelf)
+	{
+	LOG_STATIC_FUNC;
+	ASSERT_DEBUG(aSelf);
+	return reinterpret_cast<CBulkReceiver*>(aSelf)->Connect();
+	}
+
+TInt CBulkReceiver::Connect()
+	{
+	LOG_FUNC;
+	// issue the connect from the bulk thread.
+	TRAPD(err, iObserver.BulkSessionConnectL());
+	if(err == KErrNone)
+		{
+		// Start the perpetual receive cycle.
+		Receive();
+		}
+	return err;
+	}
+
+void CBulkReceiver::InitialiseL(RRemConBulk& aRemConBulk, TUint aMaxDataLength)
+	{
+	LOG_FUNC;
+	iData.CreateL(aMaxDataLength);
+	iRemConBulk = &aRemConBulk;
+	// NB If a remote sends longer data than we expect to receive here, our 
+	// receive will be errored and the message will effectively be dropped in 
+	// the intermediate layer. (It won't get passed to the outer layer.)
+	
+	// Receive is queued once we have a connected bulk server session
+	}
+
+void CBulkReceiver::Receive()
+	{
+	LOG_FUNC
+	ASSERT_DEBUG(iRemConBulk);
+	iRemConBulk->Receive(iStatus, iInterfaceUid, iOperationId, iData);
+	SetActive();
+	}
+
+void CBulkReceiver::RunL()
+	{
+	LOG_FUNC
+	LOG1(_L8("\tiStatus = %d"), iStatus.Int());
+
+	TInt err = iStatus.Int();
+	
+	if(err == KErrNone)
+		{
+		iObserver.BulkReceiveComplete(iInterfaceUid, iOperationId, iData);
+		}
+	else
+		{
+		iObserver.BulkError(err);
+		}
+	
+	if(err != KErrServerTerminated)
+		{
+		// Repost request.
+		Receive();
+		}
+	}
+
+void CBulkReceiver::DoCancel()
+	{
+	LOG_FUNC
+	
+	if(RThread().Id() == iThreadId)
+		{
+		// There's nothing we can do about any error here, and it probably 
+		// indicates that the server has gone away anyway for some reason.
+		ASSERT_DEBUG(iRemConBulk);
+		static_cast<void>(iRemConBulk->ReceiveCancel());
+		
+		// No need to cancel the "connecting" request as it is a synchronous kick
+		}
+	else
+		{
+		// being run in a different thread - this means that something has gone
+		// wrong and we merely want to tidy up the CActive state (i.e. not active).
+		TRequestStatus* status = &iStatus;
+		User::RequestComplete(status, KErrCancel);
+		}
+	}
+
+/**
+This function deals with connecting to the bulk server - it handles the
+cases where the bulk interfaces are running in the same thread as the control
+interfaces, and also when running in a different thread (which is as one might
+expect more complicated). 
+*/
+void CBulkReceiver::WaitUntilConnectedL()
+	{
+	LOG_FUNC;
+	LEAVEIFERRORL(iConnectCall.CallBack());
+	}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/src/interfacebase.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,118 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <remcon/remconinterfacebase.h>
+#include <remconinterfaceselector.h>
+#include "interfacebaseextension.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_IF_BASE);
+#endif
+
+EXPORT_C CRemConInterfaceBase::~CRemConInterfaceBase()
+	{
+	LOG_FUNC	
+	
+	delete iExtension;
+	}
+
+EXPORT_C CRemConInterfaceBase::CRemConInterfaceBase(TUid aInterfaceUid, 
+													TUint aMaxLength,
+													CRemConInterfaceSelector& aInterfaceSelector,
+													TRemConClientType aType)
+ :	iInterfaceUid(aInterfaceUid),
+	iMaxLength(aMaxLength),
+	iType(aType),
+	iInterfaceSelector(aInterfaceSelector)
+	{
+	LOG_FUNC
+	
+	if ( aType != ERemConClientTypeController && aType != ERemConClientTypeTarget )
+		{
+		LOG(_L("Panicking with RemConIfSel / ERemConIfSelUndefinedClientType"));
+		User::Panic(KRemConIfSelPanicCat, ERemConIfSelUndefinedClientType);
+		}
+	}
+
+EXPORT_C void CRemConInterfaceBase::BaseConstructL()
+	{
+	iInterfaceSelector.RegisterInterfaceL(*this);
+	}
+
+EXPORT_C void CRemConInterfaceBase::BaseConstructL(RRemConInterfaceFeatures& aRemConInterfaceFeatures)
+	{
+	iInterfaceSelector.RegisterInterfaceL(*this, aRemConInterfaceFeatures);
+	}
+
+EXPORT_C void CRemConInterfaceBase::BaseConstructL(RRemConInterfaceFeatures& aRemConInterfaceFeatures, TBool aBulkInterface)
+	{
+	iExtension = new(ELeave) CRemConInterfaceBaseExtension();
+	iExtension->SetBulk(aBulkInterface);
+	BaseConstructL(aRemConInterfaceFeatures);
+	}
+
+EXPORT_C CRemConInterfaceSelector& CRemConInterfaceBase::InterfaceSelector()
+	{
+	return iInterfaceSelector;
+	}
+
+EXPORT_C TInt CRemConInterfaceBase::Cancel()
+	{
+	TRemConMessageType msgType = ERemConResponse;
+	if ( iType == ERemConClientTypeController )
+		{
+		msgType = ERemConCommand;
+		}
+		
+	//Ignore Return code because
+	// a) It'll mostly be other than KErrNone because the server has terminated, in which
+	//    case the original async request will have completed with the error anyway!
+	// b) It's meaningless to the client whatever the return code is.
+	(void)InterfaceSelector().SendCancel(msgType);
+	
+	return KErrNone;
+	}
+
+TUid CRemConInterfaceBase::InterfaceUid() const
+	{
+	return iInterfaceUid;
+	}
+
+TUint CRemConInterfaceBase::MaxLength() const
+	{
+	return iMaxLength;
+	}
+
+TRemConClientType CRemConInterfaceBase::Type() const
+	{
+	return iType;
+	}
+
+TBool CRemConInterfaceBase::Bulk() const
+	{
+	return iExtension && iExtension->Bulk();
+	}
+
+TBool CRemConInterfaceBase::Target(TRemConClientType aType)
+	{
+	return aType == ERemConClientTypeTarget;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/src/interfacebaseextension.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,39 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+@file
+@internalComponent
+*/
+
+#include "interfacebaseextension.h"
+
+CRemConInterfaceBaseExtension::CRemConInterfaceBaseExtension()
+	{
+	}
+
+CRemConInterfaceBaseExtension::~CRemConInterfaceBaseExtension()
+	{
+	}
+	
+void CRemConInterfaceBaseExtension::SetBulk(TBool aBulk)
+	{
+	iBulk = aBulk;
+	}
+
+TBool CRemConInterfaceBaseExtension::Bulk() const
+	{
+	return iBulk;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/src/interfaceselector.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,1057 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <remconinterfaceselector.h>
+#include <remcon/remconinterfacebase.h>
+#include <remconerrorobserver.h>
+#include <remcon/remconinterfacefeatures.h>
+#include <remcon/remconifdetails.h>
+#include <s32mem.h>
+#include "bulkreceiver.h"
+#include "receiver.h"
+#include "remconclient.h"
+#include "remconbulkclient.h"
+#include "utils.h"
+
+
+const TInt KMaxSharedThreadHeapSize = 0x0400;
+
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_IF_SEL);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("ifsel");
+#endif
+
+#define RCIS_VERBOSE_PANIC(code) \
+	{ \
+	LOG1(_L("Panicking with RemConIfSel / %d"), code); \
+	User::Panic(KRemConIfSelPanicCat, code); \
+	}
+
+#define RCIS_VERBOSE_ASSERT(cond, code) \
+	{ \
+	if ( !(cond) ) \
+		{ \
+		RCIS_VERBOSE_PANIC(code); \
+		} \
+	}
+
+void CloseDeleteAndNull(TAny* aPtr)
+	{
+	RRemCon** sessionPtrPtr = static_cast<RRemCon**>(aPtr);
+	RRemCon* session = *sessionPtrPtr;
+	session->Close();
+	delete session;
+	*sessionPtrPtr = NULL;
+	}
+
+void CleanupCloseDeleteAndNullPushL(RRemCon** aSession)
+	{
+	TCleanupItem item(CloseDeleteAndNull, aSession);
+	CleanupStack::PushL(item);	
+	}
+
+EXPORT_C CRemConInterfaceSelector* CRemConInterfaceSelector::NewL()
+	{
+	CONNECT_LOGGER
+	LOG_STATIC_FUNC
+
+	CRemConInterfaceSelector* ifSel = new(ELeave) CRemConInterfaceSelector;
+	CleanupStack::PushL(ifSel);
+	ifSel->ConstructL();
+	CleanupStack::Pop(ifSel);
+	return ifSel;
+	}
+
+void CRemConInterfaceSelector::ConstructL()
+	{
+	iSharedThreadHeap = UserHeap::ChunkHeap(NULL, 0, KMaxSharedThreadHeapSize);
+	if(!iSharedThreadHeap)
+		{
+		LEAVEL(KErrNoMemory);
+		}
+	iBulkCleanupCall = new(ELeave) RSpecificThreadCallBack;
+	TCallBack bulkCleanupCb(StaticBulkCleanup, this);
+	LEAVEIFERRORL(iBulkCleanupCall->Create(bulkCleanupCb, CActive::EPriorityStandard));
+	
+	// allocate in the shared objects heap.
+	RHeap* currentHeap = User::SwitchHeap(iSharedThreadHeap);
+	CleanupSwitchHeapPushL(*currentHeap);
+		{
+		iInterfaces = CRemConInterfaceDetailsArray::NewL();
+		}
+	CleanupStack::PopAndDestroy(currentHeap);
+	
+	RNestableLock* lock = new (ELeave) RNestableLock;
+    CleanupStack::PushL(lock);
+	LEAVEIFERRORL(lock->CreateLocal());
+	CleanupStack::Pop(lock);
+	iLock = lock;
+	}
+
+CRemConInterfaceSelector::CRemConInterfaceSelector()
+	{
+	LOG_FUNC
+	iTargetReceiver = NULL;
+	}
+
+EXPORT_C CRemConInterfaceSelector::~CRemConInterfaceSelector()
+	{
+	LOG_FUNC
+	
+	// The easy one... (i.e. non-bulk interfaces)
+	for(TInt ix = 0; ix < iInterfaces->Array().Count(); ++ix)
+		{
+		CRemConInterfaceDetails* const details = iInterfaces->Array()[ix];
+		ASSERT_DEBUG(details);
+		if(!details->IsBulk())
+			{
+			CRemConInterfaceBase* interface = details->Interface();
+			details->Interface() = NULL;
+			delete interface;
+			}
+		}
+	
+	// The tricky one...
+	// we have to use the thread specific cleanup because they have to 
+	// cancel some objects...
+	TInt err = iBulkCleanupCall->CallBack();
+	if(err == KErrDied)
+		{
+		// If the other thread is dead then we cannot cleanly cleanup
+		// but if the heap is shared then we should be ok.
+		if(iBulkHeap == &User::Heap())
+			{
+			BulkCleanup();
+			}
+		}
+	
+	// Finally tidy-up shared thread objects.
+	RHeap* currentHeap = User::SwitchHeap(iSharedThreadHeap);
+		{
+		delete iInterfaces;
+		}
+	User::SwitchHeap(currentHeap);
+
+	
+	delete iTargetReceiver;
+	delete iControllerReceiver;
+	// delete iBulkReceiver; // This is done in the bulk thread cleanup.
+
+	if(iControllerSession)
+		{
+		iControllerSession->Close();
+		delete iControllerSession;
+		}
+
+	if(iTargetSession)
+		{
+		iTargetSession->Close();
+		delete iTargetSession;
+		}
+
+	// iBulkSession.Close(); // This is done in the bulk thread cleanup.
+
+	iBulkCleanupCall->Close();
+	delete iBulkCleanupCall;
+	
+	iSharedThreadHeap->Close();
+	
+	iBulkThread.Close();
+
+	iLock->Wait();
+	iLock->Close();
+	delete iLock;
+	
+	CLOSE_LOGGER
+	}
+
+TInt CRemConInterfaceSelector::StaticBulkCleanup(TAny* aSelf)
+	{
+	LOG_STATIC_FUNC
+	reinterpret_cast<CRemConInterfaceSelector*>(aSelf)->BulkCleanup();
+	return KErrNone;
+	}
+
+void CRemConInterfaceSelector::BulkCleanup()
+	{
+	LOG_FUNC
+	CBulkReceiver* recv = iBulkReceiver;
+	iBulkReceiver = NULL;
+	delete recv;
+	if(RThread().Id() == iBulkThread.Id() && iBulkSession)
+		{
+		iBulkSession->Close();
+		delete iBulkSession;
+		iBulkSession = NULL;
+		}
+	for(TInt ix = 0; ix < iInterfaces->Array().Count(); ++ix)
+		{
+		CRemConInterfaceDetails* const details = iInterfaces->Array()[ix];
+		ASSERT_DEBUG(details);
+		if(details->IsBulk())
+			{
+			CRemConInterfaceBase* interface = details->Interface();
+			details->Interface() = NULL;
+			delete interface;
+			}
+		}
+	}
+
+void CRemConInterfaceSelector::EstablishBulkThreadBindingL()
+	{
+	LOG_FUNC
+	if(iBulkHeap)
+		{
+		// Already bound
+		RCIS_VERBOSE_ASSERT(RThread().Id() == iBulkThread.Id(), ERemConIfSelMultipleBulkInterfaceThreads);
+		}
+	else
+		{
+		// Create Binding.
+		LEAVEIFERRORL(iBulkThread.Duplicate(RThread()));
+		CleanupClosePushL(iBulkThread);
+		LEAVEIFERRORL(iBulkCleanupCall->Start());
+		iBulkReceiver = CBulkReceiver::NewL(*this);	
+		iBulkHeap = &User::Heap();
+		CleanupStack::Pop(&iBulkThread);
+		}
+	
+	}
+
+void CRemConInterfaceSelector::RegisterInterfaceCommonL(CRemConInterfaceBase& aInterface, const TDesC8& aFeatures)
+	{
+	LOG_FUNC
+	
+	const TBool bulkIf = aInterface.Bulk();
+	if(bulkIf)
+		{
+		EstablishBulkThreadBindingL();
+		}
+
+	// Check an instance of the same interface (same interface UID and type) 
+	// has not already been added.
+	const TUint count = iInterfaces->Array().Count();
+	for(TUint ii=0; ii<count; ++ii)
+		{
+		CRemConInterfaceBase* const iface = iInterfaces->Array()[ii]->Interface();
+		RCIS_VERBOSE_ASSERT(iface, ERemConIfSelInternalError);
+		RCIS_VERBOSE_ASSERT( (iface->InterfaceUid() != aInterface.InterfaceUid()) || (iface->Type() != aInterface.Type()), 
+			ERemConIfSelInterfaceOfThatTypeAlreadyRegistered);
+		}
+
+	// Registration of interfaces should occur before we try to use any of 
+	// them.
+	RCIS_VERBOSE_ASSERT(!TargetOpened() && !ControllerOpened(), ERemConIfSelTardyInterfaceRegistration);
+	
+	iLock->Wait();	// critical session
+	RHeap* currentHeap = User::SwitchHeap(iSharedThreadHeap);
+	CleanupSwitchHeapPushL(*currentHeap);
+		{
+		CRemConInterfaceDetails* details = CRemConInterfaceDetails::NewLC(aInterface.InterfaceUid(), aInterface.Type(), bulkIf, &aInterface, aFeatures);
+		iInterfaces->AppendL(details);
+		CleanupStack::Pop(details);
+		}
+	CleanupStack::PopAndDestroy(currentHeap);
+	iLock->Signal(); // end of critical session
+	
+	// The interface has been appended OK, so adjust iMaxDataLength.
+	const TUint interfaceMaxLength = aInterface.MaxLength();
+	if(!bulkIf && interfaceMaxLength > iControlMaxDataLength)
+		{
+		iControlMaxDataLength = interfaceMaxLength;
+		}
+	else if(bulkIf && interfaceMaxLength > iBulkMaxDataLength)
+		{
+		iBulkMaxDataLength = interfaceMaxLength;
+		}
+	}
+
+EXPORT_C void CRemConInterfaceSelector::RegisterInterfaceL(CRemConInterfaceBase& aInterface)
+	{
+	LOG_FUNC
+	
+	RegisterInterfaceCommonL(aInterface, KNullDesC8);
+	}
+
+void CRemConInterfaceSelector::RegisterInterfaceL(CRemConInterfaceBase& aInterface, RRemConInterfaceFeatures& aRemConInterfaceFeatures)
+	{
+	LOG_FUNC
+
+	RegisterInterfaceCommonL(aInterface, aRemConInterfaceFeatures.SupportedOperations());
+	}
+
+EXPORT_C void CRemConInterfaceSelector::RegisterErrorObserver(MRemConErrorObserver* aObserver)
+	{
+	LOG_FUNC
+	LOG1(_L("\taObserver = 0x%08x"), aObserver);
+	
+	iErrorObserver = aObserver;
+	}
+
+EXPORT_C void CRemConInterfaceSelector::OpenControllerL()
+	{
+	LOG_FUNC
+
+	// An attempt to open a controller session when one is already open 
+	// is an exceptional condition.
+	if (ControllerOpened())
+		{
+		LEAVEL(KErrInUse);
+		}
+
+	// NB We don't enforce that there are some interfaces registered here 
+	// because the client might be connecting just to watch connection 
+	// statuses.
+
+	iControllerSession = new(ELeave)RRemConController();
+	LEAVEIFERRORL(iControllerSession->Connect());
+	CleanupCloseDeleteAndNullPushL(reinterpret_cast<RRemCon**>(&iControllerSession));
+	
+	RegisterInterestedApisL(ERemConClientTypeController);
+
+	// Now there's a session to receive on, start the receiver.
+	RCIS_VERBOSE_ASSERT(!iControllerReceiver, ERemConIfSelInternalError);
+	iControllerReceiver = CReceiver::NewL(*iControllerSession, *this, iControlMaxDataLength, ERemConClientTypeController);
+	CleanupStack::Pop(&iControllerSession);
+	}
+
+void CRemConInterfaceSelector::RegisterInterestedApisL(TRemConClientType aType)
+	{
+	LOG_FUNC
+
+	TBool target = CRemConInterfaceBase::Target(aType);
+	
+	// First get the size of the data we are going to pass to the server.
+	RCountSizeWriteStream counter;
+	iInterfaces->ExternalizeL(counter, aType);
+	TInt size = counter.Size();
+	counter.Close();
+	
+	// Create a suitable size buffer.
+	RBuf8 ipcBuf;
+	ipcBuf.CreateL(size);
+	ipcBuf.CleanupClosePushL();
+	
+	// Encode the interface details into the buffer.
+	RDesWriteStream ipcStream(ipcBuf);
+	iInterfaces->ExternalizeL(ipcStream, aType);
+	ipcStream.CommitL();
+	ipcStream.Close();
+	
+	// Inform the correct session about the interfaces
+	if(!target)
+		{
+		LEAVEIFERRORL(iControllerSession->RegisterInterestedAPIs(ipcBuf));
+		}
+	else
+		{	
+		LEAVEIFERRORL(iTargetSession->RegisterInterestedAPIs(ipcBuf));
+		}
+	
+	CleanupStack::PopAndDestroy(&ipcBuf);
+	}
+
+void CRemConInterfaceSelector::OpenTargetCommonL()
+	{
+	LOG_FUNC
+
+	// NB We don't enforce that there are some interfaces registered here 
+	// because the client might be connecting just to watch connection 
+	// statuses.
+	CleanupCloseDeleteAndNullPushL(reinterpret_cast<RRemCon**>(&iTargetSession));
+
+	RegisterInterestedApisL(ERemConClientTypeTarget);
+	
+	// Now we are finished with the features, so we can release some memory.
+	RHeap* currentHeap = User::SwitchHeap(iSharedThreadHeap);
+		{
+		for(TInt ix = 0; ix < iInterfaces->Array().Count(); ++ix)
+			{
+			CRemConInterfaceDetails* const details = iInterfaces->Array()[ix];
+			ASSERT_DEBUG(details);
+			details->DeleteFeatures();
+			}
+		}
+	User::SwitchHeap(currentHeap);
+	
+	// Now there's a session to receive on, start the receiver.
+	RCIS_VERBOSE_ASSERT(!iTargetReceiver, ERemConIfSelInternalError);
+	iTargetReceiver = CReceiver::NewL(*iTargetSession, *this, iControlMaxDataLength, ERemConClientTypeTarget);
+	CleanupDeleteAndNullPushL(iTargetReceiver);
+
+	if(iBulkReceiver)
+		{
+		// We delegate the call to the thread the receiver is running
+		// in - waiting until it has completed (with success or error).
+		iBulkReceiver->WaitUntilConnectedL();
+		}
+
+	CleanupStack::Pop(2, &iTargetSession); // iTargetReceiver, iTargetSession
+	}
+
+EXPORT_C void CRemConInterfaceSelector::OpenTargetL()
+	{
+	LOG_FUNC
+
+	// An attempt to open a target session when one is already open 
+	// is an exceptional condition.
+	if (TargetOpened())
+		{
+		LEAVEL(KErrInUse);
+		}
+	
+	iTargetSession = new(ELeave)RRemConTarget();
+	TInt err = iTargetSession->Connect();
+	if(err == KErrNone)
+		{
+		OpenTargetCommonL();
+		}
+	else
+		{
+		delete iTargetSession;
+		iTargetSession = NULL;
+		LEAVEL(err);
+		}
+	}
+
+/**
+This should be run from the thread in which the bulk interfaces are to run.
+*/
+void CRemConInterfaceSelector::BulkSessionConnectL()
+	{
+	LOG_FUNC
+
+	RRemConBulk* bulkSession = new(ELeave)RRemConBulk;
+	CleanupStack::PushL(bulkSession);
+	LEAVEIFERRORL(bulkSession->Connect());
+	CleanupClosePushL(*bulkSession);
+	RCIS_VERBOSE_ASSERT(iBulkReceiver, ERemConIfSelInternalError);
+	iBulkReceiver->InitialiseL(*bulkSession, iBulkMaxDataLength);
+	CleanupStack::Pop(2, bulkSession);
+	iBulkSession = bulkSession;
+	}
+
+/**
+Opens a target session to RemCon.
+
+If any bulk interfaces have been registered on this interface selector the
+the thread in which the first bulk interface was created must be ready to run and
+not blocked waiting for the completion of this function.  Failure to do so will lead
+to deadlock.
+
+@param aPlayerType The type of player
+@param aPlayerSubType The sub-type of the player
+@param aPlayerName  The name of the player
+@leave KErrInUse If a target session is already open.
+*/
+EXPORT_C void CRemConInterfaceSelector::OpenTargetL(TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aPlayerName)
+	{
+	LOG_FUNC
+
+	// An attempt to open a target session when one is already open 
+	// is an exceptional condition.
+	if (TargetOpened())
+		{
+		LEAVEL(KErrInUse);
+		}
+
+	iTargetSession = new(ELeave)RRemConTarget();
+	TInt err = iTargetSession->Connect(aPlayerType,aPlayerSubType,aPlayerName);
+	if(err == KErrNone)
+		{
+		OpenTargetCommonL();
+		}
+	else
+		{
+		delete iTargetSession;
+		iTargetSession = NULL;
+		LEAVEL(err);
+		}
+	}
+
+EXPORT_C TBool CRemConInterfaceSelector::ControllerOpened() const
+	{
+	ASSERT_DEBUG((iControllerSession && iControllerSession->Handle()) || !iControllerSession);
+	return iControllerSession ? ETrue : EFalse;
+	}
+
+EXPORT_C TBool CRemConInterfaceSelector::TargetOpened() const
+	{
+	ASSERT_DEBUG((iTargetSession && iTargetSession->Handle()) || !iTargetSession);
+	return iTargetSession ? ETrue : EFalse;
+	}
+
+TBool CRemConInterfaceSelector::BulkOpened() const
+	{
+	ASSERT_DEBUG((iBulkSession && iBulkSession->Handle()) || !iBulkSession);
+	return iBulkSession ? ETrue : EFalse;
+	}
+
+EXPORT_C void CRemConInterfaceSelector::GoConnectionOrientedL(const TRemConAddress& aConnection)
+	{
+	LOG_FUNC
+
+	RCIS_VERBOSE_ASSERT(ControllerOpened(), ERemConIfSelNoControllerSession);
+
+	LEAVEIFERRORL(iControllerSession->GoConnectionOriented(aConnection));
+	
+	// Store the address.  This means that if the server dies we know all
+	// we need to to return the existing sessions to usability without 
+	// troubling the app.
+	iAddress = aConnection;
+	}
+
+EXPORT_C void CRemConInterfaceSelector::GoConnectionlessL()
+	{
+	LOG_FUNC
+
+	RCIS_VERBOSE_ASSERT(ControllerOpened(), ERemConIfSelNoControllerSession);
+
+	LEAVEIFERRORL(iControllerSession->GoConnectionless());
+	
+	// Unset any stored address, so we know we are connectionless.
+	iAddress.BearerUid() = KNullUid;
+	}
+
+EXPORT_C void CRemConInterfaceSelector::ConnectBearer(TRequestStatus& aStat)
+	{
+	LOG_FUNC
+
+	RCIS_VERBOSE_ASSERT(ControllerOpened(), ERemConIfSelNoControllerSession);
+
+	iControllerSession->ConnectBearer(aStat);
+	}
+
+EXPORT_C TInt CRemConInterfaceSelector::ConnectBearerCancel()
+	{
+	LOG_FUNC
+
+	RCIS_VERBOSE_ASSERT(ControllerOpened(), ERemConIfSelNoControllerSession);
+
+	//Ignore Return code because
+	// a) It'll mostly be other than KErrNone because the server has terminated, in which
+	//    case the original async request will have completed with the error anyway!
+	// b) It's meaningless to the client whatever the return code is.
+	(void)iControllerSession->ConnectBearerCancel();
+	
+	return KErrNone;
+	}
+
+EXPORT_C void CRemConInterfaceSelector::DisconnectBearer(TRequestStatus& aStat)
+	{
+	LOG_FUNC
+
+	RCIS_VERBOSE_ASSERT(ControllerOpened(), ERemConIfSelNoControllerSession);
+
+	iControllerSession->DisconnectBearer(aStat);
+	}
+
+EXPORT_C TInt CRemConInterfaceSelector::DisconnectBearerCancel()
+	{
+	LOG_FUNC
+
+	RCIS_VERBOSE_ASSERT(ControllerOpened(), ERemConIfSelNoControllerSession);
+
+	//See CRemConInterfaceSelector::ConnectBearerCancel() for comment
+	(void)iControllerSession->DisconnectBearerCancel();
+
+	return KErrNone;
+	}
+
+EXPORT_C void CRemConInterfaceSelector::Send(TRequestStatus& aStatus, 
+											 TUid aInterfaceUid, 
+											 TUint aOperationId, 
+											 TUint& aNumRemotes,
+											 TRemConMessageType aMsgType,
+											 const TDesC8& aData)
+	{
+	LOG_FUNC
+
+	Send(aStatus, aInterfaceUid, aOperationId, aNumRemotes, aMsgType, ERemConMessageDefault, aData);
+	}
+
+EXPORT_C void CRemConInterfaceSelector::Send(TRequestStatus& aStatus, 
+											 TUid aInterfaceUid, 
+											 TUint aOperationId, 
+											 TUint& aNumRemotes,
+											 TRemConMessageType aMsgType,
+											 TRemConMessageSubType aSubType,
+											 const TDesC8& aData)
+	{
+	LOG_FUNC
+	
+	switch ( aMsgType )
+		{
+	case ERemConCommand:
+	case ERemConNotifyCommand:
+		RCIS_VERBOSE_ASSERT(ControllerOpened(), ERemConIfSelNoControllerSession);
+		iControllerSession->Send(aStatus, aInterfaceUid, aOperationId, aNumRemotes, aSubType, aData);
+		break;
+		
+	case ERemConResponse:
+		RCIS_VERBOSE_ASSERT(TargetOpened(), ERemConIfSelNoTargetSession);
+		iTargetSession->Send(aStatus, aInterfaceUid, aOperationId, aNumRemotes, aSubType, aData);
+		break;
+		
+	default:
+		RCIS_VERBOSE_PANIC(ERemConIfSelBadMessageType);
+		break;
+		}
+	}
+
+/**
+Sends a notify command to the remote device.
+
+@see CRemConInterfaceSelector::Send()
+*/
+EXPORT_C void CRemConInterfaceSelector::SendNotify(TRequestStatus& aStatus, 
+											 TUid aInterfaceUid, 
+											 TUint aOperationId, 
+											 TRemConMessageType aMsgType,
+											 TRemConMessageSubType aSubType,
+											 const TDesC8& aData)
+	{
+	LOG_FUNC
+	if (aMsgType == ERemConNotifyCommand)
+		{
+		RCIS_VERBOSE_ASSERT(ControllerOpened(), ERemConIfSelNoControllerSession);
+		iControllerSession->SendNotify(aStatus, aInterfaceUid, aOperationId, aSubType, aData);
+		}
+	else
+		{
+		RCIS_VERBOSE_PANIC(ERemConIfSelBadMessageType);
+		}
+	}
+
+EXPORT_C TInt CRemConInterfaceSelector::SendUnreliable(
+											 TUid aInterfaceUid, 
+											 TUint aOperationId, 
+											 TRemConMessageType aMsgType,
+											 const TDesC8& aData)
+	{
+	LOG_FUNC
+	
+	return SendUnreliable(aInterfaceUid, aOperationId, aMsgType, ERemConMessageDefault, aData);
+	}
+
+EXPORT_C TInt CRemConInterfaceSelector::SendUnreliable(
+											 TUid aInterfaceUid, 
+											 TUint aOperationId, 
+											 TRemConMessageType aMsgType,
+											 TRemConMessageSubType aSubType,
+											 const TDesC8& aData)
+	{
+	LOG_FUNC
+	
+	TInt ret = KErrNone;
+	
+	switch ( aMsgType )
+		{
+		case ERemConCommand:
+		case ERemConNotifyCommand:
+		RCIS_VERBOSE_ASSERT(ControllerOpened(), ERemConIfSelNoControllerSession);
+		ret = iControllerSession->SendUnreliable(aInterfaceUid, aOperationId, aSubType, aData);
+		break;
+		
+		case ERemConResponse:
+		RCIS_VERBOSE_ASSERT(TargetOpened(), ERemConIfSelNoTargetSession);
+		ret = iTargetSession->SendUnreliable(aInterfaceUid, aOperationId, aSubType, aData);
+		break;
+		
+		default:
+		RCIS_VERBOSE_PANIC(ERemConIfSelBadMessageType);
+		break;
+		}
+	return ret;
+	}
+
+EXPORT_C TInt CRemConInterfaceSelector::SendCancel(TRemConMessageType aMsgType)
+	{
+	LOG_FUNC
+
+	switch ( aMsgType )
+		{
+	case ERemConCommand:
+	case ERemConNotifyCommand:
+		RCIS_VERBOSE_ASSERT(ControllerOpened(), ERemConIfSelNoControllerSession);
+		//See CRemConInterfaceSelector::ConnectBearerCancel() for comment
+		(void)iControllerSession->SendCancel();
+		break;
+
+	case ERemConResponse:
+		RCIS_VERBOSE_ASSERT(TargetOpened(), ERemConIfSelNoTargetSession);
+		//See CRemConInterfaceSelector::ConnectBearerCancel() for comment
+		(void)iTargetSession->SendCancel();
+		break;
+
+	default:
+		RCIS_VERBOSE_PANIC(ERemConIfSelBadMessageType);
+		break;
+		}
+
+	return KErrNone;
+	}
+
+EXPORT_C void CRemConInterfaceSelector::SendBulk(TRequestStatus& aStatus, 
+											 TUid aInterfaceUid, 
+											 TUint aOperationId, 
+											 const TDesC8& aData)
+	{
+	LOG_FUNC
+	
+	// Panic as Target Session, because bulkness is transparent to client
+	RCIS_VERBOSE_ASSERT(BulkOpened(), ERemConIfSelNoTargetSession);
+	iBulkSession->Send(aStatus, aInterfaceUid, aOperationId, aData);
+	}
+
+EXPORT_C TInt CRemConInterfaceSelector::SendBulkUnreliable(
+											TUid aInterfaceUid,
+											TUint aOperationId,
+											const TDesC8& aData)
+	{
+	LOG_FUNC
+	
+	// Panic as Target Session, because bulkness is transparent to client
+	RCIS_VERBOSE_ASSERT(BulkOpened(), ERemConIfSelNoTargetSession);
+	return iBulkSession->SendUnreliable(aInterfaceUid, aOperationId, aData);
+	}
+
+EXPORT_C TInt CRemConInterfaceSelector::SendBulkCancel()
+	{
+	LOG_FUNC
+
+	RCIS_VERBOSE_ASSERT(BulkOpened(), ERemConIfSelNoTargetSession);
+	//See CRemConInterfaceSelector::ConnectBearerCancel() for comment
+	(void)iBulkSession->SendCancel();
+
+	return KErrNone;
+	}
+
+void CRemConInterfaceSelector::ReceiveComplete(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TRemConMessageSubType aMsgSubType, 
+		const TRemConAddress& aRemoteAddress,
+		const TDesC8& aData, 
+		TRemConClientType aType)
+	{
+	LOG_FUNC
+	LOG1(_L("\taInterfaceUid = 0x%08x"), aInterfaceUid);
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	LOG1(_L("\taRemoteAddress.BearerUid = 0x%08x"), aRemoteAddress.BearerUid());
+	
+	const TUint count = iInterfaces->Array().Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConInterfaceDetails* const details = iInterfaces->Array()[ii];
+		ASSERT_DEBUG(details);
+		CRemConInterfaceBase* const iface = details->Interface();
+		RCIS_VERBOSE_ASSERT(iface, ERemConIfSelInternalError);
+
+		if (	iface->InterfaceUid() == aInterfaceUid 
+			&&	iface->Type() == aType )
+			{
+			ASSERT_DEBUG(!details->IsBulk());
+			MRemConInterfaceIf3* interfaceIf3 = reinterpret_cast<MRemConInterfaceIf3*>(iface->GetInterfaceIf(TUid::Uid(KRemConInterfaceIf3)));
+			if (interfaceIf3)
+				{
+				interfaceIf3->MrcibNewMessage(aOperationId, aData, aMsgSubType, aRemoteAddress);
+				break;
+				}
+			MRemConInterfaceIf2* interfaceIf2 = reinterpret_cast<MRemConInterfaceIf2*>(iface->GetInterfaceIf(TUid::Uid(KRemConInterfaceIf2)));
+			if (interfaceIf2)
+				{
+				interfaceIf2->MrcibNewMessage(aOperationId, aData, aMsgSubType);
+				break;
+				}
+			MRemConInterfaceIf* interfaceIf = reinterpret_cast<MRemConInterfaceIf*>(iface->GetInterfaceIf(TUid::Uid(KRemConInterfaceIf1)));
+			RCIS_VERBOSE_ASSERT(interfaceIf, ERemConIfSelNoInterfaceImplementation);
+			interfaceIf->MrcibNewMessage(aOperationId, aData);
+			break;
+			}
+		}
+	}
+
+void CRemConInterfaceSelector::BulkReceiveComplete(TUid aInterfaceUid, TUint aOperationId, const TDesC8& aData)
+	{
+	LOG_FUNC
+	LOG1(_L("\taInterfaceUid = 0x%08x"), aInterfaceUid);
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+
+	const TUint count = iInterfaces->Array().Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConInterfaceDetails* const details = iInterfaces->Array()[ii];
+		ASSERT_DEBUG(details);
+		CRemConInterfaceBase* const iface = details->Interface();
+		RCIS_VERBOSE_ASSERT(iface, ERemConIfSelInternalError);
+
+		if(details->IsBulk() && iface->InterfaceUid() == aInterfaceUid)
+			{
+			MRemConInterfaceIf* interfaceIf = reinterpret_cast<MRemConInterfaceIf*>(iface->GetInterfaceIf(TUid::Uid(KRemConInterfaceIf1)));
+			RCIS_VERBOSE_ASSERT(interfaceIf, ERemConIfSelNoInterfaceImplementation);
+			interfaceIf->MrcibNewMessage(aOperationId, aData);
+			}
+		}
+	}
+
+void CRemConInterfaceSelector::Error(TInt aError)
+	{
+	LOG_FUNC
+	LOG1(_L("\taError = %d"), aError);
+	LOG1(_L("\tiErrorObserver = 0x%08x"), iErrorObserver);
+	
+	if(aError == KErrServerTerminated)
+		{
+		// Initially try and deal with server death in a way that is
+		// transparent to the app.
+		TInt err = TryToReconnect();
+		LOG1(_L("\tTryToReconnect error = %d"), err);
+	
+		// If we fail inform any registered app.  Unregistered apps
+		// just take the risk that they may not realise the server has
+		// died if it errors on a receive.
+		if(err && iErrorObserver)
+			{
+			iErrorObserver->MrceoError(KErrServerTerminated);
+			}
+		}
+	}
+
+void CRemConInterfaceSelector::BulkError(TInt aError)
+	{
+	LOG_FUNC
+	LOG1(_L("\taError = %d"), aError);
+	LOG1(_L("\tiErrorObserver = 0x%08x"), iErrorObserver);
+	
+	if(aError == KErrServerTerminated)
+		{
+		// Initially try and deal with server death in a way that is
+		// transparent to the app.
+		TInt err = TryToReconnectBulk();
+		LOG1(_L("\tTryToReconnectBulk error = %d"), err);
+	
+		// If we fail inform any registered app.  Unregistered apps
+		// just take the risk that they may not realise the server has
+		// died if it errors on a receive.
+		if(err && iErrorObserver)
+			{
+			iErrorObserver->MrceoError(KErrServerTerminated);
+			}
+		}
+	}
+
+EXPORT_C TInt CRemConInterfaceSelector::GetConnections(TSglQue<TRemConAddress>& aConnections)
+	{
+	LOG_FUNC
+
+	// It doesn't matter which session we use for this.
+	RRemCon* sess = ControllerOpened() ? reinterpret_cast<RRemCon*>(iControllerSession) : reinterpret_cast<RRemCon*>(iTargetSession);
+	AssertSession(sess, ERemConIfSelNoSession);
+
+	return sess->GetConnections(aConnections);
+	}
+
+EXPORT_C void CRemConInterfaceSelector::NotifyConnectionsChange(TRequestStatus& aStatus)
+	{
+	LOG_FUNC
+
+	// It doesn't matter which session we use for this.
+	iNotificationSession = ControllerOpened() ? reinterpret_cast<RRemCon*>(iControllerSession) : reinterpret_cast<RRemCon*>(iTargetSession);
+	AssertSession(iNotificationSession, ERemConIfSelNoSession);
+
+	iNotificationSession->NotifyConnectionsChange(aStatus);
+	}
+
+EXPORT_C TInt CRemConInterfaceSelector::NotifyConnectionsChangeCancel()
+	{
+	LOG_FUNC
+
+	// Get the session we used for posting the original notification. It won't 
+	// have gone away in the meantime as that only happens when 'this' is 
+	// destroyed, but the client may call this without ever having called the 
+	// original notification.
+	AssertSession(iNotificationSession, ERemConIfSelNoSession);
+
+	//See CRemConInterfaceSelector::ConnectBearerCancel() for comment
+	(void)iNotificationSession->NotifyConnectionsChangeCancel();
+
+	return KErrNone;
+	}
+
+void CRemConInterfaceSelector::AssertSession(RRemCon* aSess, TInt aPanicCode) const
+	{
+	LOG_FUNC
+
+	RCIS_VERBOSE_ASSERT(aSess && aSess->Handle(), aPanicCode);
+	}
+
+/** 
+Resurrects sessions in case of server death.
+
+For the target and controller session we try to open a new
+session.  If this succeeds we can then set the old session
+to point to the new one after closing our old defunct 
+session.
+
+On success we are left with happy functioning handles.
+On failure we are left with defunct handles, which are still 
+valid but will complete all requests with KErrServerTerminated.
+
+This means that we won't cause an application to get a bad handle
+panic if it hasn't done anything wrong.
+*/
+TInt CRemConInterfaceSelector::TryToReconnect()
+	{
+	LOG_FUNC
+	
+	// Always want to stop receiving.  The receiver itself should stop issuing
+	// further receives on completion, but we only want to have the error function
+	// called once, so Cancel() receivers in case we had both.
+	if(TargetOpened())
+		{
+		RCIS_VERBOSE_ASSERT(iTargetReceiver, ERemConIfSelInternalError);
+		iTargetReceiver->Cancel();
+		}
+
+	if(ControllerOpened())
+		{
+		RCIS_VERBOSE_ASSERT(iControllerReceiver, ERemConIfSelInternalError);
+		iControllerReceiver->Cancel();
+		}
+		
+	// Now try and create new sessions.  We do all the failable work first
+	// so we aren't left in a half alive situation.		
+	TInt err = KErrNone;
+	RRemConTarget newTarget;
+	RRemConController newController;
+	
+	if(TargetOpened())
+		{
+		// See if we can kick RemCon back into life
+		err = newTarget.Connect();
+		}
+	
+	if(!err && ControllerOpened())
+		{		
+		// See if we can kick RemCon back into life
+		err = newController.Connect();
+		
+		if(!err && !iAddress.IsNull())
+			{	
+			// If an address is set the session was connection oriented, 
+			// resurrect that now.	
+			err = newController.GoConnectionOriented(iAddress);
+			}
+		}
+	
+	if(!err)
+		{
+		// RemCon lives!  Set our sessions to be the nice new ones.
+		if(TargetOpened())
+			{
+			iTargetSession->Close();
+			iTargetSession->SetHandle(newTarget.Handle());
+			iTargetReceiver->Receive();
+			}
+
+		if(ControllerOpened())
+			{
+			iControllerSession->Close();
+			iControllerSession->SetHandle(newController.Handle());
+			iControllerReceiver->Receive();
+			}
+		}
+	else
+		{
+		// We may not have successfully opened these, but it's safe to 
+		// close them anyway.
+		newTarget.Close();
+		newController.Close();
+		}
+	
+	return err;
+	}
+
+
+
+/** 
+Resurrects bulk sessions in case of server death.
+
+For the bulk session we try to open a new
+session.  If this succeeds we can then set the old session
+to point to the new one after closing our old defunct 
+session.
+
+On success we are left with happy functioning handles.
+On failure we are left with defunct handles, which are still 
+valid but will complete all requests with KErrServerTerminated.
+
+This means that we won't cause an application to get a bad handle
+panic if it hasn't done anything wrong.
+*/
+TInt CRemConInterfaceSelector::TryToReconnectBulk()
+	{
+	LOG_FUNC
+	
+	// Always want to stop receiving.  The receiver itself should stop issuing
+	// further receives on completion, but we only want to have the error function
+	// called once, so Cancel() receivers in case we had both.
+	if(BulkOpened())
+		{
+		RCIS_VERBOSE_ASSERT(iBulkReceiver, ERemConIfSelInternalError);
+		iBulkReceiver->Cancel();
+		}
+		
+	// Now try and create new sessions.  We do all the failable work first
+	// so we aren't left in a half alive situation.		
+	TInt err = KErrNone;
+	RRemConBulk newBulk;
+	
+	if(BulkOpened())
+		{
+		// See if we can kick RemCon back into life
+		err = newBulk.Connect();
+		}
+	
+	if(err == KErrNone)
+		{
+		// RemCon lives!  Set our session to be the nice new one.
+		if(BulkOpened())
+			{
+			iBulkSession->Close();
+			iBulkSession->SetHandle(newBulk.Handle());
+			iBulkReceiver->Receive();
+			}
+		}
+	else
+		{
+		// We may not have successfully opened this, but it's safe to 
+		// close it anyway.
+		newBulk.Close();
+		}
+	
+	return err;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/src/receiver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,121 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include "remconclient.h"
+#include "receiver.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_IL_RECV);
+#endif
+
+CReceiver* CReceiver::NewL(RRemCon& aRemCon, 
+						   CRemConInterfaceSelector& aObserver, 
+						   TUint aMaxDataLength,
+						   TRemConClientType aType)
+	{
+	LOG_STATIC_FUNC
+	CReceiver* self = new(ELeave) CReceiver(aRemCon, aObserver, aType);
+	CleanupStack::PushL(self);
+	self->ConstructL(aMaxDataLength);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+/**
+Destructor.
+*/
+CReceiver::~CReceiver()
+	{
+	LOG_FUNC
+	Cancel();
+
+	iData.Close();
+	}
+
+CReceiver::CReceiver(RRemCon& aRemCon, 
+					 CRemConInterfaceSelector& aObserver, 
+					 TRemConClientType aType)
+:	CActive(CActive::EPriorityStandard),
+	iType(aType),
+	iRemCon(aRemCon),
+	iObserver(aObserver)
+	{
+	LOG_FUNC
+	CActiveScheduler::Add(this);
+	}
+
+void CReceiver::ConstructL(TUint aMaxDataLength)
+	{
+	iData.CreateL(aMaxDataLength);
+	// NB If a remote sends longer data than we expect to receive here, our 
+	// receive will be errored and the message will effectively be dropped in 
+	// the intermediate layer. (It won't get passed to the outer layer.)
+
+	// Start the perpetual receive cycle.
+	Receive();
+	}
+
+void CReceiver::Receive()
+	{
+	LOG_FUNC
+
+	iRemCon.Receive(iStatus, iReceivePackage, iData);
+	SetActive();
+	}
+
+void CReceiver::RunL()
+	{
+	LOG_FUNC
+	LOG1(_L("\tiStatus = %d"), iStatus.Int());
+
+	// Record the result of our last request, because the stuff we
+	// do depends on it, but may also issue further requests.
+	TInt err = iStatus.Int();
+	
+	if(err == KErrNone)
+		{
+		iObserver.ReceiveComplete(iReceivePackage.iInterfaceUid, 
+			iReceivePackage.iOperationId, 
+			iReceivePackage.iMessageSubType, 
+			iReceivePackage.iRemoteAddress, 
+			iData, 
+			iType);
+		}
+	else
+		{
+		iObserver.Error(err);
+		}
+		
+	if(err != KErrServerTerminated)
+		{
+		// Repost request.
+		Receive();
+		}
+	}
+
+void CReceiver::DoCancel()
+	{
+	LOG_FUNC
+
+	// There's nothing we can do about any error here, and it probably 
+	// indicates that the server has gone away anyway for some reason.
+	(void)iRemCon.ReceiveCancel();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/intermediate/src/remconinterfacefeatures.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <remcon/remconinterfacefeatures.h>
+
+// Default size chosen based on number of operations in core api
+const TInt KDefaultOperationBufLength = 62;
+const TInt KIncrementReallocGranularity = 62;
+
+EXPORT_C TInt RRemConInterfaceFeatures::Open()
+	{
+	return iOperations.Create(KDefaultOperationBufLength);
+	}
+
+EXPORT_C void RRemConInterfaceFeatures::Close()
+	{
+	iOperations.Close();
+	}
+
+EXPORT_C void RRemConInterfaceFeatures::AddOperationL(TUint aOperationId)
+	{
+	if(iOperations.Length() + sizeof(TUint) > iOperations.MaxLength())
+		{
+		// Need more space!
+		iOperations.ReAllocL(iOperations.Length() + KIncrementReallocGranularity);
+		}
+	
+	TPckgBuf<TUint> opBuf(aOperationId);
+	iOperations.Append(opBuf);
+	}
+
+const TDesC8& RRemConInterfaceFeatures::SupportedOperations() const
+	{
+	return iOperations;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/sidekeyapi/bwins/remconsidekeyapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+	?SideKeyDownResponse@CRemConSideKeyTarget@@QAEXH@Z @ 1 NONAME ; void CRemConSideKeyTarget::SideKeyDownResponse(int)
+	?NewL@CRemConSideKeyTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConSideKeyTargetObserver@@@Z @ 2 NONAME ; class CRemConSideKeyTarget * CRemConSideKeyTarget::NewL(class CRemConInterfaceSelector &, class MRemConSideKeyTargetObserver &)
+	??1CRemConSideKeyTarget@@UAE@XZ @ 3 NONAME ; CRemConSideKeyTarget::~CRemConSideKeyTarget(void)
+	?SideKeyUpResponse@CRemConSideKeyTarget@@QAEXH@Z @ 4 NONAME ; void CRemConSideKeyTarget::SideKeyUpResponse(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/sidekeyapi/eabi/remconsidekeyapiu.def	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,8 @@
+EXPORTS
+	_ZN20CRemConSideKeyTarget17SideKeyUpResponseEi @ 1 NONAME
+	_ZN20CRemConSideKeyTarget19SideKeyDownResponseEi @ 2 NONAME
+	_ZN20CRemConSideKeyTarget4NewLER24CRemConInterfaceSelectorR28MRemConSideKeyTargetObserver @ 3 NONAME
+	_ZN20CRemConSideKeyTargetD0Ev @ 4 NONAME
+	_ZN20CRemConSideKeyTargetD1Ev @ 5 NONAME
+	_ZN20CRemConSideKeyTargetD2Ev @ 6 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/sidekeyapi/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,27 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconsidekeyapi.mmp
+
+PRJ_EXPORTS
+../public/remconsidekeyapi.h					SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconsidekeyapi.h)
+../public/remconsidekeytarget.h					SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconsidekeytarget.h)
+../public/remconsidekeytargetobserver.h			SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconsidekeytargetobserver.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/sidekeyapi/group/remconsidekeyapi.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,52 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconsidekeyapi.dll An outer layer client side library facilitating 
+// Side Key messages.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+
+TARGET			remconsidekeyapi.dll //Recommended unpaged
+
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+USERINCLUDE 	../inc
+
+
+SOURCEPATH		../src
+SOURCE			sidekeytarget.cpp
+
+
+USERINCLUDE 	../../../common
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		remconinterfacebase.lib
+
+#include <bluetooth/btlogger.mmh>
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/sidekeyapi/inc/remconsidekeyapipaniccodes.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,27 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef REMCONSIDEKEYAPIPANICCODES_H
+#define REMCONSIDEKEYAPIPANICCODES_H
+
+enum TSideKeyApiPanicCat
+	{
+	ESideKeyMissingButtonData,
+	ESideKeyInvalidOperationId,
+	};
+
+_LIT(KSideKeyPanicCat,"RemconSideKeyApi");
+
+#endif // REMCONSIDEKEYAPIPANICCODES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/sidekeyapi/public/remconsidekeyapi.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,70 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef REMCONSIDEKEYAPI_H
+#define REMCONSIDEKEYAPI_H
+
+#include <e32base.h>
+
+/** Offset in the operation-specific data of the 'result' (this field exists 
+in both commands and responses, but logically only applies to responses). */
+const TUint KRemConSideKeyApiResultDataOffset = 0;
+
+/** Length of the results data/field in bytes. */
+const TUint KRemConSideKeyApiResultDataLength = 4;
+
+/** Used for checking operation-specific data. The operation-specific data of 
+an Side Key API message must always contain at least a results field, so the length 
+of the results field is the minimum length of this 'packet'. */
+const TUint KRemConSideKeyApiMinimumDataLength = KRemConSideKeyApiResultDataLength;
+
+/**
+The UID identifying the Side Key outer-layer RemCon interface.
+*/
+const TInt KRemConSideKeyApiUid = 0x2002FF91;
+
+/**
+Operation ids belonging to the Side Key interface.
+These are public so bearers/converters can access them.
+*/
+enum TRemConSideKeyOperationId
+	{
+	/** Side key up pressed. */
+	ERemConSideKeyUp			= 0x00,
+	/** Side key down pressed. */
+	ERemConSideKeyDown			= 0x01,
+	};
+
+/** Length of the button action data in bytes. */
+const TUint KRemConSideKeyApiButtonDataLength = 1;
+
+/** Button actions. */
+enum TRemConSideKeyApiButtonAction
+	{
+	/** A button has been pressed. */
+	ERemConSideKeyApiButtonPress	= 0,
+	/** A button has been released. */
+	ERemConSideKeyApiButtonRelease 	= 1,
+	/** A button has been clicked. */
+	ERemConSideKeyApiButtonClick	= 2,
+	};
+
+#endif // REMCONSIDEKEYAPI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/sidekeyapi/public/remconsidekeytarget.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,89 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONSIDEKEYTARGET_H
+#define REMCONSIDEKEYTARGET_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+
+class MRemConSideKeyTargetObserver;
+class CRemConInterfaceSelector;
+
+/**
+Client-instantiable type supporting sending SideKey API responses.
+*/
+NONSHARABLE_CLASS(CRemConSideKeyTarget) : public CRemConInterfaceBase, 
+								         public MRemConInterfaceIf
+	{
+public:
+	/**
+	Factory function.
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@return A new CRemConSideKeyTarget, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConSideKeyTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConSideKeyTargetObserver& aObserver);
+	
+	IMPORT_C ~CRemConSideKeyTarget();
+
+public:
+	/**
+	Sends a response to a 'side key up' command.
+	@param aError The response error.
+	*/
+	IMPORT_C void SideKeyUpResponse(TInt aError);
+
+	/**
+	Sends a response to a 'side key down' command.
+	@param aError The response error.
+	*/
+	IMPORT_C void SideKeyDownResponse(TInt aError);
+
+
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	@param aObserver The observer of this interface.
+	*/
+	CRemConSideKeyTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConSideKeyTargetObserver& aObserver);
+
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+
+private: // unowned
+	MRemConSideKeyTargetObserver& iObserver;
+
+private: // owned
+	// For operation-specific data.
+	static const TUint KMaxOperationDataSize = 0x04;
+	TBuf8<KMaxOperationDataSize> iOutData;
+	};
+
+#endif // REMCONSIDEKEYTARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/sidekeyapi/public/remconsidekeytargetobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,45 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONSIDEKEYTARGETOBSERVER_H
+#define REMCONSIDEKEYTARGETOBSERVER_H
+
+#include <e32base.h>
+#include <remcon/remconsidekeyapi.h>
+
+/**
+Client-implemented mixin- notifies the client of incoming SideKey commands.
+*/
+class MRemConSideKeyTargetObserver
+	{
+public:
+	/** 
+	A 'side key up' command has been received.
+	*/
+	virtual void MrcsktoSideKeyUp(TRemConSideKeyApiButtonAction aAction) = 0;
+
+	/** 
+	A 'side key down' command has been received.
+	*/
+	virtual void MrcsktoSideKeyDown(TRemConSideKeyApiButtonAction aAction) = 0;
+	};
+
+#endif // REMCONSIDEKEYTARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/client/sidekeyapi/src/sidekeytarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,141 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <e32base.h>
+#include <remcon/remconsidekeyapi.h>
+#include <remcon/remconsidekeytarget.h>
+#include <remcon/remconsidekeytargetobserver.h>
+#include <remconinterfaceselector.h>
+#include "remconsidekeyapipaniccodes.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "RemconSideKeyApi");
+#endif
+
+#ifdef _DEBUG
+// only called via __ASSERT_DEBUG statements
+static void Panic(TSideKeyApiPanicCat aCode)
+	{
+	User::Panic(KSideKeyPanicCat, aCode);
+	}
+#endif
+
+EXPORT_C CRemConSideKeyTarget* CRemConSideKeyTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+																	MRemConSideKeyTargetObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConSideKeyTarget* self = new(ELeave) CRemConSideKeyTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->BaseConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConSideKeyTarget::CRemConSideKeyTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+													 MRemConSideKeyTargetObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConSideKeyApiUid), 
+						 KMaxOperationDataSize,
+						 aInterfaceSelector,
+						 ERemConClientTypeTarget),
+	iObserver(aObserver)
+	{
+	}
+
+EXPORT_C CRemConSideKeyTarget::~CRemConSideKeyTarget()
+	{
+	LOG_FUNC
+	}
+
+TAny* CRemConSideKeyTarget::GetInterfaceIf(TUid aUid)
+	{
+	LOG_FUNC
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+void CRemConSideKeyTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData)
+	{
+	LOG_FUNC
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	LOG1(_L("\taData.Length = %d"), aData.Length());
+
+	// Get the button action
+	if ( aData.Length() < KRemConSideKeyApiButtonDataLength )
+		{
+		// The bearer sent us incorrect data. We cannot panic the bearer
+		// from here, so we panic ourselves in udeb mode only instead.
+		__ASSERT_DEBUG(EFalse,Panic(ESideKeyMissingButtonData));
+		LOG(_L("\tdropping command because button data not found"));
+		return; // ditch malformed messages
+		}
+	TRemConSideKeyApiButtonAction action = static_cast<TRemConSideKeyApiButtonAction>(aData.Ptr()[0]);
+
+	switch ( aOperationId )
+		{
+	case ERemConSideKeyUp:
+		iObserver.MrcsktoSideKeyUp(action);
+		break;
+
+	case ERemConSideKeyDown:
+		iObserver.MrcsktoSideKeyDown(action);
+		break;
+
+	default:
+		// The bearer sent us incorrect data. We cannot panic the bearer
+		// from here, so we panic ourselves in udeb mode only instead.
+		__ASSERT_DEBUG(EFalse,Panic(ESideKeyInvalidOperationId));
+		break;
+		}
+	}
+
+EXPORT_C void CRemConSideKeyTarget::SideKeyUpResponse(TInt aError)
+	{
+	LOG_FUNC
+
+	iOutData.Copy((TUint8*)&aError, KRemConSideKeyApiResultDataLength);
+	
+	InterfaceSelector().SendUnreliable( 
+		TUid::Uid(KRemConSideKeyApiUid), 
+		(TUint)ERemConSideKeyUp, 
+		ERemConResponse,
+		iOutData);
+	}
+
+EXPORT_C void CRemConSideKeyTarget::SideKeyDownResponse(TInt aError)
+	{
+	LOG_FUNC
+
+	iOutData.Copy((TUint8*)&aError, KRemConSideKeyApiResultDataLength);
+	
+	InterfaceSelector().SendUnreliable(
+		TUid::Uid(KRemConSideKeyApiUid), 
+		(TUint)ERemConSideKeyDown, 
+		ERemConResponse,
+		iOutData);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/common/operationinformation.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,39 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Operation information 
+// Used by both Remote Control server side and Remote Control client side library.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef OPERATIONINFORMATION_H
+#define OPERATIONINFORMATION_H
+
+#include <e32base.h>
+#include <remcon/messagetype.h>
+
+
+class TOperationInformation
+	{
+public:
+	TUint iOperationId;
+	TRemConMessageSubType iMessageSubType;
+	};
+
+
+#endif // OPERATIONINFORMATION_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/common/remconserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,114 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// API for the Remote Control server side.
+// Used by the Remote Control client side library.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCONSERVER_H
+#define REMCONSERVER_H
+
+#include <remcon/remconserverid.h>
+#include <remconaddress.h>
+#include "operationinformation.h"
+
+_LIT(KRemConServerImg, "z:\\sys\\bin\\remconserver.exe");
+
+_LIT(KRemConServerName, "!RemConSrv");
+
+/** Version numbers for the RemCon server. */
+const TInt8 KRemConSrvMajorVersionNumber = 2;
+const TInt8 KRemConSrvMinorVersionNumber = 0;
+const TInt16 KRemConSrvControllerSession = 1;
+const TInt16 KRemConSrvTargetSession = 2;
+
+/** IPC messages supported by the RemCon server. */
+enum TRemConIpc
+	{
+	ERemConDbgMarkHeap						= 0, // the 1st message must be 0 for CPolicyServer to start up
+	ERemConDbgCheckHeap 					= 1,
+	ERemConDbgMarkEnd						= 2,
+	ERemConDbgFailNext						= 3,
+	ERemConSetPlayerType					= 4,
+	ERemConGoConnectionOriented 			= 5,
+	ERemConGoConnectionless 				= 6,
+	ERemConConnectBearer					= 7,
+	ERemConConnectBearerCancel				= 8,
+	ERemConDisconnectBearer 				= 9,
+	ERemConDisconnectBearerCancel			= 10,
+	ERemConSend 							= 11,
+	ERemConSendCancel						= 12,
+	ERemConReceive							= 13,
+	ERemConReceiveCancel					= 14,
+	ERemConGetConnectionCount				= 15,
+	ERemConGetConnections					= 16,
+	ERemConNotifyConnectionsChange			= 17,
+	ERemConNotifyConnectionsChangeCancel	= 18,
+	ERemConRegisterInterestedAPIs			= 19,
+	ERemConSendUnreliable					= 20,
+	ERemConSendNotify						= 21,
+	//
+	// Next entry should always come last. 
+	//
+	ERemConNumberOfServerFunctions
+	};
+
+_LIT(KRemConBulkServerName, "!RemConBulkSrv");
+
+/** Version numbers for RemCon bulk server. */
+const TInt8 KRemConBulkSrvMajorVersionNumber = 1;
+const TInt8 KRemConBulkSrvMinorVersionNumber = 1;
+const TInt16 KRemConBulkSrvBuildNumber = 0;
+
+/** IPC messages supported by the RemCon bulk server. */
+enum TRemConBulkIpc
+	{
+	ERemConBulkDbgMarkHeap						= 0, // the 1st message must be 0 for CPolicyServer to start up
+	ERemConBulkDbgCheckHeap 					= 1,
+	ERemConBulkDbgMarkEnd						= 2,
+	ERemConBulkDbgFailNext						= 3,
+	ERemConBulkSend 							= 4,
+	ERemConBulkSendCancel						= 5,
+	ERemConBulkReceive							= 6,
+	ERemConBulkReceiveCancel					= 7,
+	ERemConBulkRegisterInterestedAPIs			= 8,
+	ERemConBulkSendUnreliable					= 9,
+	//
+	// Next entry should always come last.
+	//
+	ERemConBulkNumberOfServerFunctions
+	};
+
+/**
+This struct wraps up the information passed from the server to the client in 
+an RRemCon::Receive operation.
+It does not however include the arbitrary-length narrow descriptor 'associated 
+data' as this cannot be wrapped in a struct.
+We do it this way because TIpcArgs only has four slots and we've used all of 
+them. 
+*/
+NONSHARABLE_STRUCT(TRemConClientReceivePackage)
+	{
+	TUid iInterfaceUid;
+	TUint iOperationId;
+	TRemConMessageSubType iMessageSubType;
+	TRemConAddress iRemoteAddress;
+	};
+
+#endif // REMCONSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/common/utils.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,464 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "utils.h"
+#include <e32msgqueue.h>
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_UTILS);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("RCFUtils");
+#endif
+
+/**
+Function passed in as a parameter to TCleanupItem constructor to reset and 
+destroy the received aPtr.
+@param aPtr A pointer to the object that is to be cleaned up
+*/
+void ResetAndDestroy(TAny* aPtr)
+	{
+	ASSERT_DEBUG(aPtr);
+	reinterpret_cast<RImplInfoPtrArray*>(aPtr)->ResetAndDestroy();
+	}
+
+/**
+Function that creates a cleanup item for aArray and specifies the cleanup 
+function as ResetAndDestroy. When the item is removed from the cleanup stack 
+the function ResetAndDestroy will be called on aArray.
+@param aArray The array to be destroyed.
+*/
+void CleanupResetAndDestroyPushL(RImplInfoPtrArray& aArray)
+	{		
+	TCleanupItem item(ResetAndDestroy, &aArray);
+	CleanupStack::PushL(item);
+	}
+
+void SwitchHeap(TAny* aPtr)
+	{
+	ASSERT_DEBUG(aPtr);
+	User::SwitchHeap(reinterpret_cast<RHeap*>(aPtr));
+	}
+
+void CleanupSwitchHeapPushL(RHeap& aHeap)
+	{
+	TCleanupItem item(SwitchHeap, &aHeap);
+	CleanupStack::PushL(item);
+	}
+
+
+RNestableLock::RNestableLock()
+	: iThreadId(KInvalidThreadId)
+	, iRefCount(0)
+	{
+	LOG_FUNC
+	}
+
+TInt RNestableLock::CreateLocal()
+	{
+	TInt err = iLock.CreateLocal();
+	if(err == KErrNone)
+		{
+		err = iMetaLock.CreateLocal();
+		}
+	if(err != KErrNone)
+		{
+		Close();
+		}
+	return err;
+	}
+
+void RNestableLock::Close()
+	{
+	LOG_FUNC
+	iLock.Close();
+	iMetaLock.Close();
+	iRefCount = 0;
+	iThreadId = TThreadId(KInvalidThreadId);
+	}
+
+void RNestableLock::Wait()
+	{
+	iMetaLock.Wait();
+	TThreadId currentThreadId = RThread().Id();
+	if(iThreadId == TThreadId(KInvalidThreadId) || currentThreadId != iThreadId)
+		{
+		iMetaLock.Signal();
+		iLock.Wait();
+		iMetaLock.Wait();
+		iThreadId = currentThreadId;
+		}
+	++iRefCount;
+	iMetaLock.Signal();
+	}
+
+void RNestableLock::Signal()
+	{
+	iMetaLock.Wait();
+	// Assert if current thread is stored current thread?
+	if(--iRefCount == 0)
+		{
+		iLock.Signal();
+		iThreadId = TThreadId(KInvalidThreadId);
+		}
+	iMetaLock.Signal();
+	}
+
+
+
+
+NONSHARABLE_CLASS(CSpecificThreadCallBackBody)
+	: public CActive
+	{
+public:
+	static CSpecificThreadCallBackBody* NewL(const TCallBack& aCallBack, TInt aPriority);
+	~CSpecificThreadCallBackBody();
+	
+	TInt Start();
+	TInt CallBack();
+	void HandleCancel();
+	
+private:
+	CSpecificThreadCallBackBody(const TCallBack& aCallBack, TInt aPriority);
+	void ConstructL();
+	
+	TInt AsyncMessage(TInt aParam);
+	
+private: // from CActive
+	void RunL();
+	void DoCancel();
+	
+private:
+	TCallBack		iCallBack;
+	
+	RThread			iLocalThread;
+	
+	RMsgQueue<TInt>	iInbound;
+	RMsgQueue<TInt>	iOutbound;
+	};
+
+
+RSpecificThreadCallBack::RSpecificThreadCallBack()
+	: iBody(NULL)
+	{
+	LOG_FUNC
+	}
+
+TInt RSpecificThreadCallBack::Create(const TCallBack& aCallBack, TInt aPriority)
+	{
+	TRAPD(err, iBody = CSpecificThreadCallBackBody::NewL(aCallBack, aPriority));
+	return err;
+	}
+
+void RSpecificThreadCallBack::Close()
+	{
+	LOG_FUNC
+	delete iBody;
+	iBody = NULL;
+	}
+
+TInt RSpecificThreadCallBack::Start()
+	{
+	ASSERT_DEBUG(iBody);
+	return iBody->Start();
+	}
+
+TInt RSpecificThreadCallBack::CallBack()
+	{
+	ASSERT_DEBUG(iBody);
+	return iBody->CallBack();
+	}
+
+void RSpecificThreadCallBack::Cancel()
+	{
+	ASSERT_DEBUG(iBody);
+	return iBody->HandleCancel();
+	}
+
+
+
+
+
+
+
+
+CSpecificThreadCallBackBody* CSpecificThreadCallBackBody::NewL(const TCallBack& aCallBack, TInt aPriority)
+	{
+	LOG_STATIC_FUNC
+	CSpecificThreadCallBackBody* self = new(ELeave) CSpecificThreadCallBackBody(aCallBack, aPriority);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CSpecificThreadCallBackBody::CSpecificThreadCallBackBody(const TCallBack& aCallBack, TInt aPriority)
+	: CActive(aPriority)
+	, iCallBack(aCallBack)
+	{
+	LOG_FUNC
+	}
+
+void CSpecificThreadCallBackBody::ConstructL()
+	{
+	User::LeaveIfError(iInbound.CreateLocal(1));
+	User::LeaveIfError(iOutbound.CreateLocal(1));
+	}
+
+CSpecificThreadCallBackBody::~CSpecificThreadCallBackBody()
+	{
+	LOG_FUNC
+	HandleCancel();
+	iInbound.Close();
+	iOutbound.Close();
+	iLocalThread.Close();
+	}
+
+TInt CSpecificThreadCallBackBody::Start()
+	{
+	TInt err = KErrNone;
+	if(!IsAdded())
+		{
+		err = iLocalThread.Duplicate(RThread());
+		if(err == KErrNone)
+			{
+			CActiveScheduler::Add(this);
+			iInbound.NotifyDataAvailable(iStatus);
+			SetActive();
+			}
+		}
+	return err;
+	}
+
+TInt CSpecificThreadCallBackBody::CallBack()
+	{
+	TInt err = KErrUnknown;
+	if(iLocalThread.Id() == RThread().Id())
+		{
+		// Simple synchronous case.
+		err = iCallBack.CallBack();
+		}
+	else
+		{
+		RThread thisThread;
+		err = thisThread.Duplicate(RThread());
+		if(err == KErrNone)
+			{
+			err = AsyncMessage(thisThread.Handle());
+			}
+		}
+	return err;
+	}
+	
+TInt CSpecificThreadCallBackBody::AsyncMessage(TInt aParam)
+	{
+	TInt err = KErrNone;
+	TRequestStatus logonStatus;
+	iLocalThread.Logon(logonStatus);
+	if(logonStatus == KErrNoMemory)
+		{
+		// This seems kludgy, but I think it is the most reliable way.
+		User::WaitForRequest(logonStatus); // Ensure the all requests are correct...
+		err = KErrNoMemory;
+		}
+	else
+		{
+		iInbound.SendBlocking(aParam);
+		TRequestStatus status;
+		iOutbound.NotifyDataAvailable(status);
+		User::WaitForRequest(status, logonStatus);
+		if(status == KRequestPending)
+			{
+			// Remote thread is dead
+			iOutbound.CancelDataAvailable();
+			User::WaitForRequest(status);
+			err = KErrDied;
+			}
+		else
+			{
+			// Success (the thread may have subsequently died, but we are only concerned with this call).
+			iLocalThread.LogonCancel(logonStatus);
+			User::WaitForRequest(logonStatus);
+			err = status.Int();
+			if(err == KErrNone)
+				{
+				iOutbound.ReceiveBlocking(err);
+				}
+			}
+		}
+	return err;
+	}
+
+
+void CSpecificThreadCallBackBody::RunL()
+	{
+	TInt threadHandle;
+	iInbound.ReceiveBlocking(threadHandle);
+	if(threadHandle == 0)
+		{
+		// 0 is a cancel message
+		// therefore don't do anything
+		iOutbound.SendBlocking(KErrNone);
+		}
+	else
+		{
+		RThread remoteThread;
+		remoteThread.SetHandleNC(threadHandle);
+		
+		TInt result = iCallBack.CallBack();
+		
+		// There doesn't seem to be a safe way of handling when the other thread
+		// dies......
+		iOutbound.SendBlocking(result);
+		
+		remoteThread.Close();
+		
+		iInbound.NotifyDataAvailable(iStatus);
+		SetActive();
+		}
+	}
+
+void CSpecificThreadCallBackBody::DoCancel()
+	{
+	if(RThread().Id() == iLocalThread.Id())
+		{
+		iInbound.CancelDataAvailable();
+		}
+	else
+		{
+		// other thread cancelling - so just complete the
+		// request
+		TRequestStatus* status = &iStatus;
+		User::RequestComplete(status, KErrCancel);
+		}
+	}
+
+void CSpecificThreadCallBackBody::HandleCancel()
+	{
+	if(IsAdded())
+		{
+		if(RThread().Id() == iLocalThread.Id())
+			{
+			Cancel(); // synchronous cancel is fine in same thread...
+			}
+		else
+			{
+			// In a different thread - this is more interesting...
+			TInt err = AsyncMessage(0); // 0 is special as it means cancel.
+			if(err == KErrDied && IsActive())
+				{
+				// Remote thread has already died so we need to tidy up the
+				// active object ourselves.
+				Cancel();
+				}
+			}
+		}
+	// else shouldn't be active...
+	}
+
+
+#ifdef _DEBUG
+_LIT(KCountSizeWriteStreamPanic, "CountStream");
+#endif // _DEBUG
+#define ASSERT_NOT_CALLED __ASSERT_DEBUG(EFalse, User::Panic(KCountSizeWriteStreamPanic, 0));
+
+RCountSizeWriteStream::RCountSizeWriteStream()
+	: RWriteStream()
+	, iSize(0)
+	{
+	Attach(this);
+	}
+
+TInt RCountSizeWriteStream::Size() const
+	{
+	return iSize;
+	}
+
+void RCountSizeWriteStream::Reset()
+	{
+	iSize = 0;
+	}
+
+void RCountSizeWriteStream::DoRelease()
+	{
+	// No resources to free - Nothing to do
+	}
+
+void RCountSizeWriteStream::DoSynchL()
+	{
+	// No buffering - Nothing to do
+	}
+
+TInt RCountSizeWriteStream::DoReadL(TAny* /*aPtr*/,TInt /*aMaxLength*/)
+	{
+	LOG_FUNC
+	ASSERT_NOT_CALLED;
+	User::Leave(KErrNotSupported);
+	return 0;
+	}
+
+TInt RCountSizeWriteStream::DoReadL(TDes8& /*aDes*/,TInt /*aMaxLength*/,TRequestStatus& /*aStatus*/)
+	{
+	LOG_FUNC
+	ASSERT_NOT_CALLED;
+	User::Leave(KErrNotSupported);
+	return 0;
+	}
+
+TStreamTransfer RCountSizeWriteStream::DoReadL(MStreamInput& /*anInput*/,TStreamTransfer /*aTransfer*/)
+	{
+	LOG_FUNC
+	ASSERT_NOT_CALLED;
+	User::Leave(KErrNotSupported);
+	return 0;
+	}
+
+void RCountSizeWriteStream::DoWriteL(const TAny* /*aPtr*/,TInt aLength)
+	{
+	iSize += aLength;
+	}
+
+TInt RCountSizeWriteStream::DoWriteL(const TDesC8& /*aDes*/,TInt aMaxLength,TRequestStatus& aStatus)
+	{
+	iSize += aMaxLength;
+	TRequestStatus* stat = &aStatus;
+	User::RequestComplete(stat, KErrNone);
+	return aMaxLength;
+	}
+
+TStreamTransfer RCountSizeWriteStream::DoWriteL(MStreamOutput& /*anOutput*/,TStreamTransfer /*aTransfer*/)
+	{
+	ASSERT_NOT_CALLED;
+	User::Leave(KErrNotSupported);
+	return 0;
+	}
+
+TStreamPos RCountSizeWriteStream::DoSeekL(TMark /*aMark*/,TStreamLocation /*aLocation*/,TInt /*anOffset*/)
+	{
+	ASSERT_NOT_CALLED;
+	User::Leave(KErrNotSupported);
+	return 0;
+	}
+
+#undef ASSERT_NOT_CALLED
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/common/utils.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,165 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Utilities for Rem Con server.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCONUTILS_H
+#define REMCONUTILS_H
+
+#include <e32base.h>
+#include <ecom/ecom.h>
+#include <s32strm.h>
+#include <s32buf.h>
+
+// In debug, using checking forms of CleanupStack::Pop. In release builds, 
+// use the non-checking form to save a little bit of ROM.
+#ifdef _DEBUG
+#define CLEANUPSTACK_POP1(a)		CleanupStack::Pop(a);
+#define CLEANUPSTACK_POP2(a, b) 	CleanupStack::Pop(a, b);
+#else
+#define CLEANUPSTACK_POP1(a)		CleanupStack::Pop();
+#define CLEANUPSTACK_POP2(a, b) 	CleanupStack::Pop(2);
+#endif // _DEBUG
+
+// Used for cleanup stack-based cleanup of RImplInfoPtrArrays.
+void CleanupResetAndDestroyPushL(RImplInfoPtrArray& aArray);
+// Used for cleanup stack-based cleanup of temporary heaps.
+void CleanupSwitchHeapPushL(RHeap& aHeap);
+
+
+template <class T>
+class CleanupDeleteAndNull
+	{
+public:
+	inline static void PushL(T*& aRef) {CleanupStack::PushL(TCleanupItem(&DeleteAndNull,&aRef));};
+private:
+	static void DeleteAndNull(TAny *aPtr) {T*& ptr = *static_cast<T**>(aPtr); delete ptr; ptr = NULL;};
+	};
+template <class T>
+inline void CleanupDeleteAndNullPushL(T*& aRef)
+	{CleanupDeleteAndNull<T>::PushL(aRef);}
+
+template <class T>
+class CleanupReset
+	{
+public:
+	inline static void PushL(T& aRef) {CleanupStack::PushL(TCleanupItem(&Reset,&aRef));};
+private:
+	static void Reset(TAny *aPtr) {(static_cast<T*>(aPtr))->Reset();};
+	};
+template <class T>
+inline void CleanupResetPushL(T& aRef)
+	{CleanupReset<T>::PushL(aRef);}
+
+template <class T>
+class CleanupSignal
+	{
+public:
+	inline static void PushL(T& aRef) {CleanupStack::PushL(TCleanupItem(&Signal,&aRef));};
+private:
+	static void Signal(TAny *aPtr) {(static_cast<T*>(aPtr))->Signal();};
+	};
+template <class T>
+inline void CleanupSignalPushL(T& aRef)
+	{CleanupSignal<T>::PushL(aRef);}
+
+template <class T>
+class CleanupNull
+	{
+public:
+	inline static void PushL(T*& aRef) {CleanupStack::PushL(TCleanupItem(&Null,&aRef));};
+private:
+	static void Null(TAny *aPtr) {T*& ptr = *static_cast<T**>(aPtr); ptr = NULL;};
+	};
+template <class T>
+inline void CleanupNullPushL(T*& aRef)
+	{CleanupNull<T>::PushL(aRef);}
+
+
+
+/**
+A wrapper class around an RFastLock that enables locks to be nested.
+*/
+NONSHARABLE_CLASS(RNestableLock)
+	{
+public:
+	RNestableLock();
+	TInt CreateLocal();
+	void Close();
+	
+	void Wait();
+	void Signal();
+	
+private:
+	static const TUint32 KInvalidThreadId = ~0u;
+	
+private:
+	RFastLock	iLock;
+	RFastLock	iMetaLock;
+	TThreadId	iThreadId;
+	TInt		iRefCount;
+	};
+
+
+class CSpecificThreadCallBackBody;
+
+NONSHARABLE_CLASS(RSpecificThreadCallBack)
+	{
+public:
+	RSpecificThreadCallBack();
+	
+	TInt Create(const TCallBack& aCallBack, TInt aPriority);
+	void Close();
+	
+	TInt Start();
+	TInt CallBack();
+	void Cancel();
+	
+private:
+	CSpecificThreadCallBackBody*	iBody;
+	};
+
+
+NONSHARABLE_CLASS(RCountSizeWriteStream)
+	: public RWriteStream
+	, public MStreamBuf
+	{
+public:
+	using RWriteStream::Close;
+	RCountSizeWriteStream();
+	TInt Size() const;
+	void Reset();
+
+private: // MStreamBuf
+	void DoRelease();
+	void DoSynchL();
+	TInt DoReadL(TAny* aPtr,TInt aMaxLength);
+	TInt DoReadL(TDes8& aDes,TInt aMaxLength,TRequestStatus& aStatus);
+	TStreamTransfer DoReadL(MStreamInput& anInput,TStreamTransfer aTransfer);
+	void DoWriteL(const TAny* aPtr,TInt aLength);
+	TInt DoWriteL(const TDesC8& aDes,TInt aMaxLength,TRequestStatus& aStatus);
+	TStreamTransfer DoWriteL(MStreamOutput& anOutput,TStreamTransfer aTransfer);
+	TStreamPos DoSeekL(TMark aMark,TStreamLocation aLocation,TInt anOffset);
+	
+private:
+	TInt iSize;
+	};
+
+#endif // REMCONUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/converterplugin/bwins/remconconverterpluginU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+	??0CRemConConverterPlugin@@IAE@XZ @ 1 NONAME ; CRemConConverterPlugin::CRemConConverterPlugin(void)
+	??1CRemConConverterPlugin@@UAE@XZ @ 2 NONAME ; CRemConConverterPlugin::~CRemConConverterPlugin(void)
+	?NewL@CRemConConverterPlugin@@SAPAV1@VTUid@@@Z @ 3 NONAME ; class CRemConConverterPlugin * CRemConConverterPlugin::NewL(class TUid)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/converterplugin/eabi/remconconverterpluginU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,9 @@
+EXPORTS
+	_ZN22CRemConConverterPlugin4NewLE4TUid @ 1 NONAME
+	_ZN22CRemConConverterPluginC2Ev @ 2 NONAME
+	_ZN22CRemConConverterPluginD0Ev @ 3 NONAME
+	_ZN22CRemConConverterPluginD1Ev @ 4 NONAME
+	_ZN22CRemConConverterPluginD2Ev @ 5 NONAME
+	_ZTI22CRemConConverterPlugin @ 6 NONAME ; #<TI>#
+	_ZTV22CRemConConverterPlugin @ 7 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/converterplugin/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,26 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconconverterplugin.mmp
+
+PRJ_EXPORTS
+../public/remconconverterplugin.h		SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconconverterplugin.h)
+../public/remconconverterinterface.h	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconconverterinterface.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/converterplugin/group/remconconverterplugin.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,46 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconconverterplugin.dll Base DLL for converter plugins to 
+// RemCon.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconservercaps.mmh>
+
+TARGET			remconconverterplugin.dll
+TARGETPATH		/system/libs
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			remconconverterplugin.cpp
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		ecom.lib
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/converterplugin/public/remconconverterinterface.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,89 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef REMCONCONVERTERINTERFACE_H
+#define REMCONCONVERTERINTERFACE_H
+
+#include <e32base.h>
+#include <remcon/messagetype.h>
+
+/** 
+The UID of the converter API. If the converter API ever has to change, a new 
+UID and associated M class will be created. New implementations of 
+CRemConConverterPlugin may implement the new API. Old (non-updated) converters 
+will still work as long as RemCon supports the old API.
+*/
+const TInt KRemConConverterInterface1 = 0x1020D40A;
+
+/**
+Mixin for the converter API.
+*/
+class MRemConConverterInterface
+	{
+public:
+	/** 
+	Called by the server to get the converter to convert from the interface 
+	(API) format to the bearer-specific format.
+	@param aInterfaceUid The interface UID.
+	@param aOperationId Operation ID.
+	@param aData Data associated with the operation.
+	@param aMsgType The type of the message.
+	@param aBearerData Converted output.
+	*/
+	virtual TInt InterfaceToBearer(TUid aInterfaceUid, 
+		TUint aOperationId,
+		const TDesC8& aData,
+		TRemConMessageType aMsgType, 
+		TDes8& aBearerData) const = 0;
+	
+	/** 
+	Called by the server to get the converter to convert from the bearer-
+	specific format to the interface (API) format.
+	@param aBearerData Bearer input.
+	@param aInterfaceUid The interface UID.
+	@param aOperationId Operation ID.
+	@param aMsgType The type of the message.
+	@param aData Data associated with the operation.
+	*/
+	virtual TInt BearerToInterface(const TDesC8& aBearerData,
+		TUid& aInterfaceUid, 
+		TUint& aOperationId,
+		TRemConMessageType& aMsgType, 
+		TDes8& aData) const = 0;
+
+	/**
+	Called by the server to find out if this converter converts between the formats 
+	of this interface and bearer.
+	@param aInterfaceUid The interface UID.
+	@param aBearerUid The bearer UID.
+	*/
+	virtual TBool SupportedUids(const TUid& aInterfaceUid, const TUid& aBearerUid) const = 0;
+	
+	/**
+	Called by the server to find out if this converter converts between the formats 
+	of this bearer interface and RemCon interface.
+	@param aInterfaceData The identifier of this interface in a bearer defined format.
+	@param aBearerUid The bearer UID.
+	*/
+	virtual TBool SupportedInterface(const TDesC8& aInterfaceData, const TUid& aBearerUid) const = 0;
+	};
+
+#endif // REMCONCONVERTERINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/converterplugin/public/remconconverterplugin.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,81 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef REMCONCONVERTERPLUGIN_H
+#define REMCONCONVERTERPLUGIN_H
+
+#include <e32base.h>
+#include <remcon/messagetype.h>
+
+/** 
+The UID of the RemCon converter interface. Implementors of new converters are 
+implementing this interface. The converter interface is simply a means of 
+supplying implementations of the 'converter API' to RemCon. The converter API 
+may change over time, so this extension pattern is used.
+*/
+const TInt KRemConConverterInterfaceUid = 0x10205C43;
+
+/**
+Base class for RemCon converter plugins.
+*/
+class CRemConConverterPlugin : public CBase
+	{
+public:
+	/** 
+	Constructor.
+	@param aImplementationUid The implemention UID.
+	@return Ownership of a new converter plugin.
+	*/
+	IMPORT_C static CRemConConverterPlugin* NewL(TUid aImplementationId);
+
+	/** Destructor. */
+	IMPORT_C ~CRemConConverterPlugin();
+
+public:
+	/**
+	Called by RemCon server to get a pointer to an object which implements the 
+	converter API with UID aUid. This is a mechanism for allowing future 
+	change to the converter API without breaking BC in existing (non-updated) 
+	converter plugins.
+	*/
+	virtual TAny* GetInterface(TUid aUid) = 0;
+
+protected:
+	/** Constructor
+	@param aObserver To be notified of the completion of requests.
+	@param aImplementationId Identifier of the concrete implementation.
+	*/
+	IMPORT_C CRemConConverterPlugin();
+	
+private: // owned
+	/**
+	UID set by ECOM when the instance is created. Used when the instance is 
+	destroyed.
+	*/
+	TUid iInstanceId;
+
+	/** 
+	Pad for BC-friendly future change.
+	*/
+	TAny* iPad;
+	};
+
+#endif // REMCONCONVERTERPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/converterplugin/src/remconconverterplugin.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,49 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Implementation of Rem Con bearer plugin.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconconverterplugin.h>
+#include <ecom/ecom.h>
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+EXPORT_C CRemConConverterPlugin::~CRemConConverterPlugin()
+	{
+	LOG_FUNC
+	REComSession::DestroyedImplementation(iInstanceId);
+	}
+
+EXPORT_C CRemConConverterPlugin::CRemConConverterPlugin()
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C CRemConConverterPlugin* CRemConConverterPlugin::NewL(TUid aImplementationId)
+	{
+	return reinterpret_cast<CRemConConverterPlugin*>(
+		REComSession::CreateImplementationL(
+			aImplementationId, 
+			_FOFF(CRemConConverterPlugin, iInstanceId))
+		);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,31 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "../types/group/bld.inf"
+#include "../client/bld.inf"
+#include "../converterplugin/group/bld.inf"
+#include "../bearerplugin/group/bld.inf"
+#include "../targetselectorplugin/group/bld.inf"
+#include "../server/group/bld.inf"
+#include "../test/bld.inf"
+#include "../reference/bld.inf"
+
+PRJ_EXPORTS
+remotecontrol.iby	/epoc32/rom/include/remotecontrol.iby
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/group/bluetooth_remotecontrol.history.xml	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<relnotes name="Remote Control Framework">
+  <purpose>
+    Bearer agnostic remote control framework. Provides APIs to allow apps to send and receive remote control commands using bearers provided as plugins to the franework.
+  </purpose>
+
+  <defect number="PDEF139836" title=".esk and .cmi files do not have header" revision="024">
+    Added copyright headers
+  </defect>
+  
+  <defect number="DEF140166" title="Remote Control Framework includes middle-ware headers" revision="023">
+    Removed incorrect includes.
+  </defect>
+
+  <defect number="DEF137114" title="In multi-players situation, RemconServer paniced with pass through commands" revision="022">
+    Added some constructor logging.
+  </defect>
+
+  <defect number="DEF130411" title="RemCon target supported interfaces list includes controller interfaces " revision="021">
+    Prevent interface being added to supported interface list when not supported. 
+  </defect>  
+
+  <defect number="DEF130010" title="Add logging-panic facility to btlogger" revision="020">
+    Fix included undefining ASSERT; reworked code using ASSERT. 
+  </defect>  
+
+  <defect number="INC129276" title="Missing enum value in TRemConCoreApiOperationId" revision="019">
+    Added ENop and ELargestOperationId in TRemConCoreApiOperationId.
+  </defect>
+
+  <defect number="DEF126570" title="SMP: Migrate remcon and avrcp to Bluetooth logger" revision="018">
+    Change all logging over to Bluetooth logger.
+  </defect>
+
+  <defect number="PDEF127746" title="Minimise header dependancy for remconclient.h " revision="017">
+    Introduce a new .h file holding TOperationInformation class
+  </defect>
+
+  <defect number="DEF127395" title="Some simple syntax errors in OE code" revision="016">
+    Remove scoping from declarations of 'SendNextCb' and 'DoSendNext' in the class 'CRemConSession'
+  </defect>
+
+  <defect number="DEF125504" title="Checking process ID in CRemConServer::ClientClosed isn't sufficient" revision="015">
+    Check that session type is target before calling CMessageRecipients::RemoveAndDestroyClient
+  </defect>
+
+  <defect number="INC124056" title="IOP qualification of AVRCP 1.3 fails with the PTS." revision="014">
+    Added NULL check in CRemConServer::ReceiveRequest -- message could have been completed before. Other issue solved by fix for DEF121649.
+  </defect>
+
+  <defect number="DEF124330" title="CRemConServer::MrctspoDoOutgoingCommandAddressed has unused variable" revision="013">
+    Remove unused variable.
+  </defect>
+
+  <defect number="DEF119933" title="RemCon's logger's LEAVEIFERRORL sometimes leaves if not error" revision="012">
+	Changes are made to handle error values appropriately
+  </defect>
+
+  <defect number="PDEF116232" title="Phone crashes when disconnecting the SA505 bluetooth headset" revision="011">
+    Updated RemCon to queue commands when in connecting or disconnecting states.
+  </defect>
+  
+  <defect number="PDEF116190" title="Redundant compile-time assert definition" revision ="010">
+    replaced redundant macro COMPILE_ASSERT with __ASSERT_COMPILE from e32def.h .
+  </defect>
+  
+  <defect number="PDEF116073" title="Remote control documentation does not say clients need to send" revision ="009">
+    Updated RemCon documentation to state that response be sent by cleint for every command .
+  </defect>
+  
+  <defect number="DEF114230" title="RemCon documentation doesn't state that only one message can be sent at a time" revision ="008">
+    Updated RemCon documentation to state that only one message can be sent at a time .
+  </defect>
+
+  <defect number="DEF113514" title="Remcon bearer interface doxygen problems" revision="007">
+    Fixed Doxygen problems.
+  </defect>
+
+  <defect number="PDEF111635" title="Multiple completion of remcon NotifyConnectionChange" revision="006">
+    Added a code in CRemConSession::ConnectionsChanged to set the pointer to latest item in connection history before completing the client's message. 
+  </defect>
+
+  <defect number="PDEF111148" title="Incorrect ASSERT_DEBUG in remcon server" revision="005">
+    Corrected the ASSERT_DEBUG statement in CRemConServer::ConnectionState. 
+  </defect>
+
+  <defect number="DEF109705" title="Remcon drops responses when commands are received in quick succession" revision="004">
+    Appended the msg in the RemConServer::SendReceive from IncomingPendingDelivery to the IncomingDelivered queue so that it isn't dropped. 
+  </defect>
+  
+    <defect number="DEF110314" title="IMPORT_C/EXPORT_C: CRemConInterfaceSelector::RegisterInterfaceL" revision="003">
+    Added IMPORT_C in the declaration. Added comment to explain that the function should not be called outside of remconinterfacebase.dll.
+  </defect>
+
+  <defect number="DEF102064" title="Missing TRemConTrackInfoOperationId in the MrcibNewMessage for target and contr" revision="002">
+    Added functionality to allow back to back testing of the Track Info API within Symbian (between two Symbian stacks). By default this is not compiled.
+  </defect>
+
+  <defect number="DEF062333" title="RemCon server needs to understand connecting and disconnecting states" revision="001">
+    Making RemCon server understand connecting and disconnecting states
+  </defect>
+</relnotes>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/group/bluetooth_remotecontrol.mrp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,37 @@
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+component	bluetooth_remotecontrol
+source		\sf\os\bt\remotecontrol\remotecontrolfw\bearerplugin
+source		\sf\os\bt\remotecontrol\remotecontrolfw\client
+source		\sf\os\bt\remotecontrol\remotecontrolfw\common
+source		\sf\os\bt\remotecontrol\remotecontrolfw\converterplugin
+source		\sf\os\bt\remotecontrol\remotecontrolfw\group
+source		\sf\os\bt\remotecontrol\remotecontrolfw\reference
+source		\sf\os\bt\remotecontrol\remotecontrolfw\server
+source		\sf\os\bt\remotecontrol\remotecontrolfw\targetselectorplugin
+source		\sf\os\bt\remotecontrol\remotecontrolfw\test
+source		\sf\os\bt\remotecontrol\remotecontrolfw\types
+
+binary		\sf\os\bt\remotecontrol\remotecontrolfw\group	all
+exports		\sf\os\bt\remotecontrol\remotecontrolfw\group
+
+notes_source	\component_defs\release.src
+
+
+ipr E 
+ipr T \sf\os\bt\remotecontrol\remotecontrolfw\reference
+ipr T \sf\os\bt\remotecontrol\remotecontrolfw\test
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/group/remotecontrol.iby	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,71 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ROM include file for Remote Control system.
+// 
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef __REMCON_IBY__
+#define __REMCON_IBY__
+
+REM *** The following iby files are always included, whether bluetooth is
+REM *** supported by the device or not.
+
+#include <ecom.iby>
+
+// If __BT_DEBUG__ is defined pull in debug versions of the
+// RemCon DLLs regardless of the ROM type
+#ifdef __BT_DEBUG__
+define BT_DIR UDEB
+#else
+define BT_DIR BUILD_DIR
+#endif
+
+REM *** The following dlls are client side dlls. They are always included
+REM *** in the ROM, whether bluetooth is supported by the device or not, so
+REM *** that client applications can link against them regardless.
+
+// Client side
+file=ABI_DIR\BT_DIR\remconcoreapi.dll					System\Libs\remconcoreapi.dll
+file=ABI_DIR\BT_DIR\remconinterfacebase.dll				System\Libs\remconinterfacebase.dll
+file=ABI_DIR\BT_DIR\remconclient.dll 					System\Libs\remconclient.dll
+
+// An extension API (outer client side) supporting track name and absolute 
+// volume APIs.
+file=ABI_DIR\BT_DIR\remconextapi1.dll					System\Libs\remconextapi1.dll
+
+// DLL containing types used by more than one server-side subcomponent.
+file=ABI_DIR\BT_DIR\remcontypes.dll						System\Libs\remcontypes.dll
+
+// Server
+file=ABI_DIR\BT_DIR\remconserver.exe 					System\Programs\remconserver.exe
+
+// Base DLL for bearer plugins
+file=ABI_DIR\BT_DIR\remconbearerplugin.dll				System\Libs\remconbearerplugin.dll
+
+// Base DLL for target selector plugins
+file=ABI_DIR\BT_DIR\remcontargetselectorplugin.dll		System\Libs\remcontargetselectorplugin.dll
+
+// Base DLL for converter plugins
+file=ABI_DIR\BT_DIR\remconconverterplugin.dll			System\Libs\remconconverterplugin.dll
+
+// The concrete Target Selector Plugin.
+#include <tsp.iby>
+
+#endif // __REMCON_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// bld.inf for Rem Con test components.
+// NB The refTSP is a separate CBR component and may be built from the 
+// '/refTSP/group/' directory bld.inf. 
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "converters/bld.inf"
+#include "serialbearer/group/bld.inf"
+
+PRJ_EXPORTS
+tsp.iby			/epoc32/rom/include/tsp.iby
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/converters/Core_Serial/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,25 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_TESTEXPORTS
+coreserialconverter.iby 		/epoc32/rom/include/coreserialconverter.iby
+
+PRJ_TESTMMPFILES
+coreserialconverter.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/converters/Core_Serial/group/coreserialconverter.iby	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef __CORESERIALCONVERTER_IBY__
+#define __CORESERIALCONVERTER_IBY__
+
+#include <ecom.iby>
+
+ECOM_PLUGIN(coreserialconverter.dll, 101F906E.rsc)
+
+#endif // __CORESERIALCONVERTER_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/converters/Core_Serial/group/coreserialconverter.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,55 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// coreserialconverter.dll Converter between RemCon Core API and 
+// serial bearer.
+// coreserialconverter.rsc Resource file for Core/Serial converter.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconservercaps.mmh>
+
+TARGET			coreserialconverter.dll
+TARGETPATH		/system/libs
+TARGETTYPE		PLUGIN
+// UID2 = 0x10009d8d for ECOM plugins.
+// UID3 = the 'DLL UID' (see resource file)
+UID 			0x10009d8d 0x101F906E
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			coreserialconverter.cpp
+SOURCE			coreserialconvertermain.cpp
+
+START RESOURCE 101F906E.rss
+target coreserialconverter.rsc
+END
+
+USERINCLUDE 	../inc
+USERINCLUDE	../../../serialbearer/inc/
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib 
+LIBRARY 		remconconverterplugin.lib 
+
+NOEXPORTLIBRARY
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/converters/Core_Serial/inc/coreserialconverter.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,64 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CORESERIALCONVERTER_H
+#define CORESERIALCONVERTER_H
+
+#include <e32base.h>
+#include <remcon/remconconverterplugin.h>
+#include <remcon/remconconverterinterface.h>
+
+/**
+Converter for the Core API and the serial bearer.
+*/
+NONSHARABLE_CLASS(CCoreSerialConverter) : public CRemConConverterPlugin, 
+										public MRemConConverterInterface
+	{
+public:
+	static CCoreSerialConverter* NewL();
+	~CCoreSerialConverter();
+
+private: // from CRemConConverterPlugin
+	TAny* GetInterface(TUid aUid);
+
+private: // from MRemConConverterInterface
+	TInt InterfaceToBearer(TUid aInterfaceUid, 
+		TUint aOperationId,
+		const TDesC8& aData,
+		TRemConMessageType aMsgType, 
+		TDes8& aBearerData) const;
+	
+	TInt BearerToInterface(const TDesC8& aBearerData,
+		TUid& aInterfaceUid, 
+		TUint& aOperationId,
+		TRemConMessageType& aMsgType, 
+		TDes8& aData) const;
+
+	TBool SupportedUids(const TUid& aInterfaceUid, const TUid& aBearerUid) const;
+	TBool SupportedInterface(const TDesC8& aInterfaceData, const TUid& aBearerUid) const;
+
+private:
+	CCoreSerialConverter();
+
+private: // owned
+	static const TUint KRemConSerialBearerMessageLength = 30;
+	};
+
+#endif // CORESERIALCONVERTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/converters/Core_Serial/src/101F906E.rss	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,44 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x101F906E;
+	interfaces =
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x10205C43;
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x101F906D;
+					version_no = 1;
+					display_name = "CoreSerialConv";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/converters/Core_Serial/src/coreserialconverter.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,176 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconcoreapi.h>
+#include "remconserialbeareruid.h"
+#include "coreserialconverter.h"
+
+_LIT8(KCmdText, "Cmd");
+_LIT8(KRspText, "Rsp");
+
+/**
+Factory function.
+@return Ownership of a new CRemConSerialBearer.
+*/
+CCoreSerialConverter* CCoreSerialConverter::NewL()
+	{
+	CCoreSerialConverter* self = new(ELeave) CCoreSerialConverter;
+	return self;
+	}
+
+/**
+Destructor.
+*/
+CCoreSerialConverter::~CCoreSerialConverter()
+	{
+	}
+
+/**
+Constructor.
+*/
+CCoreSerialConverter::CCoreSerialConverter()
+	{
+	}
+
+TAny* CCoreSerialConverter::GetInterface(TUid aUid)
+	{
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConConverterInterface1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConConverterInterface*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+TBool CCoreSerialConverter::SupportedUids(const TUid& aInterfaceUid, const TUid& aBearerUid) const
+	{
+	return (aInterfaceUid == TUid::Uid(KRemConCoreApiUid) &&
+	   aBearerUid == TUid::Uid(KRemConSerialBearerUid));
+	}
+
+TBool CCoreSerialConverter::SupportedInterface(const TDesC8& /*aInterfaceData*/, const TUid& aBearerUid) const
+	{
+	// aInterfaceData is not used by the serial bearer.
+	return aBearerUid == TUid::Uid(KRemConSerialBearerUid);
+	}
+
+/**
+Convert data from the API's form (as we're given it by RemCon) the
+bearer-specific form.
+*/
+TInt CCoreSerialConverter::InterfaceToBearer(TUid aInterfaceUid,
+		TUint aOperationId,
+		const TDesC8& aData,
+		TRemConMessageType aMsgType,
+		TDes8& aBearerData) const
+	{
+	TInt ret = KErrCorrupt;
+
+	if ( aData.Length() <= 10 )
+		{
+		if ( aMsgType == ERemConCommand )
+			{
+			aBearerData.Format(_L8("0x%08x 0x%02x %S %S"), aInterfaceUid, aOperationId, &KCmdText(), &aData);
+			// Pad it up in case aData was less than 4 characters.
+			while ( aBearerData.Length() < KRemConSerialBearerMessageLength )
+				{
+				aBearerData.Append(_L8(" "));
+				}
+			ret = KErrNone;
+			}
+		else if ( aMsgType == ERemConResponse )
+			{
+			aBearerData.Format(_L8("0x%08x 0x%02x %S %S"), aInterfaceUid, aOperationId, &KRspText(), &aData);
+			// Pad it up in case aData was less than 4 characters.
+			while ( aBearerData.Length() < KRemConSerialBearerMessageLength )
+				{
+				aBearerData.Append(_L8(" "));
+				}
+			ret = KErrNone;
+			}
+		}
+
+	return ret;
+	}
+
+
+TInt CCoreSerialConverter::BearerToInterface(const TDesC8& aBearerData,
+		TUid& aInterfaceUid,
+		TUint& aOperationId,
+		TRemConMessageType& aMsgType,
+		TDes8& aData) const
+	{
+	TInt ret = KErrCorrupt;
+
+	// We read KRemConSerialBearerMessageLength bytes at a time, so we should
+	// get precisely one message.
+	if ( aBearerData.Length() == KRemConSerialBearerMessageLength )
+		{
+		TPtrC8 ptr;
+		ptr.Set(aBearerData);
+
+		TPtrC8 interfaceUid;
+		interfaceUid.Set(ptr.Mid(2, 8));
+		TLex8 interfaceLex(interfaceUid);
+		TUint uid = 0;
+		ret = interfaceLex.Val(uid, EHex);
+		if ( ret == KErrNone )
+			{
+			aInterfaceUid = TUid::Uid(uid);
+
+			TPtrC8 operationId;
+			operationId.Set(ptr.Mid(13, 2));
+			TLex8 operationLex(operationId);
+			TUint id = 0;
+			ret = operationLex.Val(id, EHex);
+			if ( ret == KErrNone )
+				{
+				aOperationId = id;
+
+				TPtrC8 data;
+				data.Set(ptr.Mid(16, 3));
+				if ( data == KCmdText() )
+					{
+					aMsgType = ERemConCommand;
+					}
+				else if ( data == KRspText() )
+					{
+					aMsgType = ERemConResponse;
+					}
+				else
+					{
+					ret = KErrCorrupt;
+					}
+
+				if ( ret == KErrNone )
+					{
+					TPtrC8 data;
+					data.Set(ptr.Mid(20, 10));
+					aData.Copy(data);
+					}
+				}
+			}
+		}
+
+	return ret;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/converters/Core_Serial/src/coreserialconvertermain.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,34 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <ecom/implementationproxy.h>
+#include "coreserialconverter.h"
+
+const TImplementationProxy ImplementationTable[] =
+	{
+	IMPLEMENTATION_PROXY_ENTRY(0x101F906D, CCoreSerialConverter::NewL),
+	};
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/converters/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "Core_Serial/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,30 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// bld.inf for Rem Con test components.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_TESTEXPORTS
+t_serialbearer.iby					/epoc32/rom/include/t_serialbearer.iby
+#ifdef SYMBIAN_OLD_EXPORT_LOCATION
+../inc/remconserialbeareruid.h	/epoc32/include/remconserialbeareruid.h
+#endif
+
+PRJ_TESTMMPFILES
+t_serialbearer.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/group/t_serialbearer.iby	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,31 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ROM include file for Remote Control system.
+// 
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef __TSERIALBEARER_IBY__
+#define __TSERIALBEARER_IBY__
+
+#include <ecom.iby>
+
+ECOM_PLUGIN(t_serialbearer.dll, 1020453D.rsc)
+
+#endif // __TSERIALBEARER_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/group/t_serialbearer.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,61 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// t_serialbearer.dll Serial bearer plugin for RemCon.
+// t_serialbearer.rsc Resource file for serial bearer plugin.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconservercaps.mmh>
+
+TARGET			t_serialbearer.dll
+TARGETPATH		/system/libs
+TARGETTYPE		PLUGIN
+// UID2 = 0x10009d8d for ECOM plugins.
+// UID3 = the 'DLL UID' (see resource file)
+UID 			0x10009d8d 0x1020453D
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			remconserialbearer.cpp
+SOURCE			sender.cpp
+SOURCE			receiver.cpp
+SOURCE			remconserialbearermain.cpp
+
+START RESOURCE 1020453D.rss
+target t_serialbearer.rsc
+END
+
+
+USERINCLUDE 	../inc
+// For logger
+USERINCLUDE 	../../../common
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib 
+LIBRARY 		c32.lib 
+LIBRARY 		remconbearerplugin.lib 
+LIBRARY 		remcontypes.lib
+//LIBRARY			usbman.lib
+
+NOEXPORTLIBRARY
+
+#include <bluetooth/btlogger.mmh>
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/inc/receiveobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,39 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef RECEIVEOBSERVER_H
+#define RECEIVEOBSERVER_H
+
+#include <e32base.h>
+
+/**
+Observer for receive completions.
+*/
+class MReceiveObserver
+	{
+public:
+	/**
+	Called when a receive has completed.
+	@param aError The completion error of the receive.
+	*/
+	virtual void MroReceiveComplete(TInt aError) = 0;
+	};
+
+#endif // RECEIVEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/inc/receiver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,55 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef RECEIVER_H
+#define RECEIVER_H
+
+#include <e32base.h>
+
+class RComm;
+class MReceiveObserver;
+
+/**
+Active Object for receiving text over an RComm. Notifies completion to a 
+MReceiveObserver.
+*/
+NONSHARABLE_CLASS(CReceiver) : public CActive
+	{
+public:
+	static CReceiver* NewL(RComm& aComm, MReceiveObserver& aObserver);
+	~CReceiver();
+
+public:
+	void Receive(TDes8& aBuf);
+
+private: // from CActive
+	void RunL();
+	void DoCancel();
+
+private:
+	CReceiver(RComm& aComm, MReceiveObserver& aObserver);
+	void ConstructL();
+
+private: // unowned
+	RComm& iComm;
+	MReceiveObserver& iObserver;
+	};
+
+#endif // RECEIVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/inc/remconserialbearer.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,146 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCONSERIALBEARER_H
+#define REMCONSERIALBEARER_H
+
+#include <e32base.h>
+#include <c32comm.h>
+#include <remcon/remconbearerplugin.h>
+#include <remcon/remconbearerinterface.h>
+#include <remcon/messagetype.h>
+/*#ifndef __WINS__
+#include <usbman.h>
+#endif
+*/
+#include "sendobserver.h"
+#include "receiveobserver.h"
+
+class CSender;
+class CReceiver;
+
+/**
+Concrete serial bearer.
+*/
+NONSHARABLE_CLASS(CRemConSerialBearer) : public CRemConBearerPlugin, 
+							public MRemConBearerInterface,
+							public MSendObserver, 
+							public MReceiveObserver
+	{
+public:
+	static CRemConSerialBearer* NewL(TBearerParams& aParams);
+	~CRemConSerialBearer();
+
+private: // from CRemConBearerPlugin
+	TAny* GetInterface(TUid aUid);
+
+private: // from MRemConBearerInterface
+	TInt GetResponse(TUid& aInterfaceUid, 
+		TUint& aTransactionId, 
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr);
+	TInt SendCommand(TUid aInterfaceUid, 
+		TUint aCommand, 
+		TUint aTransactionId,  
+		RBuf8& aData, 
+		const TRemConAddress& aAddr);
+	TInt GetCommand(TUid& aInterfaceUid, 
+		TUint& aTransactionId, 
+		TUint& aCommand, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr);
+	TInt SendResponse(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint aTransactionId, 
+		RBuf8& aData, 
+		const TRemConAddress& aAddr);
+	void ConnectRequest(const TRemConAddress& aAddr);
+	void DisconnectRequest(const TRemConAddress& aAddr);
+	void ClientStatus(TBool aControllerPresent, TBool aTargetPresent);
+	TSecurityPolicy SecurityPolicy() const;
+
+private: // from MSendObserver
+	void MsoSendComplete(TInt aError);
+
+private: // from MReceiveObserver
+	void MroReceiveComplete(TInt aError);
+
+private:
+	CRemConSerialBearer(TBearerParams& aParams);
+	void ConstructL();
+
+private: // utility
+	TInt DoSend(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		RBuf8& aData, 
+		TRemConMessageType aMsgType);
+	void ConnectL();
+	void Receive();
+	void ClosePort();
+	void DoGetResponseL(TUid& aInterfaceUid, 
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr);
+	void DoGetCommandL(TUid& aInterfaceUid,
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr);
+
+private: // owned
+/*#ifndef __WINS__
+	RUsb iUsb;
+#endif
+*/	RCommServ iCommServ;
+	RComm iComm;
+
+	CSender* iSender;
+	CReceiver* iReceiver;
+
+	// The format of a serial bearer message is:
+	// 012345678901234567890123456789
+	// 0xaaaaaaaa 0xbb XXX YYYYYYYYYY
+	// Where 
+	//	aaaaaaaa is the interface UID
+	//	bb is the operation ID
+	//	XXX is Cmd or Rsp
+	//	YYYYYYYYYY is any associated data
+	// The message is always KRemConSerialBearerMessageLength bytes long.
+	static const TUint KRemConSerialBearerMessageLength = 30;
+
+	// The message we may be currently sending.
+	TBuf8<KRemConSerialBearerMessageLength> iOutMsg;
+
+	// The message we may be currently receiving.
+	TBuf8<KRemConSerialBearerMessageLength> iInMsg;
+
+	// Last received and corrected-decoded message.
+	TUid iInterfaceUid;
+	TUint iOperationId;
+	TRemConMessageType iMsgType;
+	TBuf8<10> iData; // This is the length of the associated data in our naive 
+	// protocol.
+
+	// The ID of the current transaction- RemCon gives us this, and expects us 
+	// to remember it.
+	TUint iTransactionId;
+	};
+
+#endif // REMCONSERIALBEARER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/inc/remconserialbeareruid.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,31 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCONSERIALBEARERUID_H
+#define REMCONSERIALBEARERUID_H
+
+#include <e32base.h>
+
+/**
+The implementation UID of the serial bearer plugin.
+*/
+const TInt KRemConSerialBearerUid = 0x1020453C;
+
+#endif // REMCONSERIALBEARERUID_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/inc/sender.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,55 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef SENDER_H
+#define SENDER_H
+
+#include <e32base.h>
+
+class RComm;
+class MSendObserver;
+
+/**
+Active Object for sending text over an RComm. Notifies completion to a 
+MSendObserver.
+*/
+NONSHARABLE_CLASS(CSender) : public CActive
+	{
+public:
+	static CSender* NewL(RComm& aComm, MSendObserver& aObserver);
+	~CSender();
+
+public:
+	void Send(const TDesC8& aBuf);
+
+private: // from CActive
+	void RunL();
+	void DoCancel();
+
+private:
+	CSender(RComm& aComm, MSendObserver& aObserver);
+	void ConstructL();
+
+private: // unowned
+	RComm& iComm;
+	MSendObserver& iObserver;
+	};
+
+#endif // SENDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/inc/sendobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,39 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef SENDOBSERVER_H
+#define SENDOBSERVER_H
+
+#include <e32base.h>
+
+/**
+Observer of send completion events.
+*/
+class MSendObserver
+	{
+public:
+	/**
+	Called when a send has completed.
+	@param aError The completion error of the send.
+	*/
+	virtual void MsoSendComplete(TInt aError) = 0;
+	};
+
+#endif // SENDOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/src/1020453D.rss	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,44 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x1020453D;
+	interfaces =
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x10204546;
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x1020453C;
+					version_no = 1;
+					display_name = "SERIAL";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/src/receiver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,66 @@
+	// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <c32comm.h>
+#include "receiver.h"
+#include "receiveobserver.h"
+#include <bluetooth/logger.h>
+ 
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_REF_SER_BEARER);
+#endif
+ 
+CReceiver* CReceiver::NewL(RComm& aComm, MReceiveObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+	CReceiver* self = new(ELeave) CReceiver(aComm, aObserver);
+	return self;
+	}
+
+CReceiver::~CReceiver()
+	{
+	LOG_FUNC
+	Cancel();
+	}
+
+CReceiver::CReceiver(RComm& aComm, MReceiveObserver& aObserver)
+:	CActive(CActive::EPriorityStandard),
+	iComm(aComm),
+	iObserver(aObserver)
+	{
+	LOG_FUNC
+	CActiveScheduler::Add(this);
+	}
+
+void CReceiver::Receive(TDes8& aBuf)
+	{
+	iComm.Read(iStatus, aBuf);
+	SetActive();
+	}
+
+void CReceiver::RunL()
+	{
+	iObserver.MroReceiveComplete(iStatus.Int());
+	}
+
+void CReceiver::DoCancel()
+	{
+	iComm.ReadCancel();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/src/remconserialbearer.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,549 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <remcon/remconbearerobserver.h>
+#include <remcon/remconconverterplugin.h>
+#include <remconaddress.h>
+#include "remconserialbearer.h"
+#include "sender.h"
+#include "receiver.h"
+#include "utils.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_REF_SER_BEARER);
+#endif
+
+PANICCATEGORY("SerialBear");
+
+/**
+Factory function.
+@return Ownership of a new CRemConSerialBearer.
+*/
+CRemConSerialBearer* CRemConSerialBearer::NewL(TBearerParams& aParams)
+	{
+	LOG_STATIC_FUNC
+	CRemConSerialBearer* self = new(ELeave) CRemConSerialBearer(aParams);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CLEANUPSTACK_POP1(self);
+	return self;
+	}
+
+/**
+Destructor.
+*/
+CRemConSerialBearer::~CRemConSerialBearer()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	delete iSender;
+	delete iReceiver;
+
+	iComm.Close();
+	iCommServ.Close();
+
+/*#ifndef __WINS__
+	if ( iUsb.Handle() )
+		{
+		// Can't do anything with error here.
+		(void)iUsb.Stop();
+		}
+	iUsb.Close();
+#endif
+*/
+	}
+
+/**
+Constructor.
+*/
+CRemConSerialBearer::CRemConSerialBearer(TBearerParams& aParams)
+:	CRemConBearerPlugin(aParams)
+	{
+	LOG_FUNC
+	}
+
+/**
+2nd-phase construction.
+*/
+void CRemConSerialBearer::ConstructL()
+	{
+	// NB The sender and receiver have references to our RComm. We protect our 
+	// down-calls in case the port subsession is not open.
+	iSender = CSender::NewL(iComm, *this);
+	iReceiver = CReceiver::NewL(iComm, *this);
+
+/*#ifndef __WINS__
+	// Connect and Start USB to begin with. 
+	LEAVEIFERRORL(iUsb.Connect());
+	TRequestStatus stat;
+	iUsb.Start(stat);
+	User::WaitForRequest(stat);
+	LEAVEIFERRORL(stat.Int());
+#endif
+*/
+	// We trap and discard errors from this 'connection' attempt. We don't 
+	// want to fail RemCon server initialisation because the port is being 
+	// used by someone else. When RemCon wants to send a command, it will 
+	// expect the bearer to reconnect.
+	// In any case a controller client is allowed to request a 
+	// connection-oriented channel over this bearer- this will result in 
+	// another 'connection' attempt.
+	TRAPD(err, ConnectL());
+	// If we 'connected' OK, throw an indication up to RemCon.
+	if ( err == KErrNone )
+		{
+		TRemConAddress addr;
+		addr.BearerUid() = Uid();
+		err = Observer().ConnectIndicate(addr);
+		if ( err != KErrNone )
+			{
+			// We couldn't successfully tell RemCon about our connection, so 
+			// tear it down.
+			ClosePort();
+			}
+		}
+		
+	if ( iComm.SubSessionHandle() )
+		{
+		Receive();
+		}
+
+//	TRemConAddress addr;
+//	addr.BearerUid() = Uid();
+//	addr.Addr() = _L8("different");
+//	Observer().ConnectIndicate(addr);
+
+	LOG(_L("<<CRemConSerialBearer::ConstructL"));
+	}
+
+TAny* CRemConSerialBearer::GetInterface(TUid aUid)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taUid = 0x%08x"), aUid);
+
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConBearerInterface1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConBearerInterface*>(this)
+			);
+		}
+
+	LOG1(_L("\tret = [0x%08x]"), ret);
+	return ret;
+	}
+
+void CRemConSerialBearer::ConnectRequest(const TRemConAddress& aAddr)
+	{
+	LOG(KNullDesC8);
+	LOG_FUNC;
+	// This bearer does not use client-specified connection data. The 
+	// connection data gives the *remote* address to connect to. This is not a 
+	// valid concept in the wired case. 
+
+	// This ASSERTS if we already have the port open!!!!
+	TRAPD(connectErr, ConnectL());
+	
+	TInt err = Observer().ConnectConfirm(aAddr, connectErr);
+	// If there was an error in RemCon we should drop the connection otherwise 
+	// RemCon might get surprised by later incoming messages on a connection 
+	// it doesn't know exists. Otherwise, start listening for incoming data.
+	// Of course, don't start listening unless the port opened OK 
+	// (connectErr).
+	if ( err != KErrNone || connectErr != KErrNone )
+		{
+		ClosePort();
+		}
+	else
+		{
+		Receive();
+		}
+	}
+
+void CRemConSerialBearer::DisconnectRequest(const TRemConAddress& aAddr)
+	{
+	LOG(KNullDesC8);
+	LOG_FUNC;
+
+	// make sure we are connected before disconnect
+	ASSERT_ALWAYS(iCommServ.Handle());
+	
+	// Undo everything done in Connect (without assuming that Connect 
+	// completed successfully). Must cancel any outstanding requests for this 
+	// to be safe.
+	ClosePort();
+	Observer().DisconnectConfirm(aAddr, KErrNone);
+	}
+
+void CRemConSerialBearer::ConnectL()
+	{
+	LOG_FUNC;
+
+#if defined (__WINS__)
+#define PDD_NAME _L("ECDRV")
+#define LDD_NAME _L("ECOMM")
+#else  // __GCC32__
+#define PDD_NAME _L("EUART1")
+#define LDD_NAME _L("ECOMM")
+#endif
+
+	// make sure we aren't connected
+	ASSERT_ALWAYS(!iCommServ.Handle());
+	
+	TInt r=User::LoadPhysicalDevice(PDD_NAME);
+	if (r!=KErrNone && r!=KErrAlreadyExists)
+		{
+		LEAVEIFERRORL(r);
+		}
+	r=User::LoadLogicalDevice(LDD_NAME);
+	if (r!=KErrNone && r!=KErrAlreadyExists)
+		{
+		LEAVEIFERRORL(r);
+		}
+
+	_LIT(KModule, "ECUART");
+#if defined (__WINS__)
+	_LIT(KPort, "COMM::1");
+#else
+//	_LIT(KPort, "COMM::2");  // On H2 and H4 this is the IR port
+							 // use COMM::2 for Lubbock.
+	_LIT(KPort, "COMM::3");  // need this for H2 and H4 board
+#endif
+
+	LEAVEIFERRORL(iCommServ.Connect());
+	
+ 	// if appropriate close will unloadcommmodule internally
+ 	CleanupClosePushL(iCommServ);
+
+	LEAVEIFERRORL(iCommServ.LoadCommModule(KModule));
+	
+	// as above if not connected this should be NULL
+	ASSERT_ALWAYS(!iComm.SubSessionHandle());
+	
+	LEAVEIFERRORL(iComm.Open(iCommServ, KPort, ECommExclusive));
+
+	// put these on clean up stack - will call close if we leave
+	CleanupClosePushL(iComm);
+
+	// Put the port's config into a known state.
+	TCommConfig portSettings;
+	LEAVEIFERRORL(iComm.Config(portSettings));
+	portSettings().iRate = EBps115200;
+	portSettings().iDataBits = EData8;
+	portSettings().iStopBits = EStop1;
+	LEAVEIFERRORL(iComm.SetConfig(portSettings));
+
+	CleanupStack::Pop(2,&iCommServ);// pop iComm then iCommServ
+
+	/* clear out the serial port so we know we start from fresh...
+	 simple expedient (that hopefully will work), try and receive 20 bytes,
+	 then cancel the receive. Given the current behaviour of the read cancel this
+	 will return any characters that are currently in the serial port buffers 
+	*/
+	ASSERT_DEBUG(iReceiver);
+	Receive();
+	iReceiver->Cancel();
+	}
+
+void CRemConSerialBearer::ClosePort()
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(iSender);
+	iSender->Cancel();
+	ASSERT_DEBUG(iReceiver);
+	iReceiver->Cancel();
+	iComm.Close();
+	iCommServ.Close();
+	}
+
+TInt CRemConSerialBearer::SendResponse(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint /*aTransactionId*/, // we don't care about this transaction ID
+		RBuf8& aData, 
+		const TRemConAddress& /*aAddr*/)
+	{
+	LOG(KNullDesC8);
+	LOG_FUNC;
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	
+	TInt ret = DoSend(aInterfaceUid, aOperationId, aData, ERemConResponse);
+
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+TInt CRemConSerialBearer::SendCommand(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		TUint aTransactionId,  
+		RBuf8& aData, 
+		const TRemConAddress& /*aAddr*/)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	
+	iTransactionId = aTransactionId;
+	TInt ret = DoSend(aInterfaceUid, aOperationId, aData, ERemConCommand);
+
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+TInt CRemConSerialBearer::DoSend(TUid aInterfaceUid, 
+		TUint aOperationId, 
+		RBuf8& aData, 
+		TRemConMessageType aMsgType)
+	{
+	LOG_FUNC;
+	
+	TInt ret = KErrInUse;
+
+	// make sure we are connected
+	ASSERT_ALWAYS(iComm.SubSessionHandle());
+
+	// Check we're not already busy sending.
+	ASSERT_DEBUG(iSender);
+	if ( iSender->IsActive() )
+		{
+		ret = KErrInUse;
+		}
+	else
+		{
+		ret = Observer().InterfaceToBearer(Uid(), aInterfaceUid, aOperationId, aData, aMsgType, iOutMsg);
+		if ( ret == KErrNone )
+			{
+			LOG1(_L("\tsending text \"%S\""), &iOutMsg);
+			iSender->Send(iOutMsg);
+			}
+		}
+
+	// If no error, we took ownership of aData- we've finished with it now.
+	if ( ret == KErrNone )
+		{
+		aData.Close();
+		}
+
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+void CRemConSerialBearer::MsoSendComplete(TInt aError)
+	{
+	LOG(KNullDesC8);
+	LOG_FUNC;
+	LOG1(_L("\taError = %d"), aError);
+	(void)aError;
+
+	// We don't do anything. How does RemCon get to know of this? Does it 
+	// care? No. A command which never gets a response is standard remote 
+	// control behaviour. The user will retry, and doesn't need an InfoMsg to 
+	// tell them anything about it.
+	}
+
+TInt CRemConSerialBearer::GetResponse(TUid& aInterfaceUid, 
+		TUint& aTransactionId, 
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(iReceiver);
+	// RemCon shouldn't call use unless we prompted them to with NewResponse.
+	ASSERT_DEBUG(!iReceiver->IsActive()); 
+	// The message should be a response, unless RemCon is being buggy and 
+	// calling GetResponse at bad times.
+	ASSERT_DEBUG(iMsgType == ERemConResponse);
+
+	TRAPD(err, DoGetResponseL(aInterfaceUid, aOperationId, aData, aAddr));
+	LOG3(_L("\taInterfaceUid = 0x%08x, aOperationId = 0x%02x, msgType = %d"), 
+		aInterfaceUid, aOperationId, iMsgType);
+
+	// The serial bearer only has one incoming message in it at once, so we 
+	// don't need any queueing or anything fancy to get the transaction ID- 
+	// it's just the last one RemCon told us.
+	aTransactionId = iTransactionId;
+
+	// Repost read request on port.
+	Receive();
+
+	LOG1(_L("\terr = %d"), err);
+	return err;
+	}
+
+void CRemConSerialBearer::DoGetResponseL(TUid& aInterfaceUid, 
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+
+	aInterfaceUid = iInterfaceUid;
+	aOperationId = iOperationId;
+	ASSERT_DEBUG(aData.MaxLength() == 0);
+	// Pass ownership of this to RemCon.
+	aData.CreateL(iData);
+
+	aAddr.BearerUid() = Uid();
+	aAddr.Addr() = KNullDesC8();
+	}
+
+TInt CRemConSerialBearer::GetCommand(TUid& aInterfaceUid, 
+		TUint& aTransactionId, 
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(iReceiver);
+	// RemCon shouldn't call use unless we prompted them to with NewCommand.
+	ASSERT_DEBUG(!iReceiver->IsActive()); 
+	// The message should be a command, unless RemCon is being buggy and 
+	// calling GetCommand at bad times.
+	ASSERT_DEBUG(iMsgType == ERemConCommand);
+
+	TRAPD(err, DoGetCommandL(aInterfaceUid, aOperationId, aData, aAddr));
+	LOG3(_L("\taInterfaceUid = 0x%08x, aOperationId = 0x%02x, msgType = %d"), 
+		aInterfaceUid, aOperationId, iMsgType);
+
+	// The serial bearer only has one incoming message in it at once, so we 
+	// don't need any queueing or anything fancy to get the transaction ID- 
+	// it's just the last one RemCon told us.
+	aTransactionId = iTransactionId;
+	
+	// Repost read request on port.
+	Receive();
+
+	LOG1(_L("\terr = %d"), err);
+	return err;
+	}
+
+void CRemConSerialBearer::DoGetCommandL(TUid& aInterfaceUid,
+		TUint& aOperationId, 
+		RBuf8& aData, 
+		TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+
+	aInterfaceUid = iInterfaceUid;
+	aOperationId = iOperationId;
+	// Pass ownership of this to RemCon.
+	aData.CreateL(iData);
+	
+	aAddr.BearerUid() = Uid();
+	aAddr.Addr() = KNullDesC8();
+	}
+
+// Utility to repost a read on the port.
+void CRemConSerialBearer::Receive()
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(iComm.SubSessionHandle());
+	ASSERT_DEBUG(iReceiver);
+	/* we should check we aren't currently trying to receive. 
+	   In this design we only kick off a receive when we aren't already trying to read something already.
+	   If we get this wrong the SetActive in iReceiver->Receive will blow up, so we'll assert here so we know.
+	   This configuration is for test code not real life so there is no 'real' problem anyway.
+	*/
+	ASSERT_DEBUG(!iReceiver->IsActive());
+	/* you might expect to see an iReceiver->Cancel() here BUT there are problems with doing this
+	   a) The underlying RComm::Read may just decide to put the 5 bytes of message it currently has in 
+	       the buffer (if we happen to call this half way through an incoming message). In this case this
+	       bearer will NEVER recover as it assumes it will only receive the proper complete 30 byte message
+	       and makes no attempt to get back in step (it will have 5 bytes from one message + 25 from another for ever).
+	   b) We are pretty confident we don't need to (see above).
+	*/
+	iReceiver->Receive(iInMsg);
+	}
+
+void CRemConSerialBearer::MroReceiveComplete(TInt aError)
+	{
+	LOG(KNullDesC8);
+	LOG_FUNC;
+	LOG2(_L("\taError = %d, iInMsg = \"%S\""), aError, &iInMsg);
+
+	// If any error occurred either getting or decoding the message, we need 
+	// to re-post now. Otherwise, we wait until after RemCon has picked up the 
+	// message until we re-post a read. 
+	if ( aError == KErrNone )
+		{
+		TRemConAddress addr;
+		addr.BearerUid() = Uid();
+		addr.Addr() = KNullDesC8();
+
+		aError = Observer().BearerToInterface(Uid(), 
+			iInMsg,
+			iInMsg, 
+			iInterfaceUid, 
+			iOperationId,
+			iMsgType, 
+			iData);
+
+		if ( aError == KErrNone )
+			{
+			if ( iMsgType == ERemConCommand )
+				{
+				iTransactionId = Observer().NewTransactionId();
+				aError = Observer().NewCommand(addr);
+				}
+			else if ( iMsgType == ERemConResponse )
+				{
+				aError = Observer().NewResponse(addr);
+				}
+			else
+				{
+				// drop the message (malformed- not apparently a command or response)
+				aError = KErrNotSupported;
+				}
+			}
+		// else drop the message (either no converter for that interface UID or it couldn't convert the message)
+		}
+	// else just drop the message (error receiving it)
+	
+	// If we successfully told RemCon there was a new message to pick up, 
+	// don't repost our port read until RemCon has come back and picked up the 
+	// message. If there was any error, then RemCon isn't going to come back 
+	// for this message- it's effectively dropped- and we should re-post our 
+	// request now.
+	if ( aError != KErrNone )
+		{
+		Receive();
+		}
+	}
+
+TSecurityPolicy CRemConSerialBearer::SecurityPolicy() const
+	{
+	return TSecurityPolicy(ECapabilityLocalServices);
+	}
+
+void CRemConSerialBearer::ClientStatus(TBool aControllerPresent, TBool aTargetPresent)
+	{
+	LOG2(_L("CRemConSerialBearer::ClientStatus aControllerPresent = %d, aTargetPresent = %d"), 
+		aControllerPresent, aTargetPresent);
+	(void)aControllerPresent;
+	(void)aTargetPresent;
+
+	// I don't care.
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/src/remconserialbearermain.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,34 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <ecom/implementationproxy.h>
+#include "remconserialbearer.h"
+
+const TImplementationProxy ImplementationTable[] =
+	{
+	IMPLEMENTATION_PROXY_ENTRY(0x1020453C, CRemConSerialBearer::NewL),
+	};
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/serialbearer/src/sender.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,66 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <c32comm.h>
+#include "sender.h"
+#include "sendobserver.h"
+#include <bluetooth/logger.h>
+ 
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_REF_SER_BEARER);
+#endif
+ 
+CSender* CSender::NewL(RComm& aComm, MSendObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+	CSender* self = new(ELeave) CSender(aComm, aObserver);
+	return self;
+	}
+
+CSender::~CSender()
+	{
+	LOG_FUNC
+	Cancel();
+	}
+
+CSender::CSender(RComm& aComm, MSendObserver& aObserver)
+:	CActive(CActive::EPriorityStandard),
+	iComm(aComm),
+	iObserver(aObserver)
+	{
+	LOG_FUNC
+	CActiveScheduler::Add(this);
+	}
+
+void CSender::Send(const TDesC8& aBuf)
+	{
+	iComm.Write(iStatus, aBuf);
+	SetActive();
+	}
+
+void CSender::RunL()
+	{
+	iObserver.MsoSendComplete(iStatus.Int());
+	}
+
+void CSender::DoCancel()
+	{
+	iComm.WriteCancel();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/reference/tsp.iby	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,37 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ROM include file for the TSP.
+// This file is #included from remotecontrol.iby but unlike that file is 
+// 'Reference' and hence licensee-modifiable.
+// By default this file #includes the RefTSP's iby file. This provides the 
+// desired Symbian-internal behaviour.
+// If this is undesired, for instance if you are a licensee and wish to replace 
+// the RefTSP with your own TSP, then branch this file to include your own.
+// 
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef __TSP_IBY__
+#define __TSP_IBY__
+
+//  This is currently part of the Techview CBR and rom build process.
+//  When it is possible to build "Reference" roms in the same way as "Test" roms, re-add.. 
+//  #include <reftsp.iby>
+
+#endif // __TSP_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// bld.inf for Rem Con server.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconserver.mmp
+
+PRJ_EXPORTS
+../public/remconserverid.h		SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconserverid.h)
+../public/remconserverpanic.h		SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconserverpanic.h)
+../public/remconservercaps.mmh		SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remcon/remconservercaps.mmh)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/group/remconserver.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,79 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconserver.exe Remote Control server.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconservercaps.mmh>
+
+TARGET			remconserver.exe
+TARGETPATH		/system/programs
+TARGETTYPE		exe
+// UID2 = 0x0 for plain exes
+// UID3 = unique for RemCon system
+UID 			0x0 0x101f9067
+VENDORID		0x70000001
+
+// Non-default stack size to allow for plugins which use Qt APIs. 
+// (The value is a standard for Symbian Qt apps, generated by qmake.)
+EPOCSTACKSIZE 0x14000
+
+SOURCEPATH		../src
+SOURCE			activehelper.cpp
+SOURCE			bearermanager.cpp
+SOURCE			connectionhistory.cpp
+SOURCE			connections.cpp
+SOURCE			convertermanager.cpp
+SOURCE			main.cpp
+SOURCE			messagequeue.cpp
+SOURCE			remconmessage.cpp
+SOURCE			server.cpp
+SOURCE			session.cpp
+SOURCE 			messagerecipients.cpp
+SOURCE			tspv4stub.cpp
+SOURCE			bulkserver.cpp 
+SOURCE			bulksession.cpp
+SOURCE			bulkmain.cpp
+SOURCE			bulkbearerinterface.cpp
+SOURCE			controllersession.cpp 
+SOURCE			targetsession.cpp
+SOURCE			targetclientprocess.cpp
+
+SOURCEPATH		../../common
+SOURCE			utils.cpp
+
+USERINCLUDE 	../inc
+USERINCLUDE 	../../common
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		ecom.lib
+LIBRARY 		remconbearerplugin.lib
+LIBRARY 		remcontargetselectorplugin.lib
+LIBRARY 		remconconverterplugin.lib
+LIBRARY 		remcontypes.lib
+LIBRARY			estor.lib
+
+NOEXPORTLIBRARY
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/activehelper.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCON_ACTIVEHELPER_H
+#define REMCON_ACTIVEHELPER_H
+
+#include <e32def.h>
+#include <e32base.h>
+
+class CRemConControllerSession;
+
+/**
+Active Helper.
+Helps with the session class's pending async connect/disconnect requests.
+*/
+NONSHARABLE_CLASS(CActiveHelper) : public CActive
+	{
+public:
+	CActiveHelper(CRemConControllerSession &aSession);
+	~CActiveHelper();
+	void Complete();
+private:
+//from CActive
+	void RunL();
+	void DoCancel();
+private:
+	CRemConControllerSession& iSession;
+	};
+
+
+#endif //REMCON_ACTIVEHELPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/bearermanager.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,254 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef BEARERMANAGER_H
+#define BEARERMANAGER_H
+
+#include <e32base.h>
+#include <remcon/remconbearerobserver.h>
+#include <remcon/playertype.h>
+
+class CRemConBearerPlugin;
+class CRemConServer;
+class CRemConMessage;
+class TBearerSecurity;
+class MRemConBearerBulkInterface;
+class MRemConBearerInterface;
+class MRemConBearerInterfaceV2;
+class MRemConBearerInterfaceV3;
+
+/**
+Bearer manager.
+Owns bearer plugin instances, allows access to them, and observes them.
+APIs are provided to bring up and down connections on specific 
+TRemConAddresses. 
+The bearer manager keeps track of connections which we are in the process or 
+bringing up or down (i.e. by request). For connection and disconnection 
+_indications_, it defers to the connection history system to check that, for 
+example, a disconnect indication refers to a connection we actually already 
+knew about.
+*/
+NONSHARABLE_CLASS(CBearerManager) : public CBase, public MRemConBearerObserver
+	{
+public:
+	/** 
+	Bearer manager construction.
+	@return Ownership of a new CBearerManager object
+	*/
+	static CBearerManager* NewL(CRemConServer& aServer);
+
+	/** Destructor. */
+	~CBearerManager();
+	
+	
+public:
+	struct TBulkInterfaceInfo
+		{
+		MRemConBearerBulkInterface* iIf;
+		
+		TUid iIfUid;
+		TUid iBearerUid;
+		};
+
+public:
+	/** Send a message over a specific connection and return the result 
+	immediately. */
+	TInt Send(CRemConMessage& aMsg);
+	
+	/** called by the server when a target client has registered its available
+	interfaces and is ready to be used by a remote. */
+	void TargetClientAvailable(TRemConClientId aId, const TPlayerType& aClientType, const TPlayerSubType& aClientSubType, const TDesC8& aName);
+	
+	/** called by the server when a target client has updated its available interfaces*/
+	void TargetFeaturesUpdated(TRemConClientId aId, const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName);
+	
+	/** Called by the server when a controller client has registered its 
+	available interfaces.  
+	*/
+	void ControllerClientAvailable();
+	
+	/** called by the server when a client is going connection oriented.
+	Informs each bearer in turn, if required, when controller count goes 1->0 */
+	void ClientConnectionOriented(TUid aUid);
+	
+	/** called by the server when a client is going connection oriented.
+	Informs each bearer in turn, if required, when controller count goes 0->1 */
+	void ClientConnectionless(TUid aOldUid);
+
+	/** called by the server when a client has closed (only if controller or target)
+	calls back to server to see whether it needs to inform each bearer in turn */
+	void ClientClosed(TBool aController, TUid aOldUid, TRemConClientId aClientId);
+	
+	/** Called by the server to get the security policies of the bearers. */
+	TSglQue<TBearerSecurity>& BearerSecurityPolicies();
+
+	/** Tries to bring up a connection on an address. 
+	@return KErrNone- a bearer-level connect has been issued (or was already 
+	outstanding) and will be confirmed in due course. Other than KErrNone- we 
+	could not remember the address (no connection will be made). */
+	TInt Connect(const TRemConAddress& aAddr);
+
+	/** Tries to tear down a connection on an address. 
+	@return KErrNone- a bearer-level disconnect has been issued (or was 
+	already outstanding) and will be confirmed in due course. Other than 
+	KErrNone- we could not remember the address (no disconnection will be 
+	performed). */
+	TInt Disconnect(const TRemConAddress& aAddr);
+
+	/** @return ETrue- the bearer with the given UID exists in the system, 
+	EFalse otherwise. */
+	TBool BearerExists(TUid aBearerUid) const;
+
+	/** Does a security check of the given client message against the given 
+	bearer's security policy. 
+	@return The result of TSecurityPolicy::CheckPolicy with the given message.
+	*/
+	TBool CheckPolicy(TUid aBearerUid, const RMessage2& aMessage);
+
+	/** 
+	Checks if a bearer is in the connecting state to the given remote address 
+	@param aAddr - remote address 
+	@return  - ETrue if it is the connecting state
+	*/
+	TBool IsConnecting(const TRemConAddress& aAddr) const;
+	
+	/** 
+	Checks if a bearer is in the disconnecting state from the given remote address 
+	@param aAddr - remote address
+	@return ETrue - if it is in the disconnecting state
+	*/
+	TBool IsDisconnecting(const TRemConAddress& aAddr) const;
+	
+	TInt SetLocalAddressedClient(const TUid& aBearerUid, TRemConClientId aClientInfo);
+	
+	/**
+	This function is called from the context of the bulk server thread and is used to retrieve the
+	bulk interfaces (that are managed in a separate class).
+	No locking is provided so it is expected that the GetInterface implementation is re-entrant with
+	respect to distribution of requests.
+	@param aBulkInterfaces The array to populate with bulk interface information.
+	*/
+	void BulkInterfacesL(RArray<TBulkInterfaceInfo>& aBulkInterfaces) const;
+	
+private:
+	/** Constructor. */
+	CBearerManager(CRemConServer& aServer);
+
+	/** 2nd-phase construction. */
+	void ConstructL();
+
+private: // from MRemConBearerObserver
+	TInt MrcboDoNewResponse(const TRemConAddress& aAddr);
+	TInt MrcboDoNewNotifyResponse(const TRemConAddress& aAddr);
+	TInt MrcboDoNewCommand(const TRemConAddress& aAddr);
+	TInt MrcboDoNewNotifyCommand(const TRemConAddress& aAddr);
+	TInt MrcboDoConnectIndicate(const TRemConAddress& aAddr);
+	void MrcboDoDisconnectIndicate(const TRemConAddress& aAddr);
+	TInt MrcboDoNewCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+	TInt MrcboDoNewNotifyCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+	void MrcboDoSetRemoteAddressedClient(const TUid& aBearerUid, const TRemConClientId& aId);
+
+
+	/** Called in response to a connection request by us. */
+	TInt MrcboDoConnectConfirm(const TRemConAddress& aAddr, TInt aError);
+
+	/** Called in response to a disconnection request by us. */
+	void MrcboDoDisconnectConfirm(const TRemConAddress& aAddr, TInt aError);
+
+	TUint MrcboDoNewTransactionId();
+
+	TInt MrcboDoInterfaceToBearer(TUid aBearerUid,
+		TUid aInterfaceUid, 
+		TUint aOperationId,
+		const TDesC8& aData,
+		TRemConMessageType aMsgType, 
+		TDes8& aBearerData) const;
+	TInt MrcboDoBearerToInterface(TUid aBearerUid,
+		const TDesC8& aInterfaceData, 
+		const TDesC8& aBearerData,
+		TUid& aInterfaceUid, 
+		TUint& aOperationId,
+		TRemConMessageType& aMsgType, 
+		TDes8& aData) const;
+	
+	void MrcboDoCommandExpired(TUint aTransactionId);
+	TInt MrcboDoSupportedInterfaces(const TRemConClientId& aId, RArray<TUid>& aUids);
+	TInt MrcboDoSupportedOperations(const TRemConClientId& aId, TUid aInterfaceUid, RArray<TUint>& aOperations);
+	
+	TInt MrcboDoRegisterLocalAddressedClientObserver(const TUid& aBearerUid);
+	TInt MrcboDoUnregisterLocalAddressedClientObserver(const TUid& aBearerUid);
+	
+private: // utility
+	/** Called during (2-phase) construction to instantiate all the bearer 
+	plugins, from ROM only. */
+	void LoadAllBearersL();
+
+#ifdef __FLOG_ACTIVE
+	void LogBearers() const;
+#endif
+	
+	void NewResponseL(const TRemConAddress& aAddr);
+	void NewNotifyResponseL(const TRemConAddress& aAddr);
+	void NewCommandL(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+	void NewNotifyCommandL(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+
+	MRemConBearerInterface* BearerIf(TUid aUid) const;
+	MRemConBearerInterfaceV2* BearerIfV2(TUid aUid) const;
+	MRemConBearerInterfaceV3* BearerIfV3(TUid aUid) const;
+
+private: // unowned
+	// Struct wrapping a pointer to a bearer interface object with the UID 
+	// identifying that interface and the UID identifying the bearer supplying 
+	// the interface.
+	struct TInterfaceInfo
+		{
+		MRemConBearerInterface* iIf;
+		MRemConBearerInterfaceV2* iIfV2;
+		MRemConBearerInterfaceV3* iIfV3;
+		
+		TUid iIfUid;
+		TUid iBearerUid;
+		TInt iControllerCount;
+		TInt iTargetCount;
+		};
+
+	RArray<TInterfaceInfo>	iBearerIfs;
+
+private: // owned
+	RPointerArray<CRemConBearerPlugin> iBearers;
+	TUint iRunningTransactionId;
+
+	/** All the security policies of the bearers in the system. These are 
+	given to the TSP for reference when it is addressing outgoing commands. */ 
+	TSglQue<TBearerSecurity> iBearerSecurityPolicies;
+
+	/** Array of addresses we currently have a ConnectRequest outstanding on. 
+	*/
+	RArray<TRemConAddress> iCurrentlyBeingConnected;
+
+	/** Array of addresses we currently have a DisconnectRequest outstanding 
+	on. */
+	RArray<TRemConAddress> iCurrentlyBeingDisconnected;
+	
+private: // unowned
+	CRemConServer& iServer;
+	};
+
+#endif // BEARERMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/bulkbearerinterface.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,97 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef BULKBEARERINTERFACE_H
+#define BULKBEARERINTERFACE_H
+
+#include <e32base.h>
+#include <e32hashtab.h>
+#include <remcon/remconbearerbulkobserver.h>
+#include "bearermanager.h"
+
+class CRemConBulkServer;
+class CRemConMessage;
+class TBearerSecurity;
+class MRemConBearerBulkInterface;
+class TClientInfo;
+
+NONSHARABLE_CLASS(CBulkBearerInterface) : public CBase, public MRemConBearerBulkObserver
+	{
+public:
+	/** 
+	Bearer manager construction.
+	@return Ownership of a new CBulkBearerInterface object
+	*/
+	static CBulkBearerInterface* NewL(CRemConBulkServer& aServer, CBearerManager& aBearerManager);
+
+	~CBulkBearerInterface();
+
+public:
+	void BulkClientAvailable(const TRemConClientId& aClient);
+	void BulkClientRemoved(const TRemConClientId& aClient);
+	
+	/** Send a message over a specific connection and return the result 
+	immediately. */
+	TInt Send(CRemConMessage& aMsg);
+	
+	/**
+	@param aBearerUid The bearer with which to check the security policy with.
+	@param aMessage The message to check the policy against.
+	@return non-zero if the security check passes, zero otherwise.
+	*/
+	TBool CheckPolicy(TUid aBearerUid, const TClientInfo& aClientInfo);
+
+private:
+	CBulkBearerInterface(CRemConBulkServer& aServer, CBearerManager& aBearerManager);
+	void ConstructL(CBearerManager& aBearerManager);
+	void StopBearers();
+
+private: // from MRemConBearerBulkObserver
+	TInt MrcbboDoNewCommand(const TRemConAddress& aAddr);
+	TInt MrcbboDoNewCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+	TUint MrcbboDoNewTransactionId();
+	void MrcbboDoCommandExpired(TUint aTransactionId);
+	TInt MrcbboDoSetAddressedClient(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+	TInt MrcbboDoRemoveAddressing(const TRemConAddress& aAddr);
+	
+private: // utility
+#ifdef __FLOG_ACTIVE
+	void LogBearers() const;
+#endif
+	
+	void NewCommandL(const TRemConAddress& aAddr, const TRemConClientId& aClient);
+
+	MRemConBearerBulkInterface* BearerIf(TUid aUid) const;
+
+private: // unowned	
+	RArray<CBearerManager::TBulkInterfaceInfo> iBearerIfs;
+	RHashMap<TRemConAddress, TRemConClientId> iAddressedClients; // Stores client id by RemCon addr
+
+private: // owned
+	TUint iRunningTransactionId;
+	TSglQueIter<TBearerSecurity> iSecurityPoliciesIter;
+
+private: // unowned
+	CRemConBulkServer& iServer;
+	};
+
+#endif // BULKBEARERINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/bulkserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,173 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef BULKSERVER_H
+#define BULKSERVER_H
+
+#include <e32base.h>
+#include <e32msgqueue.h>
+#include "bulkservermsgqueue.h"
+
+class CBulkBearerInterface;
+class CMessageQueue;
+class CRemConBulkSession;
+class CRemConMessage;
+class TRemConAddress;
+
+class CRemConServer;
+
+
+/**
+The bulk server class for Rem Con.
+*/
+NONSHARABLE_CLASS(CRemConBulkServer) : public CPolicyServer
+	{
+public:
+	/**
+	RemCon bulk server construction.
+	@return Ownership of a new RemCon bulk server object
+	*/
+	static CRemConBulkServer* NewLC(RMsgQueue<TBulkServerMsg>& aMsgQueue);
+
+	/** Destructor. */
+	~CRemConBulkServer();
+
+public: // called by session objects 
+	/** Called by a session when a client session is created. Cancels the 
+	shutdown timer in accordance with transient server design. */
+	TInt ClientOpened(CRemConBulkSession& aSession, TProcessId aProcessId);
+
+	/** Called by a session when a client session is destroyed. Starts the 
+	shutdown timer if necessary in accordance with transient server design. 
+	Does not assume that the session successfully registered itself with the 
+	server to begin with.
+	*/
+	void ClientClosed(CRemConBulkSession& aSession);
+	
+	/** Called by a session when a client session has issued a receive.
+	*/
+	void ReceiveRequest(CRemConBulkSession& aSession);
+	
+	/**
+	Starts the process of sending a response.
+	Always takes ownership of aMsg.
+	@return error
+	*/
+	TInt SendResponse(CRemConMessage& aMsg, CRemConBulkSession& aSess);
+	
+	/**
+	Sends a reject back to the bearer.
+	*/
+	void SendReject(TRemConAddress aAddr, TUid aInterfaceUid, TUint aOperationId, TUint aTransactionId);
+	
+	inline CBulkBearerInterface& BulkBearerInterface();
+
+public: // called by the bearer manager 
+	inline RPointerArray<CRemConBulkSession>& Sessions();
+	
+	/** 
+	Handles a new incoming command.
+	Always takes ownership of aMsg.
+	*/
+	void NewCommand(CRemConMessage& aMsg);
+	
+	void CommandExpired(TUint aTransactionId);
+
+private:
+	/** Constructor. */
+	CRemConBulkServer(RMsgQueue<TBulkServerMsg>& aMsgQueue);
+
+	/** 2nd-phase construction. */
+	void ConstructL();
+	
+private: // from CPolicyServer
+	/**
+	Called by the base class to create a new session.
+	@param aVersion Version of client
+	@param aMessage Client's IPC message
+	@return A new session to be used for the client. If this could not be made, 
+	this function should leave.
+	*/
+	CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const;
+
+private: // utility	
+	CRemConBulkSession* Session(TUint aSessionId) const;
+	
+	void StartShutdownTimerIfNoSessions();
+	
+#ifdef __FLOG_ACTIVE
+	void LogSessions() const;
+	void LogIncomingPendingDelivery() const;
+	void LogIncomingDelivered() const;
+#endif // __FLOG_ACTIVE
+	
+	CMessageQueue& IncomingPendingDelivery();
+	CMessageQueue& IncomingDelivered();
+	
+	void DeliverCmdToClient(const CRemConMessage& aMsg, CRemConBulkSession& aSess);
+	void DeliverMessageToClient(CRemConMessage& aMsg, CRemConBulkSession& aSess);
+		
+private: // called by the shutdown timer
+	/** 
+	Called by the shutdown timer when it fires. Terminates the server thread. 
+	@param aThis This. 
+	@return KErrNone.
+	*/
+	static TInt TimerFired(TAny* aThis);
+
+	
+private: // owned
+
+	// NB This isn't really being used as a CPeriodic, but (a) it will do the 
+	// job, and (b) it saves us writing our own concrete timer (there aren't 
+	// any other more suitable concrete timer classes).
+	CPeriodic* iShutdownTimer;
+
+	// Shutdown delay (when there are no sessions) = 1 second- there's no 
+	// point hanging around.
+	static const TUint KShutdownDelay = 1 * 1000 * 1000;
+
+	RPointerArray<CRemConBulkSession> iSessions;
+	
+	CMessageQueue* iIncomingPendingDelivery;
+	CMessageQueue* iIncomingDelivered;
+	
+	CBulkBearerInterface* iBulkBearerInterface;
+	
+	RMsgQueue<TBulkServerMsg> iRemConMsgQueue;
+	
+	CRemConServer* iControlServer; //unowned.
+	};
+
+// Inlines
+
+RPointerArray<CRemConBulkSession>& CRemConBulkServer::Sessions()
+	{
+	return iSessions;
+	}
+
+CBulkBearerInterface& CRemConBulkServer::BulkBearerInterface()
+	{
+	return *iBulkBearerInterface;
+	}
+
+#endif // BULKSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/bulkservermsgqueue.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,61 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef BULKSERVERMSGQUEUE_H
+#define BULKSERVERMSGQUEUE_H
+
+#include <remcon/clientid.h>
+
+NONSHARABLE_STRUCT(TBulkClientInfo)
+	{
+	// Process Id is used to match bulk session with target session
+	TProcessId iProcessId;
+	
+	// Use to uniquely identify this client to allow bearers to address
+	TRemConClientId iRemConId;
+	
+	// This contains only the bulk APIs
+	RArray<TUid> iInterestedAPIs;
+	
+	// This is used by the receiver to queue.  Only the owner of this
+	// object may queue it.
+	TSglQueLink iClientInfoLink;
+	};
+
+enum TBulkServerMsgType
+	{
+	// Sent upon bulk server creation to provide the control server which
+	// is used to map RemCon Client IDs between bulk and control sessions.
+	EControlServer = 0,
+	// Sent upon bulk server creation to provide the bearer manager which
+	// can be used to extract (or create) the bulk interfaces from the bearer.
+	EBearerManager = 1,
+	};
+
+NONSHARABLE_STRUCT(TBulkServerMsg)
+	{
+	TBulkServerMsgType	iType;
+	TAny*				iData;
+	};
+
+#endif // BULKSERVERMSGQUEUE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/bulkserversecuritypolicy.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,65 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server Security Policy definitions.
+//
+
+
+
+/**
+ @file 
+ @internalComponent
+*/
+ 
+#ifndef REMCONBULKSERVERSECURITYPOLICY_H
+#define REMCONBULKSERVERSECURITYPOLICY_H
+
+#include <e32base.h>
+#include "remconserver.h"
+
+/** RemCon Bulk Server Security Policy Definition */
+const TUint KRemConBulkServerRangeCount = 2;
+
+const TInt KRemConBulkServerRanges[KRemConBulkServerRangeCount] = 
+	{
+	ERemConBulkDbgMarkHeap,						/** pass */
+	ERemConBulkNumberOfServerFunctions,			/** fail (to KMaxTInt) */
+	};
+
+/** Index numbers into KRemConServerElements[] */
+const TInt KPolicyPass = 0;
+
+/** Mapping IPCs to policy element */
+const TUint8 KRemConBulkServerElementsIndex[KRemConBulkServerRangeCount] = 
+	{
+	KPolicyPass,					/** All (valid) APIs */
+	CPolicyServer::ENotSupported,	/** remainder of possible IPCs */
+	};
+
+/** Individual policy elements */
+const CPolicyServer::TPolicyElement KRemConBulkServerElements[] = 
+	{
+		{ _INIT_SECURITY_POLICY_PASS },
+	};
+
+/** Main policy */
+const CPolicyServer::TPolicy KRemConBulkServerPolicy = 
+	{
+	CPolicyServer::EAlwaysPass, /** Specifies all connect attempts should pass */
+	KRemConBulkServerRangeCount,
+	KRemConBulkServerRanges,
+	KRemConBulkServerElementsIndex,
+	KRemConBulkServerElements,
+	};
+	
+#endif // REMCONBULKSERVERSECURITYPOLICY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/bulksession.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,169 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCONBULKSESSION_H
+#define REMCONBULKSESSION_H
+
+#include <e32base.h>
+#include <remconserverpanic.h>
+#include <remcon/clientinfo.h>
+
+class CRemConBulkServer;
+class CRemConLogger;
+class CBearerManager;
+class CRemConMessage;
+class CActiveHelper;
+class CMessageQueue;
+
+/**
+Rem Con session.
+*/
+NONSHARABLE_CLASS(CRemConBulkSession) : public CSession2
+	{
+public:
+	/**
+	Factory method.
+	@param aServer The server.
+	@param aMessage Handle on the client message triggering this session creation.
+	@return Ownership of a new session.
+	*/
+	static CRemConBulkSession* NewL(CRemConBulkServer& aServer,
+		const RMessage2& aMessage);
+
+	~CRemConBulkSession();
+
+public: // called by the server
+	/**
+	@return This session's unique identifier.
+	*/
+	inline TUint Id() const;
+	
+	inline void SetId(TUint aId);
+	
+	inline RArray<TUid>& InterestedAPIs();
+	
+	/** 
+	@return Information about the client using this session.
+	*/
+	inline const TClientInfo& ClientInfo() const;
+	
+	/**
+	Writes aMsg to the client's Receive message (NB RMessage2::Write may fail) 
+	and completes the client's Receive message with any error.
+	@return Error.
+	*/
+	TInt WriteMessageToClient(const CRemConMessage& aMsg);
+
+	/**
+	Accessor for the currently outstanding client Receive message.
+	@return Handle to client's receive message.
+	*/
+	inline const RMessage2& CurrentReceiveMessage() const;
+
+	
+private:
+	/**
+	@param aServer The server.
+	@param aLogger The logger.
+	@param aId The unique ID of the new session.
+	*/
+	CRemConBulkSession(CRemConBulkServer& aServer);
+
+	/**
+	2nd-phase construction.
+	@param aMessage The message received from the client.
+	*/
+	void ConstructL(const RMessage2& aMessage);
+		
+private: // from CSession2
+	/**
+	Called when a message is received from the client.
+	@param aMessage Message received from the client.
+	*/
+	void ServiceL(const RMessage2& aMessage);
+
+private: // utility- IPC command handlers
+	void Send(const RMessage2& aMessage);
+	void SendUnreliable(const RMessage2& aMessage);
+	void SendCancel(const RMessage2& aMessage);
+	void Receive(const RMessage2& aMessage);
+	void ReceiveCancel(const RMessage2& aMessage);
+	
+private: // utility
+	void DoSendL(const RMessage2& aMessage);
+	
+	/**
+	Utility to complete the given message with the given error code.
+	@param aMessage Message to complete.
+	@param aError Error to complete with.
+	*/
+	void CompleteClient(const RMessage2& aMessage, TInt aError);
+	
+	CRemConMessage* DoCreateMessageL(const RMessage2& aMessage, TBool aReliable);
+	TInt SendToServer(CRemConMessage& aMsg);
+
+	
+private: // unowned
+	CRemConBulkServer& iServer;
+
+private: // message handles for asynchronous IPC requests
+	RMessage2 iReceiveMsg;
+
+private: // owned
+	// The client's process ID, secure ID and caps.
+	TClientInfo iClientInfo;
+
+	// session identifier - mapped to the control session reference...
+	TUint iId;
+	
+	RArray<TUid> iInterestedAPIs; // cached from control server.
+	};
+
+// Inlines
+
+TUint CRemConBulkSession::Id() const
+	{
+	return iId;
+	}
+
+void CRemConBulkSession::SetId(TUint aId)
+	{
+	iId = aId;
+	}
+
+const RMessage2& CRemConBulkSession::CurrentReceiveMessage() const
+	{
+	return iReceiveMsg;
+	}
+
+RArray<TUid>& CRemConBulkSession::InterestedAPIs()
+	{
+	return iInterestedAPIs;
+	}
+
+const TClientInfo& CRemConBulkSession::ClientInfo() const
+	{
+	return iClientInfo;
+	}
+
+#endif // REMCONBULKSESSION_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/connectionhistory.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,135 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CONNECTIONHISTORY_H
+#define CONNECTIONHISTORY_H
+
+#include <e32base.h>
+
+class CConnections;
+class TRemConAddress;
+
+/**
+Encapsulates the history of the connection statuses. 
+Each item in the history is a CConnections. So, at any point in time, the 
+CConnections given by Last will represent the currently extant connections in 
+the system. 
+Note that this class allows the client to remove older items from the history 
+as they become uninteresting.
+Provides APIs to extend or grow the history when connections or disconnections 
+occur. In each case a new CConnections is made, based on Last, reflecting the 
+new change. 
+As an implementation detail, the disconnection API uses memory pre-allocated 
+at connection time to make sure that it cannot fail, as required (ultimately) 
+by the Bearer API.
+*/
+NONSHARABLE_CLASS(CConnectionHistory) : public CBase
+	{
+public:
+	/**
+	Makes a new connection history- a holder for the connection statuses as 
+	they evolve over time. Seeds itself with the initial state of the system 
+	(no connections).
+	@return Ownership of a new CConnectionHistory object.
+	*/
+	static CConnectionHistory* NewL();
+
+	/** Destructor. */
+	~CConnectionHistory();
+
+public:
+	/**
+	Destroys the first item in the connection history. Used when no session is 
+	interested in it any more. Debug-asserts that the history is empty neither 
+	before nor after the call.
+	*/
+	void DestroyFirst();
+
+	/**
+	Gets the number of items in the history. This is always >= 1.
+	*/
+	TUint Count() const;
+
+	/**
+	Accessor for a point in the connection history. If aIndex is out of range, 
+	panics.
+	@param aIndex Index of the desired point in the connection history.
+	@return A specific set of connections.
+	*/
+	const CConnections& operator[](TUint aIndex);
+
+	/**
+	Used to access the last item in the history, i.e. the current set of 
+	connections.
+	*/
+	CConnections& Last();
+
+	/**
+	Used when a connection is made. Pre-allocates memory so that any 
+	subsequent disconnection is guaranteed to work, and makes a new 'last' 
+	item on the history expressing the current state of the system (i.e. the 
+	previous state of the system, plus the change expressed by this call).
+	@param aAddr The new remote.
+	*/
+	TInt NewConnection(const TRemConAddress& aAddr);
+
+	/**
+	Used when a connection comes down. Uses the pre-allocated memory to make a 
+	new latest item in the history expressing the current state of the system 
+	(i.e. the previous state of the system, minus the connection which just 
+	went away).
+	@param aAddr The disappearing remote.
+	*/
+	void Disconnection(const TRemConAddress& aAddr);
+
+	/**
+	Logs the connection history. Note that this might not be the complete 
+	connection history, as earlier items are dropped as they become 
+	uninteresting. */
+	void LogConnectionHistory() const;
+
+private: // utility
+	void NewConnectionL(const TRemConAddress& aAddr);
+#ifdef __FLOG_ACTIVE
+	void LogCollectionPool() const;
+	void LogAddressPool() const;
+#endif // __FLOG_ACTIVE
+
+private:
+	/** Constructor. */
+	CConnectionHistory();
+
+	/** 2nd-phase construction. */
+	void ConstructL();
+		
+private: // owned
+	/** The history. */
+	TSglQue<CConnections> iHistory;
+
+	/** Pre-allocated pool of CConnections, to be used when a disconnection 
+	occurs. */
+	TSglQue<CConnections> iConnectionsPool;
+
+	/** Pre-allocated pool of TRemConAddresses, to be used when a 
+	disconnection occurs. */
+	TSglQue<TRemConAddress> iAddressPool;
+	};
+
+#endif // CONNECTIONSTATUSHISTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/connections.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,118 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CONNECTIONS_H
+#define CONNECTIONS_H
+
+#include <e32base.h>
+#include <remconaddress.h>
+
+/**
+Encapsulates a snapshot of all the connections (remotes) in RemCon at one 
+point in time.
+*/
+NONSHARABLE_CLASS(CConnections) : public CBase
+	{
+public:
+	/** Link between elements of this type in a TSglQue. */
+	TSglQueLink iLink;
+
+public:
+	/**
+	@return Ownership of a new CConnections object.
+	*/
+	static CConnections* NewL();
+	
+	/**
+	@return Ownership of a new CConnections object, with its own (owned) 
+	copies of the data in aItem.
+	*/
+	static CConnections* CopyL(CConnections& aItem);
+	
+	/**
+	Destructor.
+	*/
+	~CConnections();
+
+public:
+	/**
+	Accessor for a member iterator over the queue. The iterator is provided 
+	set to the first item in the queue. The iterator is 'safe' (will not be 
+	otherwise interfered with) until SetToFirst or the destructor is called. 
+	@return Iterator.
+	*/
+	TSglQueIter<TRemConAddress>& SetToFirst() const;
+
+	/**
+	@return The number of remote connections.
+	*/
+	inline TUint Count() const;
+
+	/**
+	Adds a remote connection to the current set. Panics if a duplicate is 
+	already present.
+	@param aAddr The new connection.
+	*/
+	void Append(TRemConAddress& aAddr);
+
+	/**
+	Removes a remote connection to the current set. Panics if the connection 
+	is not already present.
+	Does not delete the address. This is a very special utility function- the 
+	client is expected to be assuming ownership of the address. This function 
+	effectively removes ownership of the address from this CConnections.
+	@param aAddr The connection to remove.
+	*/
+	void Remove(TRemConAddress& aAddr);
+
+	/**
+	@return ETrue if the given address is present in this set of connections, 
+	EFalse otherwise.
+	*/
+	TBool Find(const TRemConAddress& aAddr) const;
+
+	/** Logs the connections. */
+	void LogConnections() const;
+
+private:
+	/** Constructor. */
+	CConnections();
+		
+private: // owned
+	TSglQue<TRemConAddress> iConnections;
+	TSglQueIter<TRemConAddress> iIter;
+	};
+
+// Inlines
+
+TUint CConnections::Count() const
+	{
+	TUint count = 0;
+
+	TSglQueIter<TRemConAddress> iter(const_cast<CConnections*>(this)->iConnections);
+	while ( iter++ )
+		{
+		++count;
+		}
+
+	return count;
+	}
+
+#endif // CONNECTIONS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/connectionstate.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,35 @@
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CONNECTIONSTATE_H
+#define CONNECTIONSTATE_H
+
+/**
+Enums describing connection's state.
+*/
+enum TConnectionState
+	{
+	EConnecting = 1,
+	EConnected,
+	EDisconnecting,
+	EDisconnected	
+	};
+	
+#endif // CONNECTIONSTATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/controllersession.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,154 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef CONTROLLERSESSION_H
+#define CONTROLLERSESSION_H
+
+#include "session.h"
+#include "messagesendobserver.h"
+
+class CActiveHelper;
+NONSHARABLE_CLASS(CRemConControllerSession) : public CRemConSession, public MRemConMessageSendObserver
+	{
+public:
+	/**
+	Factory method.
+	@param aServer The server.
+	@param aBearerManager The bearer manager.
+	@param aClientInfo Information about the client using this session.
+	@param aId The unique ID of the new session.
+	@return Ownership of a new session.
+	*/
+	static CRemConControllerSession* NewL(CRemConServer& aServer,
+		CBearerManager& aBearerManager,
+		const TClientInfo& aClientInfo,
+		TUint aId);
+
+	~CRemConControllerSession();
+
+	/** 
+	Checks if this message is supported by the session
+	@param aMsg The message to check
+	@return ETrue if it is, EFalse otherwise
+	*/
+	TBool SupportedMessage(const CRemConMessage& aMsg) const;
+
+	inline const TPlayerType& PlayerType() const;
+	inline const TPlayerSubType& PlayerSubType() const;
+	inline const TDesC8& Name() const;
+	
+public: // called by the bearer manager
+	/**
+	Indicates that a connect request has been completed. The request was not 
+	necessarily from this session- the session must check that the connected 
+	address is one it has asked to be connected. If it is, and we have a 
+	connect request outstanding, the connect request should be completed.
+	@param aAddr The connected address.
+	@param aError The error with which the connection attempt was completed.
+	*/
+	void CompleteConnect(const TRemConAddress& aAddr, TInt aError);
+
+	/**
+	Indicates that a disconnect request has been completed. The request was 
+	not necessarily from this session- the session must check that the 
+	disconnected address is one it has asked to be disconnected. If it is, and 
+	we have a disconnect request outstanding, the disconnect request should be 
+	completed.
+	@param aAddr The disconnected address.
+	@param aError The error with which the disconnection attempt was 
+	completed.
+	*/
+	void CompleteDisconnect(const TRemConAddress& aAddr, TInt aError);
+	
+public: // called by the active helper
+	void ProcessPendingMsgL();
+	
+private:
+	/**
+	Constructor.
+	@param aServer The server.
+	@param aBearerManager The bearer manager.
+	@param aId The unique ID of the new session.
+	*/
+	CRemConControllerSession(CRemConServer& aServer, 
+		CBearerManager& aBearerManager,
+		TUint aId);
+
+	/**
+	2nd-phase construction.
+	@param aClientInfo Information about the client using this session.
+	*/
+	void ConstructL(const TClientInfo& aClientInfo);
+	
+private: // From CRemConSession: utility- IPC command handlers
+	void SetPlayerType(const RMessage2& aMessage);
+	void SendUnreliable(const RMessage2& aMessage);
+	void RegisterInterestedAPIs(const RMessage2& aMessage);
+	void GoConnectionOriented(const RMessage2& aMessage);
+	void GoConnectionless(const RMessage2& aMessage);
+	void ConnectBearer(const RMessage2& aMessage);
+	void ConnectBearerCancel(const RMessage2& aMessage);
+	void DisconnectBearer(const RMessage2& aMessage);
+	void DisconnectBearerCancel(const RMessage2& aMessage);
+	void SendNotify(const RMessage2& aMessage);
+
+private: // From CRemConSession: utility
+	CRemConMessage* DoPrepareSendMessageL(const RMessage2& aMessage);
+	void DoSendCancel();
+	void DoReceive();
+	
+private: // utility
+	CRemConMessage* DoCreateUnreliableMessageL(const RMessage2& aMessage);
+	void DoSendNotifyL(const RMessage2& aMessage);
+	
+	void SendToServer(CRemConMessage& aMsg);
+	
+	void CheckForPendingMsg() const; 
+	void EmptySendQueue();
+
+	void CompleteMessage(const CRemConMessage& aMessage);
+
+public: //From MRemConMessageSendObserver
+	void MrcmsoMessageSendResult(const CRemConMessage& aMessage, TInt aError);
+	void MrcmsoMessageSendOneOrMoreAttempt(const CRemConMessage& aMessage, TUint aNumRemotes);
+	void MrcmsoMessageSendOneOrMoreIncremental(const CRemConMessage& aMessage, TUint aNumRemotes);	// Not supported
+	void MrcmsoMessageSendOneOrMoreAttemptFailed(const CRemConMessage& aMessage, TInt aError);
+	void MrcmsoMessageSendOneOrMoreResult(const CRemConMessage& aMessage, TInt aError);
+	void MrcmsoMessageSendOneOrMoreAbandoned(const CRemConMessage& aMessage);	// Not supported
+
+private: // message handles for asynchronous IPC requests
+	// Address of remote device associated with this session.
+	// A null remote address indicates a connectionless 
+	// controller; a non-null UID indicates a connection-oriented controller.
+	TRemConAddress iRemoteAddress;
+
+	RMessage2 iConnectBearerMsg;
+	RMessage2 iDisconnectBearerMsg;
+	// Stores pending connect/disconnect request
+	// There can be only one pending request at any time
+	RMessage2 iPendingMsg;
+	
+	// Helps with session's async connect/disconnect requests
+	CActiveHelper *iPendingMsgProcessor;
+
+	// the player type information
+	TPlayerTypeInformation iPlayerType;
+	//the player name 
+	RBuf8 iPlayerName;
+	};
+
+#include "controllersession.inl"
+
+#endif /* CONTROLLERSESSION_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/controllersession.inl	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,34 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// 
+
+/**
+ @file
+ @internalComponent
+*/
+
+inline const TPlayerType& CRemConControllerSession::PlayerType() const
+	{
+	return iPlayerType.iPlayerType;
+	}
+
+inline const TPlayerSubType& CRemConControllerSession::PlayerSubType() const
+	{
+	return iPlayerType.iPlayerSubType;
+	}
+
+inline const TDesC8& CRemConControllerSession::Name() const
+	{
+	return iPlayerName;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/convertermanager.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,86 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CONVERTERMANAGER_H
+#define CONVERTERMANAGER_H
+
+#include <e32base.h>
+
+class CRemConConverterPlugin;
+class MRemConConverterInterface;
+
+/**
+Converter manager.
+*/
+NONSHARABLE_CLASS(CConverterManager) : public CBase
+	{
+public:
+	/**
+	Converter manager construction.
+	@return Ownership of a new CConverterManager object
+	*/
+	static CConverterManager* NewL();
+
+	/** Destructor. */
+	~CConverterManager();
+
+public:
+	/** Returns the converter interface which supports the given outer-layer 
+	API and bearer UIDs, or NULL if it does not exist. */
+	MRemConConverterInterface* Converter(TUid aInterfaceUid, TUid aBearerUid) const;
+	
+	/** Returns the converter interface which supports the given outer-layer 
+	API and bearer UIDs, or NULL if it does not exist. */
+	MRemConConverterInterface* Converter(const TDesC8& aInterfaceData, TUid aBearerUid) const;
+
+private:
+	/** Constructor. */
+	CConverterManager();
+	
+	/** 2nd-phase construction. */
+	void ConstructL();
+
+private: // utility
+	/** Called during (2-phase) construction to instantiate all the converter 
+	plugins, from ROM only. */
+	void LoadAllConvertersL();
+	
+#ifdef __FLOG_ACTIVE
+	void LogConverters() const;
+#endif // __FLOG_ACTIVE
+
+private: // owned
+	RPointerArray<CRemConConverterPlugin> iConverters;
+
+	// Struct wrapping a pointer to a converter interface object with the UID 
+	// identifying that interface and the UID identifying the converter 
+	// supplying the interface.
+	// In the current implementation iIfUid will always be the same as we've 
+	// only (so far) released one version of the converter API.
+	struct TInterfaceInfo
+		{
+		MRemConConverterInterface* iIf;
+		TUid iIfUid;
+		TUid iConverterUid;
+		};
+	RArray<TInterfaceInfo> iConverterIfs;
+	};
+
+#endif // CONVERTERMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/messagequeue.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,134 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file 
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#ifndef MESSAGEQUEUE_H
+#define MESSAGEQUEUE_H
+
+#include <e32base.h>
+
+class CRemConMessage;
+
+/**
+A queue for RemCon messages (commands and responses). 
+Owns the messages.
+*/
+NONSHARABLE_CLASS(CMessageQueue) : public CBase 
+	{
+public:
+	/**
+	@return Ownership of a new CMessageQueue object.
+	*/
+	static CMessageQueue* NewL();
+
+	/**
+	Destructor.
+	*/
+	~CMessageQueue();
+
+public:
+	/**
+	Accessor for a member iterator over the queue. The iterator is provided 
+	set to the first item in the queue. The iterator is 'safe' (will not be 
+	otherwise interfered with) until SetToFirst or the destructor is called. 
+	@return Iterator.
+	*/
+	TSglQueIter<CRemConMessage>& SetToFirst();
+
+	/**
+	Appends the given item at the end of the queue.
+	@param aMsg New message.
+	*/
+	void Append(CRemConMessage& aMsg); 
+
+	/**
+	Removes the given item from the queue and destroys it.
+	@param aMsg Message to be destroyed.
+	*/
+	void RemoveAndDestroy(CRemConMessage& aMsg);
+
+	/**
+	Removes and destroys all messages belonging to the given session.
+	@param aSessionId ID of session.
+	*/
+	void RemoveAndDestroy(TUint aSessionId);
+
+	/**
+	Removes the given item from the queue without destroying it.
+	@param aMsg Message to be removed.
+	*/
+	void Remove(CRemConMessage& aMsg);
+
+	/**
+	Returns the first item in the queue. The queue must not be empty. 
+	@return First item in the queue.
+	*/
+	CRemConMessage& First();
+
+	/**
+	Returns a message with a specified transaction ID
+	@param Transaction ID of the required message
+	@return Pointer to the message, or NULL if it does not exist. Ownership is retained by the queue
+	*/
+	
+	CRemConMessage* Message(TUint aTransactionId);
+	
+	/** 
+	@return Whether the queue is empty or not.
+	*/
+	inline TBool IsEmpty() const;
+
+	inline TSglQue<CRemConMessage>& Queue();
+
+	void LogQueue() const;
+	
+private:
+	CMessageQueue();
+
+private: // owned
+	TSglQue<CRemConMessage> iQueue;
+	TSglQueIter<CRemConMessage> iIter;
+	// Used for logging purposes.
+	TUint iCount;
+	};
+
+// Inlines
+
+TBool CMessageQueue::IsEmpty() const
+	{
+#ifdef __FLOG_ACTIVE
+	// Needs to be defined locally to prevent redefinition
+	_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+	LOG_FUNC;
+	
+	TBool ret = iQueue.IsEmpty();
+	LOG1(_L("\tret = %d"), ret);
+
+	return ret;
+	}
+
+TSglQue<CRemConMessage>& CMessageQueue::Queue()
+	{
+	return iQueue;
+	}
+
+#endif // MESSAGEQUEUE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/messagerecipients.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,130 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file 
+ @internalComponent
+*/
+
+#ifndef MESSAGERECIPIENTS_H
+#define MESSAGERECIPIENTS_H
+
+#include <e32base.h>
+#include <remcon/clientinfo.h>
+
+/**
+A list of clients a message with the given transaction ID was delivered to,
+that hasn't yet been responded to
+*/
+NONSHARABLE_CLASS(CMessageRecipients): public CBase
+	{
+public:
+	/**
+	@return Ownership of a new CMessageRecipients object.
+	*/
+	static CMessageRecipients* NewL();
+	
+	/**
+	Destructor.
+	*/
+	~CMessageRecipients();
+	
+	/**
+	@return List of clients to which the message was delivered
+	*/
+	TSglQue<TClientInfo>& Clients();
+	
+	/**
+	@return Iterator over a list of clients to which the message was delivered.
+	@note Pointers returned by the iterator will be const TClientInfo*
+	*/
+	TClientInfoConstIter& ConstIter();
+	
+	/**
+	@return The transaction ID of the message that was delivered
+	*/
+	TUint& TransactionId();
+	
+	/**
+ 	Removes and deletes the specified client from the list of clients this message was delivered to.
+ 	Called when the client responds to the message
+	*/
+	void RemoveAndDestroyClient(const TClientInfo& aClientInfo);
+public:
+	TSglQueLink iLink;
+private:
+
+	/**
+	Constructor
+	*/
+	CMessageRecipients();
+
+	TSglQue<TClientInfo> iClientInfo;
+	TSglQueIter<TClientInfo> iIter;
+	TClientInfoConstIter iConstIter;
+	TUint iTransactionId;
+	};
+
+/**
+A list of CMessageRecipients, for storing the list of messages that haven't yet
+had a response sent to the bearer and which clients each was delivered to
+*/
+NONSHARABLE_CLASS(CMessageRecipientsList): public CBase
+	{
+public:
+	/**
+	@return Ownership of a new CMessageRecipientsList object.
+	*/
+	static CMessageRecipientsList* NewL();
+	
+	/**
+	Destructor.
+	*/
+	~CMessageRecipientsList();
+	
+	/**
+	@return The list of messages and which client each was delivered to.
+	*/
+	TSglQue<CMessageRecipients>& Messages();
+	
+	/**
+	@return Iterator over the list of messages
+	*/
+	TSglQueIter<CMessageRecipients>& Iter();
+	
+	/**
+	Removes and deletes a message from the message recipients list with a specified transaction ID
+	Called when the response is sent to the bearer, or the last client has responded. 
+	*/
+	void RemoveAndDestroyMessage(const TUint aTransactionId);
+	
+	/**
+	@return pointer to a CMessageRecipients object with a specified transaction ID, or NULL
+	if one was not found
+	*/
+	CMessageRecipients* Message(TUint aTransactionId);
+	
+private:
+
+	/**
+	Constructor
+	*/
+	CMessageRecipientsList();
+
+	TSglQue<CMessageRecipients> iMessages;
+	TSglQueIter<CMessageRecipients> iIter;
+	};
+	
+#endif // MESSAGERECIPIENTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/messagesendobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,102 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server-side representation of a target client, which may have multiple 
+// server-side sessions open
+// 
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef MESSAGESENDOBSERVER_H
+#define MESSAGESENDOBSERVER_H
+
+class MRemConMessageSendObserver
+	{
+public:
+
+	/**
+	Called by CRemConServer to provide the result of an attempt to send a given message to a single remote.
+	This should be used in cases where a command can only be delivered to zero or one remotes (e.g. a notify command)
+	AND the observer does not require notification in advance of the number of remotes.
+	The observer should complete its client request with the error given here.
+	@param aMessage The CRemConMessage whose send was attempted.
+	@param aError The result of the send attempt (KErrNone in success).
+	*/
+	virtual void MrcmsoMessageSendResult(const CRemConMessage& aMessage, TInt aError)=0;
+
+	/**
+	Called by CRemConServer to notify the observer that an attempt is about to be made to send a particular message
+	to one or more remotes.
+	This allows CRemConServer to notify the session in advance of the number of remotes to which the send will be attempted.
+	If the number of remotes is 1, this method can still be used to provide the session with notification of the number of remotes.
+	MrcmsoMessageSendOneOrMoreResult() will be invoked for each remote to which an attempt is made to send the message.
+	The observer should keep track of the number of remotes to which the message is still to be sent and should complete its client
+	request once all remotes have been tried.
+	@param aMessage The CRemConMessage whose send is about to be attempted.
+	@param aNumRemotes The number of remotes that the message is to be sent to.
+	*/
+	virtual void MrcmsoMessageSendOneOrMoreAttempt(const CRemConMessage& aMessage, TUint aNumRemotes)=0;
+
+	/**
+	Called by CRemConServer to notify the observer that an attempt is about to be made to send a particular message to n 
+	further remotes.
+	This can be used when the exact number of remotes is not known at first. This should not be invoked after the first
+	attempt to send the message has been made.
+	The observer should keep track of the number of remotes to which the message is still to be sent and should complete its client
+	request once all remotes have been tried.
+	@param aMessage The CRemConMessage whose send is about to be attempted.
+	@param aNumRemotes The number of additional remotes that this message is to be sent to.
+	*/
+	virtual void MrcmsoMessageSendOneOrMoreIncremental(const CRemConMessage& aMessage, TUint aNumRemotes)=0;
+
+	/**
+	Called by CRemConServer to indicate that a message send attempt to one or more remotes could not be made.
+	For example, the send attempt may have failed because as the message could not be addressed.
+	The observer should complete its client	request immediately with the given error.
+	@param aMessage The CRemConMessage whose send was attempted.
+	@param aError An error preventing the attempt from being made.
+	*/
+	virtual void MrcmsoMessageSendOneOrMoreAttemptFailed(const CRemConMessage& aMessage, TInt aError)=0;
+
+	/**
+	Called by CRemConServer to provide the result of an attempt to send a given message to one of a number of remotes.
+	A call is made to this method for each remote for which an attempted send was made.
+	The observer should keep track of the number of remotes to which the message is still to be sent and should complete its client
+	request once all remotes have been tried.
+	If the message send result is unexpected (i.e. the observer believes that no remotes should have been tried), then the observer
+	may ignore this result. For example, the observers client may have cancelled its send request for this message.
+	@param aMessage The CRemConMessage whose send was attempted.
+	@param aError The result of the send attempt (KErrNone in success).
+	*/
+	virtual void MrcmsoMessageSendOneOrMoreResult(const CRemConMessage& aMessage, TInt aError)=0;
+
+	/**
+	Called by CRemConServer to indicate that the sending of a given message to a remote was abandoned.
+	This provides a mechanism whereby CRemConServer may drop a message without sending an error back
+	to the client. For example, if the message is not permitted by the TSP for the remote, or fails to match a
+	command, then the attempt for this remote should be abandoned but the client may still be completed
+	without error. If a message cannot be sent because of an error, then MrcmsoMessageSendResult() should be used.
+	The observer should keep track of the number of remotes to which the message is still to be sent and should complete its client
+	request once all remotes have been tried.
+	If the message send result is unexpected (i.e. the observer believes that no remotes should have been tried), then the observer
+	may ignore this result. For example, the observers client may have cancelled its send request for this message.
+	@param aMessage The CRemConMessage whose send was attempted.
+	*/
+	virtual void MrcmsoMessageSendOneOrMoreAbandoned(const CRemConMessage& aMessage)=0;
+
+	};
+
+#endif // MESSAGESENDOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/remconmessage.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,184 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCONMESSAGE_H
+#define REMCONMESSAGE_H
+
+#include <e32base.h>
+#include <remconaddress.h>
+#include <remcon/messagetype.h>
+#include <remcon/clientid.h>
+
+/**
+Encapsulates a message internal to RemCon server.
+*/
+NONSHARABLE_CLASS(CRemConMessage) : public CBase
+	{
+public:
+	/**
+	Factory function.
+	@param aAddr The remote address associated with the message (source or 
+	destination).
+	@param aMsgType The message type.
+	@param aMsgSubType The message subtype. This should be ERemConDefault,
+	except in the case of notify commands or notify responses
+	@param aInterfaceUid The UID of the outer-layer interface to which the 
+	message belongs.
+	@param aOperationId The operation ID of the message.
+	@param aData The data associated with the operation ID. On success, 
+	ownership of aData is taken.
+	@param aSessionId The unique ID of the CRemConSession associated with the 
+	message (source or destination).
+	@param aTransactionId The transaction of which this message is a part.
+	@param aIsReliableSend Stores whether the message was sent using Send or SendUnreliable
+	@return Ownership of a new CRemConMessage.
+	*/
+	static CRemConMessage* NewL(
+		const TRemConAddress& aAddr,
+		TRemConMessageType aMsgType,
+		TRemConMessageSubType aMsgSubType,
+		TUid aInterfaceUid,
+		TUint aOperationId,
+		const RBuf8& aData,
+		TUint aSessionId,
+		TUint aTransactionId,
+		TBool aIsReliableSend);
+	
+	/**
+	Factory function
+	Overload for messages created outside of CRemConSession, where the value of
+	aIsReliableSend is not relevant.
+	*/
+	static CRemConMessage* NewL(
+		const TRemConAddress& aAddr,
+		const TRemConClientId& aClient,
+		TRemConMessageType aMsgType,
+		TRemConMessageSubType aMsgSubType,
+		TUid aInterfaceUid,
+		TUint aOperationId,
+		const RBuf8& aData,
+		TUint aSessionId,
+		TUint aTransactionId);
+	
+	/**
+	Factory function.
+	@param aMsg The data in this message is copied to a new CRemConMessage. 
+	The new message does not take ownership of aMsg's OperationData, it makes 
+	its own copy.
+	@return Ownership of a new CRemConMessage.
+	*/
+	static CRemConMessage* CopyL(const CRemConMessage& aMsg);
+
+	~CRemConMessage();
+
+public:
+	// const accessors
+	inline const TRemConAddress& Addr() const;
+	inline const TRemConClientId& Client() const;
+	inline TRemConMessageType MsgType() const;
+	inline TUid InterfaceUid() const;
+	inline TUint OperationId() const;
+	inline const RBuf8& OperationData() const;
+	inline TUint SessionId() const;
+	inline TUint TransactionId() const;
+	inline TRemConMessageSubType MsgSubType() const;
+	inline TBool IsReliableSend() const;
+	
+	// non-const accessors- the only things which may be changed about a 
+	// message after it's been created
+	inline TRemConAddress& Addr();
+	inline RBuf8& OperationData();
+	inline TUint& SessionId();
+	inline TUint& TransactionId();
+	inline TRemConMessageSubType& MsgSubType();
+	
+public:
+	/** Link between elements of this type in a TSglQue. */
+	TSglQueLink iLink;
+
+private:
+	CRemConMessage(
+		const TRemConAddress& aAddr,
+		const TRemConClientId& aClient,
+		TRemConMessageType aMsgType,
+		TRemConMessageSubType aMsgSubType,
+		TUid aInterfaceUid,
+		TUint aOperationId,
+		const RBuf8& aData,
+		TUint aSessionId,
+		TUint aTransactionId,
+		TBool aIsReliableSend);
+	
+	static CRemConMessage* NewL(
+		const TRemConAddress& aAddr,
+		const TRemConClientId& aClient,
+		TRemConMessageType aMsgType,
+		TRemConMessageSubType aMsgSubType,
+		TUid aInterfaceUid,
+		TUint aOperationId,
+		const RBuf8& aData,
+		TUint aSessionId,
+		TUint aTransactionId,
+		TBool aIsReliableSend);
+
+private: // owned
+	/** For incoming messages, the address it came from. For outgoing 
+	messages, the address it's going to. */
+	TRemConAddress iAddr;
+	
+	/** For incoming messages this is the client which the bearer requested
+	the message be addressed to.  If the bearer did not address the command
+	it is set to KNullClientId.
+	*/
+	TRemConClientId iClient;
+
+	/** The message type (command or response). */
+	TRemConMessageType iMsgType;
+
+	/** The message subtype - could be
+	Default - used for normal commands or responses
+	Notify command awaiting interim/changed
+	Notify interim/changed response
+	*/
+	TRemConMessageSubType iMsgSubType;
+
+	/** The interface UID. */
+	TUid iInterfaceUid;
+
+	/** The operation ID. */
+	TUint iOperationId;
+
+	/** Arbitrary data associated with the operation. */
+	RBuf8 iData;
+
+	/** For outgoing commands, the ID of the sending session. */
+	TUint iSessionId;
+
+	/** The identifier of the transaction this message is part of. */
+	TUint iTransactionId;
+	
+	/** Whether the message was send using Send() or SendUnreliable(), if applicable */
+	TBool iIsReliableSend;
+	
+	};
+
+#include "remconmessage.inl"
+
+#endif // REMCONMESSAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/remconmessage.inl	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,94 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+const TRemConAddress& CRemConMessage::Addr() const
+	{
+	return iAddr;
+	}
+
+TRemConAddress& CRemConMessage::Addr()
+	{
+	return iAddr;
+	}
+
+const TRemConClientId& CRemConMessage::Client() const
+	{
+	return iClient;
+	}
+
+TRemConMessageType CRemConMessage::MsgType() const
+	{
+	return iMsgType;
+	}
+
+TUid CRemConMessage::InterfaceUid() const
+	{
+	return iInterfaceUid;
+	}
+
+TUint CRemConMessage::OperationId() const
+	{
+	return iOperationId;
+	}
+
+const RBuf8& CRemConMessage::OperationData() const
+	{
+	return iData;
+	}
+
+RBuf8& CRemConMessage::OperationData()
+	{
+	return iData;
+	}
+
+TUint CRemConMessage::SessionId() const
+	{
+	return iSessionId;
+	}
+
+TUint& CRemConMessage::SessionId()
+	{
+	return iSessionId;
+	}
+
+TUint CRemConMessage::TransactionId() const
+	{
+	return iTransactionId;
+	}
+
+TUint& CRemConMessage::TransactionId()
+	{
+	return iTransactionId;
+	}
+
+TRemConMessageSubType& CRemConMessage::MsgSubType()
+	{
+	return iMsgSubType;
+	}
+
+TRemConMessageSubType CRemConMessage::MsgSubType() const
+	{
+	return iMsgSubType;
+	}
+
+TBool CRemConMessage::IsReliableSend() const
+	{
+	return iIsReliableSend;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/server.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,649 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef SERVER_H
+#define SERVER_H
+
+#include <e32base.h>
+#include <e32msgqueue.h>
+#include <remcon/remcontargetselectorpluginobserver.h>
+#include <remcon/clientid.h>
+
+#include "bulkservermsgqueue.h"
+#include "connectionstate.h"
+#include "tspv4stub.h"
+#include "utils.h"
+
+class REComSession;
+class CBearerManager;	
+class CConverterManager;
+class CRemConTargetClientProcess;
+class CRemConSession;
+class CRemConTargetSession;
+class CRemConControllerSession;
+class CMessageQueue;
+class CRemConTargetSelectorPlugin;
+class CRemConMessage;
+class CRemConConverterPlugin;
+class CMessageRecipientsList;
+class TClientInfo;
+class TRemConAddress;
+class CConnectionHistory;
+class CConnections;
+class MRemConTargetSelectorPluginInterface;
+class MRemConTargetSelectorPluginInterfaceV2;
+class MRemConTargetSelectorPluginInterfaceV3;
+class MRemConTargetSelectorPluginInterfaceV4;
+class MRemConConverterInterface;
+
+// helper classes
+class CBulkThreadWatcher;
+
+/**
+The server class for Rem Con.
+*/
+NONSHARABLE_CLASS(CRemConServer) : public CPolicyServer, public MRemConTargetSelectorPluginObserver
+	{
+friend class CBulkThreadWatcher; // helper active object
+public:
+	/**
+	RemCon server construction.
+	@return Ownership of a new RemCon server object
+	*/
+	static CRemConServer* NewLC();
+
+	~CRemConServer();
+
+public: // called by controller session objects 
+
+	/** Called by a controller session when created. Cancels the 
+	shutdown timer in accordance with transient server design. */
+	TInt ControllerClientOpened(CRemConControllerSession& aSession);
+		
+	/** Called by a controller session when it has had its features registered. */
+	void ControllerClientAvailable();
+
+	/** Called by a controller session when it has had its client go connection oriented
+	Uses the bearer manager to inform bearers as appropriate
+	aUid is the uid of the bearer we are going connection oriented on.
+	*/
+	void ClientGoConnectionOriented(CRemConControllerSession& aSession, TUid aUid);
+	
+	/** Called by a controller session when it has had its client go connection less.
+	 Uses the bearer manager to inform bearers as appropriate.
+	 aUid is the uid of the bearer we were connection oriented on,
+	*/
+	void ClientGoConnectionless(CRemConControllerSession& aSession, TUid aUid);
+
+	/** Called by a controller session it is destroyed. Starts the 
+	shutdown timer if necessary in accordance with transient server design. 
+	Does not assume that the session successfully registered itself with the 
+	server to begin with.
+	aUid is the bearer uid the session was on for connection oriented sessions,
+	if KNullUid the session was connectionless, 
+	*/
+	void ControllerClientClosed(CRemConControllerSession& aSession, TUid aUid);
+
+	/**
+	Sends a command.
+	Puts the command on the 'pending TSP' queue so the TSP can either address 
+	it or give it permission to send.
+	Always takes ownership of aMsg. 
+	*/
+	void SendCommand(CRemConMessage& aMsg);
+
+	/**
+	Removes any current message from this controller session from the 'outgoing pending 
+	TSP' queue. If the message is that currently being dealt with by the TSP, 
+	then cancels the TSP's operation.
+	*/
+	void SendCancel(CRemConControllerSession& aSess);
+
+	/**
+	Tries to complete a Receive request for a controller session.
+	Called by controller sessions when a Receive request is posted. The 'incoming pending 
+	delivery' queue is checked for commands waiting to be delivered to 
+	aSession. The controller session's request is completed with the first such found.
+	*/
+	void ReceiveRequest(CRemConControllerSession& aSession);
+	
+public:	// Called by target client objects (either CRemConTargetClientProcess or CRemConTargetSession)
+
+	/** 
+	Called by CRemConTargetClientProcess to cancel the servers shutdown timer when a new
+	target session has been opened.
+	*/
+	void CancelShutdownTimer();
+
+	/** Called by CRemConTargetClientProcess to notify the server that it is available.
+	This is done when the client has registered one or more interfaces. */
+	void TargetClientAvailable(const CRemConTargetClientProcess& aClient);
+
+	/** Called by CRemConTargetClientProcess to notify the server that it has registered
+	additional intefaces. */
+	void TargetFeaturesUpdated(CRemConTargetClientProcess& aClient);
+
+	/** Called by CRemConTargetClientProcess to notify the server that a target session
+	has closed. */
+	void TargetSessionClosed(CRemConTargetClientProcess& aClient, CRemConTargetSession& aSession);
+
+	/** Called by CRemConTargetClientProcess to notify the server that a client session is closing.
+	Starts the shutdown timer if necessary in accordance with transient server design. 
+	Does not assume that the session successfully registered itself with the 
+	server to begin with.
+	*/
+	void TargetClientClosed(CRemConTargetClientProcess& aClient);
+
+	/** Called by a client instance when a session is created. Makes an item 
+	for the session in the record of which points in the connection history 
+	sessions are interested in. */
+	TInt RegisterTargetSessionPointerToConnHistory(const CRemConTargetSession& aSession);
+
+	/**
+	Starts the process of sending a response, via the TSP
+	Completes the client's send message with a bearer-level error.
+	Always takes ownership of aMsg. 
+	*/
+	void SendResponse(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient);
+
+	/** Finishes the process of sending a response, after the TSP
+	has permitted the response
+	Always takes onwership of aMsg.
+	*/
+	void CompleteSendResponse(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient);
+
+	/**
+	Sends a reject back to the bearer.
+	*/
+	void SendReject (TRemConAddress aAddr, TUid aInterfaceUid, TUint aOperationId, TUint aTransactionId);
+
+	/**
+	Tries to complete a Receive request for a target client.
+	Called by clients when a Receive request is posted. The 'incoming pending 
+	delivery' queue is checked for commands waiting to be delivered to 
+	the client. A delivery attempt is made for each pending message.
+	*/
+	void ReceiveRequest(CRemConTargetClientProcess& aClient);
+
+public:	// called by controller and target sessions
+
+	/** Returns the current bearer-level connection state of the system. */
+	CConnections& Connections();
+
+	/** Each session has a pointer into the connection history- pointing at 
+	the record in the history in which the session is interested. This 
+	function moves the pointer (for the given session) to the last item in the 
+	history. */
+	void SetConnectionHistoryPointer(TUint aSessionId);
+
+	/** Gets the record in the connection history which the session is 
+	pointing to. */
+	const CConnections& Connections(TUint aSessionId) const;
+
+	/** Returns ETrue if the given session's currently flagged connection 
+	history record is the 'Last' connection history record, i.e. the current 
+	connection set. Returns EFalse otherwise. */
+	TBool ConnectionHistoryPointerAtLatest(TUint aSessionId) const;
+
+	/**
+	Determines a state of a connection to the given remote address.
+	@param - aAddr, remote address of a connection
+	@return - connection state 
+	*/
+	TConnectionState ConnectionState(const TRemConAddress& aAddr);
+
+	/**
+	Informs RemCon server that one of the interfaces being used by the calling
+	session requires the use of the bulk server.
+	*/
+	TInt BulkServerRequired();	
+	
+public: // called by the bearer manager 
+
+	/** This function is called when a ConnectIndicate is handled by the 
+	bearer manager (in which case aError will be KErrNone) and when 
+	ConnectConfirm is handled by the bearer manager (in which case aError will 
+	be the connection error). 
+	@return Error. If we cannot handle the new connection (if there is one) 
+	then the bearer must drop the connection. Note that if aError is not 
+	KErrNone the return value will be meaningless.
+	*/
+	TInt HandleConnection(const TRemConAddress& aAddr, TInt aError);
+
+	/** This function is called when a connection goes away, either by 
+	indication (from the remote end) or confirmation (from our end). */
+	void RemoveConnection(const TRemConAddress& aAddr, TInt aError);
+
+	/** 
+	Handles a new incoming response. 
+	Finds the (assumed single) command on the 'outgoing sent' queue matching 
+	it, to find the session which sent _that_. Gives the new response to that 
+	client session. 
+	Always takes ownership of aMsg. 
+	*/
+	void NewResponse(CRemConMessage& aMsg);
+	
+	/** 
+	Handles a new incoming response for a notify command. 
+	Finds the (assumed single) command on the 'outgoing sent' queue matching 
+	it, to find the session which sent _that_. Gives the new response to that 
+	client session. 
+	Always takes ownership of aMsg. 
+	*/
+	void NewNotifyResponse(CRemConMessage& aMsg);
+
+	/** 
+	Handles a new incoming command.
+	Puts the message on the 'incoming response pending' queue. If the TSP is 
+	not busy, asks it to address the message to target client(s). If the TSP 
+	is busy, then the queue will be checked (and the next message handled) 
+	when the TSP calls IncomingCommandAddressed. 
+	Always takes ownership of aMsg.
+	*/
+	void NewCommand(CRemConMessage& aMsg);
+	
+	/** 
+	Handles a new incoming notify command.
+	Puts the message on the 'incoming response pending' queue. If the TSP is 
+	not busy, asks it to address the message to target client. If the TSP 
+	is busy, then the queue will be checked (and the next message handled) 
+	when the TSP calls IncomingNotifyCommandAddressed. 
+	Always takes ownership of aMsg.
+	*/
+	void NewNotifyCommand(CRemConMessage& aMsg);
+
+	/** Returns the converter interface which supports the given outer-layer 
+	API and bearer UIDs, or NULL if it does not exist. */
+	MRemConConverterInterface* Converter(TUid aInterfaceUid, TUid aBearerUid) const;
+	
+	/** Returns the converter interface which supports the given outer-layer 
+	API and bearer UIDs, or NULL if it does not exist. */
+	MRemConConverterInterface* Converter(const TDesC8& aInterfaceData, TUid aBearerUid) const;
+
+	void CommandExpired(TUint aTransactionId);
+	
+	TInt SupportedInterfaces(const TRemConClientId& aId, RArray<TUid>& aUids);
+	TInt SupportedOperations(const TRemConClientId& aId, TUid aInterfaceUid, RArray<TUint>& aOperations);
+	TInt ControllerSupportedInterfaces(RArray<TUid>& aSupportedInterfaces);
+	
+	void SetRemoteAddressedClient(const TUid& aBearerUid, const TRemConClientId& aId);
+	
+	TInt RegisterLocalAddressedClientObserver(const TUid& aBearerUid);
+	TInt UnregisterLocalAddressedClientObserver(const TUid& aBearerUid);
+
+public: // called by bulk server
+	TRemConClientId ClientIdByProcessId(TProcessId aProcessId);
+	
+	void BulkInterfacesForClientL(TRemConClientId aId, RArray<TUid>& aUids);
+
+private:
+	/** Constructor. */
+	CRemConServer();
+
+	/** 2nd-phase construction. */
+	void ConstructL();
+	
+private: // from CPolicyServer
+	/**
+	Called by the base class to create a new session.
+	@param aVersion Version of client
+	@param aMessage Client's IPC message
+	@return A new session to be used for the client. If this could not be made, 
+	this function should leave.
+	*/
+	CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const;
+
+private: // from MRemConTargetSelectorPluginObserver
+	void MrctspoDoOutgoingCommandAddressed(TInt aError);
+	void MrctspoDoOutgoingCommandPermitted(TBool aIsPermitted);
+	void MrctspoDoOutgoingNotifyCommandPermitted(TBool aIsPermitted);
+	void MrctspoDoIncomingCommandAddressed(TInt aError);
+	TInt MrctspoDoGetConnections(TSglQue<TRemConAddress>& aConnections);
+	void MrctspoDoOutgoingResponsePermitted(TBool aIsPermitted);
+	void MrctspoDoIncomingNotifyAddressed(TClientInfo* aClientInfo, TInt aError);
+	void MrctspoDoReAddressNotifies();
+	void MrctspoDoOutgoingNotifyCommandAddressed(TRemConAddress* aConnection, TInt aError);
+	void MrctspoDoIncomingCommandPermitted(TBool aIsPermitted);
+	void MrctspoDoIncomingNotifyPermitted(TBool aIsPermitted);
+	TInt MrctspoSetLocalAddressedClient(const TUid& aBearerUid, const TClientInfo& aClientInfo);
+
+private: // utility
+	CRemConControllerSession* CreateControllerSessionL(const RMessage2& aMessage);
+	CRemConTargetSession* CreateTargetSessionL(const RMessage2& aMessage);
+
+	/** Extracts a client's process ID and secure ID from a given RMessage2 and stores
+	in a given TClientInfo. */
+	void ClientProcessAndSecureIdL(TClientInfo& aClientInfo, const RMessage2& aMessage) const;
+
+	void RemoveSessionFromConnHistory(const CRemConSession& aSession);
+
+	/** Removes connection history records which are no longer interesting and 
+	updates the indices in iSession2ConnHistory accordingly. */
+	void UpdateConnectionHistoryAndPointers();
+
+	CRemConControllerSession* ControllerSession(TUint aSessionId) const;
+	CRemConTargetClientProcess* TargetClient(TUint aClientId) const;
+	CRemConTargetClientProcess* TargetClient(TProcessId aProcessId) const;
+	
+	void StartShutdownTimerIfNoClientsOrBulkThread();
+	void TryToDropClientProcess(TUint aClientIndex);
+	void LoadTspL();
+	
+	TBool FindDuplicateNotify(CRemConMessage& aMsg);
+	
+#ifdef __FLOG_ACTIVE
+	void LogControllerSessions() const;
+	void LogTargetSessions() const;
+	void LogRemotes() const;
+	void LogConnectionHistoryAndInterest() const;
+	void LogOutgoingCmdPendingTsp() const;
+	void LogOutgoingNotifyCmdPendingTsp() const;
+	void LogOutgoingRspPendingTsp() const;
+	void LogOutgoingPendingSend() const;
+	void LogOutgoingSent() const;
+	void LogIncomingCmdPendingAddress() const;
+	void LogIncomingNotifyCmdPendingAddress() const;
+	void LogIncomingNotifyCmdPendingReAddress() const;
+	void LogIncomingPendingDelivery() const;
+	void LogIncomingDelivered() const;
+#endif // __FLOG_ACTIVE
+	
+	CMessageQueue& OutgoingCmdPendingTsp();
+	CMessageQueue& OutgoingNotifyCmdPendingTsp();
+	CMessageQueue& OutgoingRspPendingTsp();
+	CMessageQueue& OutgoingRspPendingSend();
+	CMessageQueue& OutgoingPendingSend();
+	CMessageQueue& OutgoingSent();
+	
+	CMessageQueue& IncomingCmdPendingAddress();
+	CMessageQueue& IncomingNotifyCmdPendingAddress();
+	CMessageQueue& IncomingNotifyCmdPendingReAddress();
+	CMessageQueue& IncomingPendingDelivery();
+	CMessageQueue& IncomingDelivered();
+
+	/** 
+	Utility for sending a single outgoing command to a remote.
+	Takes a copy of aMsg and sets its Addr to aConn. If aConn exists as a 
+	bearer-level connection then it tries to send the message. If the send 
+	fails, the new message is destroyed and the function leaves. If the send 
+	succeeds, the new message is put on OutgoingSent. 
+	If aConn does not exist as a bearer-level connection, the new message is 
+	put on OutgoingPendingSend and the bearer is requested to bring up the 
+	connection.
+	Whatever happens, ownership of the new message is retained. Ownership of 
+	aMsg stays with the caller.
+	@param aSync If aConn exists as a bearer-level connection, this is set 
+	to ETrue, otherwise it is set to EFalse. It effectively indicates whether 
+	a send attempt was made synchronously (ETrue) or if we'll have to wait for 
+	a bearer-level connection to come up (EFalse). aSync is guaranteed to be 
+	set correctly whether the function leaves or not.
+	*/
+	void SendCmdToRemoteL(const CRemConMessage& aMsg, const TRemConAddress& aConn, TBool& aSync);
+
+	/** 
+	Utility for delivering a single incoming command to a client session.
+	Takes a copy of aMsg, sets its SessionId, and delivers it to aSess, 
+	putting it on the correct queue. 
+	Does not take ownership of aMsg.
+	*/
+	void DeliverCmdToClientL(const CRemConMessage& aMsg, CRemConTargetClientProcess& aClient);
+
+	/** 
+	Utility for delivering a single message to a controller client session.
+	If the session aSess has an outstanding Receive request, completes the 
+	request with aMsg. Otherwise, puts aMsg in the 'incoming pending delivery' 
+	queue. 
+	Always takes ownership of aMsg.
+	@return KErrNone if the message was successfully delivered or put on the
+	incoming pending delivered queue, otherwise one of the system wide error codes
+	Ownership of aMsg will be taken regardless of the error.
+	*/
+	TInt DeliverMessageToClient(CRemConMessage& aMsg, CRemConControllerSession& aSess);
+
+	/** 
+	Utility for delivering a single message to a target client.
+	If the client aClient has an outstanding Receive request, completes the 
+	request with aMsg and puts aMsg the 'incoming delivered' queue (since it
+	shall be a command). Otherwise, puts aMsg in the 'incoming pending delivery' 
+	queue. 
+	Always takes ownership of aMsg.
+	@return KErrNone if the message was successfully delivered or put on the
+	incoming pending delivered queue, otherwise one of the system wide error codes
+	Ownership of aMsg will be taken regardless of the error.
+	*/
+	TInt DeliverMessageToClient(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient);
+
+	/** Gives the head outgoing command to the TSP for (a) addressing to 
+	remote target(s), if its address is null, or (b) permission to send, if it 
+	has a remote address. */
+	void TspOutgoingCommand();
+	
+	void TspOutgoingNotifyCommand();
+	
+	/** Gives the head incoming command to the TSP for addressing to target 
+	client(s). */
+	void AddressIncomingCommand();
+	
+	/** Gives the head incoming notify command to the TSP for addressing to target 
+	client. */
+	void AddressIncomingNotifyCommand();
+
+	/** Gives the head incoming notify command to the TSP for readdressing to target 
+	client. */
+	void ReAddressIncomingNotifyCommand();
+
+	
+	/** Gives the head outgoing response to the TSP for permission to send */
+	void PermitOutgoingResponse();
+	
+	TClientInfo* TargetClientIdToClientInfo(TRemConClientId aId);
+	
+	void InitialiseBulkServerThreadL();
+
+private: // called by the shutdown timer
+	/** 
+	Called by the shutdown timer when it fires. Terminates the server thread. 
+	@param aThis This. 
+	@return KErrNone.
+	*/
+	static TInt TimerFired(TAny* aThis);
+
+private: // owned
+	// Holds the history of the connection states of the system.
+	CConnectionHistory* iConnectionHistory;
+
+	// NB This isn't really being used as a CPeriodic, but (a) it will do the 
+	// job, and (b) it saves us writing our own concrete timer (there aren't 
+	// any other more suitable concrete timer classes).
+	CPeriodic* iShutdownTimer;
+
+	// Shutdown delay (when there are no sessions) = 1 second- there's no 
+	// point hanging around.
+	static const TUint KShutdownDelay = 1 * 1000 * 1000;
+	
+	// Not to be deleted, only closed (see ECOM API documentation).
+	REComSession* iEcom; 
+
+	CBearerManager* iBearerManager;
+	CConverterManager* iConverterManager;
+
+	// Unique identifier seed for sessions and clients.
+	// Controller sessions, target clients and target sessions all need a unique ID.
+	TUint iSessionOrClientId;
+
+	RPointerArray<CRemConControllerSession> iControllerSessions;
+	RPointerArray<CRemConTargetClientProcess> iTargetClients;
+	mutable RNestableLock iTargetClientsLock; 
+
+	// In the following discussion, mark carefully the difference between a 
+	// QUEUE of items awaiting serialised access to a resource, and a LOG of 
+	// things which have happened which we need to remember.
+	// There are nine collections of messages in the server:
+	// 1/ OutgoingCmdPendingTsp
+	// This is a QUEUE of commands (a) from our connectionless controller 
+	// clients, waiting to be addressed by the TSP, and (b) from our 
+	// connection-oriented controller clients, waiting to be 'permitted' by 
+	// the TSP. On sending, commands move off this queue to OutgoingPendingSend
+	// 2/ OutgoingRspPendingTsp
+	// This is a QUEUE of responses (a) from our clients waiting to be 
+	// 'permitted' by the TSP. On sending, commands move off this queue to...
+	// 3/ OutgoingPendingSend
+	// This is a QUEUE of messages, waiting for the relevant 
+	// bearer connection to exist so they can be sent. On sending, commands 
+	// move off this queue to...
+	// 4/ OutgoingSent
+	// This is a LOG of commands sent by our controller clients. Items here 
+	// have been given to bearers and are awaiting responses from remotes. We 
+	// remember these commands in order to match responses to the controller 
+	// session which sent the originating command.
+	// 5/ IncomingCmdPendingAddress
+	// This is a QUEUE of incoming commands (i.e. from remotes). Items here 
+	// are waiting to be given to the TSP for addressing. On being addressed 
+	// they move to IncomingPendingDelivery.
+	// 6/ IncomingNotifyCmdPendingAddress
+	// This is a QUEUE of incoming Notify commands (i.e. from remotes). Items here 
+	// are waiting to be given to the TSP for addressing. On being addressed 
+	// they move to Incoming PendingDelivery
+	// 7/ IncomingNotifyCmdPendingReAddress
+	// This is a QUEUE of incmoing Notify commands (i.e. from remotes). Items here 
+	// are waiting to be given to the TSP for readdressing, after the TSP called
+	// ReAddressNotifies. They are copied from IncomingDelivered, then the equivalent
+	// command is removed from IncomingDelivered after the TSP has readdressed, and
+	// moved to IncomingPendingDelivery
+	// 8/ IncomingPendingDelivery
+	// This is a QUEUE of incoming messages (commands and responses) waiting 
+	// to be given to our clients, i.e. for the client to post a Receive 
+	// request. (This is so that messages don't get dropped just because a 
+	// client hasn't reposted Receive quickly enough.) On being delivered, 
+	// responses are destroyed, but commands move to...
+	// 9/ IncomingDelivered
+	// This is a LOG of delivered commands. We remember them in order to 
+	// address responses to the correct remote.
+	CMessageQueue* iOutgoingCmdPendingTsp;
+	CMessageQueue* iOutgoingNotifyCmdPendingTsp;
+	CMessageQueue* iOutgoingRspPendingTsp;
+	CMessageQueue* iOutgoingRspPendingSend;
+	CMessageQueue* iOutgoingPendingSend;
+	CMessageQueue* iOutgoingSent;
+	
+	CMessageQueue* iIncomingCmdPendingAddress;
+	CMessageQueue* iIncomingNotifyCmdPendingAddress;
+	CMessageQueue* iIncomingNotifyCmdPendingReAddress;
+	CMessageQueue* iIncomingPendingDelivery;
+	CMessageQueue* iIncomingDelivered;
+
+	// NB IncomingPendingDelivery and IncomingDelivered would be more logical 
+	// as members of the session class, as we know which session these 
+	// messages are associated with. They are here in the server with the 
+	// other queues in order to make the flow of messages through the whole 
+	// system clearer and therefore easier to maintain.
+
+	// The target selector plugin, which controls the flow of commands through 
+	// the server.
+	CRemConTargetSelectorPlugin* iTsp;
+	// This is the object supplied by the TSP which implements the TSP API. 
+	// This is the mandatory base value and is guaranteed to exist once the 
+	// TSP has been load.
+	MRemConTargetSelectorPluginInterface* iTspIf;
+
+	// This is the object supplied by the TSP which implements the TSP V2 API. 
+	// The TSP may not support this interface so RemCon must handle this value
+	// being NULL.
+	MRemConTargetSelectorPluginInterfaceV2* iTspIf2;
+	
+	// This is the object supplied by the TSP which implements the TSP V3 API.
+	// The TSP may not support this interface, so RemCon must handle this 
+	// value being NULL
+	MRemConTargetSelectorPluginInterfaceV3* iTspIf3;
+
+	// This is the object supplied by the TSP which implements the TSP V4 API.
+	// If the TSP does not implement it itself this points to a stub object
+	// implementing default behaviour, so it is guaranteed to exist once the TSP
+	// has been loaded.
+	MRemConTargetSelectorPluginInterfaceV4* iTspIf4;
+	
+	// This is the object supplied by the TSP which implements the TSP V5 API.
+	// The TSP may not support this interface, so RemCon must handle this 
+	// value being NULL
+	MRemConTargetSelectorPluginInterfaceV5* iTspIf5;
+	
+	// Collections we pass to the TSP for it to indicate addressing 
+	// information back to us.
+	TSglQue<TRemConAddress> iTspConnections;
+	TSglQue<TClientInfo> iTspIncomingCmdClients;
+	TSglQue<TClientInfo> iTspIncomingNotifyCmdClients;
+
+	// List of which clients each message was delivered to	
+	CMessageRecipientsList* iMessageRecipientsList;
+	
+	// Flags to control serialised access to the three parts of the TSP API.
+	TBool iTspHandlingOutgoingCommand;
+	TBool iTspHandlingOutgoingNotifyCommand;
+	TBool iTspAddressingIncomingCommand;
+	TBool iTspAddressingIncomingNotifyCommand;
+	TBool iTspReAddressingIncomingNotifyCommands;
+	TBool iTspHandlingOutgoingResponse;
+
+	// Flags to control when a command is expired while being handled in TSP, so RemCon
+	// knows to remove them when the TSP is finished
+	TBool iTspDropIncomingCommand;
+	TBool iTspDropIncomingNotifyCommand;
+	
+	/** We have an array of these records, one for each session. At any point 
+	in time, each session's record's iIndex is the index of the connection 
+	history record in which that session is currently interested. */
+	struct TSessionPointerToConnectionHistory
+		{
+		/** The session ID. */
+		TUint iSessionId;
+
+		/** The index of the connection history record. */
+		TUint iIndex;
+		};
+	RArray<TSessionPointerToConnectionHistory> iSession2ConnHistory;
+	
+	TTspV4Stub iTspIf4Stub;
+
+	TBool iBulkThreadOpen;
+	RThread iBulkServerThread;
+	RMsgQueue<TBulkServerMsg> iBulkServerMsgQueue;
+	CBulkThreadWatcher*	iBulkThreadWatcher;
+	};
+
+// Inlines
+
+NONSHARABLE_CLASS(CBulkThreadWatcher)
+	: public CActive
+	{
+public:
+	CBulkThreadWatcher(CRemConServer& aServer);
+	~CBulkThreadWatcher();
+	
+	void StartL();
+	
+private: // from CActive
+	void RunL();
+	void DoCancel();
+	
+private: // unowned
+	CRemConServer&	iServer;
+	};
+
+#endif // SERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/serversecuritypolicy.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,64 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server Security Policy definitions.
+// 
+//
+
+/**
+ @file 
+ @internalComponent
+*/
+ 
+#ifndef REMCONSERVERSECURITYPOLICY_H
+#define REMCONSERVERSECURITYPOLICY_H
+
+#include <e32base.h>
+#include "remconserver.h"
+
+/** RemCon Server Security Policy Definition */
+const TUint KRemConServerRangeCount = 2;
+
+const TInt KRemConServerRanges[KRemConServerRangeCount] = 
+	{
+	ERemConDbgMarkHeap, 			/** pass */
+	ERemConNumberOfServerFunctions,	/** fail (to KMaxTInt) */
+	};
+
+/** Index numbers into KRemConServerElements[] */
+const TInt KPolicyPass = 0;
+
+/** Mapping IPCs to policy element */
+const TUint8 KRemConServerElementsIndex[KRemConServerRangeCount] = 
+	{
+	KPolicyPass,					/** All (valid) APIs */
+	CPolicyServer::ENotSupported,	/** remainder of possible IPCs */
+	};
+
+/** Individual policy elements */
+const CPolicyServer::TPolicyElement KRemConServerElements[] = 
+	{
+		{ _INIT_SECURITY_POLICY_PASS },
+	};
+
+/** Main policy */
+const CPolicyServer::TPolicy KRemConServerPolicy = 
+	{
+	CPolicyServer::EAlwaysPass, /** Specifies all connect attempts should pass */
+	KRemConServerRangeCount,
+	KRemConServerRanges,
+	KRemConServerElementsIndex,
+	KRemConServerElements,
+	};
+	
+#endif // REMCONMANSERVERSECURITYPOLICY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/session.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,344 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCONSESSION_H
+#define REMCONSESSION_H
+
+#include <e32base.h>
+#include <remconserverpanic.h>
+#include <remconaddress.h>
+#include <remcon/clientinfo.h>
+#include <remcon/clienttype.h>
+#include <remcon/messagetype.h>
+#include <remcon/playertype.h>
+#include <remcon/clientid.h>
+
+class CRemConServer;
+class CBearerManager;
+class CRemConMessage;
+class CMessageQueue;
+class CRemConInterfaceDetailsArray;
+class CRemConInterfaceDetails;
+
+/**
+Rem Con session.
+*/
+NONSHARABLE_CLASS(CRemConSession) : public CSession2
+	{
+public:
+	~CRemConSession();
+
+public: // called by the server
+	/** 
+	@return The number of remotes the current 'send' has gone to successfully.
+	*/
+	inline TUint& NumRemotes();
+
+	/** 
+	@return The number of remotes the current 'send' is supposed to be going 
+	to. NB This is decremented as the sends actually occur.
+	*/
+	inline TInt& NumRemotesToTry();
+
+	/** 
+	@return The error the current 'send' will be completed with.
+	*/
+	inline TInt& SendError();
+
+	/** 
+	@return Information about the client using this session.
+	*/
+	inline TClientInfo& ClientInfo();
+
+	/** 
+	@return Information about the client using this session.
+	*/
+	inline const TClientInfo& ClientInfo() const;
+
+	/**
+	@return This session's unique identifier.
+	*/
+	inline TUint Id() const;
+
+	/**
+	Used by the server to complete a client send request. 
+	@param aError Error.					
+	*/
+	void CompleteSend();
+	
+	/**
+	Used by the server to complete a client send notify request.
+	*/
+	void CompleteSendNotify();
+	
+	/** 
+	Checks if this message is supported by the session
+	@return ETrue if it is, EFalse otherwise
+	*/
+	virtual TBool SupportedMessage(const CRemConMessage& aMsg) const = 0;
+
+	/**
+	Writes aMsg to the client's Receive message (NB RMessage2::Write may fail) 
+	and completes the client's Receive message with any error.
+	@return Error.
+	*/
+	TInt WriteMessageToClient(const CRemConMessage& aMsg);
+
+	/**
+	Accessor for the currently outstanding client Send message. This is used 
+	to check the client's capabilities to send over a particular bearer.
+	@return Handle to client's send message.
+	*/
+	inline const RMessage2& CurrentSendMessage() const;
+
+	/**
+	Accessor for the currently outstanding client Receive message.
+	@return Handle to client's receive message.
+	*/
+	inline const RMessage2& CurrentReceiveMessage() const;
+	
+	TInt SupportedInterfaces(RArray<TUid>& aUids);
+	TInt AppendSupportedInterfaces(RArray<TUid>& aUids);
+	TInt SupportedBulkInterfaces(RArray<TUid>& aUids);
+	TInt AppendSupportedBulkInterfaces(RArray<TUid>& aUids);
+	TInt SupportedOperations(TUid aInterfaceUid, RArray<TUint>& aOperations);
+
+	/**
+	Panics the client's current Send message with the given code.
+	*/
+	void PanicSend(TRemConClientPanic aCode);
+	
+	/**
+	Checks whether this session is fully initialised and available for use
+	by bearers.
+	@return ETrue if session can be used by bearers, EFalse otherwise
+	*/
+	inline TBool ClientAvailable() const;
+
+	/**
+	Indicates that a connection has come up or down. If the session has a 
+	'connections notification' outstanding, it should be completed. Note that, 
+	when a connection comes up or down, ConnectionsChanged is called before 
+	CompleteConnect or DisconnectComplete. These functions are called 
+	synchronously by the connection-handling code.
+	*/
+	void ConnectionsChanged();
+	
+protected:
+    /**
+    Constructor.
+    @param aServer The server.
+    @param aBearerManager The bearer manager.
+    @param aId The unique ID of the new session.
+    */
+    CRemConSession(CRemConServer& aServer, 
+        CBearerManager& aBearerManager,
+        TUint aId);
+    
+    /**
+    2nd-phase construction.
+    @param aMessage The message received from the client.
+    */
+    void BaseConstructL(const TClientInfo& aClientInfo);
+
+	
+protected: 		
+
+	/**
+	Utility to complete the given message with the given error code.
+	@param aMessage Message to complete.
+	@param aError Error to complete with.
+	*/
+	void CompleteClient(const RMessage2& aMessage, TInt aError);
+
+	CRemConInterfaceDetailsArray* ExtractInterestedAPIsL(const RMessage2& aMessage);
+	
+	/**
+	Gets the information needed to send from the RMessage.
+	
+	@param aMessage The message containing the info.
+	@param aInterfaceUid The uid of the interface to send on
+	@param aOperationId The operation id to send
+	@param aMessageSubType The sub type of hte message
+	@param aSendDes The operation data to send.  Ownership is passed
+					to the caller and aSendDes is placed on the cleanup
+					stack when this function completes successfully.
+	@leave If the data was not successfully read. Note: if the message is invalid
+	       this function will not leave, but rather panic the message and return
+	       EFalse. This function will only leave if there's a system error, such
+	       as out of memory.
+	@return ETrue if the message information was successfully retrieved,
+			or EFalse if the message is invalid, in which case it got panicked.
+			If this function returns EFalse, aSendDes is not left on the cleanup stack.
+	 */
+	TBool DoGetSendInfoLC(const RMessage2& aMessage, 
+			TUid& aInterfaceUid,
+			TUint& aOperationId,
+			TRemConMessageSubType& aMessageSubType,
+			RBuf8& aSendDes);
+			
+	
+protected: // from CSession2
+	/**
+	Called when a message is received from the client.
+	
+	Also used from the session, where a session has stored
+	a message for later	processing.
+	
+	@param aMessage Message received from the client.
+	*/
+	void ServiceL(const RMessage2& aMessage);
+
+private: // utility- IPC command handlers
+	virtual void SetPlayerType(const RMessage2& aMessage)=0;
+	virtual void SendUnreliable(const RMessage2& aMessage) = 0;
+	virtual void SendCancel(const RMessage2& aMessage);
+	virtual void Receive(const RMessage2& aMessage);
+	virtual void ReceiveCancel(const RMessage2& aMessage);
+	virtual void GetConnectionCount(const RMessage2& aMessage);
+	virtual void GetConnections(const RMessage2& aMessage);
+	virtual void NotifyConnectionsChange(const RMessage2& aMessage);
+	virtual void NotifyConnectionsChangeCancel(const RMessage2& aMessage);
+	virtual void RegisterInterestedAPIs(const RMessage2& aMessage) = 0;
+	virtual void GoConnectionOriented(const RMessage2& aMessage);
+	virtual void GoConnectionless(const RMessage2& aMessage);
+	virtual void ConnectBearer(const RMessage2& aMessage);
+	virtual void ConnectBearerCancel(const RMessage2& aMessage);
+	virtual void DisconnectBearer(const RMessage2& aMessage);
+	virtual void DisconnectBearerCancel(const RMessage2& aMessage);
+	virtual void SendNotify(const RMessage2& aMessage);
+	void Send(const RMessage2& aMessage);
+
+private: // utility
+	virtual CRemConMessage* DoPrepareSendMessageL(const RMessage2& aMessage)=0;
+	virtual void DoSendCancel()=0;
+	virtual void DoReceive()=0;
+	void WriteMessageToClientL(const CRemConMessage& aMsg);
+	virtual void SendToServer(CRemConMessage& aMsg)=0;
+	static TInt SendNextCb(TAny* aThis);
+	void DoSendNext();
+
+protected:
+	void DoSendL(const RMessage2& aMessage);
+	void GetPlayerTypeAndNameL(const RMessage2& aMessage, TPlayerTypeInformation& aPlayerType, RBuf8& aPlayerName);
+	CRemConInterfaceDetails* FindInterfaceByUid(TUid aUid) const;
+	
+protected: // unowned
+	CRemConServer& iServer;
+	CBearerManager& iBearerManager;
+
+protected: // message handles for asynchronous IPC requests
+	RMessage2 iSendMsg;
+	RMessage2 iReceiveMsg;
+	RMessage2 iNotifyConnectionsChangeMsg;
+
+	CMessageQueue* iSendQueue;
+	
+protected: // owned
+	// The client's process ID, secure ID and caps.
+	TClientInfo iClientInfo;
+
+	// Unique session identifier.
+	const TUint iId;
+
+	// Used to control the completion of the client's send request until we 
+	// know the correct values of iNumSuccessfulRemotes and iSendError to use.
+	// Generally 0. 
+	// 1 when sending a connection-oriented command or a response.
+	// N when sending a connectionless command (where N is the number of 
+	// remotes the TSP addressed it to). 
+	// While processing outgoing commands to multiple remotes, 
+	// iNumRemotesToTry is decremented each time we finish trying to address a 
+	// remote. This may be at the connection stage or the actual send stage.
+	// On return to 0, the client is completed with either the result of the send
+	// or KErrCancel.
+	TInt iNumRemotesToTry;
+	// For completion of the current send request. NB A send may be completed 
+	// only after numerous asynchronous stages.
+	TUint iNumRemotes;
+	TInt iSendError;
+	
+	CRemConInterfaceDetailsArray* iInterestedAPIs;
+	
+	CAsyncCallBack* iSendNextCallBack;
+	
+	enum TRemConSessionSending
+		{
+		ENotSending,
+		ESendingReliable,
+		ESendingUnreliable
+		};
+	
+	TRemConSessionSending iSending;
+
+	TBool iInGetConnectionsProcedure;
+	};
+
+// Inlines
+
+TInt& CRemConSession::NumRemotesToTry()
+	{
+	return iNumRemotesToTry;
+	}
+
+TUint& CRemConSession::NumRemotes()
+	{
+	return iNumRemotes;
+	}
+
+TInt& CRemConSession::SendError()
+	{
+	return iSendError;
+	}
+
+TClientInfo& CRemConSession::ClientInfo()
+	{
+	return iClientInfo;
+	}
+
+const TClientInfo& CRemConSession::ClientInfo() const
+	{
+	return iClientInfo;
+	}
+
+TUint CRemConSession::Id() const
+	{
+	return iId;
+	}
+
+const RMessage2& CRemConSession::CurrentSendMessage() const
+	{
+	return iSendMsg;
+	}
+
+const RMessage2& CRemConSession::CurrentReceiveMessage() const
+	{
+	return iReceiveMsg;
+	}
+
+TBool CRemConSession::ClientAvailable() const
+	{
+	// Client is available as soon as it has registered the APIs
+	// it is interested in.
+	return iInterestedAPIs ? ETrue : EFalse;
+	}
+
+#endif // REMCONSESSION_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/targetclientprocess.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,257 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server-side representation of a target client, which may have multiple 
+// sessions associated with it.
+// 
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef TARGETCLIENTPROCESS_H
+#define TARGETCLIENTPROCESS_H
+
+#include <e32base.h>
+#include <remcon/clientinfo.h>
+#include <remcon/clientid.h>
+#include <remcon/playertype.h>
+
+#include "messagesendobserver.h"
+
+
+/**
+The maximum number of target sessions permitted for a single client process
+*/
+const TUint KMaxNumberTargetSessions = 2;
+
+class CRemConServer;
+class CBearerManager;
+class CRemConTargetSession;
+class CRemConInterfaceDetails;
+class CRemConMessage;
+
+/**
+Represents a target client process and manages that clients sessions.
+*/
+NONSHARABLE_CLASS(CRemConTargetClientProcess) : public CBase, public MRemConMessageSendObserver
+	{
+public:
+	static CRemConTargetClientProcess* NewLC(TClientInfo& aClientInfo, TRemConClientId aClientId, CRemConServer& aServer, CBearerManager& aBearerManager);
+	~CRemConTargetClientProcess();
+
+	/**
+	Returns the unique client ID for this client.
+	@return The client ID.
+	*/
+	inline TRemConClientId Id() const;
+
+	/**
+	Returns a description of the client represented by this CRemConTargetClientProcess instance.
+	@return A TClientInfo instance describing the client.
+	*/
+	inline TClientInfo& ClientInfo();
+	inline const TClientInfo& ClientInfo() const;
+
+	/**
+	Indicates whether or not this CRemConTargetClientProcess represents a client described by a given TClientInfo instance.
+	@param aClientInfo The TClientInfo instance describing the client.
+	@return ETrue if the client described by aClientInfo is that represented by this CRemConTargetClientProcess instance.
+	*/
+	inline TBool IsClient(const TClientInfo& aClientInfo) const;
+
+	/**
+	Indicates whether or not this client has been registered as available with the server.
+	@return ETrue if this client has been marked as available.
+	*/
+	inline TBool ClientAvailable() const;
+
+	/**
+	Creates a new target session for the client with a given unique session ID.
+	If the client already has KMaxNumberTargetSessions sessions open, then this will leave with KErrOverflow.
+	@param aSessionId The session ID for the new session.
+	*/
+	CRemConTargetSession* NewSessionL(TUint aSessionId);
+
+	/**
+	Called by CRemConTargetSession to provide notification of the opening of a new session.
+	@param aSession The CRemConTargetSession that is opening.
+	@return KErrNone on success, otherwise one of the other system-wide error codes.
+	*/
+	TInt TargetSessionOpened(CRemConTargetSession& aSession);
+
+	/**
+	Called by CRemConTargetSession to provide notificaton of session closure.
+	@param aSession The CRemConTargetSession that is closing.
+	*/
+	void TargetSessionClosed(CRemConTargetSession& aSession);
+
+	/**
+	Returns the number of target sessions currently open on this client.
+	@return The number of open target sessions.
+	*/
+	inline TInt TargetSessionCount() const;
+
+	/**
+	Sets the player information for this client.
+	This information can only be set once for the client.
+	@param aPlayerType The player type.
+	@param aPlayerName The player name.
+	*/
+	void SetPlayerInformationL(const TPlayerTypeInformation& aPlayerType, const TDesC8& aPlayerName);
+
+	/**
+	Indicates whether or not player information has been set for this client.
+	@return ETrue if player information has been set.
+	*/
+	inline TBool HasPlayerInformation() const;
+
+	/**
+	Returns the player type set for this client.
+	This is only valid if HasPlayerInformation() returns ETrue.
+	@return The player type.
+	*/
+	inline TPlayerType PlayerType() const;
+
+	/**
+	Returns the player subtype set for this client.
+	This is only valid if HasPlayerInformation() returns ETrue.
+	@return The player subtype.
+	*/
+	inline TPlayerSubType PlayerSubType() const;
+
+	/**
+	Returns the player name set for this client.
+	This is only valid if HasPlayerInformation() returns ETrue.
+	@return The player name.
+	*/
+	inline const TDesC8& Name() const;
+
+	/**
+	Indicates whether or not the given player information matches that set for this client.
+	This is only valid if HasPlayerInformation() returns ETrue.
+	@return ETrue if the player information matches.
+	*/
+	inline TBool PlayerInformationMatches(const TPlayerTypeInformation& aPlayerType, const TDesC8& aPlayerName) const;
+
+	/**
+	Called by CRemConTargetSession to provide notification that the session has registered a new interface.
+	@param aSession The CRemConTargetSession that has registered the new interface.
+	*/
+	void InterfacesRegistered();
+
+	/**
+	Determines whether or not an interface of the same type as that given has already been registered
+	in a session owned by this client, other than the given session.
+	@param aSession The target session to exclude from the interface search.
+	@param aInterface The interface type to test for.
+	@return Whether or not a registered interface of this type exists for the client.
+	**/
+	TBool IsInterfaceTypeRegisteredByAnotherSession(CRemConTargetSession& aSession, TUid aInterfaceUid) const;
+	
+	/**
+	Called by CRemConServer when a message has been received for this client.
+	The client will attempt to deliver the message to the appropriate session. If no session
+	supports the message, KErrArgument is returned. Otherwise, if the supporting session is
+	not ready to receive the message, KErrNotReady is returned. Any other error code is returned
+	by the session as it processes the message.
+	@param aMessage The message for this client.
+	@return KErrArgument if no session supports this message, KErrNotReady if the message cannot be handled yet, or an error
+	code returned by the session as it processes the message.
+	*/
+	TInt ReceiveMessage(CRemConMessage& aMessage);
+
+	/**
+	Indicates that a connection has come up or down.
+	This notifies each session held by this client.
+	*/
+	void ConnectionsChanged();
+
+	/**
+	Provides a list of interfaces supported by this client.
+	@param aUids An RArray to hold the UIDs of the supported interfaces.
+	@return KErrNone on success, otherwise one of the system-wide error codes.
+	*/
+	TInt SupportedInterfaces(RArray<TUid>& aUids);
+
+	/**
+	Provides a list of interfaces supported by this client that require the bulk server.
+	@param aUids An RArray to hold the UIDs of the interfaces.
+	@return KErrNone on success, otherwise one of the system-wide error codes.
+	*/
+	TInt SupportedBulkInterfaces(RArray<TUid>& aUids);
+
+	/**
+	Provides a list of operations supported by a particular interface.
+	@param aInterfaceUid The UID of the interface of interest.
+	@param aOperations An RArray to hold the supported operations.
+	@return KErrNone on success, otherwise one of the system-wide error codes.
+	*/
+	TInt SupportedOperations(TUid aInterfaceUid, RArray<TUint>& aOperations);
+
+public:	// From MRenConMessageSendObserver
+	void MrcmsoMessageSendResult(const CRemConMessage& aMessage, TInt aError);	// Not supported
+	void MrcmsoMessageSendOneOrMoreAttempt(const CRemConMessage& aMessage, TUint aNumRemotes);
+	void MrcmsoMessageSendOneOrMoreIncremental(const CRemConMessage& aMessage, TUint aNumRemotes);
+	void MrcmsoMessageSendOneOrMoreAttemptFailed(const CRemConMessage& aMessage, TInt aError);
+	void MrcmsoMessageSendOneOrMoreResult(const CRemConMessage& aMessage, TInt aError);
+	void MrcmsoMessageSendOneOrMoreAbandoned(const CRemConMessage& aMessage);
+
+private:
+	CRemConTargetClientProcess(TClientInfo& aClientInfo, TRemConClientId aClientId, CRemConServer& aServer, CBearerManager& aBearerManager);
+
+	/**
+	Returns the target session that supports a given RemCon message.
+	Since no two sessions may register the same interface, there is a maximum of one possible session that could support the message.
+	@param aMessage The RemCon message.
+	@return The supporting CRemConTargetSession instance or NULL if no supporting session could be found.
+	*/
+	CRemConTargetSession* FindSessionForMessage(const CRemConMessage& aMessage);
+
+	/**
+	Returns an index to a target session held by this client that supports a particular interface.
+	@param aInterface The UID of the interface of interest.
+	@return If found, the index of the relevent target session. Otherwise, KErrNotFound or one of the other system-wide error codes.
+	*/
+	TInt FindSessionForInterface(TUid aInterface) const;
+
+	/**
+	Utility method to complete a given RemCon message for a particular target session.
+	@param aMessage The RemCon message
+	@param aSession The target session
+	*/
+	void CompleteMessageForSession(const CRemConMessage& aMessage, CRemConTargetSession& aSession);
+
+private:
+	// Client information
+	TClientInfo iClientInfo;
+	TRemConClientId iClientId;
+	TBool iClientAvailable;
+
+	CRemConServer& iServer;
+	CBearerManager& iBearerManager;
+
+	// Player information
+	TPlayerTypeInformation iPlayerType;
+	RBuf8 iPlayerName;
+	TBool iPlayerInfoSet;
+
+	// Target sessions for this client
+	RPointerArray<CRemConTargetSession> iTargetSessions;
+	
+	};
+
+#include "targetclientprocess.inl"
+
+#endif // TARGETCLIENTPROCESS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/targetclientprocess.inl	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,77 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server-side representation of a target client, which may have multiple 
+// sessions associated with it.
+// 
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+inline TRemConClientId CRemConTargetClientProcess::Id() const
+	{
+	return iClientId;
+	}
+
+inline TClientInfo& CRemConTargetClientProcess::ClientInfo()
+	{	
+	return iClientInfo;
+	}
+
+inline const TClientInfo& CRemConTargetClientProcess::ClientInfo() const
+	{	
+	return iClientInfo;
+	}
+
+inline TBool CRemConTargetClientProcess::IsClient(const TClientInfo& aClientInfo) const
+	{
+	return (iClientInfo.ProcessId() == aClientInfo.ProcessId() && iClientInfo.SecureId() == aClientInfo.SecureId());
+	}
+
+inline TBool CRemConTargetClientProcess::ClientAvailable() const
+	{
+	return iClientAvailable;
+	}
+
+inline TInt CRemConTargetClientProcess::TargetSessionCount() const
+	{
+	return iTargetSessions.Count();
+	}
+
+inline TBool CRemConTargetClientProcess::HasPlayerInformation() const
+	{
+	return iPlayerInfoSet;
+	}
+
+inline TPlayerType CRemConTargetClientProcess::PlayerType() const
+	{
+	return iPlayerType.iPlayerType;
+	}
+
+inline TPlayerSubType CRemConTargetClientProcess::PlayerSubType() const
+	{
+	return iPlayerType.iPlayerSubType;
+	}
+
+inline const TDesC8& CRemConTargetClientProcess::Name() const
+	{
+	return iPlayerName;
+	}
+
+inline TBool CRemConTargetClientProcess::PlayerInformationMatches(const TPlayerTypeInformation& aPlayerType, const TDesC8& aPlayerName) const
+	{
+	return (aPlayerType.iPlayerType == PlayerType() && aPlayerType.iPlayerSubType == PlayerSubType() && aPlayerName == Name());
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/targetsession.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,92 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef TARGETSESSION_H
+#define TARGETSESSION_H
+
+#include "targetclientprocess.h"
+#include "session.h"
+
+NONSHARABLE_CLASS(CRemConTargetSession) : public CRemConSession
+	{
+public:
+	/**
+	Factory method.
+	@param aClientProcess The client for which this session is being created.
+	@param aServer The server.
+	@param aBearerManager The bearer manager.
+	@param aId The unique ID of the new session.
+	@return Ownership of a new session.
+	*/
+	static CRemConTargetSession* NewL(CRemConTargetClientProcess& aClientProcess,
+		CRemConServer& aServer,
+		CBearerManager& aBearerManager,
+		TUint aId);
+
+	~CRemConTargetSession();
+
+	/** 
+	From CRemConSession.
+	Checks if this message is supported by the session
+	@param aMsg The message to check
+	@return ETrue if it is, EFalse otherwise
+	*/
+	TBool SupportedMessage(const CRemConMessage& aMsg) const;
+
+	/**
+	 Indicates whether or not a given interface is supported by this
+	 target session.
+	 @param aInterfaceUid The UID of the interface to check for.
+	 @return ETrue if the interface is supported.
+	 */
+	TBool InterfaceSupported(TUid aInterfaceUid) const;
+
+private: // From CRemConSession: utility- IPC command handlers
+	void SetPlayerType(const RMessage2& aMessage);
+	void SendUnreliable(const RMessage2& aMessage);
+	void RegisterInterestedAPIs(const RMessage2& aMessage);
+
+private: // From CRemConSession: utility
+	CRemConMessage* DoPrepareSendMessageL(const RMessage2& aMessage);
+	void DoSendCancel();
+	void DoReceive();
+	void SendToServer(CRemConMessage& aMsg);
+	
+private: // utility
+	CRemConMessage* DoCreateUnreliableMessageL(const RMessage2& aMessage);
+	
+	
+private:
+	/**
+	Constructor.
+	@param aServer The server.
+	@param aBearerManager The bearer manager.
+	@param aId The unique ID of the new session.
+	*/
+	CRemConTargetSession(CRemConTargetClientProcess& aClientProcess,
+		CRemConServer& aServer, 
+		CBearerManager& aBearerManager,
+		TUint aId);
+
+	/**
+	2nd-phase construction.
+	*/
+	void ConstructL();
+
+private:
+	CRemConTargetClientProcess&	iClientProcess;
+	};
+
+#endif /* TARGETSESSION_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/inc/tspv4stub.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,54 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef TSPV4STUB_H
+#define TSPV4STUB_H
+
+/**
+@file
+@internalComponent
+*/
+
+#include <remcon/remcontargetselectorplugininterface.h>
+
+/**
+This class provides default implementations of the TSPv4 functions to allow
+AVRCP 1.4 to be used in cases where the TSP has not been updated to support
+the new functions.  
+*/
+NONSHARABLE_CLASS(TTspV4Stub) : public MRemConTargetSelectorPluginInterfaceV4
+	{
+public:
+	TTspV4Stub(MRemConTargetSelectorPluginObserver& aObserver);
+	
+private: // from MRemConTargetSelectorPluginInterfaceV3
+	virtual void PermitIncomingCommand(
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		const TClientInfo& aClient);
+	
+	virtual void PermitIncomingNotify(
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		const TClientInfo& aClient);
+	
+	virtual void SetRemoteAddressedClient(const TUid& aBearerUid, 
+			const TClientInfo& aClient);
+	
+private:
+	MRemConTargetSelectorPluginObserver& iObserver;
+	};
+
+#endif //TSPV4STUB_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/public/remconservercaps.mmh	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,26 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Remote Control server.
+// Provides the CAPABILITY definition for all subcomponents running in RemCon 
+// server's process.
+// 
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+CAPABILITY ProtServ LocalServices NetworkServices NetworkControl CommDD
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/public/remconserverid.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,32 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// API for the Remote Control server side.
+// Used by the Remote Control client side library.
+// 
+//
+
+/**
+ @file
+ @internalTechnology
+*/
+
+#ifndef REMCONSERVERID_H
+#define REMCONSERVERID_H
+
+#include <e32base.h>
+
+const TUint32 KRemConSrvTUint = 0x101f9067;
+const TUid KRemConSrvUid = {KRemConSrvTUint};
+
+#endif //REMCONSERVERID_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/public/remconserverpanic.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,161 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Panic codes for RemConServer. 
+// The server may panic clients with these codes.
+// 
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONSERVERPANIC_H
+#define REMCONSERVERPANIC_H
+
+#include <e32base.h>
+
+/** Panic category used by Rem Con server to panic the client. */
+_LIT(KRemConClientPanicCat, "RemConClient");
+
+/** Panic codes used by Rem Con server to panic the client. */
+enum TRemConClientPanic
+	{
+	/** The client side has passed an illegal IPC value */
+	ERemConClientPanicIllegalIpc										= 0,
+
+	/** The client is already connection-oriented. */
+	ERemConClientPanicAlreadyConnectionOriented 						= 1,
+
+	/** The client has called GoConnectionless, ConnectBearer or 
+	DisconnectBearer when the session is not connection-oriented. */
+	ERemConClientPanicNotConnectionOriented 							= 2,
+
+	/** The client called GoConnectionOriented with an unknown bearer UID. The 
+	given UID is not a known implementation of the bearer interface. */
+	ERemConClientPanicBearerPluginIncorrectInterface					= 3,
+
+	/** The client requested Send when there was already a Send outstanding on 
+	this session. */
+	ERemConClientPanicSendAlreadyOutstanding							= 4,
+
+	/** The client requested Receive when there was already a Receive 
+	outstanding on this session. */
+	ERemConClientPanicReceiveAlreadyOutstanding 						= 5,
+	
+	/** The client has not had their type set. */
+	ERemConClientPanicClientTypeNotSet									= 6,
+
+	/** The client has attempted to set the type of the session when it has 
+	already been set. */
+	ERemConClientPanicClientTypeAlreadySet								= 7,
+
+	/** A client has used a bad or wrong session type in one of the following 
+	ways:
+	(a) The client has tried to set the type of the session to a bad type 
+	(neither controller nor target). 
+	(b) The client (not of controller type) has called GoConnectionOriented, 
+	GoConnectionless, ConnectBearer, ConnectBearerCancel, DisconnectBearer or 
+	DisconnectBearerCancel. */
+	ERemConClientPanicBadType											= 8,
+
+	/** A client tried to open a target session when there is already one in
+	that client process. 
+	
+	This is no longer an illegal condition and so the panic will never
+	be raised.
+	*/
+	ERemConClientPanicTwoTargetSessionsInOneProcess 					= 9,
+
+	/** A badly-formed descriptor or other lump of data was sent from the 
+	client side. */
+	ERemConClientPanicBadDescriptor 									= 10,
+
+	/** The client requested NotifyConnectionStatusChange when there was 
+	already a NotifyConnectionStatusChange outstanding on this session. */
+	ERemConClientPanicConnectionsNotificationAlreadyOutstanding 		= 11,
+	
+	/** The client has committed one of a number of abuses of the 
+	ConnectBearer/DisconnectBearer interface. 
+	With respect to Send, Receive, ConnectBearer and DisconnectBearer 
+	messages, the following is a table of the legal states of a session 
+	(- = not outstanding, X = outstanding):
+	Send	Receive		Connect		Disconnect
+	-		-			-			-
+	X		-			-			-
+	-		X			-			-
+	-		-			X			-
+	-		-			-			X
+	X		X			-			-
+	X		-			X			-
+	-		X			X			-
+	X		X			X			-
+	-		X			-			X
+	In other words, any combination of the four is legal except having a 
+	DisconnectBearer outstanding at the same time as either a Send or a 
+	ConnectBearer.
+	In addition, the client cannot call GoConnectionOriented or 
+	GoConnectionless while there's a Send, ConnectBearer or DisconnectBearer 
+	outstanding.
+	This code is also used to error attempts to post a ConnectBearer or 
+	DisconnectBearer request which is already outstanding.
+	This is all in the interests of tying the legal client side behaviour to a 
+	minimum of sensible operations.
+	*/
+	ERemConClientPanicBearerControlOutstanding							= 12,
+
+	/** The client has tried to send a response to a command which does not
+	exist in the logs as having been delivered to that client.
+	
+	This is no longer an illegal condition and so the panic will never
+	be raised.
+	*/
+	ERemConClientPanicNoCommand 										= 13,
+
+	/** RRemConTarget::RegisterInterestedAPIs(...) is called on an undefined session). This doesn't make any sense because the 
+	server only filters incoming commands for the target sessions.
+	
+	The client is paniced for misusing this API.
+	
+	This panic 
+	*/
+	ERemConClientPanicRegisterInterestedAPIsInNonTargetSession			= 14,	
+	
+	/** They client side has sent a corrupt set of supported operation ids.
+	 */
+	ERemConClientPanicCorruptSupportedOperations						= 15,
+	
+	/** RRemConTarget::RegisterInterestedOperations(...) is called on a non-target session
+	(i.e. controller or undefined session). Detailed information about the controller
+	operation support is not required by RemCon.
+	
+	The client is paniced for misusing this API.
+	*/
+	ERemConClientPanicRegisterInterestedOperationsInNonTargetSession	= 16,
+	
+	/** The client has not had their features set. */
+	ERemConClientPanicClientFeaturesNotSet								= 17,
+
+	/** The client has tried to register the same interface in multiple sessions. */
+	ERemConClientPanicClientInterfaceAlreadyRegistered					= 18,
+
+	/** The client has tried to register different player information in multiple sessions. 
+	 For example, this can happen if an application directly using the RemCon client side interfaces 
+	 also uses another component that itself uses the RemCon client interfaces, such as Qt Key Capture.
+	 */
+	ERemConClientPanicPlayerInfoAlreadySet								= 19,
+	};
+
+#endif // REMCONSERVERPANIC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/activehelper.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,65 @@
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Active helper implementation.
+// 
+//
+
+/**
+ @file 
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include "activehelper.h"
+#include "controllersession.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+CActiveHelper::CActiveHelper(CRemConControllerSession &aSession) : 
+	CActive(CActive::EPriorityStandard),
+	iSession(aSession)
+	{
+	LOG_FUNC
+	CActiveScheduler::Add(this);
+	}
+	
+void CActiveHelper::RunL()
+	{
+	LOG_FUNC;
+	iSession.ProcessPendingMsgL();
+	}
+	
+void CActiveHelper::DoCancel()
+	{
+	LOG_FUNC;
+	}
+	
+CActiveHelper::~CActiveHelper()
+	{
+	LOG(KNullDesC8);
+	LOG_FUNC;
+	Cancel();
+	}
+
+void CActiveHelper::Complete()
+	{
+	LOG_FUNC;
+	iStatus = KRequestPending;
+	SetActive();
+
+	TRequestStatus *p = &iStatus;
+	User::RequestComplete(p, KErrNone);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/bearermanager.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,1126 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Bearer manager.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#include <remcon/remconbearerplugin.h>
+#include <remcon/remconbearerinterface.h>
+#include <remcon/remconbearerbulkinterface.h>
+#include <remcon/bearerparams.h>
+#include <remcon/bearersecurity.h>
+#include <remcon/remconconverterinterface.h>
+#include "bearermanager.h"
+#include "utils.h"
+#include "server.h"
+#include "session.h"
+#include "remconmessage.h"
+#include "connections.h"
+
+PANICCATEGORY("bearerman");
+
+#ifdef __FLOG_ACTIVE
+#define LOGBEARERS	LogBearers()
+#else
+#define LOGBEARERS
+#endif
+ 
+static TBool RemConAddrsMatch(const TRemConAddress& aFirstAddr, const TRemConAddress& aSecondAddr)
+	{
+	return aFirstAddr == aSecondAddr;
+	}
+
+CBearerManager* CBearerManager::NewL(CRemConServer& aServer)
+	{
+	LOG_STATIC_FUNC
+	CBearerManager* self = new(ELeave) CBearerManager(aServer);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CLEANUPSTACK_POP1(self);
+	return self;
+	}
+
+CBearerManager::~CBearerManager()
+	{
+	LOG_FUNC;
+
+	// We do not check these are empty before cleaning them up. There are no 
+	// cancel methods for connect/disconnect in the bearer API.
+	iCurrentlyBeingConnected.Close();
+	iCurrentlyBeingDisconnected.Close();
+	
+	LOGBEARERS;
+	// Destroy all bearer instances.
+	iBearers.ResetAndDestroy();
+	LOGBEARERS;
+
+	iBearerIfs.Close();
+
+	// Clean up the security policy collection.
+	TSglQueIter<TBearerSecurity> iter(iBearerSecurityPolicies);
+	TBearerSecurity* sec;
+	while ( ( sec = iter++ ) != NULL )
+		{
+		iBearerSecurityPolicies.Remove(*sec);
+		delete sec;
+		}
+	}
+
+CBearerManager::CBearerManager(CRemConServer& aServer)
+:	iBearerSecurityPolicies(_FOFF(TBearerSecurity, iLink)),
+	iServer(aServer)
+	{
+	LOG_FUNC
+	}
+
+void CBearerManager::ConstructL()
+	{
+	LOG_FUNC;
+
+	// Instantiate all bearers at construction time.
+	LoadAllBearersL();
+
+	LOGBEARERS;
+	}
+
+MRemConBearerInterface* CBearerManager::BearerIf(TUid aBearerUid) const
+	{
+	LOG_FUNC;
+	LOG1(_L("\taBearerUid = 0x%08x"), aBearerUid);
+
+	MRemConBearerInterface* bearerIf = NULL;
+
+	const TUint numBearerIfs = iBearerIfs.Count();
+	for ( TUint ii = 0 ; ii < numBearerIfs ; ++ii )
+		{
+		if ( iBearerIfs[ii].iBearerUid == aBearerUid )
+			{
+			// In the current implementation we only have three bearer interface 
+			// UIDs. This UID is tied to the version of MRemConBearerInterface.
+			ASSERT_DEBUG(iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface1) || 
+						 iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface2) ||
+						 iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface3));
+			bearerIf = iBearerIfs[ii].iIf;
+			break;
+			}
+		}
+
+	LOG1(_L("\tbearerIf = 0x%08x"), bearerIf);
+	return bearerIf;
+	}
+
+MRemConBearerInterfaceV2* CBearerManager::BearerIfV2(TUid aBearerUid) const
+	{
+	LOG_FUNC;
+	LOG1(_L("\taBearerUid = 0x%08x"), aBearerUid);
+	
+	MRemConBearerInterfaceV2* bearerIfV2 = NULL;
+	
+	const TUint numBearerIfs = iBearerIfs.Count();
+	for ( TUint ii = 0 ; ii < numBearerIfs ; ++ii )
+		{
+		if ( iBearerIfs[ii].iBearerUid == aBearerUid )
+			{
+			// In the current implementation we only have two bearer interface 
+			// UIDs. This UID is tied to the version of MRemConBearerInterface.
+			ASSERT_DEBUG(iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface1) || 
+						 iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface2) ||
+						 iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface3));
+			
+			if((iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface2)) ||
+			   (iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface3)))
+				{
+				bearerIfV2 = iBearerIfs[ii].iIfV2;
+				}
+			
+			break;
+			}
+		}
+	
+	LOG1(_L("\tbearerIfV2 = 0x%08x"), bearerIfV2);
+	return bearerIfV2;
+	}
+
+MRemConBearerInterfaceV3* CBearerManager::BearerIfV3(TUid aBearerUid) const
+	{
+	LOG_FUNC;
+	LOG1(_L("\taBearerUid = 0x%08x"), aBearerUid);
+	
+	MRemConBearerInterfaceV3* bearerIfV3 = NULL;
+	
+	const TUint numBearerIfs = iBearerIfs.Count();
+	for ( TUint ii = 0 ; ii < numBearerIfs ; ++ii )
+		{
+		if ( iBearerIfs[ii].iBearerUid == aBearerUid )
+			{
+			// In the current implementation we only have three bearer interface 
+			// UIDs. This UID is tied to the version of MRemConBearerInterfaceV3.
+			ASSERT_DEBUG(iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface1) || 
+						 iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface2) ||
+						 iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface3));
+			
+			if(iBearerIfs[ii].iIfUid == TUid::Uid(KRemConBearerInterface3))
+				{
+				bearerIfV3 = iBearerIfs[ii].iIfV3;
+				}
+			
+			break;
+			}
+		}
+	
+	LOG1(_L("\tbearerIfV3 = 0x%08x"), bearerIfV3);
+	return bearerIfV3;
+	}
+
+void CBearerManager::LoadAllBearersL()
+	{
+	LOG_FUNC;
+
+	// Use ECOM to instantiate each implementation of the bearer plugin 
+	// interface.
+	const TUid KUidRemoteControlBearerPluginInterface = TUid::Uid(KRemConBearerInterfaceUid);
+	RImplInfoPtrArray implementations;
+	const TEComResolverParams noResolverParams;
+	REComSession::ListImplementationsL(KUidRemoteControlBearerPluginInterface, 
+		noResolverParams, 
+		KRomOnlyResolverUid, 
+		implementations);
+	CleanupResetAndDestroyPushL(implementations);
+	const TUint count = implementations.Count();
+	LOG1(_L("\tnumber of implementations of bearer plugin interface: %d"), count);
+	// There should be at least one bearer present. If there are no bearers in 
+	// the ROM, then there shouldn't be RemCon server present either due to 
+	// the waste of ROM. This is why the client-side is a separate DLL, so it 
+	// can be included to satisfy any static linkages, without bringing the 
+	// unnecessary bulk of the server with it.
+	ASSERT_ALWAYS(count != 0);
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CImplementationInformation* impl = implementations[ii];
+		ASSERT_DEBUG(impl);
+		LOG(_L("\tloading bearer with:"));
+		LOG1(_L("\t\timplementation uid 0x%08x"), impl->ImplementationUid());
+		LOG1(_L("\t\tversion number %d"), impl->Version());
+		TBuf8<KMaxName> buf8;
+		buf8.Copy(impl->DisplayName());
+		LOG1(_L8("\t\tdisplay name \"%S\""), &buf8);
+		LOG1(_L("\t\tROM only %d"), impl->RomOnly());
+		LOG1(_L("\t\tROM based %d"), impl->RomBased());
+
+		TBearerParams params(impl->ImplementationUid(), *this);
+		CRemConBearerPlugin* bearer = CRemConBearerPlugin::NewL(params);
+		CleanupStack::PushL(bearer);
+		LEAVEIFERRORL(iBearers.Append(bearer));
+		CLEANUPSTACK_POP1(bearer);
+
+		// Also get information about the interface the bearer presents.
+		// Look for latest interface first
+		TInterfaceInfo ifInfo;
+		ifInfo.iIfUid = TUid::Uid(0);
+		
+		// Control interfaces
+		ifInfo.iIfV3 = reinterpret_cast<MRemConBearerInterfaceV3*>(bearer->GetInterface(TUid::Uid(KRemConBearerInterface3)));
+		ifInfo.iIfV2 = reinterpret_cast<MRemConBearerInterfaceV2*>(bearer->GetInterface(TUid::Uid(KRemConBearerInterface2)));
+		ifInfo.iIf = reinterpret_cast<MRemConBearerInterface*>(bearer->GetInterface(TUid::Uid(KRemConBearerInterface1)));
+		if(ifInfo.iIfV3)
+			{
+			ifInfo.iIfUid = TUid::Uid(KRemConBearerInterface3);
+			}
+		else if(ifInfo.iIfV2)
+			{
+			ifInfo.iIfUid = TUid::Uid(KRemConBearerInterface2);
+			}
+		else if(ifInfo.iIf)
+			{
+			ifInfo.iIfUid = TUid::Uid(KRemConBearerInterface1);
+			}
+
+		LOG1(_L8("\t\tcontrol interface (V1) = [0x%08x]"), ifInfo.iIf);
+		LOG1(_L8("\t\tcontrol interface (V2) = [0x%08x]"), ifInfo.iIfV2);
+		LOG1(_L8("\t\tcontrol interface (V3) = [0x%08x]"), ifInfo.iIfV3);
+		// If the bearer doesn't support the basic bearer API, panic server 
+		// startup.
+		ASSERT_ALWAYS(ifInfo.iIf);
+
+		ifInfo.iBearerUid = impl->ImplementationUid();
+		ifInfo.iControllerCount = 0;
+		ifInfo.iTargetCount = 0;
+		LEAVEIFERRORL(iBearerIfs.Append(ifInfo));
+
+		TBearerSecurity* sec = new(ELeave) TBearerSecurity(bearer->Uid(), ifInfo.iIf->SecurityPolicy());
+		iBearerSecurityPolicies.AddLast(*sec);
+		}
+
+	CleanupStack::PopAndDestroy(&implementations);
+	}
+
+#ifdef __FLOG_ACTIVE
+void CBearerManager::LogBearers() const
+	{
+	const TUint count = iBearers.Count();
+	LOG1(_L("\tNumber of bearers = %d"), count);
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		const CRemConBearerPlugin* const bearer = iBearers[ii];
+		ASSERT_DEBUG(bearer);
+		LOG3(_L("\t\tbearer %d [0x%08x], Uid = 0x%08x"), 
+			ii, 
+			bearer,
+			bearer->Uid()
+			);
+		}
+	}
+#endif // __FLOG_ACTIVE
+
+TInt CBearerManager::Send(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	LOG4(_L("\taMsg.Addr.BearerUid = 0x%08x, aMsg.InterfaceUid = 0x%08x, aMsg.MsgType = %d, aMsg.OperationId = 0x%02x"), 
+		aMsg.Addr().BearerUid(), aMsg.InterfaceUid(), aMsg.MsgType(), aMsg.OperationId());
+
+	MRemConBearerInterface* const bearerIf = BearerIf(aMsg.Addr().BearerUid());
+	MRemConBearerInterfaceV2* const bearerIfV2 = BearerIfV2(aMsg.Addr().BearerUid());
+	MRemConBearerInterfaceV3* const bearerIfV3 = BearerIfV3(aMsg.Addr().BearerUid());
+	// For connection-oriented sends, the session protects against trying to 
+	// connect to a non-existent bearer. For connectionless sends, the TSP can 
+	// indicate whatever connections it like, but if it indicates one 
+	// belonging to a non-existent bearer, that's panicked.
+	ASSERT_DEBUG(bearerIf); 
+
+	TInt ret = KErrNone;
+
+	switch ( aMsg.MsgType() )
+		{
+	case ERemConNotifyCommand:
+	    // We originate a transaction identifier as it's a new outgoing 
+	    // notify message.
+		aMsg.TransactionId() = MrcboDoNewTransactionId();
+		ASSERT_DEBUG(bearerIfV3);
+		ret = bearerIfV3->SendNotifyCommand(aMsg.InterfaceUid(), 
+			aMsg.OperationId(), 
+			aMsg.TransactionId(),
+			aMsg.OperationData(),
+			aMsg.Addr());
+		if ( ret == KErrNone )
+			{
+			// On success, the bearer takes ownership of the message data.
+			aMsg.OperationData().Assign(NULL);
+			}
+	    break;
+	case ERemConCommand:
+		// We originate a transaction identifier as it's a new outgoing 
+		// message.
+		aMsg.TransactionId() = MrcboDoNewTransactionId();
+		ret = bearerIf->SendCommand(aMsg.InterfaceUid(), 
+			aMsg.OperationId(), 
+			aMsg.TransactionId(),
+			aMsg.OperationData(),
+			aMsg.Addr());
+		if ( ret == KErrNone )
+			{
+			// On success, the bearer takes ownership of the message data.
+			aMsg.OperationData().Assign(NULL);
+			}
+		break;
+
+	case ERemConResponse:
+		ret = bearerIf->SendResponse(aMsg.InterfaceUid(), 
+			aMsg.OperationId(), 
+			aMsg.TransactionId(),
+			aMsg.OperationData(), 
+			aMsg.Addr());
+		if ( ret == KErrNone )
+			{
+			// On success, the bearer takes ownership of the message data.
+			aMsg.OperationData().Assign(NULL);
+			}
+		break;
+	case ERemConReject:
+		{
+		ASSERT_DEBUG(aMsg.OperationData().Length() == 0);
+		if (bearerIfV2)
+			{
+			bearerIfV2->SendReject(aMsg.InterfaceUid(), 
+					aMsg.OperationId(), 
+					aMsg.TransactionId(),
+					aMsg.Addr());
+			}
+		break;
+		}
+	default:
+		DEBUG_PANIC_LINENUM; // the session protects us against this
+		break;
+		}
+
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+
+TInt CBearerManager::Connect(const TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+
+	TInt ret = KErrNone;
+	if ( iCurrentlyBeingConnected.Find(aAddr, RemConAddrsMatch) == KErrNotFound )
+		{
+		MRemConBearerInterface* const bearerIf = BearerIf(aAddr.BearerUid());
+		// The caller should have checked that the interface existed before 
+		// calling this.
+		ASSERT_DEBUG(bearerIf);
+		// Make a note of the address. If we can't do this then fail the connect.
+		ret = iCurrentlyBeingConnected.Append(aAddr);
+		if ( ret == KErrNone )
+			{
+			bearerIf->ConnectRequest(aAddr);
+			}
+		}
+	
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+TInt CBearerManager::Disconnect(const TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+
+	TInt ret = KErrNone;
+	if ( iCurrentlyBeingDisconnected.Find(aAddr, RemConAddrsMatch) == KErrNotFound )
+		{
+		MRemConBearerInterface* const bearerIf = BearerIf(aAddr.BearerUid());
+		// The caller should have checked that the interface existed before 
+		// calling this.
+		ASSERT_DEBUG(bearerIf);
+		// Make a note of the address. If we can't do this then fail the 
+		// disconnect.
+		ret = iCurrentlyBeingDisconnected.Append(aAddr);
+		if ( ret == KErrNone )
+			{
+			bearerIf->DisconnectRequest(aAddr);
+			}
+		}
+
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+TBool CBearerManager::BearerExists(TUid aBearerUid) const
+	{
+	LOG_FUNC;
+	LOG1(_L("\taBearerUid = 0x%08x"), aBearerUid);
+
+	TBool ret = EFalse;
+	if ( BearerIf(aBearerUid) != NULL )
+		{
+		ret = ETrue;
+		}
+
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+TBool CBearerManager::CheckPolicy(TUid aBearerUid, const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taBearerUid = 0x%08x"), aBearerUid);
+
+	MRemConBearerInterface* bearerIf = BearerIf(aBearerUid);
+	// The caller should have checked that the interface existed before 
+	// calling this.
+	ASSERT_DEBUG(bearerIf);
+	TBool ret = bearerIf->SecurityPolicy().CheckPolicy(aMessage);
+
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+void CBearerManager::TargetClientAvailable(TRemConClientId aId, const TPlayerType& aClientType, const TPlayerSubType& aClientSubType, const TDesC8& aName)
+	{
+	LOG_FUNC;
+		
+	const TUint count = iBearerIfs.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		// maintain the controller and target count for each bearer 
+		// tell the bearer if the count has increased to 1
+		// by doing this in this loop we are sure we only 
+		// tell the bearer when we need to */
+		MRemConBearerInterface* const bearerIf = iBearerIfs[ii].iIf;
+		ASSERT_DEBUG(bearerIf);
+		iBearerIfs[ii].iTargetCount++;
+		if (1 == iBearerIfs[ii].iTargetCount)
+			{
+			bearerIf->ClientStatus(TBool(iBearerIfs[ii].iControllerCount), TBool(iBearerIfs[ii].iTargetCount));
+			}
+		
+		MRemConBearerInterfaceV3* const bearerIfV3 = iBearerIfs[ii].iIfV3;
+		if(bearerIfV3)
+			{
+			bearerIfV3->ClientAvailable(aId, aClientType, aClientSubType, aName);
+			}
+		}
+	}
+
+void CBearerManager::TargetFeaturesUpdated(TRemConClientId aId, const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName)
+    {
+    LOG_FUNC;
+        
+    const TUint count = iBearerIfs.Count();
+    for ( TUint ii = 0 ; ii < count ; ++ii )
+        {
+        MRemConBearerInterfaceV3* const bearerIfV3 = iBearerIfs[ii].iIfV3;
+
+        if(bearerIfV3)
+            {
+            bearerIfV3->TargetFeaturesUpdated(aId, aPlayerType, aPlayerSubType, aName);
+            }
+        }
+    }
+
+void CBearerManager::ControllerClientAvailable()
+	{
+	LOG_FUNC;
+	
+	RArray<TUid> supportedInterfaces;
+	TInt err = iServer.ControllerSupportedInterfaces(supportedInterfaces);
+	LOG2(_L("\tGot %d supported interfaces with result %d"), supportedInterfaces.Count(), err);
+	
+	const TUint count = iBearerIfs.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		// maintain the controller and target count for each bearer 
+		// tell the bearer if the count has increased to 1
+		// by doing this in this loop we are sure we only 
+		// tell the bearer when we need to
+		MRemConBearerInterface* const bearerIf = iBearerIfs[ii].iIf;
+		ASSERT_DEBUG(bearerIf);
+		iBearerIfs[ii].iControllerCount++;
+		if (1 == iBearerIfs[ii].iControllerCount)
+			{
+			bearerIf->ClientStatus(TBool(iBearerIfs[ii].iControllerCount), TBool(iBearerIfs[ii].iTargetCount));
+			}
+
+		if(!err)
+			{
+			// If we know what the supported interface are we can tell the bearer
+			MRemConBearerInterfaceV3* const bearerIfV3 = iBearerIfs[ii].iIfV3;
+
+			if(bearerIfV3)
+				{
+				bearerIfV3->ControllerFeaturesUpdated(supportedInterfaces);
+				}
+			}
+		}
+	
+	supportedInterfaces.Close();
+	}
+
+void CBearerManager::ClientConnectionOriented(TUid aUid)
+	{
+	LOG_FUNC;
+
+	const TUint count = iBearerIfs.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		MRemConBearerInterface* const bearerIf = iBearerIfs[ii].iIf;
+		ASSERT_DEBUG(bearerIf);
+		// maintain the controller and target count for each bearer 
+		// target count won't change for this
+		// Controller won't change if we are the bearer being targetted by the controller
+		// it will go down if we're not.
+		// Tell the bearer if the controller count has decreased to zero
+		if (aUid != iBearerIfs[ii].iBearerUid)
+			{
+			iBearerIfs[ii].iControllerCount--;
+			if (0 == iBearerIfs[ii].iControllerCount)
+				{
+				bearerIf->ClientStatus(TBool(iBearerIfs[ii].iControllerCount), TBool(iBearerIfs[ii].iTargetCount));
+				}
+			}
+		}
+	}
+
+void CBearerManager::ClientConnectionless(TUid aUid)
+	{
+	LOG_FUNC;
+	
+	RArray<TUid> supportedInterfaces;
+	TInt err = iServer.ControllerSupportedInterfaces(supportedInterfaces);
+	LOG2(_L("\tGot %d supported interfaces with result %d"), supportedInterfaces.Count(), err);
+
+	const TUint count = iBearerIfs.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		MRemConBearerInterface* const bearerIf = iBearerIfs[ii].iIf;
+		MRemConBearerInterfaceV3* const bearerIfV3 = iBearerIfs[ii].iIfV3;
+		ASSERT_DEBUG(bearerIf);
+
+		// maintain the controller and target count for each bearer 
+		// target count won't change for this
+		// Controller won't change if we were the bearer being targetted by the controller
+		// it will go up if we're not.
+		// tell the bearer if the controller count has increased to 1 and provide
+		// it with the current feature list.	   
+		if (aUid != iBearerIfs[ii].iBearerUid)
+			{
+			iBearerIfs[ii].iControllerCount++;
+			if (1 == iBearerIfs[ii].iControllerCount)
+				{
+				bearerIf->ClientStatus(TBool(iBearerIfs[ii].iControllerCount), TBool(iBearerIfs[ii].iTargetCount));
+
+				if(!err && bearerIfV3)
+					{
+					bearerIfV3->ControllerFeaturesUpdated(supportedInterfaces);
+					}
+				}
+			}
+		}
+	
+	supportedInterfaces.Close();
+	}
+
+void CBearerManager::ClientClosed(TBool aController, TUid aUid, TRemConClientId aClientId)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taController = %x"), aController);
+	
+	RArray<TUid> supportedInterfaces;
+	TInt err = KErrNone;
+	if(aController)
+		{
+		err = iServer.ControllerSupportedInterfaces(supportedInterfaces);
+		LOG2(_L("\tGot %d supported interfaces with result %d"), supportedInterfaces.Count(), err);
+		}
+
+	const TUint count = iBearerIfs.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		MRemConBearerInterface* const bearerIf = iBearerIfs[ii].iIf;
+		MRemConBearerInterfaceV3* const bearerIfV3 = iBearerIfs[ii].iIfV3;
+		ASSERT_DEBUG(bearerIf);
+		// maintain the controller and target count for each bearer 
+		// the target count may change for this
+		// Controller won't change if we were the bearer being targetted by the controller
+		// it will go up if we're not.
+		if (aController)
+			{
+			// so if the aUid is not null then the closed session affects only
+			// the bearer it was pointing at. If the uid is NULL then its affecting
+			// all bearers
+			// tell the bearer if controller or target count has reached zero.
+			// If there are controllers left then let the bearer know the current
+			// feature set.
+			if ((aUid == iBearerIfs[ii].iBearerUid) || (KNullUid == aUid))
+				{
+				iBearerIfs[ii].iControllerCount--;
+				if (0 == iBearerIfs[ii].iControllerCount)
+					{
+					bearerIf->ClientStatus(TBool(iBearerIfs[ii].iControllerCount), TBool(iBearerIfs[ii].iTargetCount));
+					}
+				else if(!err && bearerIfV3)
+					{
+					bearerIfV3->ControllerFeaturesUpdated(supportedInterfaces);
+					}
+				}
+			}
+		else
+			{
+			iBearerIfs[ii].iTargetCount--;
+			if (0 == iBearerIfs[ii].iTargetCount)
+				{
+				bearerIf->ClientStatus(TBool(iBearerIfs[ii].iControllerCount), TBool(iBearerIfs[ii].iTargetCount));
+				}
+			if(bearerIfV3)
+				{
+				bearerIfV3->ClientNotAvailable(aClientId);
+				}
+			}
+		}
+	
+	supportedInterfaces.Close();
+	}
+
+TInt CBearerManager::MrcboDoNewResponse(const TRemConAddress& aAddr)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+	
+	TRAPD(err, NewResponseL(aAddr));
+
+	LOG1(_L("\terr = %d"), err);
+	return err;
+	}
+TInt CBearerManager::MrcboDoNewNotifyResponse(const TRemConAddress& aAddr)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+	
+	TRAPD(err, NewNotifyResponseL(aAddr));
+
+	LOG1(_L("\terr = %d"), err);
+	return err;
+	}
+
+void CBearerManager::NewResponseL(const TRemConAddress& aAddr)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+
+	// Get the calling bearer from aAddr, call GetResponse on it, parse the 
+	// new message and find the originating command in the 'sent commands' 
+	// log. Give the new message to the session which sent that command. 
+	MRemConBearerInterface* bearerIf = BearerIf(aAddr.BearerUid());
+	ASSERT_DEBUG(bearerIf);
+	TUid interfaceUid;
+	TUint transactionId;
+	TUint operationId;
+	RBuf8 data;
+	TRemConAddress addr;
+	LEAVEIFERRORL(bearerIf->GetResponse(interfaceUid,
+		transactionId,
+		operationId, 
+		data, 
+		addr));
+	LOG4(_L("\treceived response with interfaceUid [0x%08x], operationId 0x%02x, transactionId %d, data.Length = %d"), 
+		interfaceUid, operationId, transactionId, data.Length());
+	// We now own what's pointed to by 'data'.
+	CleanupClosePushL(data);
+
+	CRemConMessage* msg = CRemConMessage::NewL(
+		aAddr,
+		KNullClientId,
+		ERemConResponse,
+		ERemConMessageDefault,
+		interfaceUid,
+		operationId,
+		data,
+		0, // session ID as yet unknown
+		transactionId);
+	CLEANUPSTACK_POP1(&data); // owned by msg
+	// Give the new response to the server to find the corresponding outgoing 
+	// command we sent, then use that to route the new response to a client 
+	// session.
+	iServer.NewResponse(*msg); // ownership of msg is always taken by NewResponse
+	}
+
+void CBearerManager::NewNotifyResponseL(const TRemConAddress& aAddr)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+
+	// Get the calling bearer from aAddr, call GetResponse on it, parse the 
+	// new message and find the originating command in the 'sent commands' 
+	// log. Give the new message to the session which sent that command. 
+	MRemConBearerInterfaceV3* bearerIfV3 = BearerIfV3(aAddr.BearerUid());
+	ASSERT_DEBUG(bearerIfV3);
+	TUid interfaceUid;
+	TUint transactionId;
+	TUint operationId;
+	RBuf8 data;
+	TRemConAddress addr;
+	TRemConMessageSubType subMessageType;
+	LEAVEIFERRORL(bearerIfV3->GetNotifyResponse(interfaceUid,
+		transactionId,
+		operationId, 
+		data, 
+		addr,
+		subMessageType));
+	LOG4(_L("\treceived response with interfaceUid [0x%08x], operationId 0x%02x, transactionId %d, data.Length = %d"), 
+		interfaceUid, operationId, transactionId, data.Length());
+	// We now own what's pointed to by 'data'.
+	CleanupClosePushL(data);
+
+	CRemConMessage* msg = CRemConMessage::NewL(
+		aAddr,
+		KNullClientId,
+		ERemConResponse,
+		subMessageType,
+		interfaceUid,
+		operationId,
+		data,
+		0, // session ID as yet unknown
+		transactionId);
+	CLEANUPSTACK_POP1(&data); // owned by msg
+	// Give the new response to the server to find the corresponding outgoing 
+	// command we sent, then use that to route the new response to a client 
+	// session.
+	iServer.NewNotifyResponse(*msg); // ownership of msg is always taken by NewResponse
+	}
+
+TInt CBearerManager::MrcboDoNewCommand(const TRemConAddress& aAddr)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+
+	TRAPD(err, NewCommandL(aAddr, KNullClientId));
+
+	LOG1(_L("\terr = %d"), err);
+	return err;
+	}
+
+TInt CBearerManager::MrcboDoNewCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+
+	TRAPD(err, NewCommandL(aAddr, aClient));
+
+	LOG1(_L("\terr = %d"), err);
+	return err;
+	}
+
+void CBearerManager::NewCommandL(const TRemConAddress& aAddr, const TRemConClientId& aClient)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+
+	// Get the calling bearer from aAddr and get the new command from it.
+	MRemConBearerInterface* const bearerIf = BearerIf(aAddr.BearerUid());
+	ASSERT_DEBUG(bearerIf);
+	TUid interfaceUid;
+	TUint transactionId;
+	TUint operationId;
+	RBuf8 data;
+	TRemConAddress addr;
+	LEAVEIFERRORL(bearerIf->GetCommand(interfaceUid,
+		transactionId, 
+		operationId, 
+		data, 
+		addr));
+	LOG3(_L("\treceived command with interfaceUid [0x%08x], operationId 0x%02x, data.Length = %d"), 
+		interfaceUid, operationId, data.Length());
+	// We now own what's pointed to by 'data'.
+	CleanupClosePushL(data);
+
+	CRemConMessage* msg = CRemConMessage::NewL(
+		aAddr,
+		aClient,
+		ERemConCommand,
+		ERemConMessageDefault,
+		interfaceUid,
+		operationId,
+		data,
+		0, // session ID as yet unknown
+		transactionId);
+	// 'msg' now has a pointer to the memory pointed to by 'data', and owns 
+	// it.
+	CLEANUPSTACK_POP1(&data);
+	// Give the new command to the server, which takes ownership of it. 
+	iServer.NewCommand(*msg);
+	}
+
+TInt CBearerManager::MrcboDoNewNotifyCommand(const TRemConAddress& aAddr)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+
+	TRAPD(err, NewNotifyCommandL(aAddr, KNullClientId));
+
+	LOG1(_L("\terr = %d"), err);
+	return err;
+	}
+
+TInt CBearerManager::MrcboDoNewNotifyCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+
+	TRAPD(err, NewNotifyCommandL(aAddr, aClient));
+
+	LOG1(_L("\terr = %d"), err);
+	return err;	}
+
+void CBearerManager::NewNotifyCommandL(const TRemConAddress& aAddr, const TRemConClientId& aClient)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+
+	// Get the calling bearer from aAddr and get the new command from it.
+	MRemConBearerInterfaceV2* const bearerIfV2 = BearerIfV2(aAddr.BearerUid());
+	
+	// We only get here because the bearer has told us it's got a notify.  In
+	// order to use notifies it must use the V2 bearer interface.
+	ASSERT_DEBUG(bearerIfV2); 
+	
+	TUid interfaceUid;
+	TUint transactionId;
+	TUint operationId;
+	RBuf8 data;
+	TRemConAddress addr;
+	LEAVEIFERRORL(bearerIfV2->GetNotifyCommand(interfaceUid,
+		transactionId, 
+		operationId, 
+		data, 
+		addr));
+	LOG3(_L("\treceived command with interfaceUid [0x%08x], operationId 0x%02x, data.Length = %d"), 
+		interfaceUid, operationId, data.Length());
+	// We now own what's pointed to by 'data'.
+	CleanupClosePushL(data);
+
+	CRemConMessage* msg = CRemConMessage::NewL(
+		aAddr,
+		aClient,
+		ERemConNotifyCommand,
+		ERemConNotifyCommandAwaitingInterim,
+		interfaceUid,
+		operationId,
+		data,
+		0, // session ID as yet unknown
+		transactionId);
+	// 'msg' now has a pointer to the memory pointed to by 'data', and owns 
+	// it.
+	CLEANUPSTACK_POP1(&data);
+	// Give the new command to the server, which takes ownership of it. 
+	iServer.NewNotifyCommand(*msg);
+	}
+
+TInt CBearerManager::MrcboDoConnectIndicate(const TRemConAddress& aAddr)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+
+	// Just call the handler for new connections.
+	TInt ret = iServer.HandleConnection(aAddr, KErrNone);
+	LOG1(_L("\tret = %d"), ret);
+
+	return ret;
+	}
+
+void CBearerManager::MrcboDoDisconnectIndicate(const TRemConAddress& aAddr)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	
+	// Just call the handler for removed connections.
+	iServer.RemoveConnection(aAddr, KErrNone);
+	}
+
+TInt CBearerManager::MrcboDoConnectConfirm(const TRemConAddress& aAddr, TInt aError)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG2(_L("\taError = %d, aAddr.BearerUid = 0x%08x"), aError, aAddr.BearerUid());
+
+	TInt index = iCurrentlyBeingConnected.Find(aAddr, RemConAddrsMatch);
+	ASSERT_DEBUG(index != KErrNotFound);
+	iCurrentlyBeingConnected.Remove(index);
+
+	TInt ret = iServer.HandleConnection(aAddr, aError);
+
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+void CBearerManager::MrcboDoDisconnectConfirm(const TRemConAddress& aAddr, TInt aError)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG2(_L("\taError = %d, aAddr.BearerUid = 0x%08x"), aError, aAddr.BearerUid());
+
+	TInt index = iCurrentlyBeingDisconnected.Find(aAddr, RemConAddrsMatch);
+	ASSERT_DEBUG(index != KErrNotFound);
+	iCurrentlyBeingDisconnected.Remove(index);
+
+	if ( aError == KErrNone )
+		{
+		// Remove connection and complete notifications.
+		iServer.RemoveConnection(aAddr, aError);
+		}
+	}
+
+TUint CBearerManager::MrcboDoNewTransactionId()
+	{
+	TUint newId = iRunningTransactionId;
+
+	if ( iRunningTransactionId == KMaxTUint )
+		{
+		iRunningTransactionId = 0;
+		}
+	else
+		{
+		++iRunningTransactionId;
+		}
+	
+	LOG1(_L("CBearerManager::MrcboDoNewTransactionId newId = %d"), newId);
+	return newId;
+	}
+
+TInt CBearerManager::MrcboDoInterfaceToBearer(TUid aBearerUid,
+		TUid aInterfaceUid, 
+		TUint aOperationId,
+		const TDesC8& aData,
+		TRemConMessageType aMsgType, 
+		TDes8& aBearerData) const
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG4(_L("\taBearerUid = 0x%08x, aInterfaceUid = 0x%08x, aOperationId = 0x%02x, aMsgType = %d"), 
+		aBearerUid, aInterfaceUid, aOperationId, aMsgType);
+
+	MRemConConverterInterface* conv = iServer.Converter(aInterfaceUid, aBearerUid);
+	TInt ret = KErrNotSupported;
+	if ( conv )
+		{
+		ret = conv->InterfaceToBearer(aInterfaceUid, aOperationId, aData, aMsgType, aBearerData);
+		}
+
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+TInt CBearerManager::MrcboDoBearerToInterface(TUid aBearerUid,
+		const TDesC8& aInterfaceData, 
+		const TDesC8& aBearerData,
+		TUid& aInterfaceUid, 
+		TUint& aOperationId,
+		TRemConMessageType& aMsgType, 
+		TDes8& aData) const
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taBearerUid = 0x%08x"), aBearerUid);
+
+	MRemConConverterInterface* conv = iServer.Converter(aInterfaceData, aBearerUid);
+	TInt ret = KErrNotSupported;
+	if ( conv )
+		{
+		ret = conv->BearerToInterface(aBearerData, aInterfaceUid, aOperationId, aMsgType, aData);
+		}
+
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+void CBearerManager::MrcboDoSetRemoteAddressedClient(const TUid& aBearerUid, const TRemConClientId& aId)
+	{
+	LOG_FUNC
+	LOG2(_L("\taBearerUid = 0x%08x, aId = %d"), aBearerUid, aId);
+	
+	iServer.SetRemoteAddressedClient(aBearerUid, aId);
+	}
+
+void CBearerManager::MrcboDoCommandExpired(TUint aTransactionId)
+	{
+	iServer.CommandExpired(aTransactionId);
+	}
+
+TSglQue<TBearerSecurity>& CBearerManager::BearerSecurityPolicies()
+	{
+	return iBearerSecurityPolicies;
+	}
+
+TBool CBearerManager::IsConnecting(const TRemConAddress& aAddr) const
+	{
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+	
+	TInt index = iCurrentlyBeingConnected.Find(aAddr, RemConAddrsMatch);
+	TInt ret = ( index != KErrNotFound ) ? ETrue : EFalse;
+	
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+TBool CBearerManager::IsDisconnecting(const TRemConAddress& aAddr) const
+	{
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+	
+	TInt index = iCurrentlyBeingDisconnected.Find(aAddr, RemConAddrsMatch);
+	TInt ret = ( index != KErrNotFound ) ? ETrue : EFalse;
+	
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+void CBearerManager::BulkInterfacesL(RArray<TBulkInterfaceInfo>& aBulkInterfaces) const
+	{
+	LOG_FUNC
+	ASSERT_DEBUG(aBulkInterfaces.Count() == 0);
+	CleanupResetPushL(aBulkInterfaces);
+	MRemConBearerBulkInterface* bulkIf = NULL;
+	for(TInt i=0; i<iBearers.Count(); i++)
+		{
+		ASSERT_DEBUG(iBearers[i]);
+		bulkIf = reinterpret_cast<MRemConBearerBulkInterface*>(iBearers[i]->GetInterface(TUid::Uid(KRemConBearerBulkInterface1)));
+		if(bulkIf)
+			{
+			TBulkInterfaceInfo ifInfo;
+			ifInfo.iIf = bulkIf;
+			ifInfo.iIfUid = TUid::Uid(KRemConBearerBulkInterface1);
+			ifInfo.iBearerUid = iBearers[i]->Uid();
+			aBulkInterfaces.AppendL(ifInfo);
+			}
+		}
+	CleanupStack::Pop(&aBulkInterfaces);
+	}
+
+TInt CBearerManager::MrcboDoSupportedInterfaces(const TRemConClientId& aId, RArray<TUid>& aUids)
+	{
+	LOG_FUNC
+	return iServer.SupportedInterfaces(aId, aUids);
+	}
+
+TInt CBearerManager::MrcboDoSupportedOperations(const TRemConClientId& aId, TUid aInterfaceUid, RArray<TUint>& aOperations)
+	{
+	LOG_FUNC
+	return iServer.SupportedOperations(aId, aInterfaceUid, aOperations);
+	}
+
+TInt CBearerManager::MrcboDoRegisterLocalAddressedClientObserver(const TUid& aBearerUid)
+	{
+	return iServer.RegisterLocalAddressedClientObserver(aBearerUid);
+	}
+
+TInt CBearerManager::MrcboDoUnregisterLocalAddressedClientObserver(const TUid& aBearerUid)
+	{
+	return iServer.UnregisterLocalAddressedClientObserver(aBearerUid);
+	}
+
+TInt CBearerManager::SetLocalAddressedClient(const TUid& aBearerUid, TRemConClientId aClientId)
+	{
+	LOG_FUNC;
+	
+	MRemConBearerInterfaceV3* const bearerIfV3 = BearerIfV3(aBearerUid);
+	if(bearerIfV3)
+		{
+		return bearerIfV3->SetLocalAddressedClient(aClientId);
+		}
+	else
+		{
+		return KErrNotFound;
+		}
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/bulkbearerinterface.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,394 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Bulk Bearer interface.
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "bulkbearerinterface.h"
+
+#include <remcon/remconbearerbulkinterface.h>
+#include <remcon/bearersecurity.h>
+#include <remcon/clientinfo.h>
+
+#include "bulkserver.h"
+#include "remconmessage.h"
+#include "utils.h"
+
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("bulkif");
+#endif // _DEBUG
+
+static TBool RemConAddrsMatch(const TRemConAddress& aFirstAddr, const TRemConAddress& aSecondAddr)
+	{
+	LOG_STATIC_FUNC
+	LOG(_L("aFirstAddr = ..."));
+	LOGHEXDESC(aFirstAddr.Addr());
+	LOG(_L("aSecondAddr = ..."));
+	LOGHEXDESC(aSecondAddr.Addr());
+	return aFirstAddr == aSecondAddr;
+	}
+
+static TUint32 RemConAddrHash(const TRemConAddress& aAddr)
+	{
+	LOG_STATIC_FUNC
+	TBuf8<sizeof(TUid) + TRemConAddress::KMaxAddrSize> buf;
+	buf.Append(TPckgC<TUid>(aAddr.BearerUid()));
+	buf.Append(aAddr.Addr());
+	LOG(_L("Hashing aAddr ..."));
+	LOGHEXDESC(buf);
+	TUint32 hash = DefaultHash::Des8(buf);
+	LOG1(_L("hash = 0x%08x"), hash);
+	return hash;
+	}
+
+CBulkBearerInterface* CBulkBearerInterface::NewL(CRemConBulkServer& aServer, CBearerManager& aBearerManager)
+	{
+	LOG_STATIC_FUNC;
+	CBulkBearerInterface* self = new(ELeave) CBulkBearerInterface(aServer, aBearerManager);
+	CleanupStack::PushL(self);
+	self->ConstructL(aBearerManager);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CBulkBearerInterface::~CBulkBearerInterface()
+	{
+	LOG_FUNC;
+	
+	StopBearers();
+
+	iAddressedClients.Close();	
+	iBearerIfs.Close();
+	}
+
+CBulkBearerInterface::CBulkBearerInterface(CRemConBulkServer& aServer, CBearerManager& aBearerManager)
+	: iAddressedClients(RemConAddrHash, RemConAddrsMatch)
+	, iSecurityPoliciesIter(aBearerManager.BearerSecurityPolicies())
+	, iServer(aServer)
+	{
+	LOG_FUNC;
+	}
+
+void CBulkBearerInterface::ConstructL(CBearerManager& aBearerManager)
+	{
+	LOG_FUNC;
+	
+	aBearerManager.BulkInterfacesL(iBearerIfs);
+	if(iBearerIfs.Count() == 0)
+		{
+		LEAVEL(KErrNotSupported);
+		}
+	
+	TInt err = KErrNone;
+	TBool oneStarted = EFalse;
+	for(TInt i=0; i<iBearerIfs.Count(); i++)
+		{
+		ASSERT_DEBUG(iBearerIfs[i].iIf);
+		err = iBearerIfs[i].iIf->MrcbbiStartBulk(*this);
+		// if we couldn't start bulk service this is of no
+		// use to us.  Throw it in the bin.
+		if(err)
+			{
+			iBearerIfs.Remove(i);
+			i--;
+			}
+		else
+			{
+			oneStarted = ETrue;
+			}
+		}
+	if(!oneStarted)
+		{
+		LEAVEL(KErrNotSupported);
+		}
+	
+	// Don't store the bearer manager - the less we interact with it the better.
+	}
+
+void CBulkBearerInterface::StopBearers()
+	{
+	for(TInt i=0; i<iBearerIfs.Count(); i++)
+		{
+		iBearerIfs[i].iIf->MrcbbiStopBulk();
+		}
+	}
+
+void CBulkBearerInterface::BulkClientAvailable(const TRemConClientId& aClient)
+	{
+	LOG_FUNC;
+	ASSERT_DEBUG(aClient != KNullClientId);
+	
+	for(TInt i=0; i<iBearerIfs.Count(); i++)
+		{
+		ASSERT_DEBUG(iBearerIfs[i].iIf);
+		iBearerIfs[i].iIf->MrcbbiBulkClientAvailable(aClient);
+		}
+	}
+
+void CBulkBearerInterface::BulkClientRemoved(const TRemConClientId& aClient)
+	{
+	LOG_FUNC;
+	ASSERT_DEBUG(aClient != KNullClientId);
+	
+	for(TInt i=0; i<iBearerIfs.Count(); i++)
+		{
+		ASSERT_DEBUG(iBearerIfs[i].iIf);
+		iBearerIfs[i].iIf->MrcbbiBulkClientNotAvailable(aClient);
+		}
+	// Bearer has been notified so remove the bulk client from any addressing.
+	// Apologses for the O(n!) code below...it's the only way we can do it
+	// without allocating memory (and the size of the table shouldn't be big
+	// enough to cause problems.)
+	const TRemConClientId* val = NULL;
+	do
+		{
+		THashMapIter<TRemConAddress, TRemConClientId> iter(iAddressedClients);
+		val = iter.CurrentValue();
+		do
+			{
+			if(val && *val == aClient)
+				{
+				const TRemConAddress* key = iter.CurrentKey();
+				ASSERT_DEBUG(key);
+				TRemConAddress addr = *key;
+				iAddressedClients.Remove(addr);
+				// modified the hash map so we must discard the current iterator.
+				break;
+				}
+			}
+		while(val = iter.NextValue(), val);
+		}
+	while(val);
+	}
+
+MRemConBearerBulkInterface* CBulkBearerInterface::BearerIf(TUid aBearerUid) const
+	{
+	LOG_FUNC;
+	LOG1(_L8("\taBearerUid = 0x%08x"), aBearerUid);
+
+	MRemConBearerBulkInterface* bearerIf = NULL;
+
+	const TUint numBearerIfs = iBearerIfs.Count();
+	for ( TUint ii = 0 ; ii < numBearerIfs ; ++ii )
+		{
+		if ( iBearerIfs[ii].iBearerUid == aBearerUid )
+			{
+			bearerIf = iBearerIfs[ii].iIf;
+			break;
+			}
+		}
+
+	LOG1(_L8("\tbearerIf = 0x%08x"), bearerIf);
+	return bearerIf;
+	}
+
+TBool CBulkBearerInterface::CheckPolicy(TUid aBearerUid, const TClientInfo& aClientInfo)
+	{
+	LOG_FUNC;
+	TBool ret = EFalse;
+	iSecurityPoliciesIter.SetToFirst();
+	TBearerSecurity* sec = NULL;
+	while(sec = iSecurityPoliciesIter++, sec)
+		{
+		if(sec->BearerUid() == aBearerUid)
+			{
+			if(aClientInfo.Message().IsNull()) // already been complete, so we have to rely on a process handle
+				{
+				RProcess process;
+				TInt err = process.Open(aClientInfo.ProcessId(), EOwnerThread);
+				if(err == KErrNone)
+					{
+					ret = sec->SecurityPolicy().CheckPolicy(process);
+					}
+				// else we failed to open the handle...so we cannot do any more - fail check.
+				process.Close();
+				}
+			else
+				{
+				ret = sec->SecurityPolicy().CheckPolicy(aClientInfo.Message());
+				}
+			break;
+			}
+		}
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+
+TInt CBulkBearerInterface::Send(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	LOG3(_L8("\taMsg.Addr.BearerUid = 0x%08x, aMsg.InterfaceUid = 0x%08x, aMsg.OperationId = 0x%02x"), 
+		aMsg.Addr().BearerUid(), aMsg.InterfaceUid(), aMsg.OperationId());
+
+	MRemConBearerBulkInterface* const bearerIf = BearerIf(aMsg.Addr().BearerUid());
+	// Unlike the control server, there is no connection oriented nature, and so 
+	// the messages are all connectionless.  However these should all be in response
+	// to a message (as only responses are currently supported).
+	ASSERT_DEBUG(bearerIf);	
+
+	TInt ret = KErrNone;
+
+	switch ( aMsg.MsgType() )
+		{
+	case ERemConResponse:
+		ret = bearerIf->MrcbbiSendResponse(aMsg.InterfaceUid(), 
+			aMsg.OperationId(), 
+			aMsg.TransactionId(),
+			aMsg.OperationData(), 
+			aMsg.Addr());
+		if ( ret == KErrNone )
+			{
+			// On success, the bearer takes ownership of the message data.
+			aMsg.OperationData().Assign(NULL);
+			}
+		break;
+	case ERemConReject:
+		{
+		ASSERT_DEBUG(aMsg.OperationData().Length() == 0);
+		bearerIf->MrcbbiSendReject(aMsg.InterfaceUid(), 
+			aMsg.OperationId(), 
+			aMsg.TransactionId(),
+			aMsg.Addr());
+		break;
+		}
+	default:
+		DEBUG_PANIC_LINENUM; // the session protects us against this
+		break;
+		}
+
+	LOG1(_L8("\tret = %d"), ret);
+	return ret;
+	}
+
+TInt CBulkBearerInterface::MrcbboDoNewCommand(const TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+	LOG1(_L8("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+
+	TRemConClientId clientId;
+	TRAPD(err, clientId = iAddressedClients.FindL(aAddr));
+	
+	if(err == KErrNone)
+		{
+		TRAP(err, NewCommandL(aAddr, clientId));
+		}
+
+	LOG1(_L8("\terr = %d"), err);
+	return err;
+	}
+
+TInt CBulkBearerInterface::MrcbboDoNewCommand(const TRemConAddress& aAddr, const TRemConClientId& aClient)
+	{
+	LOG_FUNC;
+	LOG1(_L8("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+	LOG1(_L8("\taClient = 0x%08x"), aClient);
+
+	TRAPD(err, NewCommandL(aAddr, aClient));
+
+	LOG1(_L8("\terr = %d"), err);
+	return err;
+	}
+
+void CBulkBearerInterface::NewCommandL(const TRemConAddress& aAddr, const TRemConClientId& aClient)
+	{
+	LOG_FUNC;
+	LOG1(_L8("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+	LOG1(_L8("\taClient = 0x%08x"), aClient);
+
+	// Get the calling bearer from aAddr and get the new command from it.
+	MRemConBearerBulkInterface* const bearerIf = BearerIf(aAddr.BearerUid());
+	ASSERT_DEBUG(bearerIf);
+	TUid interfaceUid;
+	TUint transactionId;
+	TUint operationId;
+	RBuf8 data;
+	TRemConAddress addr;
+	LEAVEIFERRORL(bearerIf->MrcbbiGetCommand(interfaceUid,
+		transactionId, 
+		operationId, 
+		data, 
+		addr));
+	LOG3(_L8("\treceived command with interfaceUid [0x%08x], operationId 0x%02x, data.Length = %d"), 
+		interfaceUid, operationId, data.Length());
+	// We now own what's pointed to by 'data'.
+	CleanupClosePushL(data);
+
+	CRemConMessage* msg = CRemConMessage::NewL(
+		aAddr,
+		aClient,
+		ERemConCommand,
+		ERemConMessageDefault,
+		interfaceUid,
+		operationId,
+		data,
+		0, // session ID as yet unknown
+		transactionId);
+	// 'msg' now has a pointer to the memory pointed to by 'data', and owns 
+	// it.
+	CLEANUPSTACK_POP1(&data);
+	// Give the new command to the server, which takes ownership of it. 
+	iServer.NewCommand(*msg);
+	}
+
+TUint CBulkBearerInterface::MrcbboDoNewTransactionId()
+	{
+	LOG_FUNC;
+	TUint newId = iRunningTransactionId;
+
+	if ( iRunningTransactionId == KMaxTUint )
+		{
+		iRunningTransactionId = 0;
+		}
+	else
+		{
+		++iRunningTransactionId;
+		}
+	
+	LOG1(_L8("CBulkBearerInterface::MrcbboDoNewTransactionId newId = %d"), newId);
+	return newId;
+	}
+
+void CBulkBearerInterface::MrcbboDoCommandExpired(TUint aTransactionId)
+	{
+	LOG_FUNC;
+	iServer.CommandExpired(aTransactionId);
+	}
+
+TInt CBulkBearerInterface::MrcbboDoSetAddressedClient(const TRemConAddress& aAddr, const TRemConClientId& aClient)
+	{
+	LOG_FUNC;
+	return iAddressedClients.Insert(aAddr, aClient); // hash map should cover uniqueness
+	}
+
+TInt CBulkBearerInterface::MrcbboDoRemoveAddressing(const TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+	return iAddressedClients.Remove(aAddr);
+	}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/bulkmain.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,88 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Entry point for Rem Con Bulk server.
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "remconserver.h"
+#include "bulkserver.h"
+
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+static void RunBulkServerL(RMsgQueue<TBulkServerMsg>* aMsgQueue);
+
+/**
+Entry point for the Remote Control server.
+@return Error.
+*/
+TInt BulkMain(TAny* aParam)
+	{
+	CONNECT_LOGGER;
+	LOG_STATIC_FUNC;
+	TInt ret = KErrNoMemory;
+
+	__UHEAP_MARK;
+
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+
+	if ( cleanup )
+		{
+		TRAP(ret, RunBulkServerL(reinterpret_cast<RMsgQueue<TBulkServerMsg>*>(aParam)));
+		delete cleanup;
+		}
+
+	__UHEAP_MARKEND;
+
+	LOG1(_L8("\tret = %d"), ret);
+	CLOSE_LOGGER;
+	return ret;
+	}
+
+/**
+Create the active scheduler and Rem Con bulk server instances, and start the 
+server.
+*/
+static void RunBulkServerL(RMsgQueue<TBulkServerMsg>* aMsgQueue)
+	{
+	LOG_STATIC_FUNC;
+	LEAVEIFERRORL(User::RenameThread(KRemConBulkServerName));
+
+	// Create and install the active scheduler.
+	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
+	CleanupStack::PushL(scheduler);
+	CActiveScheduler::Install(scheduler);
+
+	// Create the server. NB Odd syntax in this line because we never refer to 
+	// it directly- it's always owned by the cleanup stack!
+	static_cast<void>(CRemConBulkServer::NewLC(*aMsgQueue));
+
+	// Initialisation complete, now signal the client
+	RThread().Rendezvous(KErrNone);
+
+	// Ready to run. This only returns when the server is closing down.
+	CActiveScheduler::Start();
+
+	// Clean up the server and scheduler.
+	CleanupStack::PopAndDestroy(2, scheduler);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/bulkserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,533 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Remote Control bulk server implementation.
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+#include <bluetooth/logger.h>
+
+#include "bulkbearerinterface.h"
+#include "bulkserver.h"
+#include "bulkserversecuritypolicy.h"
+#include "bulksession.h"
+#include "messagequeue.h"
+#include "remconmessage.h"
+#include "utils.h"
+
+#include "server.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("bulkserver");
+#endif // _DEBUG
+
+#ifdef __FLOG_ACTIVE
+#define LOGSESSIONS							LogSessions()
+#define LOGINCOMINGPENDINGDELIVERY			LogIncomingPendingDelivery()
+#define LOGINCOMINGDELIVERED				LogIncomingDelivered()
+#else
+#define LOGSESSIONS
+#define LOGINCOMINGPENDINGDELIVERY
+#define LOGINCOMINGDELIVERED
+#endif // __FLOG_ACTIVE
+
+CRemConBulkServer* CRemConBulkServer::NewLC(RMsgQueue<TBulkServerMsg>& aMsgQueue)
+	{
+	LOG_STATIC_FUNC;
+	CRemConBulkServer* self = new(ELeave) CRemConBulkServer(aMsgQueue);
+	CleanupStack::PushL(self);
+	// StartL is where the kernel checks that there isn't already an instance 
+	// of the same server running, so do it before ConstructL.
+	self->StartL(KRemConBulkServerName);
+	self->ConstructL();
+	return self;
+	}
+
+CRemConBulkServer::~CRemConBulkServer()
+	{
+	LOG_FUNC;
+
+	delete iShutdownTimer;
+
+	iSessions.Close();
+	
+	delete iIncomingPendingDelivery;
+	delete iIncomingDelivered;
+	
+	delete iBulkBearerInterface;
+	}
+
+CRemConBulkServer::CRemConBulkServer(RMsgQueue<TBulkServerMsg>& aMsgQueue)
+ :	CPolicyServer(CActive::EPriorityStandard, KRemConBulkServerPolicy, ESharableSessions),
+ 	iRemConMsgQueue(aMsgQueue)
+	{
+	LOG_FUNC;
+	}
+
+void CRemConBulkServer::ConstructL()
+	{
+	LOG_FUNC;
+	iShutdownTimer = CPeriodic::NewL(CActive::EPriorityStandard);
+	
+	iIncomingPendingDelivery = CMessageQueue::NewL();
+	iIncomingDelivered = CMessageQueue::NewL();
+	
+	// First message is the control server for client ID binding
+	TBulkServerMsg ctrlMsg;
+	iRemConMsgQueue.ReceiveBlocking(ctrlMsg);
+	ASSERT_DEBUG(ctrlMsg.iType == EControlServer);
+	ASSERT_DEBUG(ctrlMsg.iData);
+	iControlServer = reinterpret_cast<CRemConServer*>(ctrlMsg.iData);
+	
+	// Second message is bearer manager information for interface loading.
+	TBulkServerMsg msg;
+	iRemConMsgQueue.ReceiveBlocking(msg);
+	ASSERT_DEBUG(msg.iType == EBearerManager);
+	ASSERT_DEBUG(msg.iData);
+	CBearerManager* bearerManager = reinterpret_cast<CBearerManager*>(msg.iData);
+	iBulkBearerInterface = CBulkBearerInterface::NewL(*this, *bearerManager);
+	}
+
+CSession2* CRemConBulkServer::NewSessionL(const TVersion& aVersion, 
+	const RMessage2& aMessage) const
+	{
+	LOG_FUNC;
+	LOG3(_L8("\taVersion = (%d,%d,%d)"), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild);
+		
+	// Version number check...
+	TVersion v(KRemConBulkSrvMajorVersionNumber,
+		KRemConBulkSrvMinorVersionNumber,
+		KRemConBulkSrvBuildNumber);
+
+	if ( !User::QueryVersionSupported(v, aVersion) )
+		{
+		LEAVEIFERRORL(KErrNotSupported);
+		}
+
+	CRemConBulkServer* ncThis = const_cast<CRemConBulkServer*>(this);
+	
+	CRemConBulkSession* sess = NULL;
+	TRAPD(err, sess = CRemConBulkSession::NewL(*ncThis, 
+				aMessage)
+			);
+	if ( err != KErrNone )
+		{
+		// Session creation might have failed- if it has we need to check if 
+		// we need to shut down again.
+		const_cast<CRemConBulkServer*>(this)->StartShutdownTimerIfNoSessions();
+		LEAVEIFERRORL(err);
+		}
+
+	LOG1(_L8("\tsess = 0x%08x"), sess);
+	return sess;
+	}
+
+void CRemConBulkServer::StartShutdownTimerIfNoSessions()
+	{
+	LOG_FUNC;
+
+	if ( iSessions.Count() == 0 )
+		{
+		LOG(_L8("\tno remaining sessions- starting shutdown timer"));
+		// Should have been created during our construction.
+		ASSERT_DEBUG(iShutdownTimer);
+		// Start the shutdown timer. It's actually a CPeriodic- the first 
+		// event will be in KShutdownDelay microseconds' time.
+		// NB The shutdown timer might already be active, in the following 
+		// case: this function is being called by NewSessionL because there 
+		// was a failure creating a new session, BUT this function had already 
+		// been called by the session's destructor (i.e. the failure was in 
+		// the session's ConstructL, NOT its new(ELeave)). To protect against 
+		// KERN-EXEC 15 just check for if the timer is already active. 
+		if ( !iShutdownTimer->IsActive() )
+			{
+			iShutdownTimer->Start(KShutdownDelay, 
+				// Delay of subsequent firings (will not happen because we kill 
+				// ourselves after the first).
+				0, 
+				TCallBack(CRemConBulkServer::TimerFired, this)
+				);
+			}
+		else
+			{
+			LOG(_L8("\tshutdown timer was already active"));
+			}
+		}
+	}
+
+TInt CRemConBulkServer::TimerFired(TAny* aThis)
+	{
+	LOG_STATIC_FUNC
+	static_cast<void>(aThis);
+	
+#if defined(__FLOG_ACTIVE) || defined(_DEBUG)
+	CRemConBulkServer* self = static_cast<CRemConBulkServer*>(aThis);
+	// We should have sent 'this' to this callback. 
+	ASSERT_DEBUG(self);
+	LOG1(_L8("\tauto shutdown- terminating the bulk server [0x%08x]"), self);
+#endif // __FLOG_ACTIVE || _DEBUG
+	
+	// Stop our Active Scheduler. This returns the flow of execution to after 
+	// the CActiveScheduler::Start call in the server startup code, and 
+	// terminates the server.
+	CActiveScheduler::Stop();
+	
+	return KErrNone;
+	}
+
+TInt CRemConBulkServer::ClientOpened(CRemConBulkSession& aSession, TProcessId aProcessId)
+	{
+	LOG_FUNC;
+	LOG1(_L8("\t&aSession = 0x%08x"), &aSession);
+	LOGSESSIONS;
+	
+	ASSERT_DEBUG(iControlServer);
+	TRemConClientId id = iControlServer->ClientIdByProcessId(aProcessId);
+	TInt ret = KErrNotFound; // If the control session has already been destroyed then fail...
+	if(id != KNullClientId)
+		{
+		TRAP(ret, iControlServer->BulkInterfacesForClientL(id, aSession.InterestedAPIs()));
+		if(ret == KErrNone)
+			{
+			aSession.SetId(id);
+		
+			// Register the session by appending it to our array, and also making an 
+			// item for it in the record of which points in the connection history 
+			// sessions are interested in.
+			ret = iSessions.Append(&aSession);
+			
+			if ( ret == KErrNone )
+				{
+				ASSERT_DEBUG(iBulkBearerInterface);
+				iBulkBearerInterface->BulkClientAvailable(id);
+				
+				// Should have been created during our construction.
+				ASSERT_DEBUG(iShutdownTimer);
+				iShutdownTimer->Cancel();
+				}
+			}
+		}
+
+	LOGSESSIONS;
+	LOG1(_L8("\tret = %d"), ret);
+	return ret;
+	}
+
+// called by session when session is closed.
+void CRemConBulkServer::ClientClosed(CRemConBulkSession& aSession)
+	{
+	LOG_FUNC;
+	LOG1(_L8("\t&aSession = 0x%08x"), &aSession);
+	LOGSESSIONS;
+
+	// Find this session in the array and remove it (if it's there).
+	const TUint sessCount = iSessions.Count();
+	for(TUint ix = 0; ix < sessCount; ++ix)
+		{
+		if(iSessions[ix] == &aSession)
+			{
+			// We've found the session in our array.
+			ASSERT_DEBUG(aSession.Id() != KNullClientId);
+			ASSERT_DEBUG(iBulkBearerInterface);
+			iBulkBearerInterface->BulkClientRemoved(aSession.Id());
+			// Remove the session from our array.
+			iSessions.Remove(ix);
+			break;
+			}
+		}
+
+	StartShutdownTimerIfNoSessions();
+
+	LOGSESSIONS;
+	}
+
+#ifdef __FLOG_ACTIVE
+void CRemConBulkServer::LogSessions() const
+	{
+	const TUint count = iSessions.Count();
+	LOG1(_L8("\tNumber of sessions = %d"), count);
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConBulkSession* const session = iSessions[ii];
+		ASSERT_DEBUG(session);
+		LOG3(_L8("\t\tsession %d [0x%08x], Id = %d"), 
+			ii, 
+			session,
+			session->Id()
+			);
+		}
+	}
+
+void CRemConBulkServer::LogIncomingPendingDelivery() const
+	{
+	LOG(_L8("Logging incoming pending delivery messages"));
+	__FLOG_STMT(const_cast<CRemConBulkServer*>(this)->IncomingPendingDelivery().LogQueue();)
+	}
+
+void CRemConBulkServer::LogIncomingDelivered() const
+	{
+	LOG(_L8("Logging incoming delivered commands"));
+	__FLOG_STMT(const_cast<CRemConBulkServer*>(this)->IncomingDelivered().LogQueue();)
+	}
+#endif // __FLOG_ACTIVE
+
+
+void CRemConBulkServer::ReceiveRequest(CRemConBulkSession& aSession)
+	{
+	LOG_FUNC;
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+	
+	// Find the first message in IncomingPendingDelivery for this session.
+	TSglQueIter<CRemConMessage>& iter = IncomingPendingDelivery().SetToFirst();
+	CRemConMessage* msg;
+	while ( ( msg = iter++ ) != NULL )
+		{
+		if ( msg->SessionId() == aSession.Id() )
+			{
+			TInt err = aSession.WriteMessageToClient(*msg);
+			IncomingPendingDelivery().Remove(*msg);
+			
+			if (err == KErrNone )
+				{
+				// We'll need to remember it for the response coming back.
+				IncomingDelivered().Append(*msg); 
+				}
+			else
+				{
+				// Tell bearer it won't be getting a response
+				SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
+
+				// 'Take ownership' of it by destroying it- it's finished with.
+				delete msg;
+				}
+			
+			break;
+			}
+		}
+
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+	}
+
+void CRemConBulkServer::NewCommand(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	
+	CRemConBulkSession* const sess = Session(aMsg.Client());
+	if(!sess)
+		{
+        // Tell bearer it won't be getting a response
+        SendReject(aMsg.Addr(), aMsg.InterfaceUid(), aMsg.OperationId(), aMsg.TransactionId());
+
+        // 'Take ownership' of it by destroying it- it's finished with.
+        delete &aMsg;
+		}
+	else
+		{
+		DeliverCmdToClient(aMsg, *sess);
+		}
+	//now wait for the actual response to come from the client (success!)
+	}
+
+void CRemConBulkServer::DeliverCmdToClient(const CRemConMessage& aMsg, CRemConBulkSession& aSess)
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(aMsg.MsgType() == ERemConCommand); 
+	// Take a reference of the message and set the right session ID (important 
+	// to set the selected session's ID because this is how we match up the 
+	// client's response).
+	CRemConMessage& msg = const_cast<CRemConMessage&>(aMsg);
+	msg.SessionId() = aSess.Id();
+	DeliverMessageToClient(msg, aSess);
+	}
+
+void CRemConBulkServer::DeliverMessageToClient(CRemConMessage& aMsg, CRemConBulkSession& aSess)
+	{
+	LOG_FUNC;
+
+	TInt err = KErrNone;
+	// See if the client can take the message now and put it on the right 
+	// queue.
+	if ( aSess.CurrentReceiveMessage().Handle() )
+		{
+		err = aSess.WriteMessageToClient(aMsg);
+		// If the message was a command, and it was delivered with no error, 
+		// then put it in the 'incoming delivered' log. Otherwise, delete it 
+		// because it's finished with.
+		if (err == KErrNone )
+			{
+			// We'll need to remember it for the response coming back.
+			IncomingDelivered().Append(aMsg); 
+			}
+		else
+			{
+			// Tell bearer it won't be getting a response
+			SendReject(aMsg.Addr(), aMsg.InterfaceUid(), aMsg.OperationId(), aMsg.TransactionId());
+
+			// 'Take ownership' of it by destroying it- it's finished with.
+			delete &aMsg;
+			}
+		}
+	else
+		{
+		IncomingPendingDelivery().Append(aMsg);
+		}
+	
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+	}
+
+TInt CRemConBulkServer::SendResponse(CRemConMessage& aMsg, CRemConBulkSession& aSess)
+	{
+	LOG_FUNC;
+	LOGINCOMINGDELIVERED;
+	TInt ret = KErrNone;
+
+	CRemConMessage* response = &aMsg;
+	
+	// Find the first command ('space badger') in the iIncomingDelivered queue with 
+	// the same session ID, interface UID and operation ID as the response 
+	// we're sending, and send the response to the same address that space badger came 
+	// from.
+	TSglQueIter<CRemConMessage>& iter = IncomingDelivered().SetToFirst();
+	CRemConMessage* msg;
+	TBool found = EFalse;
+	while ( ( msg = iter++ ) != NULL )
+		{
+		if (	msg->SessionId() == aSess.Id()
+			&&	msg->InterfaceUid() == response->InterfaceUid()
+			&&	msg->OperationId() == response->OperationId())
+			{
+			LOG1(_L8("\tfound a matching item in the incoming delivered commands log: [0x%08x]"), msg);
+			found = ETrue;
+			
+			// Set the right address and transaction id in the outgoing message
+			response->Addr() = msg->Addr();
+			response->TransactionId() = msg->TransactionId();
+			
+			// Remove the item from the 'incoming delivered' queue now we've 
+			// addressed a response using it.
+			IncomingDelivered().RemoveAndDestroy(*msg);
+			
+			ASSERT_DEBUG(iBulkBearerInterface);
+			ret = iBulkBearerInterface->Send(aMsg);
+
+			break;
+			}
+		}
+
+	// If the command was not found, then the app has sent a response to a
+	// non-existant command.  It may do this in good intention if the server 
+	// has transparently died and been restarted between the app's reception
+	// of the command and it sending its response, so we can't panic it.
+	// Just drop the message.
+	if ( !found )
+		{
+		// Complete the message with KErrNone.  We have done all we can with
+		// it.  Any other error may encourage retries from the application,
+		// which would be useless in this situation.
+		ret = KErrNone;
+		}
+
+	// We've now finished with the response.
+	delete response;
+		
+	LOGINCOMINGDELIVERED;
+	return ret;
+	}
+
+void CRemConBulkServer::CommandExpired(TUint aTransactionId)
+	{
+	LOG_FUNC;
+
+	CRemConMessage* msg;
+	
+	TSglQueIter<CRemConMessage> pendingDeliveryIter = IncomingPendingDelivery().SetToFirst();
+	
+	while ((msg = pendingDeliveryIter++) != NULL)
+		{
+		if (msg->TransactionId() == aTransactionId)
+			{
+			IncomingPendingDelivery().RemoveAndDestroy(*msg);
+			}
+		}
+	
+	TSglQueIter<CRemConMessage> deliveredIter = IncomingDelivered().SetToFirst();
+	
+	while ((msg = deliveredIter++) != NULL)
+		{
+		if (msg->TransactionId() == aTransactionId)
+			{
+			IncomingDelivered().RemoveAndDestroy(*msg);
+			}
+		}
+	}
+
+void CRemConBulkServer::SendReject(TRemConAddress aAddr, TUid aInterfaceUid, TUint aOperationId, TUint aTransactionId)
+	{
+	LOG_FUNC;
+	
+	CRemConMessage* rejectMsg = NULL;
+	RBuf8 data;
+	data = KNullDesC8;
+	TRAPD(err, rejectMsg = CRemConMessage::NewL(aAddr, KNullClientId, ERemConReject, ERemConMessageDefault, aInterfaceUid, aOperationId, data, 0, aTransactionId));
+	if ( err == KErrNone)
+		{
+		static_cast<void>(iBulkBearerInterface->Send(*rejectMsg));
+		// We've now finished with the response.
+		delete rejectMsg;
+		}
+	}
+
+CMessageQueue& CRemConBulkServer::IncomingPendingDelivery()
+	{
+	ASSERT_DEBUG(iIncomingPendingDelivery);
+	return *iIncomingPendingDelivery;
+	}
+
+CMessageQueue& CRemConBulkServer::IncomingDelivered()
+	{
+	ASSERT_DEBUG(iIncomingDelivered);
+	return *iIncomingDelivered;
+	}
+
+CRemConBulkSession* CRemConBulkServer::Session(TUint aSessionId) const
+	{
+	CRemConBulkSession* sess = NULL;
+
+	const TUint count = iSessions.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConBulkSession* const temp = iSessions[ii];
+		ASSERT_DEBUG(temp);
+		if ( temp->Id() == aSessionId )
+			{
+			sess = temp;
+			break;
+			}
+		}
+
+	return sess;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/bulksession.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,359 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Remote Control bulk session implementation.
+//
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+#include "bulksession.h"
+#include "remconserver.h"
+
+#include "bulkserver.h"
+#include "remconmessage.h"
+#include "utils.h"
+
+#include "messagequeue.h"
+
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("bulksess");
+#endif
+
+CRemConBulkSession* CRemConBulkSession::NewL(CRemConBulkServer& aServer,
+		const RMessage2& aMessage)
+	{
+	LOG_STATIC_FUNC;
+	CRemConBulkSession* self = new(ELeave) CRemConBulkSession(aServer);
+	CleanupStack::PushL(self);
+	self->ConstructL(aMessage);
+	CLEANUPSTACK_POP1(self);
+	return self;
+	}
+
+CRemConBulkSession::CRemConBulkSession(CRemConBulkServer& aServer)
+ :	iServer(aServer),
+	iId(KNullClientId)
+	{
+	LOG_FUNC;
+	}
+
+void CRemConBulkSession::ConstructL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	
+	// Get the client's process ID.
+	RThread thread;
+	LEAVEIFERRORL(aMessage.Client(thread));
+	CleanupClosePushL(thread);
+	RProcess process;
+	LEAVEIFERRORL(thread.Process(process));
+	iClientInfo.ProcessId() = process.Id();
+	process.Close();
+	iClientInfo.SecureId() = thread.SecureId();
+	CleanupStack::PopAndDestroy(&thread);
+	
+	// Tell the server about us.
+	LEAVEIFERRORL(iServer.ClientOpened(*this, iClientInfo.ProcessId()));
+	}
+
+CRemConBulkSession::~CRemConBulkSession()
+	{
+	LOG_FUNC;
+	
+	iInterestedAPIs.Close();
+	
+	// Tell the server we've gone away- it may start its shutdown timer.
+	iServer.ClientClosed(*this);
+	}
+
+void CRemConBulkSession::ServiceL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	LOG1(_L8("\taMessage.Function() = %d"), aMessage.Function());
+
+	// Switch on the IPC number and call a 'message handler'. Message handlers 
+	// complete aMessage (either with Complete or Panic), or make a note of 
+	// the message for later asynchronous completion.
+	// Message handlers should not leave- the server does not have an Error 
+	// function. 
+
+	switch ( aMessage.Function() )
+		{
+	// Heap failure testing APIs.
+	case ERemConBulkDbgMarkHeap:
+#ifdef _DEBUG
+		LOG(_L8("\tmark heap"));
+		__UHEAP_MARK;
+#endif // _DEBUG
+		CompleteClient(aMessage, KErrNone);
+		break;
+	
+	case ERemConBulkDbgCheckHeap:
+#ifdef _DEBUG
+		LOG1(_L8("\tcheck heap (expecting %d cells)"), aMessage.Int0());
+		__UHEAP_CHECK(aMessage.Int0());
+#endif // _DEBUG
+		CompleteClient(aMessage, KErrNone);
+		break;
+	
+	case ERemConBulkDbgMarkEnd:
+#ifdef _DEBUG
+		LOG1(_L8("\tmark end (expecting %d cells)"), aMessage.Int0());
+		__UHEAP_MARKENDC(aMessage.Int0());
+#endif // _DEBUG
+		CompleteClient(aMessage, KErrNone);
+		break;
+	
+	case ERemConBulkDbgFailNext:
+#ifdef _DEBUG
+		{
+		LOG1(_L8("\tfail next (simulating failure after %d allocation(s))"), aMessage.Int0());
+		if ( aMessage.Int0() == 0 )
+			{
+			__UHEAP_RESET;
+			}
+		else
+			{
+			__UHEAP_FAILNEXT(aMessage.Int0());
+			}
+		}
+#endif // _DEBUG
+		CompleteClient(aMessage, KErrNone);
+		break;
+	
+	case ERemConBulkSend:
+		Send(aMessage);
+		break;
+	
+	case ERemConBulkSendUnreliable:
+		SendUnreliable(aMessage);
+		break;
+	
+	case ERemConBulkSendCancel:
+		SendCancel(aMessage);
+		ASSERT_DEBUG(aMessage.Handle() == 0);
+		break;
+	
+	case ERemConBulkReceive:
+		Receive(aMessage);
+		break;
+	
+	case ERemConBulkReceiveCancel:
+		ReceiveCancel(aMessage);
+		ASSERT_DEBUG(aMessage.Handle() == 0);
+		break;
+	
+	default:
+		// Unknown message
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
+		break;
+		}
+	}
+
+void CRemConBulkSession::CompleteClient(const RMessage2& aMessage, TInt aError)
+	{
+	LOG1(_L("\tcompleting client message with %d"), aError);
+	TBool cleanClientInfoMessage = (iClientInfo.Message().Handle() == aMessage.Handle());
+	aMessage.Complete(aError);
+	if(cleanClientInfoMessage)
+		{
+		iClientInfo.Message() = RMessage2();
+		}
+	}
+
+TInt CRemConBulkSession::WriteMessageToClient(const CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(iReceiveMsg.Handle());
+	
+	TInt err = KErrNone;
+	TPckg<TUint> uid(aMsg.InterfaceUid().iUid);
+	
+	//check if our client is interested in this API
+	//Only need to check commands because it is safe to assume that we are interested 
+	//in the response if we have sent out a command.
+	
+	if(aMsg.MsgType() == ERemConCommand && iInterestedAPIs.Find(aMsg.InterfaceUid())==KErrNotFound)
+		{
+		//The server will clean up the resource allocated for this msg
+		err = KErrArgument;
+		}
+	else 
+		{
+		err = iReceiveMsg.Write(0, uid);
+		}
+		
+	if ( err == KErrNone )
+		{
+		TPckg<TUint> opId(aMsg.OperationId());
+		err = iReceiveMsg.Write(1, opId);
+		if ( err == KErrNone )
+			{
+			// This logging code left in for maintenance.
+			//LOG1(_L8("\t\tOperationData = \"%S\""), &aMsg.OperationData());
+			// Note that we do not panic the client if their descriptor is not 
+			// big enough to hold the operation-specific data. If we did, then 
+			// a buggy remote could take down a client of RemCon. Just error 
+			// the client instead.
+			err = iReceiveMsg.Write(2, aMsg.OperationData());
+			}
+		}
+
+	CompleteClient(iReceiveMsg, err);
+	LOG1(_L8("\terr = %d"), err);
+
+	return err;
+	}
+
+void CRemConBulkSession::Receive(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	if ( iReceiveMsg.Handle() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicReceiveAlreadyOutstanding);
+		return;
+		}
+
+	iReceiveMsg = aMessage;
+	// If there's anything waiting to be given to us, ReceiveRequest will call 
+	// back to us with it.
+	iServer.ReceiveRequest(*this);
+	}
+
+void CRemConBulkSession::ReceiveCancel(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	if ( iReceiveMsg.Handle() )
+		{
+		CompleteClient(iReceiveMsg, KErrCancel);
+		}
+	CompleteClient(aMessage, KErrNone);
+	// At no point do we make any change to the processes going on underneath
+	// us- 'Cancel' APIs are just for cancelling interest in an async
+	// operation.
+	}
+
+void CRemConBulkSession::Send(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	TRAPD(err, DoSendL(aMessage));
+	CompleteClient(aMessage, err);
+	}
+
+void CRemConBulkSession::DoSendL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	
+	CRemConMessage* msg = DoCreateMessageL(aMessage, ETrue);
+	LEAVEIFERRORL(SendToServer(*msg));
+	}
+
+void CRemConBulkSession::SendUnreliable(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	CRemConMessage* msg = NULL;
+	TRAPD(err, msg = DoCreateMessageL(aMessage, EFalse));
+	CompleteClient(aMessage, err);
+	if (err == KErrNone)
+		{
+		static_cast<void>(SendToServer(*msg)); // unreliable so ignore error.
+		}
+	}
+
+CRemConMessage* CRemConBulkSession::DoCreateMessageL(const RMessage2& aMessage, TBool aReliable)
+	{
+	LOG_FUNC;
+
+	// Get the data the client wants to send.
+	const TUid interfaceUid = TUid::Uid(aMessage.Int0());
+	LOG1(_L8("\tinterfaceUid = 0x%08x"), interfaceUid);
+	
+	const TUint operationId = aMessage.Int1();
+	LOG1(_L8("\toperationId = 0x%08x"), operationId);
+	
+	const TUint dataLength = (TUint)aMessage.GetDesLengthL(2);
+	LOG1(_L8("\tdataLength = %d"), dataLength);
+	
+	// If the client wanted to send some operation-associated data, read it 
+	// from them.
+	RBuf8 sendDes;
+	if ( dataLength != 0 )
+		{
+		sendDes.CreateL(dataLength);
+		TInt err = aMessage.Read(
+			2, // location of the descriptor in the client's message (as we expect them to have set it up)
+			sendDes, // descriptor to write to from client memory space
+			0 // offset into our descriptor to put the client's data
+			);
+		// NB We don't do LEAVEIFERRORL(aMessage.Read) because a bad client 
+		// descriptor is a panicking offence for them, not an 'error the 
+		// request' offence.
+		if ( err != KErrNone )
+			{
+			LOG1(_L8("\taMessage.Read = %d"), err);
+			sendDes.Close();
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+			LEAVEL(KErrBadDescriptor);
+			}
+		}
+	CleanupClosePushL(sendDes);
+
+	CRemConMessage* msg = CRemConMessage::NewL(
+			TRemConAddress(), // we don't know which remotes it's going to yet
+			ERemConResponse, // targets can only send responses
+			ERemConMessageDefault,
+			interfaceUid,
+			operationId,
+			sendDes, // msg takes ownership
+			Id(), // session id to match this response against the originating command
+			0, // transaction id not yet known
+			aReliable);
+	CLEANUPSTACK_POP1(&sendDes); // now owned by msg
+	
+	iClientInfo.Message() = aMessage;
+
+	return msg;
+	}
+
+TInt CRemConBulkSession::SendToServer(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	return iServer.SendResponse(aMsg, *this);
+	}
+
+void CRemConBulkSession::SendCancel(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	
+	// This is left as an actual function on the server for interface
+	// reasons.  In fact the sending is (unlike in the control server)
+	// processed synchronously - so currently there is never be anything
+	// to cancel when this arrives.
+	
+	CompleteClient(aMessage, KErrNone);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/connectionhistory.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,353 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include "connectionhistory.h"
+#include "connections.h"
+#include "utils.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("connhist");
+#endif
+
+#ifdef __FLOG_ACTIVE
+#define LOGCOLLECTIONPOOL	LogCollectionPool()
+#define LOGADDRESSPOOL		LogAddressPool()
+#else
+#define LOGCOLLECTIONPOOL
+#define LOGADDRESSPOOL
+#endif // __FLOG_ACTIVE
+
+CConnectionHistory* CConnectionHistory::NewL()
+	{
+	LOG_STATIC_FUNC
+	CConnectionHistory* self = new(ELeave) CConnectionHistory();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CLEANUPSTACK_POP1(self);
+	return self;
+	}
+
+CConnectionHistory::CConnectionHistory()
+ :	iHistory(_FOFF(CConnections, iLink)),
+	iConnectionsPool(_FOFF(CConnections, iLink)),
+	iAddressPool(_FOFF(TRemConAddress, iLink))
+	{
+	LOG_FUNC
+	}
+
+void CConnectionHistory::ConstructL()
+	{
+	LOG_FUNC;
+
+	// Start the history off with the start-up state of the system- no 
+	// connections.
+	CConnections* const conns = CConnections::NewL();
+	iHistory.AddLast(*conns);
+
+	LogConnectionHistory();
+	}
+
+CConnectionHistory::~CConnectionHistory()
+	{
+	LOG_FUNC;
+	LogConnectionHistory();
+	LOGCOLLECTIONPOOL;
+	LOGADDRESSPOOL;
+
+	// Clean up all the collections of everything!
+
+	LOG(_L("\tdestroying history..."));
+		{
+		TSglQueIter<CConnections> iter1(iHistory);
+		CConnections* conns1;
+		while ( ( conns1 = iter1++ ) != NULL )
+			{
+			iHistory.Remove(*conns1);
+			delete conns1;
+			}
+		}
+
+	LOG(_L("\tdestroying connections pool..."));
+		{
+		TSglQueIter<CConnections> iter2(iConnectionsPool);
+		CConnections* conns2;
+		while ( ( conns2 = iter2++ ) != NULL )
+			{
+			iConnectionsPool.Remove(*conns2);
+			delete conns2;
+			}
+		}
+
+	LOG(_L("\tdestroying address pool..."));
+		{
+		TSglQueIter<TRemConAddress> iter3(iAddressPool);
+		TRemConAddress* addr;		 
+		while ( ( addr = iter3++ ) != NULL )
+			{
+			iAddressPool.Remove(*addr);
+			delete addr;
+			}
+		}
+	
+	// Can't LogConnectionHistory here because it breaks our invariant (we've 
+	// deleted all the history items, so it's empty and Count == 0).
+	LOGCOLLECTIONPOOL;
+	LOGADDRESSPOOL;
+	}
+
+void CConnectionHistory::DestroyFirst()
+	{
+	LOG_FUNC;
+	LogConnectionHistory();
+
+	ASSERT_DEBUG(!iHistory.IsEmpty());
+	CConnections* conn = iHistory.First();
+	ASSERT_DEBUG(conn);
+	iHistory.Remove(*conn);
+	delete conn;
+	ASSERT_DEBUG(!iHistory.IsEmpty());
+
+	LogConnectionHistory();
+	}
+
+TUint CConnectionHistory::Count() const
+	{
+	TUint count = 0;
+
+	TSglQueIter<CConnections> iter(const_cast<CConnectionHistory*>(this)->iHistory);
+	while ( iter++ != NULL )
+		{
+		++count;
+		}
+
+	ASSERT_DEBUG(count >= 1);
+	return count;
+	}
+
+const CConnections& CConnectionHistory::operator[](TUint aIndex)
+	{
+	TSglQueIter<CConnections> iter(iHistory);
+	CConnections* conn;
+	TUint count = 0;
+	while ( ( conn = iter++ ) != NULL )
+		{
+		if ( count == aIndex )
+			{
+			break;
+			}
+		++count;
+		}
+	ASSERT_DEBUG(conn);
+	return *conn;
+	}
+
+CConnections& CConnectionHistory::Last()
+	{
+	// The connection history should never be empty. It should always hold at 
+	// least the current connection set.
+	ASSERT_DEBUG(!iHistory.IsEmpty());
+
+	CConnections* last = iHistory.Last();
+	ASSERT_DEBUG(last);
+	return *last;
+	}
+
+TInt CConnectionHistory::NewConnection(const TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+	LogConnectionHistory();
+	LOGCOLLECTIONPOOL;
+	LOGADDRESSPOOL;
+
+	TRAPD(err, NewConnectionL(aAddr));
+	LOG1(_L("\terr = %d"), err);
+	
+	LogConnectionHistory();
+	LOGCOLLECTIONPOOL;
+	LOGADDRESSPOOL;
+
+	return err;
+	}
+
+void CConnectionHistory::NewConnectionL(const TRemConAddress& aAddr)
+	{
+	// Called to handle a new connection by updating the connection history.
+	// Create a copy of the Last item (CConnections) in the history, add the 
+	// new address to it, and add that (the new CConnections) to the end of 
+	// the history.
+	// Then, in order to guarantee that any subsequent disconnection will 
+	// work, allocate a new CConnections and add it to the pool of 
+	// CConnections iConnectionsPool. Also allocate N TRemConAddresses and add 
+	// them to the pool iAddressPool, where N is the number of remotes in the 
+	// old head CConnections. 
+	// When a disconnection occurs, the new CConnections will be got from 
+	// iConnectionsPool, and the required TRemConAddresses will be got from 
+	// iAddressPool- without failing.
+	// If any of this fails, roll us back to how we were at the beginning of 
+	// the call and leave.
+	// At the end the history will have a new Last, with one new item in it. 
+
+	// Make a new item for the history...
+	CConnections* const newSetOfConnections = CConnections::CopyL(Last());
+	CleanupStack::PushL(newSetOfConnections);
+	TRemConAddress* const addr = new(ELeave) TRemConAddress;
+	*addr = aAddr;
+	newSetOfConnections->Append(*addr);
+	// Leave newSetOfConnections on the cleanup stack so if we leave it gets 
+	// destroyed automatically.
+	
+	// ...and pre-allocate memory.
+	CConnections* conn = CConnections::NewL();
+	CleanupStack::PushL(conn); // leave this on the cleanup stack so it gets 
+	// dealt with if we leave.
+
+	// Get the number of TRemConAddresses we need to pre-allocate.
+	const TUint count = Last().Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		TRemConAddress* preAllocAddr = new TRemConAddress;
+		if ( preAllocAddr )
+			{
+			iAddressPool.AddLast(*preAllocAddr);
+			}
+		else
+			{
+			// We couldn't pre-allocate as much as we needed... destroy as 
+			// many TRemConAddresses as we have already made and leave. 
+			for ( TUint jj = 0 ; jj < ii ; ++jj )
+				{
+				ASSERT_DEBUG(!iAddressPool.IsEmpty());
+				TRemConAddress* removeAddr = iAddressPool.Last();
+				ASSERT_DEBUG(removeAddr);
+				iAddressPool.Remove(*removeAddr);
+				delete removeAddr;
+				}
+			// This leave will clean up the pre-allocated CConnections and the 
+			// new 'real' CConnections.
+			LEAVEIFERRORL(KErrNoMemory);
+			}
+		}
+
+	// If we got to here, do some sanity checking, clean up the cleanup stack 
+	// (!) and finally add the new history item.
+	CLEANUPSTACK_POP1(conn);
+	iConnectionsPool.AddLast(*conn);
+	
+	ASSERT_DEBUG(newSetOfConnections->Count() == Last().Count() + 1);
+	
+	CLEANUPSTACK_POP1(newSetOfConnections);
+	iHistory.AddLast(*newSetOfConnections); 
+	}
+
+void CConnectionHistory::Disconnection(const TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+	LogConnectionHistory();
+	LOGCOLLECTIONPOOL;
+	LOGADDRESSPOOL;
+	
+	// Called to handle a disconnection by updating the connection history.
+	// In order for this operation to be guaranteed to work, we must take a 
+	// CConnections from the pool iConnectionsPool, and, for each 
+	// TRemConAddress in Last, _except the one being disconnected in this 
+	// call_, copy it into a TRemConAddress taken from the iAddressPool, and 
+	// add it to the reclaimed CConnections. Finally add the CConnections to 
+	// the history.
+	// At the end the history will have a new Last with one less remote in it 
+	// than the previous.
+
+	// Get a CConnections from the pool.
+	ASSERT_DEBUG(!iConnectionsPool.IsEmpty());
+	CConnections* newSetOfConnections = iConnectionsPool.Last();
+	ASSERT_DEBUG(newSetOfConnections);
+	iConnectionsPool.Remove(*newSetOfConnections);
+
+	// Copy addresses from Last into newSetOfConnections, except the one being 
+	// disconnected.
+	CConnections& last = Last();
+	TSglQueIter<TRemConAddress>& iter = last.SetToFirst();
+	TRemConAddress* conn = NULL;
+	while ( ( conn = iter++ ) != NULL )
+		{
+		if ( !(*conn == aAddr) )
+			{
+			ASSERT_DEBUG(!iAddressPool.IsEmpty());
+			TRemConAddress* const newAddr = iAddressPool.Last();
+			ASSERT_DEBUG(newAddr);
+			iAddressPool.Remove(*newAddr);
+			*newAddr = *conn;
+			newSetOfConnections->Append(*newAddr);
+			}
+		}
+
+	// Sanity check and finally add the new CConnections to the history.
+	ASSERT_DEBUG(newSetOfConnections->Count() == Last().Count() - 1);
+	iHistory.AddLast(*newSetOfConnections);
+
+	LogConnectionHistory();
+	LOGCOLLECTIONPOOL;
+	LOGADDRESSPOOL;
+	}
+
+void CConnectionHistory::LogConnectionHistory() const
+	{
+#ifdef __FLOG_ACTIVE
+
+	const TUint count = Count();
+	LOG1(_L("\tNumber of items in history = %d"), count);
+	TSglQueIter<CConnections> iter(const_cast<CConnectionHistory*>(this)->iHistory);
+	CConnections* conns;
+	while ( ( conns = iter++ ) != NULL )
+		{
+		LOG1(_L("\t\titem [0x%08x]:"), conns);
+		conns->LogConnections();
+		}
+
+#endif // __FLOG_ACTIVE
+	}
+
+#ifdef __FLOG_ACTIVE
+void CConnectionHistory::LogCollectionPool() const
+	{
+	LOG(_L("\tLogging pre-allocated connections pool"));
+	TSglQueIter<CConnections> iter(const_cast<CConnectionHistory*>(this)->iConnectionsPool);
+	CConnections* conns;
+	while ( ( conns = iter++ ) != NULL )
+		{
+		LOG1(_L("\t\titem [0x%08x]:"), conns);
+		}
+	}
+
+void CConnectionHistory::LogAddressPool() const
+	{
+	LOG(_L("\tLogging pre-allocated address pool"));
+	TSglQueIter<TRemConAddress> iter(const_cast<CConnectionHistory*>(this)->iAddressPool);
+	TRemConAddress* addr;
+	while ( ( addr = iter++ ) != NULL )
+		{
+		LOG1(_L("\t\titem [0x%08x]:"), addr);
+		}
+	}
+#endif // __FLOG_ACTIVE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/connections.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,181 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include "connections.h"
+#include "utils.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("connectns");
+#endif
+
+CConnections* CConnections::NewL()
+	{
+	LOG_STATIC_FUNC
+	return new(ELeave) CConnections();
+	}
+
+CConnections::CConnections()
+ :	iConnections(_FOFF(TRemConAddress, iLink)),
+	iIter(iConnections)
+	{
+	LOG_FUNC
+	}
+
+CConnections::~CConnections()
+	{
+	LOG_FUNC;
+	LogConnections();
+
+	iIter.SetToFirst();
+	TRemConAddress* addr;
+	while ( ( addr = iIter++ ) != NULL )
+		{
+		iConnections.Remove(*addr);
+		delete addr;
+		}
+
+	LogConnections();
+	}
+
+CConnections* CConnections::CopyL(CConnections& aItem)
+	{
+	CConnections* const self = NewL();
+	CleanupStack::PushL(self);
+
+	TSglQueIter<TRemConAddress> iter(aItem.iConnections);
+	TRemConAddress* orig;
+	while ( ( orig = iter++ ) != NULL )
+		{
+		TRemConAddress* const newAddr = new(ELeave) TRemConAddress;
+		newAddr->BearerUid() = orig->BearerUid();
+		newAddr->Addr() = orig->Addr();
+		self->Append(*newAddr);
+		}
+
+	CLEANUPSTACK_POP1(self);
+	return self;
+	}
+
+TSglQueIter<TRemConAddress>& CConnections::SetToFirst() const
+	{
+	LOG_FUNC;
+
+	TSglQueIter<TRemConAddress>& ncIter = const_cast<CConnections*>(this)->iIter;
+
+	ncIter.SetToFirst();
+
+	return ncIter;
+	}
+
+void CConnections::Append(TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+	LogConnections();
+
+	// Add the connection to the array of remotes. In debug, check it isn't 
+	// already known. This is a programming error somewhere, possibly the 
+	// bearer informing us of a new connection twice.
+#ifdef _DEBUG
+	TSglQueIter<TRemConAddress> iter(iConnections);
+	TRemConAddress* addr;
+	while ( ( addr = iter++ ) != NULL )
+		{
+		ASSERT_DEBUG( !(*addr == aAddr) );
+		}
+#endif // _DEBUG			 
+
+	iConnections.AddLast(aAddr);
+
+	LogConnections();
+	}
+
+
+void CConnections::Remove(TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+	LogConnections();
+
+	// Remove the connection from the array of remotes. In debug, check it's 
+	// already known.
+#ifdef _DEBUG
+	TBool found = EFalse;
+	TSglQueIter<TRemConAddress> iter(iConnections);
+	TRemConAddress* addr;
+	while ( ( addr = iter++ ) != NULL )
+		{
+		if ( *addr == aAddr )
+			{
+			found = ETrue;
+			}
+		}
+	ASSERT_DEBUG(found);
+#endif // _DEBUG			 
+
+	iConnections.Remove(aAddr);
+
+	LogConnections();
+	}
+
+TBool CConnections::Find(const TRemConAddress& aAddr) const
+	{
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid() = 0x%08x"), aAddr.BearerUid());
+	LogConnections();
+
+	TBool found = EFalse;
+	TSglQueIter<TRemConAddress> iter(const_cast<CConnections*>(this)->iConnections);
+	TRemConAddress* addr;
+	while ( ( addr = iter++ ) != NULL )
+		{
+		if ( *addr == aAddr )
+			{
+			found = ETrue;
+			break;
+			}
+		}
+
+	LOG1(_L("\tfound = %d"), found);
+	return found;
+	}
+
+void CConnections::LogConnections() const
+	{
+#ifdef __FLOG_ACTIVE
+
+	const TUint count = Count();
+	LOG1(_L("\tNumber of remotes = %d"), count);
+	TSglQueIter<TRemConAddress> iter(const_cast<CConnections*>(this)->iConnections);
+	TRemConAddress* addr;
+	while ( ( addr = iter++ ) != NULL )
+		{
+		LOG3(_L("\t\tremote [0x%08x], BearerUid = 0x%08x, Addr.Length = %d"), 
+			addr,
+			addr->BearerUid(),
+			addr->Addr().Length()
+			);
+		}
+
+#endif // __FLOG_ACTIVE
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/controllersession.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,958 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <bluetooth/logger.h>
+#include "activehelper.h"
+#include "bearermanager.h"
+#include "controllersession.h"
+#include "messagequeue.h"
+#include "remconmessage.h"
+#include "remconserver.h"
+#include "server.h"
+#include "utils.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("ctsession");
+#endif
+
+
+CRemConControllerSession* CRemConControllerSession::NewL(CRemConServer& aServer,
+	CBearerManager& aBearerManager,
+	const TClientInfo& aClientInfo,
+	TUint aId)
+	{
+	LOG_STATIC_FUNC;
+	CRemConControllerSession* self = new(ELeave) CRemConControllerSession(aServer, aBearerManager, aId);
+	CleanupStack::PushL(self);
+	self->ConstructL(aClientInfo);
+	CLEANUPSTACK_POP1(self);
+	return self;
+	}
+
+CRemConControllerSession::~CRemConControllerSession()
+	{
+	LOG_FUNC;
+
+	delete iPendingMsgProcessor;
+
+	// we will need to tell the server which bearer this used to be connected to
+	// this enables the server to not inform a bearer that is already connected
+	// that its been connected
+	// Tell the server we've gone away- it may start its shutdown timer.
+	iServer.ControllerClientClosed(*this, iRemoteAddress.BearerUid());
+	iPlayerName.Close();
+	}
+
+CRemConControllerSession::CRemConControllerSession(CRemConServer& aServer, 
+	CBearerManager& aBearerManager,
+	TUint aId)
+	: CRemConSession(aServer, aBearerManager, aId)
+	{
+	LOG_FUNC;
+	}
+
+void CRemConControllerSession::ConstructL(const TClientInfo& aClientInfo)
+	{
+	LOG_FUNC;
+	
+	BaseConstructL(aClientInfo);
+
+	iPendingMsgProcessor = new (ELeave) CActiveHelper(*this);
+	
+	LEAVEIFERRORL(iServer.ControllerClientOpened(*this));
+
+	// Set our pointer into the connection history at the current/'Last' item.
+	// Can't do this til we've told the server we exist
+	iServer.SetConnectionHistoryPointer(Id());
+	}
+
+TBool CRemConControllerSession::SupportedMessage(const CRemConMessage& aMsg) const
+	{
+	LOG_FUNC;
+	LOG1(_L("\taMsg.InterfaceUid() = 0x%08x"), aMsg.InterfaceUid());
+
+	// Return true unless this is a command for an unsupported interface
+	TBool result = !(aMsg.MsgType() == ERemConCommand && !FindInterfaceByUid(aMsg.InterfaceUid()));
+
+	LOG1(_L("result = %d"), result);
+	return result;
+	}
+
+void CRemConControllerSession::SetPlayerType(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Controller clients don't provide the additional parameters are optional,
+	// so we just complete the message with KErrNone.
+	CompleteClient(aMessage, KErrNone);
+	}
+
+void CRemConControllerSession::CompleteConnect(const TRemConAddress& aAddr, TInt aError)
+	{
+	LOG_FUNC;
+	LOG2(_L("\taError = %d, aAddr.BearerUid = 0x%08x"), aError, aAddr.BearerUid());
+
+	LOG1(_L("\tiRemoteAddress.BearerUid = 0x%08x"), iRemoteAddress.BearerUid());
+	LOG1(_L("\tiConnectBearerMsg.Handle = %d"), iConnectBearerMsg.Handle());
+
+	if ( iRemoteAddress == aAddr )
+		{
+		if ( iConnectBearerMsg.Handle() )
+			{
+			// We are a session that has an outstanding request on this specific 
+			// connection address.
+			CompleteClient(iConnectBearerMsg, aError);
+			}
+		else 
+			{
+			// Connect bearer message is not valid. 
+			// Check for pending messages.
+			CheckForPendingMsg();
+			}
+		}
+	}
+
+void CRemConControllerSession::CompleteDisconnect(const TRemConAddress& aAddr, TInt aError)
+	{
+	LOG_FUNC;
+	LOG2(_L("\taError = %d, aAddr.BearerUid = 0x%08x"), aError, aAddr.BearerUid());
+
+	LOG1(_L("\tiRemoteAddress.BearerUid = 0x%08x"), iRemoteAddress.BearerUid());
+	LOG1(_L("\tiDisconnectBearerMsg.Handle = %d"), iDisconnectBearerMsg.Handle());
+
+	if ( iRemoteAddress == aAddr )
+		{
+		if ( iDisconnectBearerMsg.Handle() )
+			{
+			// We are a session that has an outstanding request on this specific 
+			// connection address.
+			CompleteClient(iDisconnectBearerMsg, aError);
+			}
+		else 
+			{
+			// Diconnect bearer message is not valid. 
+			// Check for pending messages.
+			CheckForPendingMsg();
+			}
+
+		}
+	}
+
+void CRemConControllerSession::ProcessPendingMsgL()
+	{
+	LOG_FUNC;
+	if (!iPendingMsg.Handle())
+		{
+		// This means that the pending connect or disconnect message,
+		// has been cancelled by the time we got here.
+		// (It was cancelled between two following calls:
+		// iPendingMsgProcessor::Complete and iPendingMsgProcessor::RunL
+		return;
+		}
+
+	ServiceL(iPendingMsg);
+	if (iPendingMsg.Handle())
+		{
+		// This means that the pending msg has not been completed in ServiceL call.
+		// It was stored either in iConnectBearerMsg or iDisconnectBearerMsg member.
+		// This also means that this message is not "pending" any more 
+		// (as processing of its copy has been started). 
+		// However because the copy will get completed we need to 
+		// clean iPendingMsg.iHandle here
+		// To supress coverity error for uninitialized use of 'emptyMsg' coverity annotations
+		// are used as the in-line default constructor of RMessage2 doesn't initialize all member variables.
+		// coverity[var_decl]
+		RMessage2 emptyMsg;
+		iPendingMsg = emptyMsg;
+		}
+	}
+
+void CRemConControllerSession::CheckForPendingMsg() const
+	{
+	LOG_FUNC;
+	if (iPendingMsg.Handle())
+		{
+		ASSERT_DEBUG(iPendingMsgProcessor);
+		iPendingMsgProcessor->Complete();
+		}
+	}
+
+CRemConMessage* CRemConControllerSession::DoPrepareSendMessageL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we don't have a disconnect outstanding- this makes no sense from 
+	// a client viewpoint (they should cancel the disconnect first).
+	// [The client is allowed to have a connect request outstanding- the 
+	// bearer manager makes sure a bearer-level connect is not posted on the 
+	// same address twice.]
+	if ( iDisconnectBearerMsg.Handle() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return NULL;
+		}
+
+	// Get the data the client wants to send.
+	TUid interfaceUid;
+	TUint operationId;
+
+	TRemConMessageSubType messageSubType;
+	RBuf8 sendDes;
+	if (!DoGetSendInfoLC(aMessage, interfaceUid, operationId, messageSubType, sendDes))
+		{
+		// DoGetSendInfoLC() panicked the message
+		return NULL;
+		}
+
+	CRemConMessage* msg = NULL;
+	LOG(_L("\tCONTROLLER send"));
+	if (  (messageSubType == ERemConNotifyCommandAwaitingInterim)
+	   || (messageSubType == ERemConNotifyCommandAwaitingChanged)
+		)
+		{
+		LOG(_L("\terror, not allowed to use Send() to send notify command"));
+		CleanupStack::PopAndDestroy(&sendDes);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
+		}
+	else
+		{
+		msg = CRemConMessage::NewL(
+				iRemoteAddress, // either specified (if we're connection-oriented) or null (we're connectionless- this field will be filled in by the TSP)
+				ERemConCommand, 
+				messageSubType,
+				interfaceUid,
+				operationId,
+				sendDes, // msg takes ownership
+				Id(), // session id for when the response comes back
+				0, // we let the bearer manager invent a new transaction id when the message gets to it
+				ETrue);
+		CLEANUPSTACK_POP1(&sendDes); // now owned by msg
+		}		
+
+	return msg;
+	}
+
+void CRemConControllerSession::SendUnreliable(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	// Check we don't have a disconnect outstanding- this makes no sense from 
+	// a client viewpoint (they should cancel the disconnect first).
+	// [The client is allowed to have a connect request outstanding- the 
+	// bearer manager makes sure a bearer-level connect is not posted on the 
+	// same address twice.]
+	if ( iDisconnectBearerMsg.Handle() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+
+	CRemConMessage* msg = NULL;
+	TRAPD(err, msg = DoCreateUnreliableMessageL(aMessage));
+	CompleteClient(aMessage, err);
+	if (err == KErrNone)
+		{
+		ASSERT_DEBUG(iSendQueue);
+		if (iSending || !iSendQueue->IsEmpty())
+			{
+			iSendQueue->Append(*msg);
+			}
+		else
+			{
+			SendToServer(*msg);
+			}
+		}
+	}
+
+CRemConMessage* CRemConControllerSession::DoCreateUnreliableMessageL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Get the data the client wants to send.
+	TUid interfaceUid;
+	TUint operationId;
+	TRemConMessageSubType messageSubType;
+	RBuf8 sendDes;
+	DoGetSendInfoLC(aMessage, interfaceUid, operationId, messageSubType, sendDes);
+
+	// Before we ask the server to send, we must set our ClientInfo 
+	// correctly so the TSP can get information about the client. 
+	iClientInfo.Message() = aMessage;
+
+	CRemConMessage* msg = NULL;
+	
+	LOG(_L("\tCONTROLLER send"));
+	
+	// A client is not allowed to send an unreliable notify command.
+	if	(	(messageSubType == ERemConNotifyCommandAwaitingInterim)
+		||	(messageSubType == ERemConNotifyCommandAwaitingChanged)
+		)
+		{
+		LOG(_L8("\tNot allowed to send unreliable notify command"));
+		CleanupStack::PopAndDestroy(&sendDes);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
+		LEAVEL(KErrBadDescriptor);
+		}
+	
+	msg = CRemConMessage::NewL(
+		iRemoteAddress, // either specified (if we're connection-oriented) or null (we're connectionless- this field will be filled in by the TSP)
+		ERemConCommand, // controllers can only send commands
+		messageSubType,
+		interfaceUid,
+		operationId,
+		sendDes, // msg takes ownership
+		Id(), // session id for when the response comes back
+		0, // we let the bearer manager invent a new transaction id when the message gets to it
+		EFalse);
+	CLEANUPSTACK_POP1(&sendDes); // now owned by msg
+
+	return msg;
+	}
+
+void CRemConControllerSession::RegisterInterestedAPIs(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	// No interfaces should have been registered yet!
+	ASSERT_DEBUG(iInterestedAPIs == NULL);
+	
+	TRAPD(err, iInterestedAPIs = ExtractInterestedAPIsL(aMessage));
+	
+	iServer.ControllerClientAvailable();
+
+	CompleteClient(aMessage, err);
+	}
+
+void CRemConControllerSession::GoConnectionOriented(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( !iRemoteAddress.IsNull() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicAlreadyConnectionOriented);
+		return;
+		}
+
+	if ( iConnectBearerMsg.Handle() || iDisconnectBearerMsg.Handle() || iSendMsg.Handle())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+	if (iSending != ENotSending)
+		{
+		DoSendCancel();
+		}
+	EmptySendQueue();
+	
+	// Get the desired address from the message and check it.
+	const TUid uid = TUid::Uid(aMessage.Int0());
+	LOG1(_L("\tuid = 0x%08x"), uid);
+	// Check the requested bearer exists.
+	TBool bearerExists = iBearerManager.BearerExists(uid);
+	if ( !bearerExists)
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerPluginIncorrectInterface);
+		return;
+		}
+	// Check the bearer-specific part of the address.
+	TBuf8<TRemConAddress::KMaxAddrSize> buf;
+	TInt err = aMessage.Read(1, buf);
+	if ( err != KErrNone )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+		return;
+		}
+
+	// Do security check- if this client won't be allowed to use the bearer 
+	// then fail the request. 
+	// NB This security check (repeated in debug at ConnectBearer and 
+	// DisconnectBearer time) is all that stands between a connection-oriented 
+	// client and the bearer, and is all the caps checking that RemCon does!
+	err = KErrPermissionDenied;
+	if ( iBearerManager.CheckPolicy(uid, aMessage) )
+		{
+		err = KErrNone;
+		}
+		
+		
+	// if alls well and we're connection oriented then set up as such
+	if (KErrNone == err)
+		{
+		// The client has passed all our checks- set our data member.
+		iRemoteAddress.BearerUid() = uid;
+		iRemoteAddress.Addr() = buf;
+		// tell the server
+		iServer.ClientGoConnectionOriented(*this,uid);
+		}
+				
+	CompleteClient(aMessage, err);
+	}
+
+void CRemConControllerSession::GoConnectionless(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( iRemoteAddress.IsNull() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicNotConnectionOriented);
+		return;
+		}
+
+	if ( iConnectBearerMsg.Handle() || iDisconnectBearerMsg.Handle() || iSendMsg.Handle())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+	
+	if (iSending != ENotSending)
+		{
+		DoSendCancel();
+		}
+	EmptySendQueue();
+	
+	// we will need to tell the server which bearer this used to be connected to
+	// this enables the server to not inform a bearer that is already connected
+	// that its been connected
+	TUid oldUid = iRemoteAddress.BearerUid();
+	
+	iRemoteAddress.BearerUid() = KNullUid;	
+
+	// tell the server
+	iServer.ClientGoConnectionless(*this, oldUid);
+
+	CompleteClient(aMessage, KErrNone);
+	}
+
+void CRemConControllerSession::ConnectBearer(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( iConnectBearerMsg.Handle() || iDisconnectBearerMsg.Handle() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+
+	if ( iRemoteAddress.IsNull() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicNotConnectionOriented);
+		return;
+		}
+
+	// Check the requested bearer exists.
+	TBool bearerExists = iBearerManager.BearerExists(iRemoteAddress.BearerUid());
+	// This check was done at GoConnectionOriented time.
+	ASSERT_DEBUG(bearerExists);
+	// So was this one.
+	ASSERT_DEBUG(iBearerManager.CheckPolicy(iRemoteAddress.BearerUid(), aMessage));
+
+	// Check the state of our given connection at the bearer level. If it is: 
+	// -) disconnected request the connection to come up,
+	// -) connecting or disconnecting, add message to the queue of pending 
+	//		messages, and process it once connecting/disconnecting has been completed
+	// -) connected, complete the client's message,
+
+	TConnectionState conState;
+	conState = iServer.ConnectionState(iRemoteAddress);
+
+	if ( conState == EDisconnected )
+		{
+		// The bearer may indicate connection synchronously, so set this 
+		// message _before_ we ask them
+		iConnectBearerMsg = aMessage;
+		TInt err = iBearerManager.Connect(iRemoteAddress);
+		if ( err != KErrNone )
+			{
+			CompleteClient(iConnectBearerMsg, err);
+			}
+		}
+	else if ( conState == EDisconnecting ||  conState == EConnecting )
+		{
+		if ( iPendingMsg.Handle() )
+			{
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+			return;
+			}
+		// Store the message, it will get processed later.
+		iPendingMsg = aMessage;
+		}
+	else // EConnected
+		{
+		CompleteClient(aMessage, KErrNone);
+		}
+		
+	}
+
+void CRemConControllerSession::ConnectBearerCancel(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( iConnectBearerMsg.Handle() )
+		{
+		CompleteClient(iConnectBearerMsg, KErrCancel);
+		}
+	else if ( iPendingMsg.Handle() && ( iPendingMsg.Function() == ERemConConnectBearer ))
+		{
+		CompleteClient(iPendingMsg, KErrCancel);
+		}
+		
+	CompleteClient(aMessage, KErrNone);
+	// At no point do we make any change to the processes going on underneath
+	// us- 'Cancel' APIs are just for cancelling interest in an async
+	// operation.
+	}
+
+void CRemConControllerSession::DisconnectBearer(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( iDisconnectBearerMsg.Handle() || iConnectBearerMsg.Handle() || iSendMsg.Handle())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+
+	if ( iRemoteAddress.IsNull() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicNotConnectionOriented);
+		return;
+		}
+
+	if (iSending != ENotSending)
+		{
+		DoSendCancel();
+		}
+	EmptySendQueue();
+	
+	// Check the requested bearer exists.
+	TBool bearerExists = iBearerManager.BearerExists(iRemoteAddress.BearerUid());
+	// This check was done at GoConnectionOriented time.
+	ASSERT_DEBUG(bearerExists);
+	// So was this one.
+	ASSERT_DEBUG(iBearerManager.CheckPolicy(iRemoteAddress.BearerUid(), aMessage));
+
+	// Check the state of the given connection. If it is:
+	// -) connected, request connection to go away,
+	// -) disconnected, compete the client's message,
+	// -) connecting or disconnecting, add message to the queue of pending 
+	//		messages, and process it once connecting/disconnecting has been completed
+
+	TInt err;
+	TConnectionState conState;
+	conState = iServer.ConnectionState(iRemoteAddress);
+
+	if ( conState == EConnected )
+		{
+		// The bearer may indicate disconnection synchronously, so set this 
+		// message _before_ we ask them
+		iDisconnectBearerMsg = aMessage;
+		err = iBearerManager.Disconnect(iRemoteAddress);
+		if ( err != KErrNone )
+			{
+			CompleteClient(iDisconnectBearerMsg, err);
+			}
+		}
+	else if ( conState == EDisconnecting ||  conState == EConnecting )
+		{
+		if ( iPendingMsg.Handle() )
+			{
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+			return;
+			}
+		// Store the message, it will get processed later.
+		iPendingMsg = aMessage;
+		}
+	else //disconnected
+		{
+		CompleteClient(aMessage, KErrNone);	
+		}
+	}
+
+void CRemConControllerSession::DisconnectBearerCancel(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( iDisconnectBearerMsg.Handle() )
+		{
+		CompleteClient(iDisconnectBearerMsg, KErrCancel);
+		}
+	else if ( iPendingMsg.Handle() && (iPendingMsg.Function() == ERemConDisconnectBearer ))
+		{
+		CompleteClient(iPendingMsg, KErrCancel);
+		}
+		
+	CompleteClient(aMessage, KErrNone);
+	}
+
+/**
+Sends a notify message to the remote device.
+
+This function is intended for the RemCon controller client to send a notify
+command to the remote device.
+*/
+void CRemConControllerSession::SendNotify(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we're not already sending...
+	if ( iSendMsg.Handle())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicSendAlreadyOutstanding);
+		return;
+		}
+	
+	iSendMsg = aMessage;
+	
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	// Check we don't have a disconnect outstanding- this makes no sense from 
+	// a client viewpoint (they should cancel the disconnect first).
+	// [The client is allowed to have a connect request outstanding- the 
+	// bearer manager makes sure a bearer-level connect is not posted on the 
+	// same address twice.]
+	if ( iDisconnectBearerMsg.Handle() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+
+	TRAPD(err, DoSendNotifyL(aMessage));
+	if ( err != KErrNone )
+		{
+		CompleteClient(aMessage, err);
+		}
+	}
+
+/**
+@see CRemConControllerSession::SendNotify
+*/
+void CRemConControllerSession::DoSendNotifyL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Get the data the client wants to send.
+	const TUid interfaceUid = TUid::Uid(aMessage.Int0());
+	LOG1(_L("\tinterfaceUid = 0x%08x"), interfaceUid);
+
+	if (aMessage.GetDesLengthL(1) != sizeof(TOperationInformation))
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+		return;
+		}
+
+	TPckgBuf<TOperationInformation> opInfoPckg;	
+	TInt err= aMessage.Read(
+			1, // location of the descriptor in the client's message (as we expect them to have set it up)
+			opInfoPckg, // descriptor to write to from client memory space
+			0 // offset into our descriptor to put the client's data
+			);
+	
+	if ( err != KErrNone )
+		{
+		LOG1(_L("\taMessage.Read = %d"), err);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+		return;
+		}	
+	
+	const TUint operationId = opInfoPckg().iOperationId;
+	LOG1(_L("\toperationId = 0x%02x"), operationId);
+	
+	const TRemConMessageSubType messageSubType = opInfoPckg().iMessageSubType;
+	LOG1(_L("\tmessageSubType = 0x%02x"), messageSubType);
+	
+	const TUint dataLength = (TUint)aMessage.GetDesLengthL(2);
+	LOG1(_L("\tdataLength = %d"), dataLength);
+	
+	// If the client wanted to send some operation-associated data, read it 
+	// from them.
+	RBuf8 sendDes;
+	if ( dataLength != 0 )
+		{
+		sendDes.CreateL(dataLength);
+		TInt err = aMessage.Read(
+			2, // location of the descriptor in the client's message (as we expect them to have set it up)
+			sendDes, // descriptor to write to from client memory space
+			0 // offset into our descriptor to put the client's data
+			);
+		// NB We don't do LEAVEIFERRORL(aMessage.Read) because a bad client 
+		// descriptor is a panicking offence for them, not an 'error the 
+		// request' offence.
+		if ( err != KErrNone )
+			{
+			LOG1(_L("\taMessage.Read = %d"), err);
+			sendDes.Close();
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+			return;
+			}
+		}
+
+	// Before we ask the server to send, we must set our ClientInfo 
+	// correctly so the TSP can get information about the client. 
+	iClientInfo.Message() = aMessage;
+
+	CRemConMessage* msg = NULL;
+	
+	if (messageSubType != ERemConNotifyCommandAwaitingInterim)
+		{
+		sendDes.Close();
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
+		return;
+		}
+	
+	CleanupClosePushL(sendDes);
+	msg = CRemConMessage::NewL(
+			iRemoteAddress, // either specified (if we're connection-oriented) or null (we're connectionless- this field will be filled in by the TSP)
+			ERemConNotifyCommand, 
+			messageSubType,
+			interfaceUid,
+			operationId,
+			sendDes, // msg takes ownership
+			Id(), // session id for when the response comes back
+			0, // we let the bearer manager invent a new transaction id when the message gets to it
+			ETrue);	
+	CLEANUPSTACK_POP1(&sendDes); // now owned by msg
+	
+	LOG(_L("\tCONTROLLER send"));
+	ASSERT_DEBUG(iSendQueue);
+	if (iSending != ENotSending || !iSendQueue->IsEmpty())
+		{
+		iSendQueue->Append(*msg);
+		}
+	else
+		{
+		SendToServer(*msg);
+		}
+	}
+
+void CRemConControllerSession::SendToServer(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	
+	// Set our completion members.
+	NumRemotes() = 0;
+	NumRemotesToTry() = 0;
+	SendError() = KErrNone;
+
+	
+	iSending = (aMsg.IsReliableSend()) ? ESendingReliable: ESendingUnreliable;
+	
+	iServer.SendCommand(aMsg);
+	}
+
+void CRemConControllerSession::EmptySendQueue()
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(!iSendMsg.Handle())
+	ASSERT_DEBUG(iSendNextCallBack);
+	iSendNextCallBack->Cancel();
+	CRemConMessage* msg;
+	ASSERT_DEBUG(iSendQueue);
+	TSglQueIter<CRemConMessage>& iter = iSendQueue->SetToFirst();
+	while ((msg = iter++) != NULL)
+		{
+		iSendQueue->RemoveAndDestroy(*msg);
+		}
+	}
+
+void CRemConControllerSession::DoSendCancel()
+	{
+	LOG_FUNC;
+	// We must tell the server, and pull the CRemConMessage from the 
+	// 'outgoing pending TSP' queue if it's on it. If the TSP is currently 
+	// processing the CRemConMessage, we must tell it to stop before we 
+	// can complete the RMessage2 iSendMsg- the TSP might still be 
+	// dereferencing bits of it. (The TSP is given iSendMsg so it can 
+	// access the client's secure ID and do a capability check.)
+	// NB This only matters for commands- responses don't go through the 
+	// TSP.
+	// Not also that this processing *stops* this 
+	// CRemConSession::SendCancel method from being the very simple 'I'm 
+	// no longer interested in the completion of the asynchronous request' 
+	// type of API it (and all cancels) should be. It actually does work 
+	// as well. As long as this work is implemented _synchronously_, we 
+	// should be OK.
+	iServer.SendCancel(*this);
+
+	NumRemotesToTry() = 0;
+	iSendError = KErrCancel;
+	CompleteSend();
+	}
+
+void CRemConControllerSession::CompleteMessage(const CRemConMessage& aMessage)
+	{
+	LOG_FUNC;
+
+	switch (aMessage.MsgType())
+		{
+	case ERemConCommand:
+	case ERemConResponse:
+	case ERemConReject:
+		{
+		CompleteSend();
+		break;
+		}
+	case ERemConNotifyCommand:
+		{
+		CompleteSendNotify();
+		break;
+		}
+	default:
+		ASSERT_DEBUG(EFalse);
+		break;
+		}
+
+	}
+
+void CRemConControllerSession::DoReceive()
+	{
+	// Request messages from the server for this controller session.
+	// If there's anything waiting to be given to us, ReceiveRequest will call 
+	// back to us with it.
+	iServer.ReceiveRequest(*this);	
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendResult(const CRemConMessage& aMessage, TInt aError)
+	{
+	LOG_FUNC;
+
+	// We should not already be sending a message to n remotes
+	ASSERT_DEBUG(NumRemotesToTry() == 0);
+
+	SendError() = aError;
+	CompleteMessage(aMessage);
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendOneOrMoreAttempt(const CRemConMessage& /*aMessage*/, TUint aNumRemotes)
+	{
+	LOG_FUNC;
+
+	// We should not already be sending a message
+	ASSERT_DEBUG(NumRemotesToTry() == 0);
+
+	NumRemotes() = 0;
+	NumRemotesToTry() = aNumRemotes;
+	SendError() = KErrNone;
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendOneOrMoreIncremental(const CRemConMessage& /*aMessage*/, TUint /*aNumRemotes*/)
+	{
+	LOG_FUNC;
+
+	// This method should never be called, as it is not required to support controller sessions.
+	ASSERT_DEBUG(EFalse);
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendOneOrMoreAttemptFailed(const CRemConMessage& aMessage, TInt aError)
+	{
+	LOG_FUNC;
+
+	// We should not already be sending a message
+	ASSERT_DEBUG(NumRemotesToTry() == 0);
+
+	NumRemotes() = 0;
+	SendError() = aError;
+	CompleteMessage(aMessage);
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendOneOrMoreResult(const CRemConMessage& aMessage, TInt aError)
+	{
+	LOG_FUNC;
+
+	// Ignore notification if client has been completed
+	if (NumRemotesToTry() > 0)
+		{
+		// Only set error if different from KErrNone
+		if (aError == KErrNone)
+			{
+			++NumRemotes();
+			}
+		else
+			{
+			SendError() = aError;
+			}
+
+		--NumRemotesToTry();
+		if (NumRemotesToTry() == 0)
+			{
+			CompleteMessage(aMessage);
+			}
+		}
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendOneOrMoreAbandoned(const CRemConMessage& /*aMessage*/)
+	{
+	LOG_FUNC;
+
+	// This method should never be called, as it is not required to support controller sessions.
+	ASSERT_DEBUG(EFalse);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/convertermanager.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,193 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Converter manager.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <remcon/remconconverterplugin.h>
+#include <remcon/remconconverterinterface.h>
+#include "convertermanager.h"
+#include "utils.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("convman");
+#endif
+
+#ifdef __FLOG_ACTIVE
+#define LOGCONVERTERS	LogConverters()
+#else
+#define LOGCONVERTERS
+#endif
+
+CConverterManager* CConverterManager::NewL()
+	{
+	LOG_STATIC_FUNC
+	CConverterManager* self = new(ELeave) CConverterManager();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CLEANUPSTACK_POP1(self);
+	return self;
+	}
+
+CConverterManager::~CConverterManager()
+	{
+	LOG_FUNC;
+	LOGCONVERTERS;
+
+	iConverterIfs.Reset();
+
+	// Destroy all converter instances.
+	iConverters.ResetAndDestroy();
+
+	LOGCONVERTERS;
+	}
+
+CConverterManager::CConverterManager()
+	{
+	LOG_FUNC
+	}
+
+void CConverterManager::ConstructL()
+	{
+	LOG_FUNC;
+
+	// Instantiate all converters at construction time. 
+	LoadAllConvertersL();
+
+	LOGCONVERTERS;
+	}
+
+void CConverterManager::LoadAllConvertersL()
+	{
+	LOG_FUNC;
+
+	// Use ECOM to instantiate each implementation of the plugin interface.
+	const TUid KUidRemoteControlConverterPluginInterface = TUid::Uid(KRemConConverterInterfaceUid);
+	RImplInfoPtrArray implementations;
+	const TEComResolverParams noResolverParams;
+	REComSession::ListImplementationsL(KUidRemoteControlConverterPluginInterface, 
+		noResolverParams, 
+		KRomOnlyResolverUid, 
+		implementations);
+	CleanupResetAndDestroyPushL(implementations);
+	const TUint count = implementations.Count();
+	LOG1(_L("\tnumber of implementations of converter plugin interface: %d"), count);
+	// It is legal to have no converters. Some bearers may do conversion 
+	// internally. Others may have entirely state-dependent conversion.
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CImplementationInformation* impl = implementations[ii];
+		ASSERT_DEBUG(impl);
+		LOG(_L("\tloading converter with:"));
+		LOG1(_L("\t\timplementation uid 0x%08x"), impl->ImplementationUid());
+		LOG1(_L("\t\tversion number %d"), impl->Version());
+		TBuf8<KMaxName> buf8;
+		buf8.Copy(impl->DisplayName());
+		LOG1(_L8("\t\tdisplay name \"%S\""), &buf8);
+		LOG1(_L("\t\tROM only %d"), impl->RomOnly());
+		LOG1(_L("\t\tROM based %d"), impl->RomBased());
+
+		CRemConConverterPlugin* conv = CRemConConverterPlugin::NewL(impl->ImplementationUid());
+		CleanupStack::PushL(conv);
+		LEAVEIFERRORL(iConverters.Append(conv));
+
+		TInterfaceInfo info;
+		info.iIf = reinterpret_cast<MRemConConverterInterface*>(conv->GetInterface(TUid::Uid(KRemConConverterInterface1)));
+		// The converter plugins must currently support MRemConConverterInterface.
+		ASSERT_DEBUG(info.iIf);
+		info.iIfUid = TUid::Uid(KRemConConverterInterface1);
+		info.iConverterUid = impl->ImplementationUid();
+		TInt err = iConverterIfs.Append(info);
+		if ( err != KErrNone )
+			{
+			iConverters.Remove(iConverters.Count() - 1);
+			LEAVEIFERRORL(err);
+			}
+		CLEANUPSTACK_POP1(conv);
+		}
+	CleanupStack::PopAndDestroy(&implementations);
+	}
+
+#ifdef __FLOG_ACTIVE
+void CConverterManager::LogConverters() const
+	{
+	const TUint count = iConverters.Count();
+	LOG1(_L("\tNumber of converters = %d"), count);
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		const CRemConConverterPlugin* const conv = iConverters[ii];
+		ASSERT_DEBUG(conv);
+		LOG2(_L("\t\tconv %d [0x%08x]"), 
+			ii, 
+			conv);
+		}
+	}
+#endif // __FLOG_ACTIVE
+
+MRemConConverterInterface* CConverterManager::Converter(TUid aInterfaceUid, 
+							   TUid aBearerUid) const
+	{
+	LOG_FUNC;
+	LOG2(_L("\taInterfaceUid = 0x%08x, aBearerUid = 0x%08x"), aInterfaceUid, aBearerUid);
+
+	MRemConConverterInterface* converter = NULL;
+
+	const TUint count = iConverterIfs.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		const TInterfaceInfo& tmp = iConverterIfs[ii];
+		ASSERT_DEBUG(tmp.iIf);
+		if (tmp.iIf->SupportedUids(aInterfaceUid, aBearerUid))
+			{
+			converter = tmp.iIf;
+			break;
+			}
+		}
+
+	LOG1(_L("\tconverter = 0x%08x"), converter);
+	return converter;
+	}
+	
+MRemConConverterInterface* CConverterManager::Converter(const TDesC8& aInterfaceData, 
+							   TUid aBearerUid) const
+	{
+	LOG_FUNC;
+
+	MRemConConverterInterface* converter = NULL;
+
+	const TUint count = iConverterIfs.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		const TInterfaceInfo& tmp = iConverterIfs[ii];
+		ASSERT_DEBUG(tmp.iIf);
+		if (tmp.iIf->SupportedInterface(aInterfaceData, aBearerUid))
+			{
+			converter = tmp.iIf;
+			break;
+			}
+		}
+
+	LOG1(_L("\tconverter = 0x%08x"), converter);
+	return converter;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/main.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,91 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Entry point for Rem Con server.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <e32base.h>
+#include "remconserver.h"
+#include "server.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+static void RunServerL();
+
+/**
+Entry point for the Remote Control server.
+@return Error.
+*/
+GLDEF_C TInt E32Main()
+	{
+	CONNECT_LOGGER;
+	LOG_STATIC_FUNC;
+	TInt ret = KErrNoMemory;
+
+	__UHEAP_MARK;
+
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+
+	if ( cleanup )
+		{
+		TRAP(ret, RunServerL());
+
+		delete cleanup;
+		}
+
+	__UHEAP_MARKEND;
+
+	LOG1(_L8("\tret = %d"), ret);
+	CLOSE_LOGGER;
+	return ret;
+	}
+
+/**
+Create the active scheduler and Rem Con server instances, and start the 
+server.
+*/
+static void RunServerL()
+	{
+	LOG_STATIC_FUNC;
+	LEAVEIFERRORL(User::RenameThread(KRemConServerName));
+
+	CONNECT_LOGGER
+
+	// Create and install the active scheduler.
+	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
+	CleanupStack::PushL(scheduler);
+	CActiveScheduler::Install(scheduler);
+
+	// Create the server. NB Odd syntax in this line because we never refer to 
+	// it directly- it's always owned by the cleanup stack!
+	(void)CRemConServer::NewLC();
+
+	// Initialisation complete, now signal the client
+	RProcess::Rendezvous(KErrNone);
+
+	// Ready to run. This only returns when the server is closing down.
+	CActiveScheduler::Start();
+
+	// Clean up the server and scheduler.
+	CleanupStack::PopAndDestroy(2, scheduler);
+	CLOSE_LOGGER
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/messagequeue.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,178 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include "messagequeue.h"
+#include "utils.h"
+#include "remconmessage.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("msgqueue");
+#endif
+
+CMessageQueue* CMessageQueue::NewL()
+	{
+	LOG_STATIC_FUNC
+	return new(ELeave) CMessageQueue();
+	}
+
+CMessageQueue::CMessageQueue()
+:	iQueue(_FOFF(CRemConMessage, iLink)),
+	iIter(iQueue)
+	{
+	LOG_FUNC
+	}
+
+CMessageQueue::~CMessageQueue()
+	{
+	LOG_FUNC;
+	LogQueue();
+
+	iIter.SetToFirst(); 
+	CRemConMessage* msg;
+	while ( ( msg = iIter++ ) != NULL )
+		{
+		iQueue.Remove(*msg);
+		--iCount;
+		delete msg;
+		}
+	
+	LogQueue();
+	}
+
+TSglQueIter<CRemConMessage>& CMessageQueue::SetToFirst()
+	{
+	LOG_FUNC;
+
+	iIter.SetToFirst();
+
+	return iIter;
+	}
+
+void CMessageQueue::Append(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	LogQueue();
+
+	iQueue.AddLast(aMsg);
+	++iCount;
+
+	LogQueue();
+	}
+
+void CMessageQueue::RemoveAndDestroy(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	LOG1(_L("\t&aMsg = [0x%08x]"), &aMsg);
+
+	Remove(aMsg);
+	delete &aMsg;
+	}
+
+void CMessageQueue::RemoveAndDestroy(TUint aSessionId)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taSessionId = %d"), aSessionId);
+
+	TSglQueIter<CRemConMessage> iter(iQueue);
+	CRemConMessage* msg;
+	while ( ( msg = iter++ ) != NULL )
+		{
+		if ( msg->SessionId() == aSessionId )
+			{
+			RemoveAndDestroy(*msg);
+			}
+		}
+	}
+
+void CMessageQueue::Remove(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	LOG1(_L("\t&aMsg = [0x%08x]"), &aMsg);
+	LogQueue();
+
+	iQueue.Remove(aMsg);
+	--iCount;
+
+	LogQueue();
+	}
+
+CRemConMessage& CMessageQueue::First()
+	{
+	LOG_FUNC;
+
+	CRemConMessage* msg = iQueue.First();
+	ASSERT_DEBUG(msg);
+	return *msg;
+	}
+
+CRemConMessage* CMessageQueue::Message(TUint aTransactionId)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taTransactionId = %d"), aTransactionId);
+
+	TSglQueIter<CRemConMessage> iter(iQueue);
+	CRemConMessage* msg;
+	CRemConMessage* ret = NULL;
+	
+	while ( ( msg = iter++ ) != NULL )
+		{
+		if ( msg->TransactionId() == aTransactionId )
+			{
+			ret = msg;
+			break;
+			}
+		}
+	return ret;
+	}
+
+void CMessageQueue::LogQueue() const
+	{
+#ifdef __FLOG_ACTIVE
+	
+	LOG2(_L("\tthis = 0x%08x, iCount = %d"), this, iCount);
+
+	// Make our own local iterator so we don't interfere with one the client 
+	// may be relying on.
+	TSglQueIter<CRemConMessage> iter(const_cast<CMessageQueue*>(this)->iQueue);
+	CRemConMessage* msg;
+	while ( ( msg = iter++ ) != NULL )
+		{
+		LOG4(_L("\t\tmsg [0x%08x], Addr.BearerUid = 0x%08x, MsgType = %d, InterfaceUid = 0x%08x,"),
+			msg,
+			msg->Addr().BearerUid(),
+			msg->MsgType(),
+			msg->InterfaceUid()
+			);
+		LOG3(_L("\t\tOperationId = 0x%02x, SessionId = %d, TransactionId = %d"),
+			msg->OperationId(),
+			msg->SessionId(),
+			msg->TransactionId()
+			);
+		// This logging code left in for maintenance.
+		//LOG1(_L("\t\tOperationData = \"%S\""), &msg->OperationData());
+		}
+
+#endif // __FLOG_ACTIVE
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/messagerecipients.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,141 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "messagerecipients.h"
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+CMessageRecipients* CMessageRecipients::NewL()
+	{
+	LOG_STATIC_FUNC
+	return new(ELeave) CMessageRecipients();
+	}
+
+CMessageRecipients::CMessageRecipients()
+:	iClientInfo(_FOFF(TClientInfo, iLink)),
+	iIter(iClientInfo),
+	iConstIter(iClientInfo)
+	{
+	LOG_FUNC
+	}
+
+CMessageRecipients::~CMessageRecipients()
+	{
+	LOG_FUNC
+	iIter.SetToFirst();
+	TClientInfo* client;
+	while ((client = iIter++) != NULL)
+		{
+		iClientInfo.Remove(*client);
+		delete client;
+		}
+	}
+
+TUint& CMessageRecipients::TransactionId()
+	{
+	return iTransactionId;
+	}
+
+TSglQue<TClientInfo>& CMessageRecipients::Clients()
+	{
+	return iClientInfo;
+	}
+
+TClientInfoConstIter& CMessageRecipients::ConstIter()
+	{
+	return iConstIter;
+	}
+
+void CMessageRecipients::RemoveAndDestroyClient(const TClientInfo& aClientInfo)
+	{
+	iIter.SetToFirst();
+	TClientInfo* client;
+	while ((client = iIter++) != NULL)
+		{
+		if (client->ProcessId() == aClientInfo.ProcessId() && client->SecureId() == aClientInfo.SecureId())
+			{
+			iClientInfo.Remove(*client);
+			delete client;
+			}
+		}
+	}
+
+CMessageRecipientsList* CMessageRecipientsList::NewL()
+	{
+	return new(ELeave) CMessageRecipientsList();
+	}
+
+CMessageRecipientsList::CMessageRecipientsList()
+	:iMessages(_FOFF(CMessageRecipients, iLink)),
+	iIter(iMessages)
+	{
+	}
+
+CMessageRecipientsList::~CMessageRecipientsList()
+	{
+	iIter.SetToFirst();
+	CMessageRecipients* message;
+	while ((message = iIter++) != NULL)
+		{
+		iMessages.Remove(*message);
+		delete message;
+		}
+	}
+
+TSglQue<CMessageRecipients>& CMessageRecipientsList::Messages()
+	{
+	return iMessages;
+	}
+
+TSglQueIter<CMessageRecipients>& CMessageRecipientsList::Iter()
+	{
+	return iIter;
+	}
+
+void CMessageRecipientsList::RemoveAndDestroyMessage(const TUint aTransactionId)
+	{
+	iIter.SetToFirst();
+	CMessageRecipients* message;
+	while ((message = iIter++) != NULL)
+		{
+		if (message->TransactionId() == aTransactionId)
+			{
+			iMessages.Remove(*message);
+			delete message;
+			}
+		}
+	}
+
+CMessageRecipients* CMessageRecipientsList::Message(TUint aTransactionId)
+	{
+	iIter.SetToFirst();
+	CMessageRecipients* message;
+	while ((message = iIter++) != NULL)
+		{
+		if (message->TransactionId() == aTransactionId)
+			{
+			break;
+			}
+		}
+	return message;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/remconmessage.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,162 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "remconmessage.h"
+#include "utils.h"
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+CRemConMessage* CRemConMessage::NewL(
+	const TRemConAddress& aAddr,
+	TRemConMessageType aMsgType,
+	TRemConMessageSubType aMsgSubType,
+	TUid aInterfaceUid,
+	TUint aOperationId,
+	const RBuf8& aData,
+	TUint aSessionId,
+	TUint aTransactionId,
+	TBool aIsReliableSend)
+	{
+	LOG_STATIC_FUNC
+	return new(ELeave) CRemConMessage(
+		aAddr,
+		KNullClientId,
+		aMsgType,
+		aMsgSubType,
+		aInterfaceUid,
+		aOperationId,
+		aData,
+		aSessionId,
+		aTransactionId,
+		aIsReliableSend
+		);
+	}
+
+CRemConMessage* CRemConMessage::NewL(
+	const TRemConAddress& aAddr,
+	const TRemConClientId& aClient,
+	TRemConMessageType aMsgType,
+	TRemConMessageSubType aMsgSubType,
+	TUid aInterfaceUid,
+	TUint aOperationId,
+	const RBuf8& aData,
+	TUint aSessionId,
+	TUint aTransactionId)
+	{
+	LOG_STATIC_FUNC
+	return CRemConMessage::NewL(
+		aAddr,
+		aClient,
+		aMsgType,
+		aMsgSubType,
+		aInterfaceUid,
+		aOperationId,
+		aData,
+		aSessionId,
+		aTransactionId,
+		EFalse
+		);
+	}
+
+CRemConMessage* CRemConMessage::NewL(
+	const TRemConAddress& aAddr,
+	const TRemConClientId& aClient,
+	TRemConMessageType aMsgType,
+	TRemConMessageSubType aMsgSubType,
+	TUid aInterfaceUid,
+	TUint aOperationId,
+	const RBuf8& aData,
+	TUint aSessionId,
+	TUint aTransactionId,
+	TBool aIsReliableSend)
+	{
+	LOG_STATIC_FUNC
+	return new(ELeave) CRemConMessage(
+		aAddr,
+		aClient,
+		aMsgType,
+		aMsgSubType,
+		aInterfaceUid,
+		aOperationId,
+		aData,
+		aSessionId,
+		aTransactionId,
+		aIsReliableSend
+		);
+	}
+
+CRemConMessage::CRemConMessage(
+	const TRemConAddress& aAddr,
+	const TRemConClientId& aClient,
+	TRemConMessageType aMsgType,
+	TRemConMessageSubType aMsgSubType,
+	TUid aInterfaceUid,
+	TUint aOperationId,
+	const RBuf8& aData,
+	TUint aSessionId,
+	TUint aTransactionId,
+	TBool aIsReliableSend)
+:	iAddr(aAddr),
+	iClient(aClient),
+	iMsgType(aMsgType),
+	iMsgSubType(aMsgSubType),
+	iInterfaceUid(aInterfaceUid),
+	iOperationId(aOperationId),
+	iSessionId(aSessionId),
+	iTransactionId(aTransactionId),
+	iIsReliableSend(aIsReliableSend)
+	{
+	LOG_FUNC
+	iData.Assign(aData);
+	}
+
+CRemConMessage::~CRemConMessage()
+	{
+	LOG_FUNC
+	iData.Close();
+	}
+
+CRemConMessage* CRemConMessage::CopyL(const CRemConMessage& aMsg)
+	{
+	LOG_STATIC_FUNC
+	// Allocate a new heap descriptor with a copy of that in aMsg, then make a 
+	// new CRemConMessage to take ownership of it.
+	RBuf8 newData;
+	newData.CreateL(aMsg.OperationData());
+	
+	CleanupClosePushL(newData);
+	CRemConMessage* msg = NewL(
+		aMsg.Addr(),
+		aMsg.Client(),
+		aMsg.MsgType(),
+		aMsg.MsgSubType(),
+		aMsg.InterfaceUid(),
+		aMsg.OperationId(),
+		newData,
+		aMsg.SessionId(),
+		aMsg.TransactionId(),
+		aMsg.IsReliableSend()
+		);
+	CLEANUPSTACK_POP1(&newData);	
+	return msg;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/server.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,3826 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Remote Control server implementation.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <remcon/remcontargetselectorplugin.h>
+#include <remcon/remcontargetselectorplugininterface.h>
+#include <remcon/remconbearerinterface.h>
+#include <remcon/remconbearerbulkinterface.h>
+#include "server.h"
+#include "targetclientprocess.h"
+#include "controllersession.h"
+#include "targetsession.h"
+#include "serversecuritypolicy.h"
+#include "utils.h"
+#include "bearermanager.h"
+#include "messagequeue.h"
+#include "convertermanager.h"
+#include "remconmessage.h"
+#include "connections.h"
+#include "connectionhistory.h"
+#include "messagerecipients.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+PANICCATEGORY("server");
+
+#ifdef __FLOG_ACTIVE
+#define LOGCONTROLLERSESSIONS				LogControllerSessions()
+#define LOGTARGETSESSIONS					LogTargetSessions()
+#define LOGREMOTES							LogRemotes()
+#define LOGCONNECTIONHISTORYANDINTEREST		LogConnectionHistoryAndInterest()
+#define LOGOUTGOINGCMDPENDINGTSP			LogOutgoingCmdPendingTsp()
+#define LOGOUTGOINGNOTIFYCMDPENDINGTSP		LogOutgoingNotifyCmdPendingTsp()
+#define LOGOUTGOINGRSPPENDINGTSP			LogOutgoingRspPendingTsp()
+#define LOGOUTGOINGPENDINGSEND				LogOutgoingPendingSend()
+#define LOGOUTGOINGSENT						LogOutgoingSent()
+#define LOGINCOMINGCMDPENDINGADDRESS			LogIncomingCmdPendingAddress()
+#define LOGINCOMINGNOTIFYCMDPENDINGADDRESS		LogIncomingNotifyCmdPendingAddress()
+#define LOGINCOMINGNOTIFYCMDPENDINGREADDRESS	LogIncomingNotifyCmdPendingReAddress()
+#define LOGINCOMINGPENDINGDELIVERY			LogIncomingPendingDelivery()
+#define LOGINCOMINGDELIVERED				LogIncomingDelivered()
+#else
+#define LOGCONTROLLERSESSIONS
+#define LOGTARGETSESSIONS
+#define LOGREMOTES
+#define LOGCONNECTIONHISTORYANDINTEREST
+#define LOGOUTGOINGCMDPENDINGTSP
+#define LOGOUTGOINGNOTIFYCMDPENDINGTSP
+#define LOGOUTGOINGRSPPENDINGTSP
+#define LOGOUTGOINGPENDINGSEND
+#define LOGOUTGOINGSENT
+#define LOGINCOMINGCMDPENDINGADDRESS
+#define LOGINCOMINGNOTIFYCMDPENDINGADDRESS
+#define LOGINCOMINGNOTIFYCMDPENDINGREADDRESS
+#define LOGINCOMINGPENDINGDELIVERY
+#define LOGINCOMINGDELIVERED
+#endif // __FLOG_ACTIVE
+
+TInt BulkMain(TAny* aParam);
+TBool ControllerSessionCompare(const TUint* aSessionId, const CRemConControllerSession& aSession)
+	{
+	return *aSessionId == aSession.Id();
+	}
+
+TBool TargetClientCompareUsingSessionId(const TUint* aClientId, const CRemConTargetClientProcess& aClient)
+	{
+	return *aClientId == aClient.Id();
+	}
+
+TBool TargetClientCompareUsingProcessId(const TProcessId* aProcessId, const CRemConTargetClientProcess& aClient)
+	{
+	return *aProcessId == aClient.ClientInfo().ProcessId();
+	}
+
+CRemConServer* CRemConServer::NewLC()
+	{
+	LOG_STATIC_FUNC;
+	CRemConServer* self = new(ELeave) CRemConServer();
+	CleanupStack::PushL(self);
+	// StartL is where the kernel checks that there isn't already an instance 
+	// of the same server running, so do it before ConstructL.
+	self->StartL(KRemConServerName);
+	self->ConstructL();
+	return self;
+	}
+
+CRemConServer::~CRemConServer()
+	{
+	LOG_FUNC;
+
+	delete iBearerManager;
+	delete iShutdownTimer;
+	
+	// There should be no watcher as there should be no bulk thread running
+	ASSERT_DEBUG(!iBulkThreadWatcher);
+
+	iControllerSessions.Close();
+
+	iTargetClientsLock.Wait();
+	iTargetClients.Close();
+	iTargetClientsLock.Close();
+
+	// Destroy TSP before iIncomingPendingAddress in case the TSP is 
+	// addressing a message on it at the time.
+	// The TSP should not be handling outgoing commands or responses as all the sessions 
+	// have gone, and they clean up their outgoing messages when they close.
+	ASSERT_DEBUG(!iTspHandlingOutgoingCommand);
+	ASSERT_DEBUG(!iTspHandlingOutgoingResponse);
+	ASSERT_DEBUG(!iTspHandlingOutgoingNotifyCommand);	
+	// We can't assert anything about iTspAddressingIncomingCommand- it isn't 
+	// interesting.
+	delete iTsp;
+
+	delete iOutgoingCmdPendingTsp;
+	delete iOutgoingNotifyCmdPendingTsp;
+	delete iOutgoingRspPendingTsp;
+	delete iOutgoingRspPendingSend;
+	delete iOutgoingPendingSend;
+	delete iOutgoingSent;
+	delete iIncomingCmdPendingAddress;
+	delete iIncomingNotifyCmdPendingAddress;
+	delete iIncomingNotifyCmdPendingReAddress;
+	delete iIncomingPendingDelivery;
+	delete iIncomingDelivered;
+	
+	delete iMessageRecipientsList;
+
+	iTspConnections.Reset();
+	iTspIncomingCmdClients.Reset();
+	iTspIncomingNotifyCmdClients.Reset();
+	
+	delete iConverterManager;
+
+	// Clean up the connection information (must be done after the bearer 
+	// manager is destroyed).
+	LOGREMOTES;
+	LOGCONNECTIONHISTORYANDINTEREST;
+	delete iConnectionHistory;
+
+	iSession2ConnHistory.Close();
+	
+	// This is the odd ECOM code for cleaning our session. NB This must be 
+	// done AFTER destroying all the other things in this thread which use 
+	// ECOM!
+	if ( iEcom )
+		{
+		iEcom->Close();
+		}
+	REComSession::FinalClose();
+	}
+
+CRemConServer::CRemConServer()
+ :	CPolicyServer(CActive::EPriorityHigh, KRemConServerPolicy),
+ 	iTspConnections(_FOFF(TRemConAddress, iLink)),
+	iTspIncomingCmdClients(_FOFF(TClientInfo, iLink)),
+	iTspIncomingNotifyCmdClients(_FOFF(TClientInfo, iLink2)),
+	iTspIf4Stub(*this)
+	{
+	LOG_FUNC;
+	// NB CRemConServer uses CActive::EPriorityHigh to help it get priority 
+	// over other AOs in its thread. (The fact that it's added to the AS 
+	// before anything else helps too.) This is so that client requests are 
+	// not blocked by other AOs in the thread being very busy. This relies of 
+	// course on the cooperation of the other AOs running in RemCon's thread 
+	// over which we have no control (e.g. those in externally-supplied 
+	// bearers or the Target Selector Plugin). In Symbian OS, it's the best we 
+	// can do.
+	
+	// This is needed for BC reasons, as the TUint32 padding in TClientInfo is now replaced with
+	// a second TSglQueLink. Therefore in order to maintain BC we need these two classes
+	// to be the same size.
+	__ASSERT_COMPILE(sizeof(TUint32) == sizeof(TSglQueLink));
+	}
+
+void CRemConServer::ConstructL()
+	{
+	LOG_FUNC;
+	// Open ECOM session.
+	iEcom = &(REComSession::OpenL());
+	LEAVEIFERRORL(iTargetClientsLock.CreateLocal());
+
+	iShutdownTimer = CPeriodic::NewL(CActive::EPriorityStandard);
+
+	// Make the connection history holder before creating the bearer manager, 
+	// as some bearers might call the bearer manager back synchronously with a 
+	// new connection, and we need iConnectionHistory to be able to handle 
+	// that.
+	iConnectionHistory = CConnectionHistory::NewL();
+
+	// Make the queues before making the bearer manager because otherwise a 
+	// 'connection up' which is indicated synchronously with 
+	// CBearerManager::NewL will blow us up (we address some of the queues 
+	// when that happens).
+	iOutgoingCmdPendingTsp = CMessageQueue::NewL();
+	iOutgoingNotifyCmdPendingTsp = CMessageQueue::NewL();
+	iOutgoingRspPendingTsp = CMessageQueue::NewL();
+	iOutgoingRspPendingSend = CMessageQueue::NewL();
+	iOutgoingPendingSend = CMessageQueue::NewL();
+	iOutgoingSent = CMessageQueue::NewL();
+	iIncomingCmdPendingAddress = CMessageQueue::NewL();
+	iIncomingNotifyCmdPendingAddress = CMessageQueue::NewL();
+	iIncomingNotifyCmdPendingReAddress = CMessageQueue::NewL();
+	iIncomingPendingDelivery = CMessageQueue::NewL();
+	iIncomingDelivered = CMessageQueue::NewL();
+
+	iMessageRecipientsList = CMessageRecipientsList::NewL();
+	
+	// Make bearer manager. This makes the bearers, and connects them up to 
+	// the event handler.
+	iBearerManager = CBearerManager::NewL(*this);
+	
+	// We must load the bearers before the TSP as the TSP loader checks
+	// whether there are any bearers with interface V2	
+	ASSERT_ALWAYS(!iTspIf);
+	
+	iConverterManager = CConverterManager::NewL();
+
+	LoadTspL();
+
+	LOGREMOTES;
+	LOGCONNECTIONHISTORYANDINTEREST;
+	}
+
+CSession2* CRemConServer::NewSessionL(const TVersion& aVersion, 
+	const RMessage2& aMessage) const
+	{
+	LOG(KNullDesC8);
+	LOG_FUNC;
+	LOG3(_L("\taVersion = (%d,%d,%d)"), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild);
+		
+	// Version number check...
+	if ( aVersion.iMajor != KRemConSrvMajorVersionNumber || aVersion.iMinor != KRemConSrvMinorVersionNumber )
+		{
+		LEAVEIFERRORL(KErrNotSupported);
+		}
+
+	// We need a non-const copy of ourself so that:
+	// (a) New target clients may be added to iTargetClients (controller sessions are added to 
+	// iControllerSessions when ControllerClientOpened() is invoked).
+	// (b) We may provide new sessions/clients with a non-const pointer to ourself.
+	CRemConServer* ncThis = const_cast<CRemConServer*>(this);
+
+	CRemConSession* sess = NULL;
+	ASSERT_DEBUG(iBearerManager);
+
+	TInt err = KErrNotSupported;	
+	if (aVersion.iBuild == KRemConSrvControllerSession)
+		{
+		TRAP(err, sess = ncThis->CreateControllerSessionL(aMessage));
+		}
+	else if(aVersion.iBuild == KRemConSrvTargetSession)
+		{
+		TRAP(err, sess = ncThis->CreateTargetSessionL(aMessage));
+		}
+	
+	if ( err != KErrNone)
+		{
+		// Session creation might have failed- if it has we need to check if 
+		// we need to shut down again.
+		const_cast<CRemConServer*>(this)->StartShutdownTimerIfNoClientsOrBulkThread();
+		LEAVEIFERRORL(err);
+		}
+
+	LOG1(_L("\tsess = 0x%08x"), sess);
+	return sess;
+	}
+
+CRemConControllerSession* CRemConServer::CreateControllerSessionL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	CRemConControllerSession* sess=NULL;
+
+	// Obtain client process ID.
+	TClientInfo clientInfo;
+	ClientProcessAndSecureIdL(clientInfo, aMessage);
+
+	// Create the session and return
+	sess = CRemConControllerSession::NewL(*this, *iBearerManager, clientInfo, iSessionOrClientId++);
+	return sess;
+	}
+
+CRemConTargetSession* CRemConServer::CreateTargetSessionL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	CRemConTargetSession* sess=NULL;
+	
+	// Obtain client process ID and search for clients server-side process representation.
+	TClientInfo clientInfo;
+	ClientProcessAndSecureIdL(clientInfo, aMessage);
+
+	// We search for the client ourselves here as we need to know where it
+	// is in the array if we end up needing to destroy it.
+	iTargetClientsLock.Wait();	
+	CleanupSignalPushL(iTargetClientsLock);
+
+	TInt clientIndex = iTargetClients.Find(clientInfo.ProcessId(), TargetClientCompareUsingProcessId);
+
+	if (clientIndex == KErrNotFound)
+		{
+		// Client is new, create process representation for client and add to iTargetClients 
+		CRemConTargetClientProcess* newClient = CRemConTargetClientProcess::NewLC(clientInfo, iSessionOrClientId++, *this, *iBearerManager);
+
+		iTargetClients.AppendL(newClient);
+
+		// Set clientIndex to point to the new client.
+		clientIndex = iTargetClients.Count()-1;
+
+		CleanupStack::Pop(newClient);
+		}
+
+	// Create session on client and return.
+	// On error, remove the clients process representation if client has no other sessions.
+	TRAPD(err, sess = iTargetClients[clientIndex]->NewSessionL(iSessionOrClientId++));
+	if (err)
+		{
+		TryToDropClientProcess(clientIndex);
+		LEAVEL(err);
+		}
+
+	CleanupStack::PopAndDestroy(&iTargetClientsLock);
+
+	return sess;
+	}
+
+void CRemConServer::ClientProcessAndSecureIdL(TClientInfo& aClientInfo, const RMessage2& aMessage) const
+	{
+	LOG_FUNC;
+
+	RThread thread;
+	LEAVEIFERRORL(aMessage.Client(thread));
+	CleanupClosePushL(thread);
+	RProcess process;
+	LEAVEIFERRORL(thread.Process(process));
+	aClientInfo.ProcessId() = process.Id();
+	process.Close();
+	aClientInfo.SecureId() = thread.SecureId();
+	CleanupStack::PopAndDestroy(&thread);
+	}
+
+void CRemConServer::StartShutdownTimerIfNoClientsOrBulkThread()
+	{
+	LOG_FUNC;
+	iTargetClientsLock.Wait();
+	if ( iControllerSessions.Count() == 0 && iTargetClients.Count() == 0 && !iBulkThreadOpen)
+		{
+		LOG(_L("\tno remaining sessions- starting shutdown timer"));
+		// Should have been created during our construction.
+		ASSERT_DEBUG(iShutdownTimer);
+		// Start the shutdown timer. It's actually a CPeriodic- the first 
+		// event will be in KShutdownDelay microseconds' time.
+		// NB The shutdown timer might already be active, in the following 
+		// case: this function is being called by NewSessionL because there 
+		// was a failure creating a new session, BUT this function had already 
+		// been called by the session's destructor (i.e. the failure was in 
+		// the session's ConstructL, NOT its new(ELeave)). To protect against 
+		// KERN-EXEC 15 just check for if the timer is already active. 
+		if ( !iShutdownTimer->IsActive() )
+			{
+			iShutdownTimer->Start(KShutdownDelay, 
+				// Delay of subsequent firings (will not happen because we kill 
+				// ourselves after the first).
+				0, 
+				TCallBack(CRemConServer::TimerFired, this)
+				);
+			}
+		else
+			{
+			LOG(_L("\tshutdown timer was already active"));
+			}
+		}
+	iTargetClientsLock.Signal();
+	}
+
+void CRemConServer::CancelShutdownTimer()
+	{
+	// Should have been created during our construction.		
+	ASSERT_DEBUG(iShutdownTimer);
+	iShutdownTimer->Cancel();
+	}
+
+void CRemConServer::TryToDropClientProcess(TUint aClientIndex)
+	{
+	ASSERT_DEBUG(iTargetClients.Count() > aClientIndex);
+	
+	iTargetClientsLock.Wait();
+	
+	CRemConTargetClientProcess* client = iTargetClients[aClientIndex]; 
+	if (client->TargetSessionCount() == 0)
+		{
+		// No sessions held by this client process representation, OK to destroy.
+		// The destructor of CRemConTargetClientProcess will call back to us, after which we will
+		// handle the client close.
+		delete client;
+		}
+	
+	iTargetClientsLock.Signal();
+	}
+
+TInt CRemConServer::TimerFired(TAny* aThis)
+	{
+	LOG_STATIC_FUNC;
+	static_cast<void>(aThis);
+	
+#if defined(__FLOG_ACTIVE) || defined(_DEBUG)
+	CRemConServer* self = static_cast<CRemConServer*>(aThis);
+	// We should have sent 'this' to this callback. 
+	ASSERT_DEBUG(self);
+	LOG1(_L8("\tauto shutdown- terminating the server [0x%08x]"), self);
+#endif // __FLOG_ACTIVE || _DEBUG
+	
+	// Stop our Active Scheduler. This returns the flow of execution to after 
+	// the CActiveScheduler::Start call in the server startup code, and 
+	// terminates the server.
+	CActiveScheduler::Stop();
+	
+	return KErrNone;
+	}
+
+void CRemConServer::InitialiseBulkServerThreadL()
+	{
+	LOG_FUNC;
+	// Set up the configuration of the thread
+	iBulkServerThread.SetPriority(EPriorityLess);
+	
+	iBulkThreadWatcher = new(ELeave) CBulkThreadWatcher(*this);
+	CleanupDeleteAndNullPushL(iBulkThreadWatcher);
+	
+	// Create the communication between the servers.
+	LEAVEIFERRORL(iBulkServerMsgQueue.CreateLocal(2)); // only ever two outstanding messages
+	CleanupClosePushL(iBulkServerMsgQueue); // member variable, but closing again should be fine.
+	
+	// Load the server pointer (for TClientInfo info)
+	TBulkServerMsg ctrlMsg;
+	ctrlMsg.iType = EControlServer;
+	ctrlMsg.iData = this;
+	iBulkServerMsgQueue.SendBlocking(ctrlMsg); // this should not block as there is enough room in queue.
+	
+	// Load the bearer manager pointer
+	TBulkServerMsg manMsg;
+	manMsg.iType = EBearerManager;
+	manMsg.iData = iBearerManager;
+	iBulkServerMsgQueue.SendBlocking(manMsg); // this should not block as there is enough room in queue.
+	
+	TRequestStatus stat;
+	iBulkServerThread.Rendezvous(stat);
+	
+	// Mark bulk server thread ready to run
+	iBulkServerThread.Resume();
+	User::WaitForRequest(stat); 	// wait for start or death
+	
+	// we can't use the 'exit reason' if the server panicked as this
+	// is the panic 'reason' and may be '0' which cannot be distinguished
+	// from KErrNone
+	TInt err = (iBulkServerThread.ExitType() == EExitPanic) ? KErrServerTerminated : stat.Int();
+	LEAVEIFERRORL(err);
+	
+	// Everything appears to be running...so watch the thread until it dies...
+	iBulkThreadWatcher->StartL();
+	
+	CleanupStack::Pop(2, &iBulkThreadWatcher); // iBulkServerMsgQueue, iBulkThreadWatcher
+	}
+
+
+TInt CRemConServer::BulkServerRequired()
+	{
+	LOG_FUNC;
+	// If the bulk server is required then try to create it
+	TThreadFunction bulkServerThreadFunction(BulkMain);
+	_LIT(KBulkServerThreadName, "RemConBulkServerThread");
+	const TInt KMaxBulkServerThreadHeapSize = 0x100000;
+	
+	TInt err = KErrNone;
+	if(!iBulkThreadOpen)
+		{
+		err = iBulkServerThread.Create(KBulkServerThreadName, bulkServerThreadFunction, KDefaultStackSize, KMinHeapSize, KMaxBulkServerThreadHeapSize, &iBulkServerMsgQueue, EOwnerThread);
+		if(err == KErrNone)
+			{
+			TRAP(err, InitialiseBulkServerThreadL());
+			if(err == KErrNone)
+				{
+				iBulkThreadOpen = ETrue;
+				}
+			}
+		}
+	return err;
+	}
+
+TInt CRemConServer::ControllerClientOpened(CRemConControllerSession& aSession)
+	{
+	LOG_FUNC;
+	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
+	LOGCONTROLLERSESSIONS;
+
+	// Register the session by appending it to our array, and also making an 
+	// item for it in the record of which points in the connection history 
+	// sessions are interested in.
+	TInt ret = iControllerSessions.Append(&aSession);
+	if ( ret == KErrNone )
+		{
+		TSessionPointerToConnectionHistory item;
+		item.iSessionId = aSession.Id();
+		item.iIndex = 0; // there is always at least one item in the connection history
+		ret = iSession2ConnHistory.Append(item);
+		if ( ret != KErrNone )
+			{
+			iControllerSessions.Remove(iControllerSessions.Count() - 1);
+			}
+		}
+
+	if ( ret == KErrNone )
+		{
+		// Should have been created during our construction.
+		ASSERT_DEBUG(iShutdownTimer);
+		iShutdownTimer->Cancel();
+		}
+
+	LOGCONTROLLERSESSIONS;
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+TInt CRemConServer::RegisterTargetSessionPointerToConnHistory(const CRemConTargetSession& aSession)
+	{
+	LOG_FUNC;
+
+	TSessionPointerToConnectionHistory item;
+	item.iSessionId = aSession.Id();
+	item.iIndex = 0; // there is always at least one item in the connection history
+	TInt ret = iSession2ConnHistory.Append(item);
+
+	return ret;
+	}
+
+
+// this function is called by the client when it has registered its features
+void CRemConServer::TargetClientAvailable(const CRemConTargetClientProcess& aClient)
+	{
+	LOG_FUNC;
+	LOG1(_L("\t&aClient = 0x%08x"), &aClient);
+	LOGTARGETSESSIONS;
+
+	ASSERT_DEBUG(iBearerManager);
+	iBearerManager->TargetClientAvailable(aClient.Id(), aClient.PlayerType(), aClient.PlayerSubType(), aClient.Name());
+	if(iTspIf5)
+		{
+		iTspIf5->TargetClientAvailable(aClient.ClientInfo());
+		}
+
+	LOGTARGETSESSIONS;
+	}
+
+void CRemConServer::TargetFeaturesUpdated(CRemConTargetClientProcess& aClient)
+	{
+	LOG_FUNC;
+	LOG1(_L("\t&aClient = 0x%08x"), &aClient);
+	LOGTARGETSESSIONS;
+
+	ASSERT_DEBUG(iBearerManager);
+	iBearerManager->TargetFeaturesUpdated(aClient.Id(), aClient.PlayerType(), aClient.PlayerSubType(), aClient.Name());
+
+	LOGTARGETSESSIONS;
+	}
+
+// this function is called by the session when the client has registered its features
+void CRemConServer::ControllerClientAvailable()
+	{
+	LOG_FUNC;
+	LOGCONTROLLERSESSIONS;
+
+	ASSERT_DEBUG(iBearerManager);
+	iBearerManager->ControllerClientAvailable();
+	
+	LOGCONTROLLERSESSIONS;
+	}
+
+// this function is called by the session when it goes connection oriented
+void CRemConServer::ClientGoConnectionOriented(CRemConControllerSession& aSession, TUid aUid)
+	{
+	LOG_FUNC;
+	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
+	LOGCONTROLLERSESSIONS;
+
+	(void)&aSession; // get rid of unused warning. We keep the param to enforce usage only
+					 // by controller sessions
+
+	/* now tell the bearer manager that someones went connection oriented
+	   The bearer manager maintains controller and target counts for all bearers
+	   and will tell bearers when they need to know things have changed */
+	ASSERT_DEBUG(iBearerManager);
+	iBearerManager->ClientConnectionOriented(aUid);
+
+	LOGCONTROLLERSESSIONS;
+	}
+
+// this is called by the session when the client goes connectionless
+void CRemConServer::ClientGoConnectionless(CRemConControllerSession& aSession, TUid aUid)
+	{
+	LOG_FUNC;
+	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
+	LOGCONTROLLERSESSIONS;
+
+	(void)&aSession; // get rid of unused warning. We keep the param to enforce usage only
+					 // by controller sessions
+
+	/* now tell the bearer manager that someones went connection less
+	   The bearer manager maintains controller and target counts for all bearers
+	   and will tell bearers when they need to know things have changed */
+	ASSERT_DEBUG(iBearerManager);
+	iBearerManager->ClientConnectionless(aUid);
+
+	LOGCONTROLLERSESSIONS;
+	}
+
+// called by controller session when closed.
+void CRemConServer::ControllerClientClosed(CRemConControllerSession& aSession, TUid aUid)
+	{
+	LOG_FUNC;
+	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
+	LOGCONTROLLERSESSIONS;
+
+	// Find this session in the array and remove it (if it's there).
+	TInt index = iControllerSessions.Find(&aSession);
+	if(index >= 0)
+		{
+		// We've found the session in our array.
+		// 1. Remove the session from our array.
+		iControllerSessions.Remove(index);
+		
+		// 2. Tell the bearers about the session going away, if it was the 
+		// last controller.
+		// If the session hasn't already set its type, then it doesn't 
+		// count (we won't have told the bearers about it to begin with).
+		// The bearer manager maintains controller and target counts for all bearers
+		// and will tell bearers when they need to know things have changed 
+		if (aSession.ClientAvailable())
+			{
+			ASSERT_DEBUG(iBearerManager);
+			iBearerManager->ClientClosed(ETrue, aUid, aSession.Id());
+			}
+
+		// 3. Remove queued messages belonging to this session that: 
+		// (a) are outgoing, awaiting access to the TSP 
+		// (OutgoingPendingTsp, OutgoingNotifyPendingTsp), 
+		// (b) are outgoing, awaiting a bearer connection 
+		// (OutgoingPendingSend), 
+		// (c) have been sent (OutgoingSent)
+		// (d) are pending delivery to this session 
+		// (IncomingPendingDelivery)
+
+		// (3)(a) Outgoing, waiting access to the TSP:
+		TSglQueIter<CRemConMessage>& cmdIter = OutgoingCmdPendingTsp().SetToFirst();
+		CRemConMessage* msg;
+		TBool first = ETrue;
+		while ( ( msg = cmdIter++ ) != NULL )
+			{
+			if ( msg->SessionId() == aSession.Id() )
+				{
+				// If the message is currently being worked on by the 
+				// TSP, cancel the TSP before destroying it.
+				if ( iTspHandlingOutgoingCommand && first )
+					{
+					ASSERT_DEBUG(iTspIf);
+					iTspIf->CancelOutgoingCommand();
+					iTspHandlingOutgoingCommand = EFalse;
+					}
+				OutgoingCmdPendingTsp().RemoveAndDestroy(*msg);
+				}
+			first = EFalse;
+			}
+		
+		cmdIter = OutgoingNotifyCmdPendingTsp().SetToFirst();
+		first = ETrue;
+		while ( ( msg = cmdIter++ ) != NULL )
+			{
+			if ( msg->SessionId() == aSession.Id() )
+				{
+				// If the message is currently being worked on by the 
+				// TSP, cancel the TSP before destroying it.
+				if ( iTspHandlingOutgoingNotifyCommand && first )
+					{
+					ASSERT_DEBUG(iTspIf3);
+					iTspIf3->CancelOutgoingNotifyCommand();
+					iTspHandlingOutgoingNotifyCommand = EFalse;
+					}
+				OutgoingNotifyCmdPendingTsp().RemoveAndDestroy(*msg);
+				}
+			first = EFalse;
+			}
+
+		// (3)(b) Outgoing, awaiting a bearer connection:
+		TSglQueIter<CRemConMessage>& sendIter = OutgoingPendingSend().SetToFirst();
+		while ( ( msg = sendIter++ ) != NULL )
+			{
+			if ( msg->SessionId() == aSession.Id() )
+				{
+				// Only commands are sent by controllers
+				ASSERT_DEBUG(msg->MsgType() == ERemConCommand || msg->MsgType() == ERemConNotifyCommand);
+				OutgoingPendingSend().RemoveAndDestroy(*msg);
+				}
+			}
+
+		// (3)(c) Have been sent:
+		OutgoingSent().RemoveAndDestroy(aSession.Id());
+		
+		// (3)(d) Are pending delivery to this session:
+		TSglQueIter<CRemConMessage>& pendingDeliveryIter = IncomingPendingDelivery().SetToFirst();
+		while ( ( msg = pendingDeliveryIter++ ) != NULL )
+			{
+			if ( msg->SessionId() == aSession.Id() )
+				{
+				// Only responses or rejects are received by controllers
+				ASSERT_DEBUG(msg->MsgType() == ERemConResponse || msg->MsgType() == ERemConReject);
+				IncomingPendingDelivery().RemoveAndDestroy(*msg);
+				}
+			}
+
+		// (3)(e) Have been delivered to this session and are awaiting responses:
+		TSglQueIter<CRemConMessage>& deliveredIter = IncomingDelivered().SetToFirst();
+		while ( ( msg = deliveredIter++ ) != NULL )
+			{
+			if ( msg->SessionId() == aSession.Id() )
+				{
+				// Only responses or rejects are received by controllers
+				ASSERT_DEBUG(msg->MsgType() == ERemConResponse || msg->MsgType() == ERemConReject);
+				IncomingDelivered().RemoveAndDestroy(*msg);
+				}
+			}
+		}
+
+	// Also remove its record from the connection history record.
+	RemoveSessionFromConnHistory(aSession);
+	
+	StartShutdownTimerIfNoClientsOrBulkThread();
+
+	LOGCONTROLLERSESSIONS;
+	}
+
+/**
+Called by CRemConTargetClientProcess when a session is closing.
+We have some work to do here as we need to remove the messages pertaining to
+that session.
+**/
+void CRemConServer::TargetSessionClosed(CRemConTargetClientProcess& aClient, CRemConTargetSession& aSession)
+	{
+	LOG_FUNC;
+	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
+	LOGTARGETSESSIONS;
+	
+	iTargetClientsLock.Wait();
+
+	// Find the client in our array (required for later removal)
+	TInt clientIndex = iTargetClients.Find(aClient.ClientInfo().ProcessId(), TargetClientCompareUsingProcessId);
+
+	// We should always find the client.
+	ASSERT_DEBUG(clientIndex > KErrNotFound);
+
+	// 1. Remove queued messages belonging to this session that:
+	// (a) are outgoing, awaiting access to the TSP 
+	// (OutgoingRspPendingTsp)
+	// (b) are outgoing, awaiting a bearer connection 
+	// (OutgoingPendingSend), 
+	// (c) have been sent (OutgoingSent)
+	// (d) are pending delivery to this session 
+	// (IncomingPendingDelivery)
+	// (e) have been delivered to this session and are awaiting 
+	// responses (IncomingDelivered).
+		
+	// (1)(a) Outgoing, awaiting access to the TSP
+	// First remove the client pertaining to this session from the message recipients list.
+	ASSERT_DEBUG(iMessageRecipientsList);
+	TSglQueIter<CMessageRecipients>& messageRecipientsIter = iMessageRecipientsList->Iter();
+	
+	messageRecipientsIter.SetToFirst();
+	CMessageRecipients* message;
+	while ((message = messageRecipientsIter++) != NULL)
+		{
+		// First we need to find the message - it could be in
+		// OutgoingRspPendingTsp, IncomingDelivered or IncomingPendingDelivery
+		CRemConMessage* msg;
+		msg = OutgoingRspPendingTsp().Message(message->TransactionId());
+			
+		if (!msg)
+			{
+			msg = IncomingDelivered().Message(message->TransactionId());
+			}
+		if (!msg)
+			{
+			msg = IncomingPendingDelivery().Message(message->TransactionId());
+			}
+			
+		if(msg)
+			{
+			// Try to remove this client from the message (this does nothing if we were not a recipient).
+			message->RemoveAndDestroyClient(aSession.ClientInfo());
+			if (message->Clients().IsEmpty())
+				{
+				iMessageRecipientsList->Messages().Remove(*message);
+				// Inform bearer that it won't be getting a response
+				SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
+
+				delete message;
+				}
+			}
+		}
+
+	TSglQueIter<CRemConMessage>& rspIter = OutgoingRspPendingTsp().SetToFirst();
+	CRemConMessage* msg;
+	TBool first = ETrue;
+	while ( ( msg = rspIter++ ) != NULL )
+		{
+		if ( aClient.Id() == msg->SessionId() && aSession.SupportedMessage(*msg) )
+			{
+			// If the message is currently being worked on by the 
+			// TSP, cancel the TSP before destroying it.
+			if (iTspIf2 && iTspHandlingOutgoingResponse && first )
+				{
+				iTspIf2->CancelOutgoingResponse();
+				iTspHandlingOutgoingResponse = EFalse;
+				}
+			OutgoingRspPendingTsp().RemoveAndDestroy(*msg);
+			}
+		first = EFalse;
+		}
+
+	// (1)(b) Outgoing, awaiting a bearer connection:
+	TSglQueIter<CRemConMessage>& sendIter = OutgoingPendingSend().SetToFirst();
+	while ( ( msg = sendIter++ ) != NULL )
+		{
+		if ( aClient.Id() == msg->SessionId() && aSession.SupportedMessage(*msg) )
+			{
+			if (msg->MsgType() == ERemConResponse)
+				{
+				SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
+				}
+			OutgoingPendingSend().RemoveAndDestroy(*msg);
+			}
+		}
+
+	// (1)(c) Have been sent:
+	TSglQueIter<CRemConMessage>& haveSentIter = OutgoingSent().SetToFirst();
+	while ( ( msg = haveSentIter++ ) != NULL)
+		{
+		if ( aClient.Id() == msg->SessionId() && aSession.SupportedMessage(*msg) )
+			{
+			OutgoingSent().RemoveAndDestroy(*msg);
+			}
+		}
+	
+	// (1)(d) Are pending delivery to this session:
+	TSglQueIter<CRemConMessage>& pendingDeliveryIter = IncomingPendingDelivery().SetToFirst();
+	while ( ( msg = pendingDeliveryIter++ ) != NULL )
+		{
+		if ( aClient.Id() == msg->SessionId() && aSession.SupportedMessage(*msg) )
+			{
+			if (msg->MsgType() == ERemConNotifyCommand)
+				{
+				SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
+				}
+			IncomingPendingDelivery().RemoveAndDestroy(*msg);
+			}
+		}
+
+	// (1)(e) Have been delivered to this session and are awaiting responses:
+	TSglQueIter<CRemConMessage>& deliveredIter = IncomingDelivered().SetToFirst();
+	while ( ( msg = deliveredIter++ ) != NULL )
+		{
+		if ( aClient.Id() == msg->SessionId() && aSession.SupportedMessage(*msg) )
+			{
+			if (msg->MsgType() == ERemConNotifyCommand)
+				{
+				SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
+				}
+			IncomingDelivered().RemoveAndDestroy(*msg);
+			}
+		}
+
+	// Remove the session's record from the connection history record.
+	RemoveSessionFromConnHistory(aSession);
+
+	// Finally, try to delete client process representation if it now has no sessions
+	TryToDropClientProcess(clientIndex);
+
+	iTargetClientsLock.Signal();
+	
+	LOGTARGETSESSIONS;
+	}
+
+void CRemConServer::RemoveSessionFromConnHistory(const CRemConSession& aSession)
+	{
+	LOG_FUNC;
+
+	const TUint count = iSession2ConnHistory.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		if ( iSession2ConnHistory[ii].iSessionId == aSession.Id() )
+			{
+			iSession2ConnHistory.Remove(ii);
+			UpdateConnectionHistoryAndPointers();
+			break;
+			}
+		}
+	}
+
+// called by client process representation on close.
+void CRemConServer::TargetClientClosed(CRemConTargetClientProcess& aClient)
+	{
+	LOG_FUNC;
+	LOG1(_L("\t&aClient = 0x%08x"), &aClient);
+	LOGTARGETSESSIONS;
+
+	iTargetClientsLock.Wait();
+	// Find this client in the array and remove it (if it's there).
+	const TUint clientCount = iTargetClients.Count();
+	for ( TUint ii = 0 ; ii < clientCount ; ++ii )
+		{
+		if ( iTargetClients[ii] == &aClient )
+			{
+			// We've found the client in our array.
+
+			// 1. Remove the client from our array.
+			iTargetClients.Remove(ii);
+
+			// 2a. Tell the TSP the client has gone away 
+			if(iTspIf5)
+				{
+				iTspIf5->TargetClientUnavailable(aClient.ClientInfo());
+				}
+			
+			// 2b. Tell the bearers about the client going away, if it was the 
+			// last target.
+			// If the client hasn't already set its type, then it doesn't 
+			// count (we won't have told the bearers about it to begin with).
+			// The bearer manager maintains controller and target counts for all bearers
+			// and will tell bearers when they need to know things have changed 
+			if (aClient.ClientAvailable())
+				{
+				ASSERT_DEBUG(iBearerManager);
+				iBearerManager->ClientClosed(EFalse, KNullUid, aClient.Id());
+				}
+					
+			break;
+			} // End found session in our array
+		}
+	iTargetClientsLock.Signal();
+
+	StartShutdownTimerIfNoClientsOrBulkThread();
+
+	LOGTARGETSESSIONS;
+	}
+
+#ifdef __FLOG_ACTIVE
+
+void CRemConServer::LogControllerSessions() const 
+	{
+	const TUint count = iControllerSessions.Count();
+	LOG1(_L("\tNumber of controller sessions = %d"), count);
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConSession* const session = iControllerSessions[ii];
+		ASSERT_DEBUG(session);
+		LOG4(_L("\t\tsession %d [0x%08x], Id = %d, ProcessId = %d"), 
+			ii, 
+			session,
+			session->Id(),
+			static_cast<TUint>(session->ClientInfo().ProcessId())
+			);
+		}
+	}
+
+void CRemConServer::LogTargetSessions() const 
+	{
+	iTargetClientsLock.Wait();
+	
+	const TUint count = iTargetClients.Count();
+	LOG1(_L("\tNumber of target clients = %d"), count);
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConTargetClientProcess* const client = iTargetClients[ii];
+		ASSERT_DEBUG(client);
+		LOG5(_L("\t\tclient %d [0x%08x], Id = %d, ProcessId = %d, SessionCount = %d"), 
+			ii, 
+			client,
+			client->Id(),
+			static_cast<TUint>(client->ClientInfo().ProcessId()),
+			client->TargetSessionCount()
+			);
+		}
+	iTargetClientsLock.Signal();
+	}
+
+void CRemConServer::LogRemotes() const
+	{
+	// Called from dtor- this may not have been made yet.
+	if ( iConnectionHistory )
+		{
+		CConnections& conns = iConnectionHistory->Last();
+		conns.LogConnections();
+		}
+	}
+
+void CRemConServer::LogConnectionHistoryAndInterest() const
+	{
+	LOG(_L("Logging connection history and interest in it"));
+	if ( iConnectionHistory )
+		{
+		iConnectionHistory->LogConnectionHistory();
+
+		const TUint count = iSession2ConnHistory.Count();
+		LOG1(_L("\tNumber of sessions = %d"), count);
+		for ( TUint ii = 0 ; ii < count ; ++ii )
+			{
+			const TSessionPointerToConnectionHistory& interest = iSession2ConnHistory[ii];
+			LOG3(_L("\t\tinterest %d, iSessionId = %d, iIndex = %d"), 
+				ii, 
+				interest.iSessionId,
+				interest.iIndex
+				);
+			}
+		}
+	}
+#endif // __FLOG_ACTIVE
+
+void CRemConServer::MrctspoDoOutgoingNotifyCommandAddressed(TRemConAddress* aConnection, TInt aError)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taError = %d"), aError);
+	LOGOUTGOINGNOTIFYCMDPENDINGTSP;
+	LOGOUTGOINGPENDINGSEND;
+	LOGOUTGOINGSENT;
+
+	ASSERT_DEBUG(iTspHandlingOutgoingNotifyCommand);
+	iTspHandlingOutgoingNotifyCommand = EFalse;
+
+	CRemConMessage& msg = OutgoingNotifyCmdPendingTsp().First();
+	ASSERT_DEBUG(msg.Addr().IsNull());
+	MRemConMessageSendObserver* const observer = ControllerSession(msg.SessionId());
+	// Session closure removes messages from the outgoing queue and cancels 
+	// the TSP request if relevant. If observer is NULL here, then this processing 
+	// has gone wrong.
+	ASSERT_DEBUG(observer);
+	
+	if ( (aError != KErrNone) || !aConnection)
+		{
+		observer->MrcmsoMessageSendResult(msg, aError);
+		}
+	else
+		{
+		// Message addressed OK.
+		if ( aConnection != NULL )
+			{
+			TBool sync = EFalse;
+			TRAPD(err, SendCmdToRemoteL(msg, *aConnection, sync));
+			if ( err || sync )
+				{
+				observer->MrcmsoMessageSendResult(msg, err);
+				}
+			
+			delete aConnection;
+			aConnection = NULL;
+			}
+		} 
+
+	// We've now finished with the addressed message, so destroy it.
+	OutgoingNotifyCmdPendingTsp().RemoveAndDestroy(msg);
+
+	// Check for more notify commands to address.
+	if ( !OutgoingNotifyCmdPendingTsp().IsEmpty() )
+		{
+		LOG(_L8("\tmore outgoing notify commands awaiting TSP..."));
+		TspOutgoingNotifyCommand();
+		}
+
+	LOGOUTGOINGNOTIFYCMDPENDINGTSP;
+	LOGOUTGOINGPENDINGSEND;
+	LOGOUTGOINGSENT;
+	}
+
+void CRemConServer::MrctspoDoOutgoingCommandAddressed(TInt aError)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taError = %d"), aError);
+	LOGOUTGOINGCMDPENDINGTSP;
+	LOGOUTGOINGPENDINGSEND;
+	LOGOUTGOINGSENT;
+
+	ASSERT_DEBUG(iTspHandlingOutgoingCommand);
+	iTspHandlingOutgoingCommand = EFalse;
+
+	// If aError is KErrNone,
+	// Remove the addressed message from the iOutgoingPendingTsp queue.
+	// Send the command to the requested bearer(s), putting items on the 
+	// iOutgoingSent queue to await responses
+	// Complete the controller client's message. 
+
+	// Any error at any point during the above should roll back everything 
+	// (apart from removing the original message from iOutgoingPendingTsp) 
+	// and error the sending controller.
+	
+	// Finally, check iOutgoingPendingTsp for more commands to give to 
+	// the TSP.
+
+	// The head item, currently being dealt with, is always at index 0.
+	// NB This msg will be destroyed by the end of the function, and copies 
+	// taken to add to iOutgoingSent. 
+	// Note that if the client went away while the address request was 
+	// outstanding, this item will still be on this queue because we protect 
+	// it (see ClientClosed).
+	CRemConMessage& msg = OutgoingCmdPendingTsp().First();
+	// Check that the message isn't addressed already. If this fails, it's 
+	// possible that the TSP has called OutgoingCommandAddressed in response 
+	// to a PermitOutgoingCommand request.
+	ASSERT_DEBUG(msg.Addr().IsNull());
+	// The observer is the session which generated the message.
+	MRemConMessageSendObserver* const observer = ControllerSession(msg.SessionId());
+	// Session closure removes messages from the outgoing queue and cancels 
+	// the TSP request if relevant. If observer is NULL here, then this processing 
+	// has gone wrong.
+	ASSERT_DEBUG(observer);
+
+	TInt numRemotesToTry = 0;
+
+	if ( aError != KErrNone )
+		{
+		// Error prevented message send attempt from being made.
+		observer->MrcmsoMessageSendOneOrMoreAttemptFailed(msg, aError);
+		}
+	else
+		{
+		// Message addressed OK.
+		// Work out how many remotes the TSP said to send to.
+		TSglQueIter<TRemConAddress> iter(iTspConnections);
+		while ( iter++ )
+			{
+			++numRemotesToTry;
+			}
+		// Notify session of send attempt.
+		observer->MrcmsoMessageSendOneOrMoreAttempt(msg, numRemotesToTry);
+		iter.SetToFirst();
+		// Try to connect and send a message to each specified remote.
+		TRemConAddress* conn;
+		while ( ( conn = iter++ ) != NULL )
+			{
+			LOG2(_L("\tsending message to remote [0x%08x] BearerUid = 0x%08x"), 
+				conn, conn->BearerUid());
+
+			// We send to as many of the remotes as we can. The observer remembers 
+			// how many remotes got sent to successfully, and completes the 
+			// client's request with either KErrNone or _one of_ the 
+			// errors that were raised. 
+			TBool sync = EFalse;
+			TRAPD(err, SendCmdToRemoteL(msg, *conn, sync));
+			if ( err || sync )
+				{
+				// We have finished trying to process this (copy of this) 
+				// message, so we can adjust our 'remotes' counter / 
+				// completion error.
+				observer->MrcmsoMessageSendOneOrMoreResult(msg, err);
+				}
+			// else we didn't actually make a send attempt because conn was 
+			// down. This particular message will undergo an actual 
+			// (bearer-level) send attempt later on when the connection comes 
+			// up. For now, however, we cannot legally complete the client's 
+			// request.
+
+			iTspConnections.Remove(*conn);
+			delete conn;
+			} // End while 
+		} // End if TSP addressed command OK
+
+	// We've now finished with the addressed message, so destroy it.
+	OutgoingCmdPendingTsp().RemoveAndDestroy(msg);
+
+	// Check for more commands to address.
+	if ( !OutgoingCmdPendingTsp().IsEmpty() )
+		{
+		LOG(_L("\tmore outgoing commands awaiting TSP..."));
+		TspOutgoingCommand();
+		}
+
+	LOGOUTGOINGCMDPENDINGTSP;
+	LOGOUTGOINGPENDINGSEND;
+	LOGOUTGOINGSENT;
+	}
+
+void CRemConServer::MrctspoDoOutgoingCommandPermitted(TBool aIsPermitted)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taIsPermitted = %d"), aIsPermitted);
+	LOGOUTGOINGCMDPENDINGTSP;
+	LOGOUTGOINGPENDINGSEND;
+	LOGOUTGOINGSENT;
+
+	ASSERT_DEBUG(iTspHandlingOutgoingCommand);
+	iTspHandlingOutgoingCommand = EFalse;
+
+	// If aIsPermitted is EFalse, complete the sending session with 
+	// KErrPermissionDenied and destroy the message. Otherwise try to send the 
+	// message and complete the sending session. If it sent OK, move the 
+	// message to the 'outgoing sent' queue.
+	// At the end, check the 'pending TSP' queue again.
+	// The head item, currently being dealt with, is always at index 0.
+	// Note that if the client went away while the address request was 
+	// outstanding, this item will still be on this queue because we protect 
+	// it (see ClientClosed).
+	CRemConMessage& msg = OutgoingCmdPendingTsp().First();
+	// Check that the message is addressed already. If this fails, it's 
+	// possible that the TSP has called OutgoingCommandPermitted in response 
+	// to a AddressOutgoingCommand request.
+	ASSERT_DEBUG(!msg.Addr().IsNull());
+	// The session is the observer
+	MRemConMessageSendObserver* const observer = ControllerSession(msg.SessionId());
+	// Session closure removes messages from the outgoing queue and cancels 
+	// the TSP request if relevant. If observer is NULL here, then this processing 
+	// has gone wrong.
+	ASSERT_DEBUG(observer);
+	TInt err = KErrPermissionDenied;
+	if ( aIsPermitted )
+		{
+		TBool sync = EFalse;
+		TRAP(err, SendCmdToRemoteL(msg, msg.Addr(), sync));
+		if ( err || sync )
+			{
+			// We made a send attempt at the bearer level, notify observer.
+			observer->MrcmsoMessageSendOneOrMoreResult(msg, err);
+			}
+		// else the message is waiting until a bearer-level connection 
+		// comes up. Only then can we complete the client's message.
+		}
+	else
+		{
+		// The send wasn't permitted, notify observer.
+		// This should complete the client's message, as we're connection oriented
+		// (so only one remote to send to).
+		observer->MrcmsoMessageSendOneOrMoreResult(msg, KErrPermissionDenied);
+		}
+
+	// We've now finished with the message, so destroy it.
+	OutgoingCmdPendingTsp().RemoveAndDestroy(msg);
+
+	// Check for more commands to give to the TSP.
+	if ( !OutgoingCmdPendingTsp().IsEmpty() )
+		{
+		LOG(_L("\tmore outgoing commands awaiting TSP..."));
+		TspOutgoingCommand();
+		}
+
+	LOGOUTGOINGCMDPENDINGTSP;
+	LOGOUTGOINGPENDINGSEND;
+	LOGOUTGOINGSENT;
+	}
+
+void CRemConServer::MrctspoDoOutgoingNotifyCommandPermitted(TBool aIsPermitted)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taIsPermitted = %d"), aIsPermitted);
+	LOGOUTGOINGCMDPENDINGTSP;
+	LOGOUTGOINGPENDINGSEND;
+	LOGOUTGOINGSENT;
+
+	ASSERT_DEBUG(iTspHandlingOutgoingNotifyCommand);
+	iTspHandlingOutgoingNotifyCommand = EFalse;
+
+	// If aIsPermitted is EFalse, complete the sending session with 
+	// KErrPermissionDenied and destroy the message. Otherwise try to send the 
+	// message and complete the sending session. If it sent OK, move the 
+	// message to the 'outgoing sent' queue.
+	// At the end, check the 'pending TSP' queue again.
+	// The head item, currently being dealt with, is always at index 0.
+	// Note that if the client went away while the address request was 
+	// outstanding, this item will still be on this queue because we protect 
+	// it (see ClientClosed).
+	CRemConMessage& msg = OutgoingNotifyCmdPendingTsp().First();
+	// Check that the message is addressed already. If this fails, it's 
+	// possible that the TSP has called OutgoingCommandPermitted in response 
+	// to a AddressOutgoingCommand request.
+	ASSERT_DEBUG(!msg.Addr().IsNull());
+	MRemConMessageSendObserver* const observer = ControllerSession(msg.SessionId());
+	// Session closure removes messages from the outgoing queue and cancels 
+	// the TSP request if relevant. If observer is NULL here, then this processing 
+	// has gone wrong.
+	ASSERT_DEBUG(observer);
+	TInt err = KErrPermissionDenied;
+	if ( aIsPermitted )
+		{
+		TBool sync = EFalse;
+		TRAP(err, SendCmdToRemoteL(msg, msg.Addr(), sync));
+		if ( err || sync )
+			{
+			observer->MrcmsoMessageSendResult(msg, err);
+			}
+		// else the message is waiting until a bearer-level connection 
+		// comes up. Only then can we complete the client's message.
+		}
+	else
+		{
+		observer->MrcmsoMessageSendResult(msg, KErrPermissionDenied);
+		}
+
+	// We've now finished with the message, so destroy it.
+	OutgoingNotifyCmdPendingTsp().RemoveAndDestroy(msg);
+
+	// Check for more commands to give to the TSP.
+	if ( !OutgoingNotifyCmdPendingTsp().IsEmpty() )
+		{
+		LOG(_L("\tmore outgoing commands awaiting TSP..."));
+		TspOutgoingNotifyCommand();
+		}
+
+	LOGOUTGOINGCMDPENDINGTSP;
+	LOGOUTGOINGPENDINGSEND;
+	LOGOUTGOINGSENT;
+	}
+
+void CRemConServer::MrctspoDoOutgoingResponsePermitted(TBool aIsPermitted)
+	{
+	LOG_FUNC;
+	LOGOUTGOINGRSPPENDINGTSP;
+	ASSERT_DEBUG(iTspHandlingOutgoingResponse);
+	iTspHandlingOutgoingResponse = EFalse;
+	ASSERT_DEBUG(iOutgoingRspPendingTsp);
+	CRemConMessage& msg = iOutgoingRspPendingTsp->First();
+	
+	iOutgoingRspPendingTsp->Remove(msg);
+	
+	CRemConTargetClientProcess* const client = TargetClient(msg.SessionId());
+	// Session closure removes messages from the outgoing queue and cancels 
+	// the TSP request if relevant. If client is NULL here, then this processing 
+	// has gone wrong.
+	ASSERT_DEBUG(client);
+
+	if (aIsPermitted)
+		{
+		ASSERT_DEBUG(iMessageRecipientsList);
+		iMessageRecipientsList->RemoveAndDestroyMessage(msg.TransactionId());
+		CompleteSendResponse(msg, *client); // Ownership of msg is always taken
+		}
+	else
+		{
+		CMessageRecipients* messageClients = iMessageRecipientsList->Message(msg.TransactionId());
+		if (messageClients)
+			{
+			messageClients->RemoveAndDestroyClient(client->ClientInfo()); // Remove the current client info from the list
+			if (messageClients->Clients().IsEmpty())
+				{
+				iMessageRecipientsList->RemoveAndDestroyMessage(msg.TransactionId());
+				// The bearer won't be getting a response
+				
+				SendReject(msg.Addr(), msg.InterfaceUid(), msg.OperationId(), msg.TransactionId());
+				}
+			}
+
+		// Notify client that a send attempt to a remote was abandoned.
+		client->MrcmsoMessageSendOneOrMoreAbandoned(msg);
+		delete &msg;
+		}
+	if (!iOutgoingRspPendingTsp->IsEmpty())
+		{
+		PermitOutgoingResponse();
+		}
+	LOGOUTGOINGRSPPENDINGTSP;
+	}
+
+void CRemConServer::MrctspoDoIncomingNotifyAddressed(TClientInfo* aClientInfo, TInt aError)
+	{
+	LOG_FUNC;
+	LOG(KNullDesC8());
+	LOG1(_L("\taError = %d"), aError);
+	LOGINCOMINGNOTIFYCMDPENDINGADDRESS;
+	LOGINCOMINGNOTIFYCMDPENDINGREADDRESS;
+	LOGINCOMINGDELIVERED;
+
+	// Send the command to the requested target client, and remove the 
+	// addressed message from the iIncomingNotifyCmdPendingAddress queue. Any error at 
+	// any point should be ignored- just complete as much as we can. 
+	// Then check iIncomingPendingAddress for more commands to give to the 
+	// TSP. 
+
+	ASSERT_DEBUG(iTspAddressingIncomingNotifyCommand || iTspReAddressingIncomingNotifyCommands);
+	
+	if (iTspAddressingIncomingNotifyCommand)
+		{
+		iTspAddressingIncomingNotifyCommand = EFalse;
+		if (!iTspDropIncomingNotifyCommand)
+			{
+			// We know that the queue is not empty because we put something on the 
+			// queue to call AddressIncomingNotifyCommand, which results in one call to this 
+			// function, which is the only place where messages are removed from the 
+			// queue.
+			CRemConMessage& msg = IncomingNotifyCmdPendingAddress().First();
+			TBool cmdDelivered = EFalse;
+		
+			// If the TSP errored, can't complete to any clients.
+			if ( aError == KErrNone && aClientInfo)
+				{
+				LOG1(_L("\t\tprocess ID %d"), static_cast<TUint>(aClientInfo->ProcessId()));
+				// Get the corresponding client.
+				CRemConTargetClientProcess* const client = TargetClient(aClientInfo->ProcessId());
+				// NB The set of open clients may have changed while the request 
+				// was out on the TSP. If the TSP indicates a client that has 
+				// gone away, then ignore that client. 
+				if ( client )
+					{
+					TRAPD(err, DeliverCmdToClientL(msg, *client));
+					if (err == KErrNone)
+						{
+						cmdDelivered = ETrue;
+						}
+					// If we couldn't deliver an instance of the command to a 
+					// target, there's not much we can do. 
+					}
+				}
+			
+			if (!cmdDelivered)
+				{
+				// The command wasn't delivered to any clients
+				
+				// The command wasn't delivered to any clients
+				// Tell bearer it won't be getting a response		
+		
+				SendReject(msg.Addr(), msg.InterfaceUid(), msg.OperationId(), msg.TransactionId());
+				}
+
+			
+			// Destroy the message we've just dealt with.
+			IncomingNotifyCmdPendingAddress().RemoveAndDestroy(msg);
+			}
+		iTspDropIncomingNotifyCommand = EFalse;
+		if ( !IncomingNotifyCmdPendingAddress().IsEmpty() )
+			{
+			LOG(_L("\tmore incoming commands awaiting addressing..."));
+			AddressIncomingNotifyCommand();
+			}
+		}
+	else
+		{
+		if (!iTspDropIncomingNotifyCommand)
+			{
+			CRemConMessage& msg = IncomingNotifyCmdPendingReAddress().First();
+			if(aError == KErrNone && aClientInfo)
+				{
+				LOG1(_L("\t\tprocess ID %d"), static_cast<TUint>(aClientInfo->ProcessId()));
+				// Get the corresponding client.
+				CRemConTargetClientProcess* const client = TargetClient(aClientInfo->ProcessId());
+				if (client)
+					{
+					if (client->Id() == msg.SessionId())
+						{
+						// Don't do anything - it's already on IncomingDelivered
+						}
+					else
+						{
+						// Remove the original message from IncomingDelivered
+						CRemConMessage* deliveredMsg = NULL;
+						TSglQueIter<CRemConMessage> iter = IncomingDelivered().SetToFirst();
+						while ((deliveredMsg = iter++) != NULL)
+							{
+							if (deliveredMsg->TransactionId() == msg.TransactionId())
+								{
+								// We need to update the subtype now, in case the client has sent an interim response while the notify
+								// was being readdressed.
+								msg.MsgSubType() = deliveredMsg->MsgSubType();
+								// Deliver to the client
+								TRAPD(err, DeliverCmdToClientL(msg, *client));
+								if (err == KErrNone)
+									{
+									// Only remove the current message if the delivery to the new client suceeded.
+									IncomingDelivered().RemoveAndDestroy(*deliveredMsg);
+									}
+								break;
+								}
+							}
+						}
+					}
+				else
+					{
+					SendReject(msg.Addr(), msg.InterfaceUid(), msg.OperationId(), msg.TransactionId());
+					}
+				}
+			IncomingNotifyCmdPendingReAddress().RemoveAndDestroy(msg);
+			}
+			
+		iTspDropIncomingNotifyCommand = EFalse;
+	
+		if ( !IncomingNotifyCmdPendingReAddress().IsEmpty() )
+			{
+			LOG(_L("\tmore incoming commands awaiting readdressing..."));
+			ReAddressIncomingNotifyCommand();
+			}
+		else
+			{
+			iTspReAddressingIncomingNotifyCommands = EFalse;
+			if ( !IncomingNotifyCmdPendingAddress().IsEmpty() )
+				{
+				LOG(_L("\tmore incoming commands awaiting addressing..."));
+				AddressIncomingNotifyCommand();
+				}
+			}
+		}
+	LOGINCOMINGNOTIFYCMDPENDINGADDRESS;
+	LOGINCOMINGNOTIFYCMDPENDINGREADDRESS;
+	LOGINCOMINGDELIVERED;
+	}
+
+void CRemConServer::MrctspoDoReAddressNotifies()
+	{
+	LOG_FUNC;
+	LOGINCOMINGNOTIFYCMDPENDINGREADDRESS;
+	LOGINCOMINGDELIVERED;
+	ASSERT_DEBUG(iTspReAddressingIncomingNotifyCommands == EFalse && iTspAddressingIncomingNotifyCommand == EFalse);
+	TSglQueIter<CRemConMessage> iter = IncomingDelivered().SetToFirst();
+	CRemConMessage* deliveredMsg;
+	while ((deliveredMsg = iter++) != NULL)
+		{
+		if (deliveredMsg->MsgType() == ERemConNotifyCommand)
+			{
+			CRemConMessage* newMsg = NULL;
+			TRAPD(err, newMsg = CRemConMessage::CopyL(*deliveredMsg));
+			if (err == KErrNone)
+				{
+				IncomingNotifyCmdPendingReAddress().Append(*newMsg);
+				}
+			// If we couldn't copy the message, there isn't much we can do now.
+			}
+		}
+	if (!IncomingNotifyCmdPendingReAddress().IsEmpty())
+		{
+		iTspReAddressingIncomingNotifyCommands = ETrue;
+		ReAddressIncomingNotifyCommand();
+		}
+	LOGINCOMINGNOTIFYCMDPENDINGREADDRESS;
+	}
+
+void CRemConServer::MrctspoDoIncomingCommandPermitted(TBool aIsPermitted)
+	{
+	LOG_FUNC;
+	
+	MrctspoDoIncomingCommandAddressed(aIsPermitted ? KErrNone : KErrAccessDenied);
+	}
+
+void CRemConServer::MrctspoDoIncomingNotifyPermitted(TBool aIsPermitted)
+	{
+	LOG_FUNC;
+	
+	if(aIsPermitted)
+		{
+		TClientInfo* clientInfo = TargetClientIdToClientInfo(IncomingNotifyCmdPendingAddress().First().Client());
+		MrctspoDoIncomingNotifyAddressed(clientInfo, KErrNone);
+		}
+	else
+		{
+		MrctspoDoIncomingNotifyAddressed(NULL, KErrAccessDenied);
+		}
+	}
+
+void CRemConServer::TspOutgoingCommand()
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(iTspIf);
+	ASSERT_DEBUG(iTspHandlingOutgoingCommand == EFalse);
+	// For TSPs which complete this request synchronously this will become 
+	// recursive, but the depth is not expected to be great (== number of 
+	// messages awaiting access to the TSP).
+
+	// Work out whether the next command to deal with is awaiting (a) 
+	// addressing or (b) permission.
+	// The head item is at index 0. This function should only be called if the 
+	// queue is not empty.
+	CRemConMessage& msg = OutgoingCmdPendingTsp().First();
+	CRemConControllerSession* const sess = ControllerSession(msg.SessionId());
+	// The session should exist- if it closed after asking to send this 
+	// message, then the message should have been removed from the outgoing 
+	// pending TSP queue at that time.
+	ASSERT_DEBUG(sess);
+	iTspHandlingOutgoingCommand = ETrue;
+	if ( msg.Addr().IsNull() )
+		{
+		// Null address means it's awaiting an address.
+		// Check the array of outgoing addresses is ready for this new request 
+		// on the TSP.
+		ASSERT_DEBUG(iTspConnections.IsEmpty());
+		ASSERT_DEBUG(iBearerManager);
+		iTspIf->AddressOutgoingCommand(
+				msg.InterfaceUid(),
+				msg.OperationId(), 
+				sess->ClientInfo(),
+				iTspConnections,
+				iBearerManager->BearerSecurityPolicies());	
+		}
+	else
+		{
+		// Non-null address means it's awaiting permission to send.
+		sess->MrcmsoMessageSendOneOrMoreAttempt(msg, 1);
+		iTspIf->PermitOutgoingCommand(
+			msg.InterfaceUid(),
+			msg.OperationId(), 
+			sess->ClientInfo(),
+			msg.Addr());
+		}
+	}
+
+void CRemConServer::TspOutgoingNotifyCommand()
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(iTspIf3);
+	ASSERT_DEBUG(iTspHandlingOutgoingNotifyCommand == EFalse);
+	// For TSPs which complete this request synchronously this will become 
+	// recursive, but the depth is not expected to be great (== number of 
+	// messages awaiting access to the TSP).
+
+	// Work out whether the next command to deal with is awaiting (a) 
+	// addressing or (b) permission.
+	// The head item is at index 0. This function should only be called if the 
+	// queue is not empty.
+	CRemConMessage& msg = OutgoingNotifyCmdPendingTsp().First();
+	CRemConControllerSession* const sess = ControllerSession(msg.SessionId());
+	// The session should exist- if it closed after asking to send this 
+	// message, then the message should have been removed from the outgoing 
+	// pending TSP queue at that time.
+	ASSERT_DEBUG(sess);
+	iTspHandlingOutgoingNotifyCommand = ETrue;
+	if ( msg.Addr().IsNull() )
+		{
+		ASSERT_DEBUG(iBearerManager);
+
+		iTspIf3->AddressOutgoingNotify(
+				msg.InterfaceUid(),
+				msg.OperationId(), 
+				sess->ClientInfo(),
+				iBearerManager->BearerSecurityPolicies());
+		}
+	else
+		{
+		// Non-null address means it's awaiting permission to send.
+		// As this is a notify command, we don't need to adjust NumRemotes() or 
+		// NumRemotesToTry() on the session.
+		iTspIf3->PermitOutgoingNotifyCommand(
+			msg.InterfaceUid(),
+			msg.OperationId(), 
+			sess->ClientInfo(),
+			msg.Addr());
+		}
+	}
+
+void CRemConServer::AddressIncomingCommand()
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(iTspIf);
+	ASSERT_DEBUG(iTspAddressingIncomingCommand == EFalse);
+	// For TSPs which complete this request synchronously this will become 
+	// recursive, but the depth is not expected to be great (== number of 
+	// messages awaiting addressing).
+	
+	// There are two possibilities here, either the bearer has already provided
+	// us with an address, in which case we just provide the TSP the command
+	// for information, and to give it the opportunity to reject the command,
+	// or we don't have an address, in which case we ask the TSP for one
+	
+	// This function should only be called if we know this queue is not 
+	// empty.
+	CRemConMessage& msg = IncomingCmdPendingAddress().First();
+	iTspIncomingCmdClients.Reset();
+	iTspAddressingIncomingCommand = ETrue;
+	
+	if(msg.Client() == KNullClientId)
+		{
+		// Prepare the array of target process IDs for the TSP.
+		iTargetClientsLock.Wait();
+		const TUint count = iTargetClients.Count();
+		for ( TUint ii = 0 ; ii < count ; ++ii )
+			{
+			CRemConTargetClientProcess* const client = iTargetClients[ii];
+			ASSERT_DEBUG(client);
+			iTspIncomingCmdClients.AddLast(client->ClientInfo());
+			}
+		iTargetClientsLock.Signal();
+		
+		iTspIf->AddressIncomingCommand(
+			msg.InterfaceUid(),
+			msg.OperationId(),
+			iTspIncomingCmdClients);
+		}
+	else
+		{
+		iTspIncomingCmdClients.AddLast(*TargetClientIdToClientInfo(msg.Client()));
+		ASSERT_DEBUG(iTspIf4);
+		iTspIf4->PermitIncomingCommand(
+			msg.InterfaceUid(),
+			msg.OperationId(),
+			*iTspIncomingCmdClients.First());
+		}
+	}
+
+void CRemConServer::AddressIncomingNotifyCommand()
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(iTspIf2);
+	ASSERT_DEBUG(iTspAddressingIncomingNotifyCommand == EFalse);
+	// For TSPs which complete this request synchronously this will become 
+	// recursive, but the depth is not expected to be great (== number of 
+	// messages awaiting addressing).
+	
+	// There are two possibilities here, either the bearer has already provided
+	// us with an address, in which case we just provide the TSP the command
+	// for information, and to give it the opportunity to reject the command,
+	// or we don't have an address, in which case we ask the TSP for one
+	
+	// This function should only be called if we know this queue is not 
+	// empty
+	CRemConMessage& msg = IncomingNotifyCmdPendingAddress().First();
+	iTspIncomingNotifyCmdClients.Reset();
+	iTspAddressingIncomingNotifyCommand = ETrue;
+	
+	if(!FindDuplicateNotify(msg))
+		{
+		if(msg.Client() == KNullClientId)
+			{
+			// Prepare the array of target process IDs for the TSP.
+			iTargetClientsLock.Wait();
+			const TUint count = iTargetClients.Count();
+			for ( TUint ii = 0 ; ii < count ; ++ii )
+				{
+				CRemConTargetClientProcess* const client = iTargetClients[ii];
+				ASSERT_DEBUG(client);
+				iTspIncomingNotifyCmdClients.AddLast(client->ClientInfo());
+				}
+			iTargetClientsLock.Signal();
+			
+			// Only send the notify to the TSP if there isn't an identical one on either incomingpendingdelivery or incomingdelivered
+			iTspIf2->AddressIncomingNotify(
+					msg.InterfaceUid(),
+					msg.OperationId(),
+					iTspIncomingNotifyCmdClients);
+			}
+		else
+			{
+			iTspIncomingNotifyCmdClients.AddLast(*TargetClientIdToClientInfo(msg.Client()));
+			ASSERT_DEBUG(iTspIf4);
+			iTspIf4->PermitIncomingNotify(
+				msg.InterfaceUid(),
+				msg.OperationId(),
+				*iTspIncomingNotifyCmdClients.First());
+			}
+		}
+	else
+		{
+		// Otherwise, we can call IncomingNotifyAddressed with NULL, and it will be rejected back to the bearer
+		MrctspoDoIncomingNotifyAddressed(NULL, KErrArgument);
+		}
+	}
+
+void CRemConServer::ReAddressIncomingNotifyCommand()
+	{
+	LOG_FUNC;
+	LOGINCOMINGNOTIFYCMDPENDINGREADDRESS;
+	ASSERT_DEBUG(iTspIf2);
+	ASSERT_DEBUG(iTspReAddressingIncomingNotifyCommands);
+	// For TSPs which complete this request synchronously this will become 
+	// recursive, but the depth is not expected to be great (== number of 
+	// messages awaiting addressing).
+	// Prepare the array of target process IDs for the TSP.
+	iTspIncomingNotifyCmdClients.Reset();
+	iTargetClientsLock.Wait();
+	const TUint count = iTargetClients.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConTargetClientProcess* const client = iTargetClients[ii];
+		ASSERT_DEBUG(client);
+		iTspIncomingNotifyCmdClients.AddLast(client->ClientInfo());
+		}
+	iTargetClientsLock.Signal();
+	
+	// This function should only be called if we know this queue is not 
+	// empty.
+	CRemConMessage& msg = IncomingNotifyCmdPendingReAddress().First();
+	iTspIf2->AddressIncomingNotify(
+		msg.InterfaceUid(),
+		msg.OperationId(),
+		iTspIncomingNotifyCmdClients);
+	}
+
+
+void CRemConServer::PermitOutgoingResponse()
+	{
+	LOG_FUNC;
+	LOGOUTGOINGRSPPENDINGTSP;
+	
+	ASSERT_DEBUG(iTspHandlingOutgoingResponse == EFalse);
+	ASSERT_DEBUG(!OutgoingRspPendingTsp().IsEmpty());
+	while (!iTspHandlingOutgoingResponse && !OutgoingRspPendingTsp().IsEmpty())
+		{
+		CRemConMessage& msg = OutgoingRspPendingTsp().First();
+		CRemConTargetClientProcess* client = TargetClient(msg.SessionId());
+		// The client should exist- if it closed after asking to send this 
+		// message, then the message should have been removed from the outgoing 
+		// pending TSP queue at that time.		
+		ASSERT_DEBUG(client);
+		ASSERT_DEBUG(iMessageRecipientsList);
+		CMessageRecipients* message = iMessageRecipientsList->Message(msg.TransactionId());
+
+		if (message) // If we aren't returned a client list, this means that the message has been delivered elsewhere
+			{
+			iTspHandlingOutgoingResponse = ETrue;
+			if (iTspIf2)
+				{
+				iTspIf2->PermitOutgoingResponse(
+						msg.InterfaceUid(),
+						msg.OperationId(),
+						client->ClientInfo(),
+						message->ConstIter()
+						);
+				}
+			else
+				{
+				OutgoingResponsePermitted(ETrue);
+				}
+			}
+		else
+			{
+			client->MrcmsoMessageSendOneOrMoreAbandoned(msg);
+			OutgoingRspPendingTsp().RemoveAndDestroy(msg);
+			}
+		}
+	LOGOUTGOINGRSPPENDINGTSP;
+	}
+
+void CRemConServer::SendCmdToRemoteL(const CRemConMessage& aMsg, const TRemConAddress& aConn, TBool& aSync)
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(  
+			       (aMsg.MsgType() == ERemConCommand)
+			    || (aMsg.MsgType() == ERemConNotifyCommand)
+			    );
+
+
+	// Populate aSync immediately in case the function leaves.
+	aSync = EFalse;
+	TConnectionState conState = ConnectionState(aConn);
+	if ( conState == EConnected)
+		{
+		aSync = ETrue;
+		}
+
+	// Take a copy of the message and set the right address.
+	CRemConMessage* newMsg = CRemConMessage::CopyL(aMsg);
+	newMsg->Addr() = aConn;
+	CleanupStack::PushL(newMsg);
+	ASSERT_DEBUG(iBearerManager);
+
+	// If we're connected (and not mid-connect/disconnect) we can send immediately,
+	// otherwise we queue and try to bring up the connection.
+	switch ( conState )
+		{
+		case EConnected:
+			{
+			// We have a connection to send over. Try to send it.
+			LEAVEIFERRORL(iBearerManager->Send(*newMsg));
+			// If Send worked, then the bearer has taken ownership of the 
+			// message's data.
+			newMsg->OperationData().Assign(NULL); 
+			CLEANUPSTACK_POP1(newMsg);
+			OutgoingSent().Append(*newMsg); 
+			break;
+			}
+		case EDisconnected:
+			{
+			// No connection. Try to bring one up. If we can't then destroy the 
+			// new message and leave.
+			CLEANUPSTACK_POP1(newMsg);
+			// We need to put the message on the queue before trying to connect 
+			// because the connect confirmation might come back synchronously.
+			OutgoingPendingSend().Append(*newMsg);
+			TInt err = iBearerManager->Connect(newMsg->Addr());
+			if ( err != KErrNone )
+				{
+				OutgoingPendingSend().RemoveAndDestroy(*newMsg);
+				aSync = ETrue;
+				LEAVEIFERRORL(err); // will destroy newMsg
+				}
+			break;
+			}
+		case EConnecting:
+		case EDisconnecting:
+			{
+			// Just queue if connection is coming up or going down.
+			//
+			// If connection is coming up, the message will be
+			// sent when ConnectConfirm fires.
+			//
+			// If connection is going down: When CBearerManager gets
+			// the DisconnectConfirm it calls us back at RemoveConnection,
+			// whereat we will reconnect the bearer that was mid-disconnect;
+			// the message will be sent when that completes.
+			CLEANUPSTACK_POP1(newMsg);
+			OutgoingPendingSend().Append(*newMsg);
+			break;
+			}
+		default:
+			{
+			DEBUG_PANIC_LINENUM;
+			break;
+			}
+		}
+
+	LOG1(_L("\taSync = %d"), aSync);
+	}
+
+void CRemConServer::DeliverCmdToClientL(const CRemConMessage& aMsg, CRemConTargetClientProcess& aClient)
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG((aMsg.MsgType() == ERemConCommand) || (aMsg.MsgType() == ERemConNotifyCommand)); 
+	// Take a copy of the message and set the right client ID (important to 
+	// set the selected client's ID because this is how we match up the 
+	// client's response, if aMsg is a command). 
+	CRemConMessage* const newMsg = CRemConMessage::CopyL(aMsg);
+	newMsg->SessionId() = aClient.Id();
+	LEAVEIFERRORL(DeliverMessageToClient(*newMsg, aClient));
+	}
+
+TInt CRemConServer::DeliverMessageToClient(CRemConMessage& aMsg, CRemConControllerSession& aSess)
+	{
+	LOG_FUNC;
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+
+	// Controller clients only receive responses or rejects
+	ASSERT_DEBUG(aMsg.MsgType() == ERemConResponse || aMsg.MsgType() == ERemConReject);
+
+	TInt err = KErrNone;
+
+	// First off check if the client supports this
+	if(!aSess.SupportedMessage(aMsg))
+		{
+		err = KErrArgument;
+        
+		// 'Take ownership' of it by destroying it- it's finished with.
+		delete &aMsg;
+		}
+	else if ( aSess.CurrentReceiveMessage().Handle() )
+		{
+		err = aSess.WriteMessageToClient (aMsg);
+
+		// 'Take ownership' of it by destroying it- it's finished with.			
+		delete &aMsg;
+		}
+	else
+		{
+		IncomingPendingDelivery().Append(aMsg);
+		}
+	
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+	return err;
+	}
+
+TInt CRemConServer::DeliverMessageToClient(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient)
+	{
+	LOG_FUNC;
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+
+	TInt err = KErrNone;
+
+	// Target clients only receive commands
+	ASSERT_DEBUG(aMsg.MsgType() == ERemConCommand || aMsg.MsgType() == ERemConNotifyCommand);
+
+	// Pass message to client
+	err = aClient.ReceiveMessage(aMsg);
+
+	if (err == KErrArgument)
+		{
+		// Message not supported.
+		// 'Take ownership' of it by destroying it- it's finished with.
+		delete &aMsg;
+		}
+	else if (err == KErrNotReady)
+		{
+		err = KErrNone;
+		// Client cannot receive this message at the moment.
+		IncomingPendingDelivery().Append(aMsg);	
+		}
+	else 
+		{
+		// If the message was delivered with no error, 
+		// then put it in the 'incoming delivered' log. Otherwise, delete it 
+		// because it's finished with.
+		if (err == KErrNone)
+			{
+			// We'll need to remember it for the response coming back.
+			IncomingDelivered().Append(aMsg); 
+			}
+		else
+			{
+			// 'Take ownership' of it by destroying it- it's finished with.
+			delete &aMsg;
+			}
+		}
+	
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+	return err;
+	}
+														  
+void CRemConServer::MrctspoDoIncomingCommandAddressed(TInt aError)
+	{
+	LOG(KNullDesC8());
+	LOG_FUNC;
+	LOG1(_L("\taError = %d"), aError);
+	LOGINCOMINGCMDPENDINGADDRESS;
+	LOGINCOMINGDELIVERED;
+
+	// Send the command to the requested target client(s), and remove the 
+	// addressed message from the iIncomingPendingAddress queue. Any error at 
+	// any point should be ignored- just complete as much as we can. 
+	// Then check iIncomingPendingAddress for more commands to give to the 
+	// TSP. 
+
+	ASSERT_DEBUG(iTspAddressingIncomingCommand);
+	
+	iTspAddressingIncomingCommand = EFalse;
+
+	if (!iTspDropIncomingCommand)
+		{
+		// If we did not call CommandExpired on the first item in the queue,
+		// we know that the queue is not empty because we put something on the 
+		// queue to call AddressIncomingCommand, which results in one call to this 
+		// function, which is the only place where messages are removed from the 
+		// queue.
+		CRemConMessage& msg = IncomingCmdPendingAddress().First();
+		TBool cmdDelivered = EFalse;
+	
+		// If the TSP errored, can't complete to any clients.
+		if ( aError == KErrNone )
+			{
+			TSglQueIter<TClientInfo> iter(iTspIncomingCmdClients);
+			
+			TClientInfo* procId;
+			CMessageRecipients* messageRecipients = NULL;
+			TBool canDeliver = ETrue;
+			TRAPD(err, messageRecipients = CMessageRecipients::NewL());
+			if (err != KErrNone)
+				{
+				// If we didn't manage to create the list of clients we're delivering to,
+				// we shouldn't deliver the message to the clients
+				canDeliver = EFalse;
+				}
+			else
+				{
+				messageRecipients->TransactionId() = msg.TransactionId();
+				}
+			if (canDeliver)
+				{
+				while ( ( procId = iter++ ) != NULL )
+					{
+					LOG1(_L("\t\tprocess ID %d"), static_cast<TUint>(procId->ProcessId()));
+					// Get the corresponding client.
+					CRemConTargetClientProcess* const client = TargetClient(procId->ProcessId());
+					// NB The set of open clients may have changed while the request 
+					// was out on the TSP. If the TSP indicates a client that has 
+					// gone away, then ignore that client. 
+					if ( client )
+						{
+						TInt err = KErrNone;
+						TClientInfo* clientInfo = NULL;
+						TRAP(err, clientInfo = new (ELeave) TClientInfo);
+						if (err == KErrNone)
+							{
+							// If we didn't manage to create the TClientInfo, we shouldn't deliver to the client
+							TRAP(err, DeliverCmdToClientL(msg, *client));
+							}
+						if (err == KErrNone)
+							{
+							cmdDelivered = ETrue;
+							// Add to the delivered information queue
+							clientInfo->ProcessId() = procId->ProcessId();
+							clientInfo->SecureId() = procId->SecureId();
+							messageRecipients->Clients().AddLast(*clientInfo);
+							}
+						else
+							{
+							delete clientInfo;
+							}
+						// If we couldn't deliver an instance of the command to a 
+						// target, there's not much we can do. 
+						}
+					}
+				if ( messageRecipients->Clients().IsEmpty())
+					{
+					delete messageRecipients;
+					}
+				else
+					{
+					ASSERT_DEBUG(iMessageRecipientsList);
+					iMessageRecipientsList->Messages().AddLast (*messageRecipients);
+					}
+				}
+			}
+	
+		if ( !cmdDelivered)
+			{
+			// The command wasn't delivered to any clients
+			// Tell bearer it won't be getting a response		
+			
+			SendReject(msg.Addr(), msg.InterfaceUid(), msg.OperationId(), msg.TransactionId());
+			}
+		// Destroy the message we've just dealt with.
+		IncomingCmdPendingAddress().RemoveAndDestroy(msg);
+		
+		}
+
+	iTspDropIncomingCommand = EFalse;
+	
+	if ( !IncomingCmdPendingAddress().IsEmpty() )
+		{
+		LOG(_L("\tmore incoming commands awaiting addressing..."));
+		AddressIncomingCommand();
+		}
+	
+	LOGINCOMINGCMDPENDINGADDRESS;
+	LOGINCOMINGDELIVERED;
+	}
+
+TInt CRemConServer::MrctspoDoGetConnections(TSglQue<TRemConAddress>& aConnections)
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(aConnections.IsEmpty());
+
+	// Get an owned copy of the current set of connections in the system.
+	CConnections* conns = NULL;
+	TRAPD(err, conns = CConnections::CopyL(Connections()));
+	LOG1(_L("\terr = %d"), err);
+	if ( err == KErrNone )
+		{
+		// Pass these into aConnections, taking ownership of them.
+		TSglQueIter<TRemConAddress>& iter = conns->SetToFirst();
+		TRemConAddress* addr;
+		while ( ( addr = iter++ ) != NULL )
+			{
+			conns->Remove(*addr);
+			aConnections.AddLast(*addr);
+			};
+		delete conns;
+		}
+  
+	return err;
+	}
+
+TInt CRemConServer::MrctspoSetLocalAddressedClient(const TUid& aBearerUid, const TClientInfo& aClientInfo)
+	{
+	LOG_FUNC;
+	
+	TRemConClientId id = KNullClientId;
+	iTargetClientsLock.Wait();
+	const TUint count = iTargetClients.Count();
+	for(TUint i=0; i<count; i++)
+		{
+		CRemConTargetClientProcess* const client = iTargetClients[i];
+		ASSERT_DEBUG(client);
+		if(client->ClientInfo().ProcessId() == aClientInfo.ProcessId())
+			{
+			id = client->Id();
+			break;
+			}
+		}
+	iTargetClientsLock.Signal();
+	
+	if(id != KNullClientId)
+		{
+		ASSERT_DEBUG(iBearerManager);
+		return iBearerManager->SetLocalAddressedClient(aBearerUid, id);
+		}
+	else
+		{
+		return KErrNotFound;
+		}
+	}
+
+void CRemConServer::LoadTspL()
+	{
+	LOG_FUNC;
+
+	// Instantiate one-and-only implementation of the target selector plugin 
+	// interface.
+	const TUid KUidTargetSelectorInterface = TUid::Uid(KRemConTargetSelectorInterfaceUid);
+	RImplInfoPtrArray implementations;
+	const TEComResolverParams noResolverParams;
+	REComSession::ListImplementationsL(KUidTargetSelectorInterface, 
+		noResolverParams, 
+		KRomOnlyResolverUid,
+		implementations);
+	CleanupResetAndDestroyPushL(implementations);
+	LOG1(_L("\tnumber of implementations of target selector plugin interface: %d"), implementations.Count());
+	// We use ASSERT_ALWAYS here because this assumption is a crucial 
+	// licensee-facing one- it's not a case of simply 'run the tests on a 
+	// debug build and fix it if it's broken'.
+	ASSERT_ALWAYS( implementations.Count() == 1 );
+	CImplementationInformation* impl = implementations[0];
+	ASSERT_DEBUG(impl);
+	LOG(_L("\tloading TSP with:"));
+	LOG1(_L("\t\timplementation uid 0x%08x"), impl->ImplementationUid());
+	LOG1(_L("\t\tversion number %d"), impl->Version());
+	TBuf8<KMaxName> buf8;
+	buf8.Copy(impl->DisplayName());
+	LOG1(_L8("\t\tdisplay name \"%S\""), &buf8);
+	LOG1(_L("\t\tROM only %d"), impl->RomOnly());
+	LOG1(_L("\t\tROM based %d"), impl->RomBased());
+	iTsp = CRemConTargetSelectorPlugin::NewL(impl->ImplementationUid(), *this);
+	CleanupStack::PopAndDestroy(&implementations);
+
+	iTspIf = reinterpret_cast<MRemConTargetSelectorPluginInterface*>(
+			iTsp->GetInterface(TUid::Uid(KRemConTargetSelectorInterface1))
+		);
+	
+	iTspIf2 = reinterpret_cast<MRemConTargetSelectorPluginInterfaceV2*>(
+			iTsp->GetInterface(TUid::Uid(KRemConTargetSelectorInterface2))
+		);
+	
+	iTspIf3 = reinterpret_cast<MRemConTargetSelectorPluginInterfaceV3*>(
+			iTsp->GetInterface(TUid::Uid(KRemConTargetSelectorInterface3))
+		);
+	
+	iTspIf4 = reinterpret_cast<MRemConTargetSelectorPluginInterfaceV4*>(
+			iTsp->GetInterface(TUid::Uid(KRemConTargetSelectorInterface4))
+		);
+	
+	iTspIf5 = reinterpret_cast<MRemConTargetSelectorPluginInterfaceV5*>(
+			iTsp->GetInterface(TUid::Uid(KRemConTargetSelectorInterface5))
+		);
+	
+	// If the TSP doesn't implement the required interface, panic server 
+	// startup.
+	ASSERT_ALWAYS(iTspIf);
+	
+	// We always need a V4 interface to allow simpler handling by the 
+	// bearers of bearer addressing so if we don't have a V4 interface
+	// from the TSP itself use a stub object to implement default
+	// behaviour.
+	if(!iTspIf4)
+		{
+		iTspIf4 = &iTspIf4Stub;
+		}
+	}
+
+void CRemConServer::SendCommand(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	
+	if (aMsg.MsgType() == ERemConCommand)
+		{
+		LOGOUTGOINGCMDPENDINGTSP;
+		
+		OutgoingCmdPendingTsp().Append(aMsg);
+		if ( !iTspHandlingOutgoingCommand )
+			{				  
+			TspOutgoingCommand();
+			}
+		
+		LOGOUTGOINGCMDPENDINGTSP;
+		}
+	else
+		{
+		// Check the command is a notify command
+		ASSERT_DEBUG(aMsg.MsgType() == ERemConNotifyCommand);
+		
+		if(iTspIf3)
+			{
+			OutgoingNotifyCmdPendingTsp().Append(aMsg);
+			if ( !iTspHandlingOutgoingNotifyCommand )
+				{				  
+				TspOutgoingNotifyCommand();
+				}
+			}
+		else
+			{
+			CRemConControllerSession* const sess = ControllerSession(aMsg.SessionId());
+			delete &aMsg;
+			ASSERT_DEBUG(sess);
+			sess->SendError() = KErrNotSupported;
+			sess->CompleteSend();
+			}
+		}
+	
+	}
+
+void CRemConServer::SendResponse(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient)
+	{
+	LOG_FUNC;
+	LOGINCOMINGDELIVERED;
+	LOGOUTGOINGRSPPENDINGTSP;
+	LOGOUTGOINGPENDINGSEND;
+
+	CRemConMessage* response = &aMsg;
+	CRemConMessage* newResponse = NULL;
+	
+	// Find the first command ('John') in the iIncomingDelivered queue with 
+	// the same session ID, interface UID and operation ID as the response 
+	// we're sending, and send the response to the same address that John came 
+	// from.
+	TSglQueIter<CRemConMessage>& iter = IncomingDelivered().SetToFirst();
+	CRemConMessage* msg;
+	TBool found = EFalse;
+	
+	while ( ( msg = iter++ ) != NULL )
+		{
+		if (	msg->SessionId() == aClient.Id()
+			&&	msg->InterfaceUid() == response->InterfaceUid()
+			&&	msg->OperationId() == response->OperationId()
+			&&  (
+					(msg->MsgSubType() == ERemConMessageDefault && response->MsgSubType() == ERemConMessageDefault)
+				||  (msg->MsgSubType() == ERemConNotifyCommandAwaitingInterim && response->MsgSubType() == ERemConNotifyResponseInterim)
+				||  (msg->MsgSubType() == ERemConNotifyCommandAwaitingChanged && response->MsgSubType() == ERemConNotifyResponseChanged)
+				)
+			)
+			{
+			LOG1(_L("\tfound a matching item in the incoming delivered commands log: [0x%08x]"), msg);
+			found = ETrue;
+
+			// Set the right address and transaction id in the outgoing message
+			response->Addr() = msg->Addr();
+			response->TransactionId() = msg->TransactionId();
+			
+			if(msg->MsgType() == ERemConCommand)
+				{
+				// Notify client (this shall go to one remote)
+				aClient.MrcmsoMessageSendOneOrMoreAttempt(*response, 1);
+			
+				// Check the normal command and response have the default subtype set
+				ASSERT_DEBUG(msg->MsgSubType() == ERemConMessageDefault && response->MsgSubType() == ERemConMessageDefault);
+
+				// Remove the item from the 'incoming delivered' queue now we've 
+				// addressed a response using it.
+				IncomingDelivered().RemoveAndDestroy(*msg);
+				
+				// At this point we need to ask the TSP if we can deliver the outgoing response,
+				// if there is a TSP supporting the V2 interface. If there isn't, we should just deliver
+				// the message to the bearer
+				OutgoingRspPendingTsp().Append(*response);
+				if (!iTspHandlingOutgoingResponse)
+					{
+					PermitOutgoingResponse();
+					}
+				}
+			else
+				{
+				// Notify client (this may be a series of messages to remotes)
+				aClient.MrcmsoMessageSendOneOrMoreIncremental(*msg, 1);
+
+				// Check the command is a notify command
+				ASSERT_DEBUG(msg->MsgType() == ERemConNotifyCommand);
+				
+				// Check the command has a valid subtype for a notify command
+				ASSERT_DEBUG(msg->MsgSubType() == ERemConNotifyCommandAwaitingInterim || msg->MsgSubType() == ERemConNotifyCommandAwaitingChanged);
+				
+				// Check the response has a valid subtype for a notify response
+				ASSERT_DEBUG(response->MsgSubType() == ERemConNotifyResponseInterim || response->MsgSubType() == ERemConNotifyResponseChanged);
+
+				switch(msg->MsgSubType())
+					{
+				case ERemConNotifyCommandAwaitingChanged:
+					IncomingDelivered().RemoveAndDestroy(*msg);
+					
+					// As this is a changed notification, there could be several notifications outstanding
+					// that should all be completed with this message.
+					// We therefore need to take a copy of the message, but the response should not be
+					// completed back to the client. We therefore set the Session ID of the new meessage to 0
+					
+					TRAPD(err, newResponse = CRemConMessage::CopyL(*response));
+					if (err != KErrNone)
+						{
+						newResponse = NULL;
+						}
+					break;
+				case ERemConNotifyCommandAwaitingInterim:
+					msg->MsgSubType() = ERemConNotifyCommandAwaitingChanged;
+					break;
+					}
+				OutgoingRspPendingSend().Append(*response);
+				response = newResponse;
+				}
+				if (!newResponse)
+					{
+					break;
+					}
+			}
+		}
+	
+	if (newResponse)
+		{
+		delete newResponse;
+		}
+
+
+	TSglQueIter<CRemConMessage>& rspIter = OutgoingRspPendingSend().SetToFirst();
+	while ((msg = rspIter++) != NULL)
+		{
+		OutgoingRspPendingSend().Remove(*msg);
+		CompleteSendResponse(*msg, aClient);
+		}
+
+	
+	// If the command was not found, then the app has sent a response to a
+	// non-existant command.  It may do this in good intention if the server 
+	// has transparently died and been restarted between the app's reception
+	// of the command and it sending its response, so we can't panic it.
+	// Just drop the message.
+	if ( !found )
+		{
+		// Inform client that message should be completed with KErrNone We 
+		// have done all we can with it.  Any other error may encourage 
+		// retries from the application, which would be useless in this situation.
+		aClient.MrcmsoMessageSendOneOrMoreAttemptFailed(aMsg, KErrNone);
+		delete &aMsg;
+		}
+	
+	LOGOUTGOINGRSPPENDINGTSP;
+	LOGINCOMINGDELIVERED;
+	LOGOUTGOINGPENDINGSEND;
+	}
+
+void CRemConServer::CompleteSendResponse(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient)
+	{
+	LOG_FUNC;
+	LOGOUTGOINGPENDINGSEND;
+	// If the bearer-level connection exists, then send the message. 
+	// Otherwise, queue the message and request the connection to come 
+	// up. The message will be sent when ConnectConfirm or 
+	// ConnectIndicate is called (assuming no error).
+	ASSERT_DEBUG(aMsg.MsgType() == ERemConResponse);
+	ASSERT_DEBUG(iBearerManager);
+	// If we're connected (and not mid-connect/disconnect) we can send immediately,
+	// otherwise we queue and try to bring up the connection.
+	switch ( ConnectionState(aMsg.Addr()) )
+		{
+		case EConnected:
+			{
+			// We're already connected
+			// If the bearer couldn't send, we need to error the client.
+			TInt err = iBearerManager->Send(aMsg);
+			
+			// Inform client that message should be completed with err. 
+			// Bearer-level error means the response got sent to zero remotes- 
+			// bearer-level success means it got sent to precisely 1.
+			aClient.MrcmsoMessageSendOneOrMoreResult(aMsg, err);
+
+			// We've now finished with the response.
+			delete &aMsg;
+			break;
+			}
+		case EDisconnected:
+			{
+			// We're not connected. 
+			// Queue the response...
+			OutgoingPendingSend().Append(aMsg);
+			// ... and ask the bearer to establish a connection. If we 
+			// couldn't then complete the client's message and clean up.
+			TInt err = iBearerManager->Connect(aMsg.Addr());
+			if ( err != KErrNone )
+				{
+				aClient.MrcmsoMessageSendOneOrMoreResult(aMsg, err);
+				OutgoingPendingSend().RemoveAndDestroy(aMsg);
+				}
+			break;
+			}
+		case EConnecting:
+		case EDisconnecting:
+			{
+			// Just queue if connection is coming up or going down.
+			//
+			// If connection is coming up, the message will be
+			// sent when ConnectConfirm fires.
+			//
+			// If connection is going down: When CBearerManager gets
+			// the DisconnectConfirm it calls us back at RemoveConnection,
+			// whereat we will reconnect the bearer that was mid-disconnect;
+			// the message will be sent when that completes.
+			OutgoingPendingSend().Append(aMsg);
+			break;
+			}
+		default:
+			{
+			DEBUG_PANIC_LINENUM;
+			break;
+			}
+		}
+	LOGOUTGOINGPENDINGSEND;
+	}
+
+
+void CRemConServer::SendReject(TRemConAddress aAddr, TUid aInterfaceUid, TUint aOperationId, TUint aTransactionId)
+	{
+	LOG_FUNC;
+	LOGOUTGOINGPENDINGSEND;
+	// If the bearer-level connection exists, then send the message. 
+	// Otherwise, queue the message and request the connection to come 
+	// up. The message will be sent when ConnectConfirm or 
+	// ConnectIndicate is called (assuming no error).
+	
+	CRemConMessage* rejectMsg = NULL;
+	RBuf8 data;
+	data = KNullDesC8;
+	TRAPD(err, rejectMsg = CRemConMessage::NewL(aAddr, KNullClientId, ERemConReject, ERemConMessageDefault, aInterfaceUid, aOperationId, data, 0, aTransactionId));
+
+	if ( err == KErrNone)
+		{
+		// SendReject will always take ownership of rejectMsg
+		
+		ASSERT_DEBUG(iBearerManager);
+		switch ( ConnectionState(rejectMsg->Addr()) )
+			{
+			case EConnected:
+				{
+				// We're already connected
+				err = iBearerManager->Send(*rejectMsg);
+				// We've now finished with the response.
+				delete rejectMsg;
+				break;
+				}
+			case EDisconnected:
+				{
+				// We're not connected. 
+				// Queue the response...
+				OutgoingPendingSend().Append(*rejectMsg);
+				// ... and ask the bearer to establish a connection. If we 
+				// couldn't then clean up.
+				err = iBearerManager->Connect (rejectMsg->Addr ());
+				if ( err != KErrNone)
+					{
+					OutgoingPendingSend().RemoveAndDestroy(*rejectMsg);
+					}
+				break;
+				}
+			case EConnecting:
+			case EDisconnecting:
+				{
+				// Just queue if connection is coming up or going down.
+				//
+				// If connection is coming up, the message will be
+				// sent when ConnectConfirm fires.
+				//
+				// If connection is going down: When CBearerManager gets
+				// the DisconnectConfirm it calls us back at RemoveConnection,
+				// whereat we will reconnect the bearer that was mid-disconnect;
+				// the message will be sent when that completes.
+				OutgoingPendingSend().Append(*rejectMsg);
+				break;
+				}
+			default:
+				{
+				DEBUG_PANIC_LINENUM;
+				break;
+				}
+			}
+		}
+	LOGOUTGOINGPENDINGSEND;
+	}
+
+void CRemConServer::SendCancel(CRemConControllerSession& aSess)
+	{
+	LOG_FUNC;
+	LOGOUTGOINGCMDPENDINGTSP;
+	
+	TSglQueIter<CRemConMessage>& iter = OutgoingCmdPendingTsp().SetToFirst();
+	CRemConMessage* msg;
+	TBool first = ETrue;
+	while ( ( msg = iter++ ) != NULL )
+		{
+		// A session can only have one send outstanding at once, so there can 
+		// only be one message on the queue belonging to it.
+		if ( msg->SessionId() == aSess.Id() )
+			{
+			ASSERT_DEBUG(msg->MsgType() == ERemConCommand);
+			LOG1(_L("\tfound a command belonging to this client in the outgoing pending TSP queue: [0x%08x]"), msg);
+
+			// If the TSP is currently handling this command, we must stop 
+			// them! The one the TSP is handling, if any, is always the first 
+			// in the queue.
+			if ( iTspHandlingOutgoingCommand && first )
+				{
+				LOG(_L("\tTSP is processing this command- cancel it"));
+				ASSERT_DEBUG(iTspIf);
+				iTspIf->CancelOutgoingCommand();
+				iTspHandlingOutgoingCommand = EFalse;
+				iTspConnections.Reset();
+				}
+			// Can now destroy the message.
+			OutgoingCmdPendingTsp().RemoveAndDestroy(*msg);
+			}
+		first = EFalse;
+		}
+
+	LOGOUTGOINGCMDPENDINGTSP;
+	}
+
+void CRemConServer::NewResponse(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	LOGOUTGOINGSENT;
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+
+	// Look through the 'outgoing sent' queue for items with the same address, 
+	// interface UID, operation ID and transaction ID. We assume there will 
+	// only be one such item.
+	TBool sentCommandFound = EFalse;
+	TSglQueIter<CRemConMessage>& iter = OutgoingSent().SetToFirst();
+	CRemConMessage* cmd;
+	while ( ( cmd = iter++ ) != NULL )
+		{
+		if (	cmd->Addr() == aMsg.Addr()
+			&&	cmd->InterfaceUid() == aMsg.InterfaceUid()
+			&&	cmd->OperationId() == aMsg.OperationId()
+			&&	cmd->TransactionId() == aMsg.TransactionId()
+			)
+			{
+			LOG1(_L("\tfound a matching item in the sent commands log: [0x%08x]"), cmd);
+			sentCommandFound = ETrue;
+			CRemConControllerSession* const session = ControllerSession(cmd->SessionId());
+			// When sessions close, their messages are removed from the logs, 
+			// so the session here _should_ exist.
+			ASSERT_DEBUG(session);
+			aMsg.SessionId() = cmd->SessionId();
+			(void) DeliverMessageToClient(aMsg, *session);
+			// Remove the found item from the sent message log.
+			OutgoingSent().RemoveAndDestroy(*cmd);
+			break;
+			}
+		}
+	if ( !sentCommandFound )
+		{
+		// Either:
+		// (a) the remote is buggy (sent a response when there wasn't an 
+		// originating command), 
+		// (b) the client closed their controller session before the response 
+		// came back (this cleans up the 'sent commands' log)
+		LOG(_L("\tno matching item found in sent commands log- response dropped"));
+		delete &aMsg;
+		}
+
+	LOGOUTGOINGSENT;
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+	}
+
+void CRemConServer::NewNotifyResponse(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	LOGOUTGOINGSENT;
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+
+	// Look through the 'outgoing sent' queue for items with the same address, 
+	// interface UID, operation ID and transaction ID. We assume there will 
+	// only be one such item.
+	TBool sentCommandFound = EFalse;
+	TSglQueIter<CRemConMessage>& iter = OutgoingSent().SetToFirst();
+	CRemConMessage* cmd;
+	TRemConMessageSubType submessagetype;
+	submessagetype = aMsg.MsgSubType();
+	
+	while ( ( cmd = iter++ ) != NULL )
+		{
+		if (	cmd->Addr() == aMsg.Addr()
+			&&	cmd->InterfaceUid() == aMsg.InterfaceUid()
+			&&	cmd->OperationId() == aMsg.OperationId()
+			&&	cmd->TransactionId() == aMsg.TransactionId()
+			)
+			{
+			LOG1(_L("\tfound a matching item in the sent commands log: [0x%08x]"), cmd);
+			sentCommandFound = ETrue;
+			CRemConControllerSession* const session = ControllerSession(cmd->SessionId());
+			// When sessions close, their messages are removed from the logs, 
+			// so the session here _should_ exist.
+			ASSERT_DEBUG(session);
+			aMsg.SessionId() = cmd->SessionId();			
+			(void) DeliverMessageToClient(aMsg, *session);
+			
+			//Do not remove the command if it is an interim response because
+			//we need to wait for the changed response.
+			//If the changed response received or error occurs, then remove
+			//the command from the sent message log
+			if (submessagetype != ERemConNotifyResponseInterim)
+				{
+				OutgoingSent().RemoveAndDestroy(*cmd);
+				}
+
+			break;
+			}
+		}
+	if ( !sentCommandFound )
+		{
+		// Either:
+		// (a) the remote is buggy (sent a response when there wasn't an 
+		// originating command), 
+		// (b) the client closed their controller session before the response 
+		// came back (this cleans up the 'sent commands' log)
+		LOG(_L("\tno matching item found in sent commands log- response dropped"));
+		delete &aMsg;
+		}
+
+	LOGOUTGOINGSENT;
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+	}
+
+void CRemConServer::NewCommand(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	LOGINCOMINGCMDPENDINGADDRESS;
+
+	IncomingCmdPendingAddress().Append(aMsg);
+	if ( !iTspAddressingIncomingCommand)
+		{
+		AddressIncomingCommand();
+		}
+
+	LOGINCOMINGCMDPENDINGADDRESS;
+	}
+
+void CRemConServer::NewNotifyCommand(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	LOGINCOMINGNOTIFYCMDPENDINGADDRESS;
+	if (!iTspIf2)
+		{
+		SendReject(aMsg.Addr(), aMsg.InterfaceUid(), aMsg.OperationId(), aMsg.TransactionId());
+		delete &aMsg;
+		}
+	else
+		{
+		IncomingNotifyCmdPendingAddress().Append(aMsg);
+		if ( !iTspAddressingIncomingNotifyCommand && !iTspReAddressingIncomingNotifyCommands)
+			{
+			AddressIncomingNotifyCommand();
+			}
+		}
+
+	LOGINCOMINGNOTIFYCMDPENDINGADDRESS;
+	}
+
+#ifdef __FLOG_ACTIVE
+void CRemConServer::LogOutgoingNotifyCmdPendingTsp() const
+	{
+	LOG(_L("Logging outgoing notify pending TSP commands"));
+	FTRACE(const_cast<CRemConServer*>(this)->OutgoingNotifyCmdPendingTsp().LogQueue();)
+	}
+
+void CRemConServer::LogOutgoingCmdPendingTsp() const
+	{
+	LOG(_L("Logging outgoing pending TSP commands"));
+	FTRACE(const_cast<CRemConServer*>(this)->OutgoingCmdPendingTsp().LogQueue();)
+	}
+
+void CRemConServer::LogOutgoingRspPendingTsp() const
+	{
+	LOG(_L("Logging outgoing pending TSP responses"));
+	FTRACE(const_cast<CRemConServer*>(this)->OutgoingRspPendingTsp().LogQueue();)
+	}
+
+
+void CRemConServer::LogOutgoingPendingSend() const
+	{
+	LOG(_L("Logging outgoing pending send"));
+	FTRACE(const_cast<CRemConServer*>(this)->OutgoingPendingSend().LogQueue();)
+	}
+
+void CRemConServer::LogOutgoingSent() const
+	{
+	LOG(_L("Logging outgoing sent"));
+	FTRACE(const_cast<CRemConServer*>(this)->OutgoingSent().LogQueue();)
+	}
+
+void CRemConServer::LogIncomingCmdPendingAddress() const
+	{
+	LOG(_L("Logging incoming pending address commands"));
+	FTRACE(const_cast<CRemConServer*>(this)->IncomingCmdPendingAddress().LogQueue();)
+	}
+
+void CRemConServer::LogIncomingNotifyCmdPendingAddress() const
+	{
+	LOG(_L("Logging incoming pending address notify commands"));
+	FTRACE(const_cast<CRemConServer*>(this)->IncomingNotifyCmdPendingAddress().LogQueue();)
+	}
+
+void CRemConServer::LogIncomingNotifyCmdPendingReAddress() const
+	{
+	LOG(_L("Logging incoming pending readdress notify commands"));
+	FTRACE(const_cast<CRemConServer*>(this)->IncomingNotifyCmdPendingReAddress().LogQueue();)
+	}
+
+void CRemConServer::LogIncomingPendingDelivery() const
+	{
+	LOG(_L("Logging incoming pending delivery"));
+	FTRACE(const_cast<CRemConServer*>(this)->IncomingPendingDelivery().LogQueue();)
+	}
+
+void CRemConServer::LogIncomingDelivered() const
+	{
+	LOG(_L("Logging incoming delivered"));
+	FTRACE(const_cast<CRemConServer*>(this)->IncomingDelivered().LogQueue();)
+	}
+#endif // __FLOG_ACTIVE
+
+CRemConControllerSession* CRemConServer::ControllerSession(TUint aSessionId) const
+	{
+	LOG_FUNC;
+
+	CRemConControllerSession* sess = NULL;
+	
+	TInt index = iControllerSessions.Find(aSessionId, ControllerSessionCompare);
+	
+	if(index >= 0)
+		{
+		sess = iControllerSessions[index];
+		}
+
+	return sess;
+	}
+
+CRemConTargetClientProcess* CRemConServer::TargetClient(TUint aClientId) const
+	{
+	LOG_FUNC;
+
+	CRemConTargetClientProcess* client = NULL;
+
+	iTargetClientsLock.Wait();
+	
+	TInt index = iTargetClients.Find(aClientId, TargetClientCompareUsingSessionId);
+	
+	if(index >= 0)
+		{
+		client = iTargetClients[index];
+		}
+
+	iTargetClientsLock.Signal();
+
+	return client;
+	}
+
+CRemConTargetClientProcess* CRemConServer::TargetClient(TProcessId aProcessId) const
+	{
+	LOG_FUNC;
+
+	CRemConTargetClientProcess* client = NULL;
+
+	iTargetClientsLock.Wait();
+	
+	TInt index = iTargetClients.Find(aProcessId, TargetClientCompareUsingProcessId);
+	
+	if(index >= 0)
+		{
+		client = iTargetClients[index];
+		}
+	
+	iTargetClientsLock.Signal();
+
+	return client;
+	}
+
+MRemConConverterInterface* CRemConServer::Converter(TUid aInterfaceUid, 
+							   TUid aBearerUid) const
+	{
+	ASSERT_DEBUG(iConverterManager);
+	return iConverterManager->Converter(aInterfaceUid, aBearerUid);
+	}
+
+MRemConConverterInterface* CRemConServer::Converter(const TDesC8& aInterfaceData, 
+							   TUid aBearerUid) const
+	{
+	ASSERT_DEBUG(iConverterManager);
+	return iConverterManager->Converter(aInterfaceData, aBearerUid);
+	}
+
+void CRemConServer::ReceiveRequest(CRemConControllerSession& aSession)
+	{
+	LOG_FUNC;
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+
+	// Find the first message in IncomingPendingDelivery for this session.
+	TSglQueIter<CRemConMessage>& iter = IncomingPendingDelivery().SetToFirst();
+	CRemConMessage* msg;
+	while ( ( msg = iter++ ) != NULL )
+		{
+		if ( msg->SessionId() == aSession.Id() )
+			{
+			// Controllers receive responses or rejects only.
+			ASSERT_DEBUG(msg->MsgType() == ERemConResponse || msg->MsgType() == ERemConReject);
+
+			TInt err = aSession.WriteMessageToClient(*msg);
+			IncomingPendingDelivery().Remove(*msg);
+			
+			// 'Take ownership' of it by destroying it- it's finished with.
+			delete msg;				
+			
+			break;
+			}
+		}
+
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+	}
+
+void CRemConServer::ReceiveRequest(CRemConTargetClientProcess& aClient)
+	{
+	LOG_FUNC;
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+
+	// Messages are addressed to the client. Ask client to deliver any pending
+	// messages. For each delivered message, update ourselves accordingly.
+	
+	// Find the first message in IncomingPendingDelivery for this session.
+	TSglQueIter<CRemConMessage>& iter = IncomingPendingDelivery().SetToFirst();
+	CRemConMessage* msg;
+	while ( ( msg = iter++ ) != NULL )
+		{
+		if (msg->SessionId() == aClient.Id())
+			{
+			// Targets receive commands only.
+			ASSERT_DEBUG(msg->MsgType() == ERemConCommand || msg->MsgType() == ERemConNotifyCommand);
+
+			TInt err = aClient.ReceiveMessage(*msg);
+
+			if (err == KErrArgument)
+				{
+				// Message not supported by this client.
+				// 'Take ownership' of it by destroying it- it's finished with.
+				IncomingPendingDelivery().Remove(*msg);
+				delete msg;
+				}
+			else if (err == KErrNotReady)
+				{
+				// Client cannot receive this message at the moment, skip for now
+				// (message is already on the pemding queue).
+				}
+			else 
+				{
+				// Message delivered, remove from pending queue.
+				IncomingPendingDelivery().Remove(*msg);
+				
+				if (err == KErrNone )
+					{
+					// We'll need to remember it for the response coming back.
+					IncomingDelivered().Append(*msg); 
+					}
+				else
+					{
+					// Tell bearer it won't be getting a response
+					CMessageRecipients* messageRecipients = iMessageRecipientsList->Message (msg->TransactionId ());
+
+					// If we aren't returned a client list, this means that the message has been delivered elsewhere
+					if (messageRecipients)
+						{
+						messageRecipients->RemoveAndDestroyClient (aClient.ClientInfo ());
+
+						if ( messageRecipients->Clients().IsEmpty ())
+							{
+							iMessageRecipientsList->Messages().Remove (*messageRecipients);
+							delete messageRecipients;
+
+							SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
+							}
+						}
+
+					// 'Take ownership' of it by destroying it- it's finished with.
+					delete msg;
+					}
+				}
+			}
+		}
+	
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+	}
+
+TBool CRemConServer::FindDuplicateNotify(CRemConMessage& aMsg)
+	{
+	ASSERT_DEBUG(aMsg.MsgType() == ERemConNotifyCommand);
+	TSglQueIter<CRemConMessage>& deliveredIter = IncomingDelivered().SetToFirst();
+	CRemConMessage* msg;
+	while ((msg = deliveredIter++) != NULL)
+		{
+		if (msg->MsgType() == ERemConNotifyCommand
+				&& msg->Addr() == aMsg.Addr()
+				&& msg->InterfaceUid() == aMsg.InterfaceUid()
+				&& msg->OperationId() == aMsg.OperationId()
+				&& msg->Client() == aMsg.Client())
+			{
+			return ETrue;
+			}
+		}
+	TSglQueIter<CRemConMessage>& pendingDeliveryIter = IncomingPendingDelivery().SetToFirst();
+	while ((msg = pendingDeliveryIter++) != NULL)
+		{
+		if (msg->MsgType() == ERemConNotifyCommand
+				&& msg->Addr() == aMsg.Addr()
+				&& msg->InterfaceUid() == aMsg.InterfaceUid()
+				&& msg->OperationId() == aMsg.OperationId()
+				&& msg->Client() == aMsg.Client())
+			{
+			return ETrue;
+			}
+		}
+	return EFalse;
+	}
+
+TInt UidCompare(const TUid& aFirst, const TUid& aSecond)
+	{
+	if(aFirst.iUid < aSecond.iUid)
+		{
+		return -1;
+		}
+	else if(aFirst.iUid == aSecond.iUid)
+		{
+		return 0;
+		}
+	else
+		{
+		return 1;
+		}
+	}
+
+/**
+Collect all supported interfaces of controller clients.  
+
+@param aSupportedInterfaces An empty RArray which will be populated with the current
+		supported interfaces.  Ownership is retained by the caller.
+@return KErrNone if any interfaces were able to be retrieved.  This does not 
+		imply that every session's interfaces were able to be retrieved.
+		KErrNoMemory if no interfaces could be retrived.
+*/
+TInt CRemConServer::ControllerSupportedInterfaces(RArray<TUid>& aSupportedInterfaces)
+	{
+	LOG_FUNC;
+	ASSERT_DEBUG(aSupportedInterfaces.Count() == 0);
+	
+	TLinearOrder<TUid> uidCompare(&UidCompare);
+	RArray<TUid> sessionFeatures;
+	TInt err = KErrNone;
+	for(TInt i=0; i<iControllerSessions.Count(); i++)
+		{
+		ASSERT_DEBUG(iControllerSessions[i]);
+		err = iControllerSessions[i]->SupportedInterfaces(sessionFeatures);
+		ASSERT_DEBUG(err == KErrNone || err == KErrNoMemory);
+		
+		if(!err)
+			{
+			for(TInt j=0; j<sessionFeatures.Count(); j++)
+				{
+				// Ignore failure here, we're trying this best effort
+				// InsertInOrder is used rather than just bunging the
+				// interface on the end as we want no duplicates 
+				(void)aSupportedInterfaces.InsertInOrder(sessionFeatures[j], uidCompare);
+				}
+			}
+		sessionFeatures.Reset();
+		}
+	
+	if(aSupportedInterfaces.Count() > 0)
+		{
+		return KErrNone;
+		}
+	else
+		{
+		return KErrNoMemory;
+		}
+	}
+
+CMessageQueue& CRemConServer::OutgoingCmdPendingTsp()
+	{
+	ASSERT_DEBUG(iOutgoingCmdPendingTsp);
+	return *iOutgoingCmdPendingTsp;
+	}
+
+CMessageQueue& CRemConServer::OutgoingNotifyCmdPendingTsp()
+	{
+	ASSERT_DEBUG(iOutgoingNotifyCmdPendingTsp);
+	return *iOutgoingNotifyCmdPendingTsp;
+	}
+
+CMessageQueue& CRemConServer::OutgoingRspPendingTsp()
+	{
+	ASSERT_DEBUG(iOutgoingRspPendingTsp);
+	return *iOutgoingRspPendingTsp;
+	}
+
+CMessageQueue& CRemConServer::OutgoingRspPendingSend()
+	{
+	ASSERT_DEBUG(iOutgoingRspPendingSend);
+	return *iOutgoingRspPendingSend;
+	}
+
+CMessageQueue& CRemConServer::OutgoingPendingSend()
+	{
+	ASSERT_DEBUG(iOutgoingPendingSend);
+	return *iOutgoingPendingSend;
+	}
+
+CMessageQueue& CRemConServer::OutgoingSent()
+	{
+	ASSERT_DEBUG(iOutgoingSent);
+	return *iOutgoingSent;
+	}
+
+CMessageQueue& CRemConServer::IncomingCmdPendingAddress()
+	{
+	ASSERT_DEBUG(iIncomingCmdPendingAddress);
+	return *iIncomingCmdPendingAddress;
+	}
+
+CMessageQueue& CRemConServer::IncomingNotifyCmdPendingAddress()
+	{
+	ASSERT_DEBUG(iIncomingNotifyCmdPendingAddress);
+	return *iIncomingNotifyCmdPendingAddress;
+	}
+
+CMessageQueue& CRemConServer::IncomingPendingDelivery()
+	{
+	ASSERT_DEBUG(iIncomingPendingDelivery);
+	return *iIncomingPendingDelivery;
+	}
+
+CMessageQueue& CRemConServer::IncomingDelivered()
+	{
+	ASSERT_DEBUG(iIncomingDelivered);
+	return *iIncomingDelivered;
+	}
+
+
+CMessageQueue& CRemConServer::IncomingNotifyCmdPendingReAddress()
+	{
+	ASSERT_DEBUG(iIncomingNotifyCmdPendingReAddress);
+	return *iIncomingNotifyCmdPendingReAddress;
+	}
+
+TBool CRemConServer::ConnectionHistoryPointerAtLatest(TUint aSessionId) const
+	{
+	LOG_FUNC;
+	LOG1(_L("\taSessionId = %d"), aSessionId);
+
+#ifdef _DEBUG
+	TBool found = EFalse;
+#endif
+	TUint index = 0;
+	const TUint count = iSession2ConnHistory.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		if ( iSession2ConnHistory[ii].iSessionId == aSessionId )
+			{
+			index = iSession2ConnHistory[ii].iIndex;
+#ifdef _DEBUG
+			found = ETrue;
+#endif
+			break;
+			}
+		}
+	ASSERT_DEBUG(found);
+
+	TBool ret = EFalse;
+	ASSERT_DEBUG(iConnectionHistory);
+	if ( index == iConnectionHistory->Count() - 1 )
+		{
+		ret = ETrue;
+		}
+
+	LOG1(_L("\tret = %d"), ret);
+	return ret;
+	}
+
+CConnections& CRemConServer::Connections()
+	{
+	ASSERT_DEBUG(iConnectionHistory);
+	return iConnectionHistory->Last();
+	}
+
+TInt CRemConServer::HandleConnection(const TRemConAddress& aAddr, TInt aError)
+	{
+	LOG_FUNC;
+	LOG2(_L("\taError = %d, aAddr.BearerUid = 0x%08x"), aError, aAddr.BearerUid());
+	LOGREMOTES;
+	LOGOUTGOINGPENDINGSEND;
+	LOGOUTGOINGSENT;
+
+	// Try to update the connection history. If this fails (it involves memory 
+	// allocation) we need to return the error so the connection will be 
+	// dropped.
+	if ( aError == KErrNone )
+		{
+		ASSERT_DEBUG(iConnectionHistory);
+		aError = iConnectionHistory->NewConnection(aAddr);
+		}
+
+	// If we have a real new connection and we could handle it, aError is 
+	// now KErrNone. In this case, sessions' notifications need completing.
+	if ( aError == KErrNone )
+		{
+		TUint count = iControllerSessions.Count();
+		for ( TUint ii = 0 ; ii < count ; ++ii )
+			{
+			ASSERT_DEBUG(iControllerSessions[ii]);
+			iControllerSessions[ii]->ConnectionsChanged();
+			}
+		
+		iTargetClientsLock.Wait();
+		count = iTargetClients.Count();
+		for ( TUint ii = 0 ; ii < count ; ++ii )
+			{
+			ASSERT_DEBUG(iTargetClients[ii]);
+			iTargetClients[ii]->ConnectionsChanged();
+			}
+		iTargetClientsLock.Signal();
+		}
+
+	// Complete the specific client request(s) that caused a ConnectRequest on 
+	// the bearer. Tell all sessions- they remember the address they wanted to 
+	// connect to, and will filter on the address we give them. NB This 
+	// function is called by ConnectIndicate as well as by ConnectConfirm, but 
+	// the client doesn't care which end brought the connection up. 
+	const TUint count = iControllerSessions.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		ASSERT_DEBUG(iControllerSessions[ii]);
+		iControllerSessions[ii]->CompleteConnect(aAddr, aError);
+		}
+
+	// Any messages waiting on OutgoingPendingSend for this connection need to 
+	// be handled.
+	TSglQueIter<CRemConMessage>& iter = OutgoingPendingSend().SetToFirst();
+	CRemConMessage* msg;
+	TBool moveToSent = EFalse;
+	while ( ( msg = iter++ ) != NULL )
+		{
+		if ( msg->Addr() == aAddr )
+			{
+			MRemConMessageSendObserver* observer  = TargetClient(msg->SessionId());
+			if(!observer)
+				{
+				observer = ControllerSession(msg->SessionId());
+				}
+#ifdef __DEBUG
+			else
+				{
+				// Message has matched to a target session, so it should not also match
+				// a controller session (we know the vice-versa is already true).
+				ASSERT_DEBUG(!ControllerSession(msg->SessionId()));
+				}
+#endif
+
+			// The session or client should exist- if it doesn't then this message 
+			// wasn't cleaned from OutgoingPendingSend correctly when the 
+			// session closed. The exceptions are Reject, which can be put
+			// on the queue without a session, and notify changed responses when they are being
+			// delivered to multiple controllers
+			ASSERT_DEBUG(observer || msg->MsgType() == ERemConReject || msg->MsgSubType() == ERemConNotifyResponseChanged);
+
+			if ( aError == KErrNone)
+				{
+				// We have a connection!
+				ASSERT_DEBUG(iBearerManager);
+				TInt err = iBearerManager->Send(*msg);
+				if ( err == KErrNone 
+				    && ((msg->MsgType() == ERemConCommand)||(msg->MsgType() == ERemConNotifyCommand)))
+					{
+					// If the send succeeded and it was a command, we move the 
+					// message to the 'sent' log. Otherwise, it's simply 
+					// deleted because we've finished with it.
+					moveToSent = ETrue;
+					}
+				if ( observer && msg->MsgType() != ERemConReject )
+					{
+					observer->MrcmsoMessageSendOneOrMoreResult(*msg, err);
+					}
+				}
+			else
+				{
+				// No connection, remember the error.
+				if ( observer )
+					{
+					if (msg->MsgType() != ERemConReject)
+						{
+						observer->MrcmsoMessageSendOneOrMoreResult(*msg, aError);
+						}
+					}
+				}
+
+			if ( moveToSent)
+				{
+				OutgoingPendingSend().Remove (*msg);
+				OutgoingSent().Append (*msg);
+				}
+			else
+				{
+				OutgoingPendingSend().RemoveAndDestroy (*msg);
+				}
+			}
+		}
+
+	LOGREMOTES;
+	LOGOUTGOINGPENDINGSEND;
+	LOGOUTGOINGSENT;
+	LOG1(_L("\taError = %d"), aError);
+	return aError;
+	}
+
+void CRemConServer::RemoveConnection(const TRemConAddress& aAddr, TInt aError)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+	LOGREMOTES;
+	
+	if(aError == KErrNone)
+		{
+		// The connection has gone away
+
+		// We make a new item in the connection history and inform the sessions so 
+		// they can complete outstanding connection status notifications.
+	
+		ASSERT_DEBUG(iConnectionHistory);
+		iConnectionHistory->Disconnection(aAddr);
+
+		TUint count = iControllerSessions.Count();
+		for ( TUint ii = 0 ; ii < count ; ++ii )
+			{
+			ASSERT_DEBUG(iControllerSessions[ii]);
+			iControllerSessions[ii]->ConnectionsChanged();
+			}
+		
+		iTargetClientsLock.Wait();
+		count = iTargetClients.Count();
+		for ( TUint ii = 0 ; ii < count ; ++ii )
+			{
+			ASSERT_DEBUG(iTargetClients[ii]);
+			iTargetClients[ii]->ConnectionsChanged();
+			}
+		iTargetClientsLock.Signal();
+		
+		// If there are any messages waiting on OutgoingPendingSend for this connection,
+		// we re-connect it - they'll be picked up in HandleConnection above.
+	
+		TSglQueIter<CRemConMessage> iter = OutgoingPendingSend().SetToFirst();
+		CRemConMessage* msg;
+		TBool needToReconnect = false;
+		while ( ( msg = iter++ ) != NULL )
+			{
+			if (msg->Addr() == aAddr)
+				{
+				needToReconnect = true;
+				break;
+				}
+			}
+		
+		if (needToReconnect)
+			{
+			ASSERT_DEBUG(iBearerManager);
+			TInt err = iBearerManager->Connect(aAddr);
+			if ( err != KErrNone )
+				{
+				// This fails if:
+				// 1. we're already connecting (in which case, we don't care)
+				// 2. we can't add aAddr to the connecting list
+				// The semantics of this observer don't let us return an error or leave, so
+				// we can't do much about it here. Log it, and the next command will
+				// invoke Connect from a better situation.
+				LOG1(_L("\tFailed to re-connect bearer after connection removed: %d"), err);
+				}
+			}
+		}
+	
+	// Complete the specific request(s) that caused a DisconnectRequest on the 
+	// bearer. Tell all sessions- they remember the address they wanted to 
+	// connect to, and will filter on the address we give them.
+	TInt count = iControllerSessions.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		ASSERT_DEBUG(iControllerSessions[ii]);
+		iControllerSessions[ii]->CompleteDisconnect(aAddr, aError);
+		}
+
+	LOGREMOTES;
+	}
+
+void CRemConServer::SetConnectionHistoryPointer(TUint aSessionId)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taSessionId = %d"), aSessionId);
+	LOGCONTROLLERSESSIONS;
+	LOGTARGETSESSIONS;
+	LOGCONNECTIONHISTORYANDINTEREST;
+
+	// Update the record for this session.
+	const TUint count = iSession2ConnHistory.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		if ( iSession2ConnHistory[ii].iSessionId == aSessionId )
+			{
+			ASSERT_DEBUG(iConnectionHistory);
+			iSession2ConnHistory[ii].iIndex = iConnectionHistory->Count() - 1;
+			break;
+			}
+		}
+
+	// If the calling session was the last session pointing to that item in 
+	// the history, and if it was the earliest item in the history, then we'll 
+	// be able to clean up the history a bit.
+	UpdateConnectionHistoryAndPointers();
+
+	LOGCONNECTIONHISTORYANDINTEREST;
+	}
+
+const CConnections& CRemConServer::Connections(TUint aSessionId) const
+	{
+	LOG_FUNC;
+	LOG1(_L("\taSessionId = %d"), aSessionId);
+
+	// Get the connection history record for this session.
+	const CConnections* conns = NULL; 
+	const TUint count = iSession2ConnHistory.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		if ( iSession2ConnHistory[ii].iSessionId == aSessionId )
+			{
+			ASSERT_DEBUG(iConnectionHistory);
+			conns = &(*iConnectionHistory)[iSession2ConnHistory[ii].iIndex];
+			break;
+			}
+		}
+
+	ASSERT_DEBUG(conns);
+
+	return *conns;
+	}
+
+void CRemConServer::UpdateConnectionHistoryAndPointers()
+	{
+	LOG_FUNC;
+	LOGCONNECTIONHISTORYANDINTEREST;
+	
+	// This function is called whenever a session finishes its interest in a 
+	// connection history record, either by closing or by completing 
+	// GetConnections. We remove uninteresting records in the history by 
+	// removing the lowest-indexed item in the history until the 
+	// lowest-indexed item has a session interested in it. As we do so, adjust 
+	// the other sessions' pointers so they're still pointing at the right 
+	// records.
+	TUint lowestInterestingRecord = KMaxTUint;
+	const TUint count = iSession2ConnHistory.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		if ( iSession2ConnHistory[ii].iIndex < lowestInterestingRecord )
+			{
+			lowestInterestingRecord = iSession2ConnHistory[ii].iIndex;
+			}
+		}
+
+	// In theory, lowestInterestingRecord is now the number of connection 
+	// history records we have to delete, starting with the 0th. This will not 
+	// be the case (lowestInterestingRecord will still be KMaxTUint) if there 
+	// are no sessions left. So adjust lowestInterestingRecord down to 
+	// iConnectionHistory->Count() - 1 so that we remove all but the 'current' 
+	// connection history record. This cleans up as much as possible in case 
+	// server termination is interrupted.
+	ASSERT_DEBUG(iConnectionHistory);
+	if ( lowestInterestingRecord >= iConnectionHistory->Count() )
+		{
+		lowestInterestingRecord = iConnectionHistory->Count() - 1;
+		}
+	ASSERT_DEBUG(iConnectionHistory);
+	for ( TUint ii = 0 ; ii < lowestInterestingRecord ; ++ii )
+		{
+		iConnectionHistory->DestroyFirst();
+		}
+
+	// We now have to go through iSession2ConnHistory and decrement each 
+	// iIndex by lowestInterestingRecord, to keep _those_ records pointing 
+	// at the right history records.
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		iSession2ConnHistory[ii].iIndex -= lowestInterestingRecord;
+		}
+
+	LOGCONNECTIONHISTORYANDINTEREST;
+	}
+
+TConnectionState CRemConServer::ConnectionState(const TRemConAddress& aAddr)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taaAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
+	
+	TConnectionState ret;
+
+	// Because 'connection state' knowledge is spread across the system
+	// we have asserts in following if statement to ensure that our state
+	// is consistent
+
+	// Check if connecting
+	ASSERT_DEBUG(iBearerManager);
+	if ( iBearerManager->IsConnecting(aAddr) )
+		{
+		ASSERT_DEBUG(!iBearerManager->IsDisconnecting(aAddr));
+		ASSERT_DEBUG(!Connections().Find(aAddr)); 
+		ret = EConnecting;
+		}
+	// Check if disconnecting
+	else if ( iBearerManager->IsDisconnecting(aAddr) )
+		{
+		ASSERT_DEBUG(!iBearerManager->IsConnecting(aAddr));
+		// NB Connection remains in connections list until we get DisconnectConfirm
+		ASSERT_DEBUG(Connections().Find(aAddr));
+		ret = EDisconnecting;	
+		}
+	// Check if connected
+	else if ( Connections().Find(aAddr) )
+		{
+		ASSERT_DEBUG(!iBearerManager->IsConnecting(aAddr));
+		ASSERT_DEBUG(!iBearerManager->IsDisconnecting(aAddr));
+		ret = EConnected;
+		}
+	// otherwise it's disconnected
+	else
+		{
+		ret = EDisconnected;
+		}
+		
+	LOG1(_L("\tret(connection state) = %d"), ret);
+	return ret;
+	}
+
+void CRemConServer::CommandExpired(TUint aTransactionId)
+	{
+	LOG_FUNC;
+
+	CRemConMessage* msg;
+
+	TBool first = ETrue;
+	
+	TSglQueIter<CRemConMessage> addressCommandIter = IncomingCmdPendingAddress().SetToFirst();
+	
+	while ((msg = addressCommandIter++) != NULL)
+		{
+		if (msg->TransactionId() == aTransactionId)
+			{
+			IncomingCmdPendingAddress().RemoveAndDestroy(*msg);
+			if (first && iTspAddressingIncomingCommand)
+				{
+				iTspDropIncomingCommand = ETrue;
+				}
+			}
+		first = EFalse;
+		}
+	
+	TSglQueIter<CRemConMessage> addressNotifyIter = IncomingNotifyCmdPendingAddress().SetToFirst();
+
+	first = ETrue;
+	
+	while ((msg = addressNotifyIter++) != NULL)
+		{
+		if (msg->TransactionId() == aTransactionId)
+			{
+			IncomingNotifyCmdPendingAddress().RemoveAndDestroy(*msg);
+			if (first && iTspAddressingIncomingNotifyCommand)
+				{
+				iTspDropIncomingNotifyCommand = ETrue;
+				}
+			}
+		first = EFalse;
+		}
+
+	TSglQueIter<CRemConMessage> reAddressNotifyIter = IncomingNotifyCmdPendingReAddress().SetToFirst();
+
+	
+	while ((msg = reAddressNotifyIter++) != NULL)
+		{
+		if (msg->TransactionId() == aTransactionId)
+			{
+			IncomingNotifyCmdPendingReAddress().RemoveAndDestroy(*msg);
+			if (first && iTspReAddressingIncomingNotifyCommands)
+				{
+				iTspDropIncomingNotifyCommand = ETrue;
+				}
+
+			}
+		first = EFalse;
+		}
+	
+	TSglQueIter<CRemConMessage> pendingDeliveryIter = IncomingPendingDelivery().SetToFirst();
+	
+	while ((msg = pendingDeliveryIter++) != NULL)
+		{
+		if (msg->TransactionId() == aTransactionId)
+			{
+			IncomingPendingDelivery().RemoveAndDestroy(*msg);
+			}
+		}
+	
+	TSglQueIter<CRemConMessage> deliveredIter = IncomingDelivered().SetToFirst();
+	
+	while ((msg = deliveredIter++) != NULL)
+		{
+		if (msg->TransactionId() == aTransactionId)
+			{
+			IncomingDelivered().RemoveAndDestroy(*msg);
+			}
+		}
+	ASSERT_DEBUG(iMessageRecipientsList);
+	iMessageRecipientsList->RemoveAndDestroyMessage(aTransactionId);
+	}
+
+TClientInfo* CRemConServer::TargetClientIdToClientInfo(TRemConClientId aId)
+	{
+	TClientInfo* clientInfo = NULL;
+	
+	iTargetClientsLock.Wait();
+	const TUint count = iTargetClients.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConTargetClientProcess * const client = iTargetClients[ii];
+		ASSERT_DEBUG(client);
+		if (client->Id() == aId)
+			{
+			clientInfo = &client->ClientInfo();
+			break;
+			}
+		}
+	iTargetClientsLock.Signal();
+	
+	return clientInfo;
+	}
+
+TInt CRemConServer::SupportedInterfaces(const TRemConClientId& aId, RArray<TUid>& aUids)
+	{
+	TUint count = iControllerSessions.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConSession* const sess = iControllerSessions[ii];
+		ASSERT_DEBUG(sess);
+		if (sess->Id() == aId)
+			{
+			return sess->SupportedInterfaces(aUids);
+			}
+		}
+	
+	iTargetClientsLock.Wait();
+	count = iTargetClients.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConTargetClientProcess* const client = iTargetClients[ii];
+		ASSERT_DEBUG(client);
+		if (client->Id() == aId)
+			{
+			iTargetClientsLock.Signal();
+			return client->SupportedInterfaces(aUids);
+			}
+		}
+	iTargetClientsLock.Signal();
+	
+	return KErrNotFound;
+	}
+
+TInt CRemConServer::SupportedOperations(const TRemConClientId& aId, TUid aInterfaceUid, RArray<TUint>& aOperations)
+	{
+	iTargetClientsLock.Wait();
+	TUint count = iTargetClients.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConTargetClientProcess* const client = iTargetClients[ii];
+		ASSERT_DEBUG(client);
+		if (client->Id() == aId)
+			{
+			iTargetClientsLock.Signal();
+			return client->SupportedOperations(aInterfaceUid, aOperations);
+			}
+		}
+	iTargetClientsLock.Signal();
+
+	count = iControllerSessions.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConControllerSession* const sess = iControllerSessions[ii];
+		ASSERT_DEBUG(sess);
+		if (sess->Id() == aId)
+			{
+			return sess->SupportedOperations(aInterfaceUid, aOperations);
+			}
+		}
+	
+	return KErrNotFound;
+	}
+
+void CRemConServer::SetRemoteAddressedClient(const TUid& aBearerUid, const TRemConClientId& aId)
+	{
+	LOG_FUNC;
+	
+	TClientInfo* clientInfo = TargetClientIdToClientInfo(aId);
+	// Bearer must supply valid client id
+	ASSERT_DEBUG(clientInfo);
+
+	ASSERT_DEBUG(iTspIf4);
+	iTspIf4->SetRemoteAddressedClient(aBearerUid, *clientInfo);
+	}
+
+TInt CRemConServer::RegisterLocalAddressedClientObserver(const TUid& aBearerUid)
+	{
+	return iTspIf5 ? iTspIf5->RegisterLocalAddressedClientObserver(aBearerUid) : KErrNotSupported;
+	}
+
+TInt CRemConServer::UnregisterLocalAddressedClientObserver(const TUid& aBearerUid)
+	{
+	return iTspIf5 ? iTspIf5->UnregisterLocalAddressedClientObserver(aBearerUid) : KErrNotSupported;
+	}
+
+TRemConClientId CRemConServer::ClientIdByProcessId(TProcessId aProcessId)
+	{
+	LOG_FUNC;
+	TRemConClientId ret = KNullClientId;
+	iTargetClientsLock.Wait();
+	CRemConTargetClientProcess* client = TargetClient(aProcessId);
+	if(client)
+		{
+		ret = client->Id();
+		}
+	iTargetClientsLock.Signal();
+	return ret;
+	}
+
+void CRemConServer::BulkInterfacesForClientL(TRemConClientId aId, RArray<TUid>& aUids)
+	{
+	LOG_FUNC;
+	iTargetClientsLock.Wait();
+	CleanupSignalPushL(iTargetClientsLock);
+	CRemConTargetClientProcess* client = TargetClient(aId);
+	if(!client)
+		{
+		LEAVEL(KErrNotFound);
+		}
+	LEAVEIFERRORL(client->SupportedBulkInterfaces(aUids));
+	CleanupStack::PopAndDestroy(&iTargetClientsLock);
+	}
+
+
+// Helper Active Objects
+
+CBulkThreadWatcher::CBulkThreadWatcher(CRemConServer& aServer)
+	: CActive(CActive::EPriorityStandard)
+	, iServer(aServer)
+	{
+	LOG_FUNC;
+	}
+
+CBulkThreadWatcher::~CBulkThreadWatcher()
+	{
+	LOG_FUNC;
+	Cancel();
+	}
+
+void CBulkThreadWatcher::StartL()
+	{
+	LOG_FUNC;
+	// Add to scheduler jit
+	CActiveScheduler::Add(this);
+	iServer.iBulkServerThread.Logon(iStatus);
+	if(iStatus.Int() == KErrNoMemory)
+		{
+		User::WaitForRequest(iStatus); // swallow the signal...
+		// if no memory then we have to fail now otherwise
+		// we are in an odd state where we don't know if the
+		// bulk thread is running or not.
+		LEAVEL(KErrNoMemory);
+		}
+	else
+		{
+		// Otherwise the request is handled by the active scheduler.
+		SetActive();
+		}
+	}
+
+void CBulkThreadWatcher::RunL()
+	{
+	LOG_FUNC;
+	LOG1(_L("\tiStatus.Int() = %d"), iStatus.Int());
+	// Thread is dead so kill handle.
+	iServer.iBulkServerThread.Close();
+	iServer.iBulkThreadOpen = EFalse;
+	iServer.StartShutdownTimerIfNoClientsOrBulkThread();
+	iServer.iBulkThreadWatcher = NULL;
+	delete this; // end...
+	}
+
+void CBulkThreadWatcher::DoCancel()
+	{
+	LOG_FUNC;
+	iServer.iBulkServerThread.LogonCancel(iStatus);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/session.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,898 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Remote Control session implementation.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+#include "e32base.h"
+
+#include <bluetooth/logger.h>
+#include <remcon/remconbearerinterface.h>
+#include <remcon/remconifdetails.h>
+#include <s32mem.h>
+#include "utils.h"
+#include "server.h"
+#include "bearermanager.h"
+#include "remconmessage.h"
+#include "connections.h"
+#include "session.h"
+#include "messagequeue.h"
+#include "remconserver.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("session");
+#endif
+
+
+CRemConSession::CRemConSession(CRemConServer& aServer,
+		CBearerManager& aBearerManager,
+		TUint aId)
+ :	iServer(aServer),
+	iBearerManager(aBearerManager),
+	iId(aId)
+	{
+	LOG_FUNC;
+	}
+
+void CRemConSession::BaseConstructL(const TClientInfo& aClientInfo)
+	{
+	LOG_FUNC;
+
+	iClientInfo = aClientInfo;
+
+	iSendQueue = CMessageQueue::NewL();
+
+	// The send callback is used by the base class to handle queued sends.
+	iSendNextCallBack = new(ELeave) CAsyncCallBack(CActive::EPriorityStandard);
+	TCallBack cb(SendNextCb, this);
+	iSendNextCallBack->Set(cb);
+
+	}
+
+CRemConSession::~CRemConSession()
+	{
+	LOG(KNullDesC8);
+	LOG_FUNC;
+	
+	delete iSendNextCallBack;
+	delete iSendQueue;
+	delete iInterestedAPIs;
+	}
+
+void CRemConSession::ServiceL(const RMessage2& aMessage)
+	{
+	LOG(KNullDesC8);
+	LOG_FUNC;
+	LOG1(_L("\taMessage.Function() = %d"), aMessage.Function());
+	// Switch on the IPC number and call a 'message handler'. Message handlers 
+	// complete aMessage (either with Complete or Panic), or make a note of 
+	// the message for later asynchronous completion.
+	// Message handlers should not leave- the server does not have an Error 
+	// function. 
+
+	switch ( aMessage.Function() )
+		{
+	// Heap failure testing APIs.
+	case ERemConDbgMarkHeap:
+#ifdef _DEBUG
+		LOG(_L("\tmark heap"));
+		__UHEAP_MARK;
+#endif // _DEBUG
+		CompleteClient(aMessage, KErrNone);
+		break;
+
+	case ERemConDbgCheckHeap:
+#ifdef _DEBUG
+		LOG1(_L("\tcheck heap (expecting %d cells)"), aMessage.Int0());
+		__UHEAP_CHECK(aMessage.Int0());
+#endif // _DEBUG
+		CompleteClient(aMessage, KErrNone);
+		break;
+
+	case ERemConDbgMarkEnd:
+#ifdef _DEBUG
+		LOG1(_L("\tmark end (expecting %d cells)"), aMessage.Int0());
+		__UHEAP_MARKENDC(aMessage.Int0());
+#endif // _DEBUG
+		CompleteClient(aMessage, KErrNone);
+		break;
+
+	case ERemConDbgFailNext:
+#ifdef _DEBUG
+		{
+		LOG1(_L("\tfail next (simulating failure after %d allocation(s))"), aMessage.Int0());
+		if ( aMessage.Int0() == 0 )
+			{
+			__UHEAP_RESET;
+			}
+		else
+			{
+			__UHEAP_FAILNEXT(aMessage.Int0());
+			}
+		}
+#endif // _DEBUG
+		CompleteClient(aMessage, KErrNone);
+		break;
+
+	case ERemConSetPlayerType:
+		SetPlayerType(aMessage);
+		// This is a sync API- check that the message has been completed.
+		// (NB We don't check the converse for async APIs because the message 
+		// may have been panicked synchronously.)
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+
+	case ERemConSend:
+		Send(aMessage);
+		break;
+				
+	case ERemConSendUnreliable:
+		SendUnreliable(aMessage);
+		break;
+	
+	case ERemConSendCancel:
+		SendCancel(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+
+	case ERemConReceive:
+		Receive(aMessage);
+		break;
+
+	case ERemConReceiveCancel:
+		ReceiveCancel(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+
+	case ERemConGetConnectionCount:
+		GetConnectionCount(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+
+	case ERemConGetConnections:
+		GetConnections(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+
+	case ERemConNotifyConnectionsChange:
+		NotifyConnectionsChange(aMessage);
+		break;
+
+	case ERemConNotifyConnectionsChangeCancel:
+		NotifyConnectionsChangeCancel(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+		
+	case ERemConRegisterInterestedAPIs:
+		RegisterInterestedAPIs(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+		
+	case ERemConGoConnectionOriented:
+		GoConnectionOriented(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+
+	case ERemConGoConnectionless:
+		GoConnectionless(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+
+	case ERemConConnectBearer:
+		ConnectBearer(aMessage);
+		break;
+
+	case ERemConConnectBearerCancel:
+		ConnectBearerCancel(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+
+	case ERemConDisconnectBearer:
+		DisconnectBearer(aMessage);
+		break;
+
+	case ERemConDisconnectBearerCancel:
+		DisconnectBearerCancel(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+		
+	case ERemConSendNotify:
+		SendNotify(aMessage);
+		break;
+		
+	default:
+		// Unknown message
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
+		break;
+		}
+	}
+
+void CRemConSession::CompleteClient(const RMessage2& aMessage, TInt aError)
+	{
+	LOG1(_L("\tcompleting client message with %d"), aError);
+	TBool cleanClientInfoMessage = (iClientInfo.Message().Handle() == aMessage.Handle());
+	aMessage.Complete(aError);
+	if(cleanClientInfoMessage)
+		{
+		iClientInfo.Message() = RMessage2();
+		}
+	}
+
+void CRemConSession::GetPlayerTypeAndNameL(const RMessage2& aMessage, TPlayerTypeInformation& aPlayerType, RBuf8& aPlayerName)
+	{
+	// check validity of descriptors
+	if (aMessage.GetDesLength(1) < 0 || aMessage.GetDesLength(2) < 0)
+		{
+		LEAVEL(KErrBadDescriptor);
+		}
+
+	// Retrieve and validate the client type information 
+	TPckg<TPlayerTypeInformation> pckg(aPlayerType);
+	aMessage.ReadL(1, pckg);
+	switch (aPlayerType.iPlayerType)
+		{
+	case ERemConAudioPlayer:
+		// Valid
+	case ERemConVideoPlayer:
+		// Valid
+	case ERemConBroadcastingAudioPlayer:
+		// Valid
+	case ERemConBroadcastingVideoPlayer:
+		// Valid
+		break;
+	default:
+		// Invalid
+		LEAVEL(KErrArgument);
+		}
+	switch (aPlayerType.iPlayerSubType)
+		{
+	case ERemConNoSubType:
+		// Valid
+	case ERemConAudioBook:
+		// Valid
+	case ERemConPodcast:
+		// Valid
+		break;
+	default:
+		// Invalid
+		LEAVEL(KErrArgument);
+		}
+
+	// Retrieve the client player name inforamtion
+	aPlayerName.CreateL(aMessage.GetDesLengthL(2));
+	CleanupClosePushL(aPlayerName);
+	aMessage.ReadL(2, aPlayerName);	
+	CleanupStack::Pop(&aPlayerName);
+	}
+
+void CRemConSession::Send(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we're not already sending...
+	if ( iSendMsg.Handle())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicSendAlreadyOutstanding);
+		return;
+		}
+	
+	iSendMsg = aMessage;
+	
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	// Before we ask the server to send, we must set our ClientInfo 
+	// correctly so the TSP can get information about the client. 
+	iClientInfo.Message() = aMessage;
+
+	// Prepare the message for send. If DoPrepareSendMessageL() returns
+	// NULL, it panicked the client.
+	CRemConMessage* msg = NULL;
+	TRAPD(err, msg = DoPrepareSendMessageL(aMessage));
+
+	if ( err != KErrNone )
+		{
+		CompleteClient(aMessage, err);
+		}
+	else if (msg)
+		{
+		ASSERT_DEBUG(iSendQueue);
+	
+		if (iSending != ENotSending || !iSendQueue->IsEmpty())
+			{
+			iSendQueue->Append(*msg);
+			}
+		else
+			{
+			// we know msg cannot be null here as said above.
+			SendToServer(*msg);
+			}
+		}
+	}
+
+void CRemConSession::SendCancel(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	// See comments in ConnectBearerCancel.
+	if ( iSendMsg.Handle() )
+		{
+		DoSendCancel();
+		}
+	
+	if (iSendMsg.Handle())
+		{
+		CRemConMessage* msg;
+		TBool first = ETrue;
+		ASSERT_DEBUG(iSendQueue);
+		TSglQueIter<CRemConMessage>& iter = iSendQueue->SetToFirst();
+		while ((msg = iter++) != NULL)
+			{
+			if (msg->IsReliableSend())
+				{
+				CompleteClient(iSendMsg, KErrCancel);
+				iSendQueue->RemoveAndDestroy(*msg);
+				if (first)
+					{
+					ASSERT_DEBUG(iSendNextCallBack);
+					iSendNextCallBack->Cancel();
+					}
+				break;
+				}
+			first = EFalse;
+			}
+		}
+	
+	CompleteClient(aMessage, KErrNone);
+	}
+
+void CRemConSession::Receive(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Messages are pushed from bearers, so we 
+	// (a) do some sanity checking, 
+	// (b) check the queue of incoming messages in case there's anything 
+	// already waiting to be given to the client.
+
+	if ( iReceiveMsg.Handle() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicReceiveAlreadyOutstanding);
+		return;
+		}
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	iReceiveMsg = aMessage;
+
+	DoReceive();
+	}
+
+void CRemConSession::ReceiveCancel(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	// See comments in ConnectBearerCancel.
+	if ( iReceiveMsg.Handle() )
+		{
+		CompleteClient(iReceiveMsg, KErrCancel);
+		}
+	CompleteClient(aMessage, KErrNone);
+	}
+
+void CRemConSession::GetConnectionCount(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	// Get the answer to the question- the number of connections at the 
+	// current point in time (i.e. the latest entry in the connection 
+	// history).
+	const TUint connCount = iServer.Connections().Count();
+	LOG1(_L("\tconnCount = %d"), connCount);
+	TPckg<TUint> count(connCount);
+	TInt err = aMessage.Write(0, count);
+
+	// If the client was told the answer with no error, then remember the 
+	// current point in the connection history, so that when the client asks 
+	// for the connections themselves, we give them a consistent answer.
+	if ( err == KErrNone )
+		{
+		iServer.SetConnectionHistoryPointer(Id());
+		iInGetConnectionsProcedure = ETrue;
+		}
+	CompleteClient(aMessage, err);
+	}
+
+void CRemConSession::GetConnections(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	iInGetConnectionsProcedure = EFalse;
+
+	// Get the array of connections at the point in the history we're 
+	// interested in and write it back to the client. NB This is not 
+	// necessarily the Last item in the history but the item that we were 
+	// pointing at when GetConnectionCount was called.
+	const CConnections& conns = iServer.Connections(iId);
+	const TUint count = conns.Count();
+	LOG1(_L("\tcount = %d"), count);
+	RBuf8 buf;
+	TInt err = buf.Create(count * sizeof(TRemConAddress));
+	if ( err == KErrNone )
+		{
+		TSglQueIter<TRemConAddress>& iter = conns.SetToFirst();
+		TRemConAddress* addr;
+		while ( ( addr = iter++ ) != NULL )
+			{
+			buf.Append((TUint8*)addr, sizeof(TRemConAddress));
+			}
+
+		// Write back to the client...
+		err = aMessage.Write(0, buf);
+		buf.Close();
+		if ( err != KErrNone )
+			{
+			// We don't need to call SetConnectionHistoryPointer here because 
+			// the server will do it when it cleans up the panicked client.
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+			return;
+			}	   		
+		}
+
+	// Whether or not there was an error, we're no longer interested in the 
+	// history item we're currently registered as being interested in, so tell 
+	// the server to bump up our pointer to the current (latest) one. NB This 
+	// may in fact be the same record, if no connection changes have occurred 
+	// since GetConnectionCount was called, but it's still important to give 
+	// the server a chance to remove obsolete history records.
+	iServer.SetConnectionHistoryPointer(Id());
+	CompleteClient(aMessage, err);
+	}
+
+void CRemConSession::NotifyConnectionsChange(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Messages are pushed to us from bearers, so we don't need anything more 
+	// than some sanity checking here.
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( iNotifyConnectionsChangeMsg.Handle() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicConnectionsNotificationAlreadyOutstanding);
+		}
+	else
+		{
+		iNotifyConnectionsChangeMsg = aMessage;
+		// Check the connection history for any more recent items than that we 
+		// currently know about. If our pointer into the connection history 
+		// isn't pointing at the 'current' item, we can complete the 
+		// notification immediately and move the pointer up.
+		if ( !iServer.ConnectionHistoryPointerAtLatest(Id()) )
+			{
+			CompleteClient(iNotifyConnectionsChangeMsg, KErrNone);
+			iServer.SetConnectionHistoryPointer(Id());
+			}
+		}
+	}
+
+void CRemConSession::NotifyConnectionsChangeCancel(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	// See comments in ConnectBearerCancel.
+	if ( iNotifyConnectionsChangeMsg.Handle() )
+		{
+		CompleteClient(iNotifyConnectionsChangeMsg, KErrCancel);
+		}
+	CompleteClient(aMessage, KErrNone);
+	}
+
+CRemConInterfaceDetailsArray* CRemConSession::ExtractInterestedAPIsL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	
+	CRemConInterfaceDetailsArray* result;
+	
+	RBuf8 buf;
+	buf.CreateL(aMessage.GetDesLengthL(0));
+	CleanupClosePushL(buf);
+	
+	aMessage.ReadL(0, buf);
+	RDesReadStream ipcStream(buf);
+	
+	result = CRemConInterfaceDetailsArray::InternalizeL(ipcStream);
+	
+	ipcStream.Close(); 
+	CleanupStack::PopAndDestroy(&buf);
+	
+	return result;
+	}
+
+TBool CRemConSession::DoGetSendInfoLC(const RMessage2& aMessage, 
+		TUid& aInterfaceUid,
+		TUint& aOperationId,
+		TRemConMessageSubType& aMessageSubType,
+		RBuf8& aSendDes)
+	{
+	// Get the data the client wants to send.
+	aInterfaceUid = TUid::Uid(aMessage.Int0());
+	LOG1(_L("\taInterfaceUid = 0x%08x"), aInterfaceUid);
+
+	if (aMessage.GetDesLengthL(1) != sizeof(TOperationInformation))
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+		return EFalse;
+		}
+
+	TPckgBuf<TOperationInformation> opInfoPckg;
+	
+	TInt err= aMessage.Read(
+			1, // location of the descriptor in the client's message (as we expect them to have set it up)
+			opInfoPckg, // descriptor to write to from client memory space
+			0 // offset into our descriptor to put the client's data
+			);
+	
+	if ( err != KErrNone )
+		{
+		LOG1(_L("\taMessage.Read = %d"), err);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+		return EFalse;
+		}	
+	
+	aOperationId = opInfoPckg().iOperationId;
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	
+	aMessageSubType = opInfoPckg().iMessageSubType;
+	LOG1(_L("\taMessageSubType = 0x%02x"), aMessageSubType);
+
+	const TUint dataLength = (TUint)aMessage.GetDesLengthL(3);
+	LOG1(_L("\tdataLength = %d"), dataLength);
+	
+	// If the client wanted to send some operation-associated data, read it 
+	// from them.
+	if ( dataLength != 0 )
+		{
+		aSendDes.CreateL(dataLength);
+		TInt err = aMessage.Read(
+			3, // location of the descriptor in the client's message (as we expect them to have set it up)
+			aSendDes, // descriptor to write to from client memory space
+			0 // offset into our descriptor to put the client's data
+			);
+		// NB We don't do LEAVEIFERRORL(aMessage.Read) because a bad client 
+		// descriptor is a panicking offence for them, not an 'error the 
+		// request' offence.
+		if ( err != KErrNone )
+			{
+			LOG1(_L("\taMessage.Read = %d"), err);
+			aSendDes.Close();
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+			return EFalse;
+			}
+		}
+	CleanupClosePushL(aSendDes);
+	return ETrue;
+	}
+
+void CRemConSession::GoConnectionOriented(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
+
+void CRemConSession::GoConnectionless(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
+
+void CRemConSession::ConnectBearer(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
+
+void CRemConSession::ConnectBearerCancel(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
+
+void CRemConSession::DisconnectBearer(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
+
+void CRemConSession::DisconnectBearerCancel(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
+
+void CRemConSession::SendNotify(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
+
+void CRemConSession::ConnectionsChanged()
+	{
+	LOG_FUNC;
+	
+	LOG1(_L("\tiInGetConnectionsProcedure = %d"), iInGetConnectionsProcedure);
+	// Only update the connections history pointer if we're not in the middle 
+	// of a 'GetConnections' procedure. 
+	if ( !iInGetConnectionsProcedure )
+		{
+		iServer.SetConnectionHistoryPointer(Id());
+		}
+	LOG1(_L("\tiNotifyConnectionsChangeMsg.Handle = %d"), iNotifyConnectionsChangeMsg.Handle());
+	if ( iNotifyConnectionsChangeMsg.Handle() )
+		{
+		CompleteClient(iNotifyConnectionsChangeMsg, KErrNone);
+		}
+	}
+
+void CRemConSession::CompleteSend()
+	{
+	LOG_FUNC;
+	LOG2(_L("\tiNumRemotes = %d, iSendError = %d"), iNumRemotes, iSendError);
+
+	ASSERT_DEBUG(NumRemotesToTry() == 0);
+	
+	if (iSending == ESendingReliable)
+		{
+		if ( iSendError == KErrNone )
+			{
+			TPckg<TUint> count(iNumRemotes);
+			// 2 is the slot in the client's message for the number of remotes the 
+			// message got sent to.
+			iSendError = iSendMsg.Write(2, count);
+			}
+		CompleteClient(iSendMsg, iSendError);
+		}
+	
+	ASSERT_DEBUG(iSendQueue);
+	if (!iSendQueue->IsEmpty())
+		{
+		ASSERT_DEBUG(iSendNextCallBack);
+		iSendNextCallBack->CallBack();
+		}
+	iSending = ENotSending;
+	}
+
+void CRemConSession::CompleteSendNotify()
+	{
+	LOG_FUNC;
+	LOG1(_L("\tiSendError = %d"), iSendError);
+
+	if (iSending == ESendingReliable)
+		{
+		CompleteClient(iSendMsg, iSendError);
+		}
+
+	ASSERT_DEBUG(iSendQueue);
+	if (!iSendQueue->IsEmpty())
+		{
+		ASSERT_DEBUG(iSendNextCallBack);
+		iSendNextCallBack->CallBack();
+		}
+	iSending = ENotSending;
+	}
+
+void CRemConSession::PanicSend(TRemConClientPanic aCode)
+	{
+	LOG_FUNC;
+	LOG1(_L("\taCode = %d"), aCode);
+
+	PANIC_MSG(iSendMsg, KRemConClientPanicCat, aCode);
+	}
+
+TInt CRemConSession::WriteMessageToClient(const CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(SupportedMessage(aMsg));
+	ASSERT_DEBUG(iReceiveMsg.Handle());
+	TRAPD(err, WriteMessageToClientL(aMsg));
+	CompleteClient(iReceiveMsg, err);
+
+	LOG1(_L("\terr = %d"), err);
+	return err;
+	}
+	
+void CRemConSession::WriteMessageToClientL(const CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	
+	//check if our client is interested in this API
+	//Only need to check commands because it is safe to assume that we are interested 
+	//in the response if we have sent out a command.
+	if(aMsg.MsgType() == ERemConCommand && !FindInterfaceByUid(aMsg.InterfaceUid()))
+		{
+		//The server will clean up the resource allocated for this msg
+		LEAVEL(KErrArgument);
+		}
+
+	// This logging code left in for maintenance.
+	//LOG1(_L("\t\tOperationData = \"%S\""), &aMsg.OperationData());
+	
+	TRemConClientReceivePackage receivePackage;
+	receivePackage.iInterfaceUid = aMsg.InterfaceUid();
+	receivePackage.iOperationId = aMsg.OperationId();
+	receivePackage.iMessageSubType = aMsg.MsgSubType();
+	receivePackage.iRemoteAddress = aMsg.Addr();
+	
+	TPckgC<TRemConClientReceivePackage> recPckg(receivePackage);
+	LEAVEIFERRORL(iReceiveMsg.Write(0, recPckg));
+	
+	// Note that we do not panic the client if their descriptor is not 
+	// big enough to hold the operation-specific data. If we did, then 
+	// a buggy remote could take down a client of RemCon. Just error 
+	// the client instead.
+	LEAVEIFERRORL(iReceiveMsg.Write(1, aMsg.OperationData()));
+	}
+
+TInt CRemConSession::SupportedInterfaces(RArray<TUid>& aUids)
+	{
+	LOG_FUNC;
+
+	aUids.Reset();
+	return AppendSupportedInterfaces(aUids);
+	}
+
+TInt CRemConSession::AppendSupportedInterfaces(RArray<TUid>& aUids)
+	{
+	LOG_FUNC;
+	ASSERT_DEBUG(iInterestedAPIs);
+	TInt err = KErrNone;
+
+	TInt count = iInterestedAPIs->Array().Count();
+	for(TInt i=0; (i<count) && (err == KErrNone); i++)
+		{
+		CRemConInterfaceDetails* details = iInterestedAPIs->Array()[i];
+		ASSERT_DEBUG(details);
+		err = aUids.Append(details->Uid());
+		}
+	
+	return err;
+	}
+
+TInt CRemConSession::SupportedBulkInterfaces(RArray<TUid>& aUids)
+	{
+	LOG_FUNC;
+
+    	aUids.Reset();
+	return AppendSupportedBulkInterfaces(aUids);
+	}
+
+TInt CRemConSession::AppendSupportedBulkInterfaces(RArray<TUid>& aUids)
+	{
+	LOG_FUNC;
+	ASSERT_DEBUG(iInterestedAPIs);
+	TInt err = KErrNone;
+
+	TInt count = iInterestedAPIs->Array().Count();
+	for(TInt i=0; (i<count) && (err == KErrNone); i++)
+		{
+		CRemConInterfaceDetails* details = iInterestedAPIs->Array()[i];
+		ASSERT_DEBUG(details);
+		if(details->IsBulk())
+			{
+			err = aUids.Append(details->Uid());
+			}
+		}
+
+	return err;
+	}
+
+TInt CRemConSession::SupportedOperations(TUid aInterfaceUid, RArray<TUint>& aOperations)
+	{
+	LOG_FUNC;
+	TInt err = KErrNotSupported;
+	CRemConInterfaceDetails* details = FindInterfaceByUid(aInterfaceUid);
+	
+	if(details)
+		{
+		TRAP(err, details->GetRemConInterfaceFeaturesL(aOperations));
+		}
+	return err;
+	}
+
+CRemConInterfaceDetails* CRemConSession::FindInterfaceByUid(TUid aUid) const
+	{
+	LOG_FUNC;
+	ASSERT_DEBUG(iInterestedAPIs);
+	TInt count = iInterestedAPIs->Array().Count();
+	for(TInt ix=0; ix<count; ++ix)
+		{
+		CRemConInterfaceDetails* details = iInterestedAPIs->Array()[ix];
+		ASSERT_DEBUG(details);
+		if(details->Uid() == aUid)
+			{
+			return details;
+			}
+		}
+	return NULL;
+	}
+
+void CRemConSession::DoSendNext()
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(iSendQueue);
+	CRemConMessage& msg = iSendQueue->First();
+	iSendQueue->Remove(msg);
+	SendToServer(msg);
+	}
+
+TInt CRemConSession::SendNextCb(TAny *aThis)
+	{
+	LOG_STATIC_FUNC;
+
+	static_cast<CRemConSession*>(aThis)->DoSendNext();
+	return KErrNone;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/targetclientprocess.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,459 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server-side representation of a target client, which may have multiple 
+// sessions associated with it.
+// 
+
+
+#include <e32base.h>
+#include <bluetooth/logger.h>
+
+#include "server.h"
+#include "bearermanager.h"
+#include "remconmessage.h"
+#include "targetsession.h"
+
+#include "targetclientprocess.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("tgclient");
+#endif
+
+TBool TargetSessionCompareUsingSupportedInterface(const TUid* aInterfaceUid, const CRemConTargetSession& aSession)
+	{
+	return aSession.InterfaceSupported(*aInterfaceUid);
+	}
+
+TBool TargetSessionCompareUsingSupportedMessage(const CRemConMessage* aMessage, const CRemConTargetSession& aSession)
+	{
+	return aSession.SupportedMessage(*aMessage);
+	}
+
+CRemConTargetClientProcess* CRemConTargetClientProcess::NewLC(TClientInfo& aClientInfo, TRemConClientId aClientId, CRemConServer& aServer, CBearerManager& aBearerManager)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConTargetClientProcess* result = new (ELeave) CRemConTargetClientProcess(aClientInfo, aClientId, aServer, aBearerManager);
+	CleanupStack::PushL(result);
+	return result;
+	}
+
+CRemConTargetClientProcess::CRemConTargetClientProcess(TClientInfo& aClientInfo, TRemConClientId aClientId, CRemConServer& aServer, CBearerManager& aBearerManager)
+	: iClientInfo(aClientInfo),
+	iClientId(aClientId),
+	iServer(aServer),
+	iBearerManager(aBearerManager),
+	iPlayerInfoSet(EFalse),
+	iTargetSessions(KMaxNumberTargetSessions)
+	{
+	LOG_FUNC
+	}
+
+CRemConTargetClientProcess::~CRemConTargetClientProcess()
+	{
+	LOG_FUNC
+
+	iPlayerName.Close();
+	iTargetSessions.Close();
+	iServer.TargetClientClosed(*this);
+	}
+
+CRemConTargetSession* CRemConTargetClientProcess::NewSessionL(TUint aSessionId)
+	{
+	LOG_FUNC
+	CRemConTargetSession* sess = NULL;
+
+	// Only create a session if we havent reached our maximum.
+	if (TargetSessionCount() < KMaxNumberTargetSessions)
+		{
+		sess = CRemConTargetSession::NewL(*this, iServer, iBearerManager, aSessionId);
+		}
+	else
+		{
+		LEAVEIFERRORL(KErrOverflow);
+		}
+
+	return sess;
+	}
+
+
+TInt CRemConTargetClientProcess::TargetSessionOpened(CRemConTargetSession& aSession)
+	{
+	LOG_FUNC
+	LOG1(_L("\t&aSession = 0x%08x"), &aSession)
+
+	// Register the session by appending it to our array and asking the server to
+	// make an item for it in the record of which points in the connection history 
+	// sessions are interested in.
+	ASSERT(iTargetSessions.Count() < KMaxNumberTargetSessions);	// Should have been caught by now.
+
+	// The append should never fail because the RPointerArray was constructed with a granularity of 
+	// KMaxNumberTargetSessions items.
+#ifdef _DEBUG	
+	TInt err = iTargetSessions.Append(&aSession);
+	ASSERT(err == KErrNone);
+#else
+	static_cast<void>(iTargetSessions.Append(&aSession));
+#endif
+
+	TInt ret = iServer.RegisterTargetSessionPointerToConnHistory(aSession);
+			
+	if ( ret != KErrNone )
+		{
+		iTargetSessions.Remove(iTargetSessions.Count() - 1);
+		}
+	else
+		{
+		// Session successfully registered.
+		iServer.CancelShutdownTimer();
+		}
+	
+	LOG1(_L("\tret = %d"), ret)
+	return ret;
+	}
+
+void CRemConTargetClientProcess::TargetSessionClosed(CRemConTargetSession& aSession)
+	{
+	LOG_FUNC
+	LOG1(_L("\t&aSession = 0x%08x"), &aSession)
+
+	// Remove session from our list
+	TInt sessionIndex = iTargetSessions.Find(&aSession);
+
+	if (sessionIndex > KErrNotFound)
+		{
+		iTargetSessions.Remove(sessionIndex);
+
+		// Inform server that session has dropped. 			
+		iServer.TargetSessionClosed(*this, aSession);
+		
+		if (iTargetSessions.Count() > 0)
+		    {
+            iServer.TargetFeaturesUpdated(*this);
+		    }
+		
+		}
+	}
+
+void CRemConTargetClientProcess::SetPlayerInformationL(const TPlayerTypeInformation& aPlayerType, const TDesC8& aPlayerName)
+	{
+	LOG_FUNC
+	ASSERT_DEBUG(!HasPlayerInformation());
+
+	if (!HasPlayerInformation())
+		{
+		iPlayerName.CreateL(aPlayerName);
+		iPlayerType = aPlayerType;
+		iPlayerInfoSet = ETrue;
+		}
+	}
+
+void CRemConTargetClientProcess::InterfacesRegistered()
+	{
+	LOG_FUNC
+
+	// If this client has not been made available yet, do so now.
+	// Otherwise, notify the server that new interfaces have been registered. 
+	if (!iClientAvailable)
+		{
+		iServer.TargetClientAvailable(*this);	
+		iClientAvailable = ETrue;
+		}
+	else
+		{
+		iServer.TargetFeaturesUpdated(*this);
+		}
+
+	}
+
+TBool CRemConTargetClientProcess::IsInterfaceTypeRegisteredByAnotherSession(CRemConTargetSession& aSession, TUid aInterfaceUid) const
+	{
+	LOG_FUNC
+
+	TUint sessionCount = iTargetSessions.Count();
+	for (TUint i=0; i < sessionCount; ++i)
+		{
+		if (aSession.Id() != iTargetSessions[i]->Id())
+			{
+			if (iTargetSessions[i]->InterfaceSupported(aInterfaceUid))
+				{
+				return ETrue;
+				}
+			}
+		}
+
+	return EFalse;
+	}
+
+TInt CRemConTargetClientProcess::ReceiveMessage(CRemConMessage& aMessage)
+	{
+	LOG_FUNC
+
+	// Find the session supporting this message
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+
+	if (sess)
+		{
+		// Session found. Check session is able to handle this message.
+		if (sess->CurrentReceiveMessage().Handle())
+			{
+			// Pass message to session and return the error code obtained.
+			return sess->WriteMessageToClient(aMessage);
+			}
+		else
+			{
+			// Session not able to handle message at this time.
+			return KErrNotReady;
+			}
+		}
+	else
+		{
+		// No session supports this message
+		return KErrArgument;
+		}
+	}
+
+void CRemConTargetClientProcess::ConnectionsChanged()
+	{
+	LOG_FUNC
+
+	// Notify each session
+	TUint sessionCount = iTargetSessions.Count();
+	for (TUint i = 0; i < sessionCount; ++i)
+		{
+		iTargetSessions[i]->ConnectionsChanged();
+		}
+	}
+
+TInt CRemConTargetClientProcess::SupportedInterfaces(RArray<TUid>& aUids)
+	{
+	LOG_FUNC
+	
+	TInt err = KErrNone;
+	aUids.Reset();
+
+	// Gather the list of supported interfaces from each session.
+	TUint sessionCount = iTargetSessions.Count();
+	for (TUint i = 0 ; i < sessionCount && err == KErrNone; ++i)
+		{
+		err = iTargetSessions[i]->AppendSupportedInterfaces(aUids);
+		}
+
+	return err;
+	}
+
+TInt CRemConTargetClientProcess::SupportedBulkInterfaces(RArray<TUid>& aUids)
+	{
+	LOG_FUNC
+	
+	TInt err = KErrNone;
+	aUids.Reset();
+
+	// Gather the list of supported bulk interfaces from each session.
+	TUint sessionCount = iTargetSessions.Count();
+	for (TUint i = 0 ; i < sessionCount && err == KErrNone; ++i)
+		{
+		err = iTargetSessions[i]->AppendSupportedBulkInterfaces(aUids);
+		}
+
+	return err;
+	}
+
+TInt CRemConTargetClientProcess::SupportedOperations(TUid aInterfaceUid, RArray<TUint>& aOperations)
+	{
+	LOG_FUNC
+
+	// Find the session supporting this interface.
+	TInt sessIndex = FindSessionForInterface(aInterfaceUid);
+
+	if (sessIndex >= KErrNone)
+		{
+		return iTargetSessions[sessIndex]->SupportedOperations(aInterfaceUid, aOperations);
+		}
+	else
+		{
+		// Interface not found, so operation not supported.
+		return KErrNotSupported;
+		}
+	}
+
+CRemConTargetSession* CRemConTargetClientProcess::FindSessionForMessage(const CRemConMessage& aMessage)
+	{
+	LOG_FUNC
+
+	TInt result = iTargetSessions.Find(aMessage, TargetSessionCompareUsingSupportedMessage);
+	if (result >= KErrNone)
+		{
+		return iTargetSessions[result];
+		}
+	else
+		{
+		return NULL;
+		}
+
+	}
+
+TInt CRemConTargetClientProcess::FindSessionForInterface(TUid aInterfaceUid) const
+	{
+	LOG_FUNC
+
+	return iTargetSessions.Find(aInterfaceUid, TargetSessionCompareUsingSupportedInterface);
+	}
+
+void CRemConTargetClientProcess::CompleteMessageForSession(const CRemConMessage& aMessage, CRemConTargetSession& aSession)
+	{
+	LOG_FUNC
+
+	// Targets can only send responses or rejects.
+	switch (aMessage.MsgType())
+		{
+	case ERemConResponse:
+	case ERemConReject:
+		aSession.CompleteSend();
+		break;
+	default:
+		ASSERT_DEBUG(EFalse);
+		break;
+		}
+
+	}
+
+void CRemConTargetClientProcess::MrcmsoMessageSendResult(const CRemConMessage& /*aMessage*/, TInt /*aError*/)
+	{
+	LOG_FUNC
+	
+	// This method should never be called, as it is not required to support target client processes.
+	ASSERT_DEBUG(EFalse);
+	}
+
+void CRemConTargetClientProcess::MrcmsoMessageSendOneOrMoreAttempt(const CRemConMessage& aMessage, TUint aNumRemotes)
+	{
+	LOG_FUNC
+
+	// Notifications should not be received for reject messages, as the client did not request these be sent.
+	ASSERT_DEBUG(aMessage.MsgType() != ERemConReject);
+	
+	// Find session and notify
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+	ASSERT_DEBUG(sess);
+	
+	// Session should not already be sending a message to n remotes
+	ASSERT_DEBUG(sess->NumRemotesToTry() == 0);
+
+	sess->NumRemotes() = 0;
+	sess->NumRemotesToTry() = aNumRemotes;
+	sess->SendError() = KErrNone;
+	}
+
+void CRemConTargetClientProcess::MrcmsoMessageSendOneOrMoreIncremental(const CRemConMessage& aMessage, TUint aNumRemotes)
+	{
+	LOG_FUNC
+
+	// Notifications should not be received for reject messages, as the client did not request these be sent.
+	ASSERT_DEBUG(aMessage.MsgType() != ERemConReject);
+	
+	// Find session and notify
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+	ASSERT_DEBUG(sess);
+
+	if (sess->NumRemotesToTry() == 0)
+		{
+		MrcmsoMessageSendOneOrMoreAttempt(aMessage,aNumRemotes);
+		}
+	else
+		{
+		// No send should have yet been attempted
+		ASSERT_DEBUG(sess->NumRemotes() == 0);
+
+		sess->NumRemotesToTry() += aNumRemotes;
+		}
+	}
+	
+void CRemConTargetClientProcess::MrcmsoMessageSendOneOrMoreAttemptFailed(const CRemConMessage& aMessage, TInt aError)
+	{
+	LOG_FUNC
+
+	// Notifications should not be received for reject messages, as the client did not request these be sent.
+	ASSERT_DEBUG(aMessage.MsgType() != ERemConReject);
+	
+	// Find session and notify
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+	ASSERT_DEBUG(sess);
+	
+	// Session should not already be sending a message to n remotes
+	ASSERT_DEBUG(sess->NumRemotesToTry() == 0);
+
+	sess->NumRemotes() = 0;
+	sess->SendError() = aError;
+	CompleteMessageForSession(aMessage, *sess);
+	}
+
+void CRemConTargetClientProcess::MrcmsoMessageSendOneOrMoreResult(const CRemConMessage& aMessage, TInt aError)
+	{
+	LOG_FUNC
+
+	// Notifications should not be received for reject messages, as the client did not request these be sent.
+	ASSERT_DEBUG(aMessage.MsgType() != ERemConReject);
+	
+	// Find session and notify
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+	ASSERT_DEBUG(sess);
+	
+	// Ignore notification if client has been completed
+	if (sess->NumRemotesToTry() > 0)
+		{
+		// Only set error if different from KErrNone
+		if (aError == KErrNone)
+			{
+			++sess->NumRemotes();
+			}
+		else
+			{
+			sess->SendError() = aError;
+			}
+
+		--sess->NumRemotesToTry();
+		if (sess->NumRemotesToTry() == 0)
+			{
+			CompleteMessageForSession(aMessage, *sess);
+			}
+		}
+	}
+
+void CRemConTargetClientProcess::MrcmsoMessageSendOneOrMoreAbandoned(const CRemConMessage& aMessage)
+	{
+	LOG_FUNC
+	
+	// Notifications should not be received for reject messages, as the client did not request these be sent.
+	ASSERT_DEBUG(aMessage.MsgType() != ERemConReject);
+
+	// Find session and notify
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+	ASSERT_DEBUG(sess);
+	
+	// Ignore notification if client has been completed
+	if (sess->NumRemotesToTry() > 0)
+		{
+		// Do not adjust NumRemotes() as the message was not sent (but we still don't error the client!)
+		--sess->NumRemotesToTry();
+		if (sess->NumRemotesToTry() == 0)
+			{
+			CompleteMessageForSession(aMessage, *sess);
+			}
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/targetsession.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,331 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <bluetooth/logger.h>
+#include <remcon/remconifdetails.h>
+#include "messagequeue.h"
+#include "remconmessage.h"
+#include "remconserver.h"
+#include "server.h"
+#include "targetsession.h"
+#include "utils.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("tgsession");
+#endif
+
+CRemConTargetSession* CRemConTargetSession::NewL(CRemConTargetClientProcess& aClientProcess,
+	CRemConServer& aServer,
+	CBearerManager& aBearerManager,
+	TUint aId)
+	{
+	LOG_STATIC_FUNC;
+	CRemConTargetSession* self = new(ELeave) CRemConTargetSession(aClientProcess, aServer, aBearerManager, aId);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CLEANUPSTACK_POP1(self);
+	return self;
+	}
+
+CRemConTargetSession::~CRemConTargetSession()
+	{
+	LOG_FUNC;
+
+	// Tell the client process representation we've gone away- it may start its shutdown timer.
+	iClientProcess.TargetSessionClosed(*this);
+	}
+
+CRemConTargetSession::CRemConTargetSession(CRemConTargetClientProcess& aClientProcess,
+	CRemConServer& aServer, 
+	CBearerManager& aBearerManager,
+	TUint aId)
+	: CRemConSession(aServer, aBearerManager, aId),
+	iClientProcess(aClientProcess)
+	{
+	LOG_FUNC;
+	}
+
+void CRemConTargetSession::ConstructL()
+	{
+	LOG_FUNC;
+
+	BaseConstructL(iClientProcess.ClientInfo());
+
+	// Tell the client process representation about us (this will in turn inform the server).
+	LEAVEIFERRORL(iClientProcess.TargetSessionOpened(*this));
+	
+	// Set our pointer into the connection history at the current/'Last' item.
+	// Can't do this til we've told the server we exist
+	iServer.SetConnectionHistoryPointer(Id());
+	}
+
+TBool CRemConTargetSession::SupportedMessage(const CRemConMessage& aMsg) const
+	{
+	LOG_FUNC;
+
+	// Return true if the message is for an interface supported by this session
+	return InterfaceSupported(aMsg.InterfaceUid());
+	}
+
+TBool CRemConTargetSession::InterfaceSupported(TUid aInterfaceUid) const
+	{
+	LOG_FUNC;
+	LOG2(_L("\taInterfaceUid = 0x%08x, iInterestedAPIs = %d"), aInterfaceUid, iInterestedAPIs);
+
+	TBool result = iInterestedAPIs ? (FindInterfaceByUid(aInterfaceUid) != NULL) : EFalse;
+
+	LOG1(_L("result = %d"), result);
+	return result;
+	}
+
+void CRemConTargetSession::SetPlayerType(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	
+	TInt err = aMessage.GetDesLength(1);
+	if (err >= 0)
+		{
+		TPlayerTypeInformation playerType;
+		RBuf8 playerName;
+	
+		TRAP(err, GetPlayerTypeAndNameL(aMessage, playerType, playerName));
+
+		if (err == KErrBadDescriptor)
+			{
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+			playerName.Close();
+			return;
+			}
+		else if (err == KErrArgument)
+			{
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
+			playerName.Close();
+			return;			
+			}
+		else if (err == KErrNone)
+			{
+			// If player type is not set, then update iClientProcess with information.
+			// If player type is already set, then dont allow this to be changed for the client (panic the client if the information is different).
+			if (!iClientProcess.HasPlayerInformation())
+				{
+				TRAP(err, iClientProcess.SetPlayerInformationL(playerType, playerName));
+				}
+			else if (!iClientProcess.PlayerInformationMatches(playerType, playerName))
+				{
+				PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicPlayerInfoAlreadySet);
+				playerName.Close();
+				return;
+				}
+			}
+
+		playerName.Close();
+		}
+	else if (err == KErrBadDescriptor)
+		{	
+		// The additional parameters are optional (i.e. old target clients won't provide them).
+		err = KErrNone;
+		}
+	
+	CompleteClient(aMessage, err);
+	}
+
+CRemConMessage* CRemConTargetSession::DoPrepareSendMessageL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Get the data the client wants to send.
+	TUid interfaceUid;
+	TUint operationId;
+
+	TRemConMessageSubType messageSubType;
+	RBuf8 sendDes;
+	if (!DoGetSendInfoLC(aMessage, interfaceUid, operationId, messageSubType, sendDes))
+		{
+		// DoGetSendInfoLC() panicked the message
+		return NULL;	
+		}
+
+	CRemConMessage* msg = NULL;
+	
+	LOG(_L("\tTARGET send"));
+
+	msg = CRemConMessage::NewL(
+		TRemConAddress(), // we don't know which remotes it's going to yet
+		ERemConResponse, // targets can only send responses
+		messageSubType,
+		interfaceUid,
+		operationId,
+		sendDes, // msg takes ownership
+		iClientProcess.Id(), // session id to match this response against the originating command
+		0, // transaction id not yet known
+		ETrue);
+	CLEANUPSTACK_POP1(&sendDes); // now owned by msg
+	
+	return msg;
+	}
+
+void CRemConTargetSession::SendUnreliable(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	CRemConMessage* msg = NULL;
+	TRAPD(err, msg = DoCreateUnreliableMessageL(aMessage));
+	CompleteClient(aMessage, err);
+	if (err == KErrNone)
+		{
+		ASSERT_DEBUG(iSendQueue);
+		if (iSending || !iSendQueue->IsEmpty())
+			{
+			iSendQueue->Append(*msg);
+			}
+		else
+			{
+			SendToServer(*msg);
+			}
+		}
+	}
+
+CRemConMessage* CRemConTargetSession::DoCreateUnreliableMessageL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Get the data the client wants to send.
+	TUid interfaceUid;
+	TUint operationId;
+	TRemConMessageSubType messageSubType;
+	RBuf8 sendDes;
+	DoGetSendInfoLC(aMessage, interfaceUid, operationId, messageSubType, sendDes);
+
+	// Before we ask the server to send, we must set our ClientInfo 
+	// correctly so the TSP can get information about the client. 
+	iClientInfo.Message() = aMessage;
+
+	CRemConMessage* msg = NULL;
+	
+	LOG(_L("\tTARGET send"));
+
+	msg = CRemConMessage::NewL(
+		TRemConAddress(), // we don't know which remotes it's going to yet
+		ERemConResponse, // targets can only send responses
+		messageSubType,
+		interfaceUid,
+		operationId,
+		sendDes, // msg takes ownership
+		iClientProcess.Id(), // session id to match this response against the originating command
+		0, // transaction id not yet known
+		EFalse);
+	CLEANUPSTACK_POP1(&sendDes); // now owned by msg
+
+	return msg;
+	}
+
+void CRemConTargetSession::DoSendCancel()
+	{
+	LOG_FUNC;
+
+	// We do not cancel any pending response messages, so don't need
+	// to notify the server here.
+
+	NumRemotesToTry() = 0;
+	iSendError = KErrCancel;
+	CompleteSend();
+	}
+
+void CRemConTargetSession::RegisterInterestedAPIs(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	
+	// Check we haven't had our features set yet
+	if (ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	CRemConInterfaceDetailsArray* interfaces = NULL;
+	TRAPD(err, interfaces = ExtractInterestedAPIsL(aMessage));
+	
+	if(err == KErrNone)
+		{
+		// Ensure that none of these interfaces have already been registered by the client.
+		// Also note if bulk server is required.
+		TInt count = interfaces->Array().Count();
+		TBool bulkServerRequired = EFalse;
+		for (TInt ix=0; ix < count; ++ix)
+			{
+			CRemConInterfaceDetails* details = interfaces->Array()[ix];
+			ASSERT_DEBUG(details);
+			if (iClientProcess.IsInterfaceTypeRegisteredByAnotherSession(*this, details->Uid()))
+				{
+				// Destroy new interfaces and panic client.
+				delete interfaces;
+				PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientInterfaceAlreadyRegistered);
+				return;
+				}
+			else if (details->IsBulk())
+				{
+				bulkServerRequired = ETrue;
+				}
+			}
+	
+		// Interfaces are OK, notify server if bulk server is required.
+		iInterestedAPIs = interfaces;
+		iClientProcess.InterfacesRegistered();
+		if (bulkServerRequired)
+			{
+			iServer.BulkServerRequired();
+			}
+		}
+	else
+		{
+		ASSERT_DEBUG(interfaces == NULL);
+		}
+	
+	CompleteClient(aMessage, err);
+	}
+
+void CRemConTargetSession::SendToServer(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	
+	// Set our completion members.
+	NumRemotes() = 0;
+	NumRemotesToTry() = 0;
+	SendError() = KErrNone;
+
+	
+	iSending = (aMsg.IsReliableSend()) ? ESendingReliable: ESendingUnreliable;
+
+	iServer.SendResponse(aMsg, iClientProcess);
+	}
+
+void CRemConTargetSession::DoReceive()
+	{
+	// Request messages from the server on behalf of the client.
+	// If there's anything waiting to be given to us, iClientProcess will call 
+	// back to us with it.
+	iServer.ReceiveRequest(iClientProcess);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/server/src/tspv4stub.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,57 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <remcon/remcontargetselectorpluginobserver.h>
+#include "tspv4stub.h"
+#include "utils.h"
+
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+TTspV4Stub::TTspV4Stub(MRemConTargetSelectorPluginObserver& aObserver)
+	: iObserver(aObserver)
+	{
+	LOG_FUNC
+	}
+
+void TTspV4Stub::PermitIncomingCommand(
+	TUid /*aInterfaceUid*/,
+	TUint /*aOperationId*/, 
+	const TClientInfo& /*aClient*/)
+	{
+	LOG_FUNC
+	iObserver.IncomingCommandPermitted(ETrue);
+	}
+
+void TTspV4Stub::PermitIncomingNotify(
+	TUid /*aInterfaceUid*/,
+	TUint /*aOperationId*/, 
+	const TClientInfo& /*aClient*/)
+	{
+	LOG_FUNC
+	iObserver.IncomingNotifyPermitted(ETrue);
+	}
+
+void TTspV4Stub::SetRemoteAddressedClient(const TUid& /*aBearerUid*/, 
+		const TClientInfo& /*aClient*/)
+	{
+	LOG_FUNC
+	// Ignore this, we are stateless
+	}
+	
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/bwins/remcontargetselectorpluginU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,30 @@
+EXPORTS
+	??0CRemConTargetSelectorPlugin@@IAE@AAVMRemConTargetSelectorPluginObserver@@@Z @ 1 NONAME ; CRemConTargetSelectorPlugin::CRemConTargetSelectorPlugin(class MRemConTargetSelectorPluginObserver &)
+	??0TBearerSecurity@@QAE@VTUid@@ABVTSecurityPolicy@@@Z @ 2 NONAME ; TBearerSecurity::TBearerSecurity(class TUid, class TSecurityPolicy const &)
+	??0TClientInfo@@QAE@XZ @ 3 NONAME ; TClientInfo::TClientInfo(void)
+	??1CRemConTargetSelectorPlugin@@UAE@XZ @ 4 NONAME ; CRemConTargetSelectorPlugin::~CRemConTargetSelectorPlugin(void)
+	??1TBearerSecurity@@QAE@XZ @ 5 NONAME ; TBearerSecurity::~TBearerSecurity(void)
+	??1TClientInfo@@QAE@XZ @ 6 NONAME ; TClientInfo::~TClientInfo(void)
+	?BearerUid@TBearerSecurity@@QBE?AVTUid@@XZ @ 7 NONAME ; class TUid TBearerSecurity::BearerUid(void) const
+	?IncomingCommandAddressed@MRemConTargetSelectorPluginObserver@@QAEXH@Z @ 8 NONAME ; void MRemConTargetSelectorPluginObserver::IncomingCommandAddressed(int)
+	?Message@TClientInfo@@QAEAAVRMessage2@@XZ @ 9 NONAME ; class RMessage2 & TClientInfo::Message(void)
+	?Message@TClientInfo@@QBEABVRMessage2@@XZ @ 10 NONAME ; class RMessage2 const & TClientInfo::Message(void) const
+	?NewL@CRemConTargetSelectorPlugin@@SAPAV1@VTUid@@AAVMRemConTargetSelectorPluginObserver@@@Z @ 11 NONAME ; class CRemConTargetSelectorPlugin * CRemConTargetSelectorPlugin::NewL(class TUid, class MRemConTargetSelectorPluginObserver &)
+	?Observer@CRemConTargetSelectorPlugin@@IAEAAVMRemConTargetSelectorPluginObserver@@XZ @ 12 NONAME ; class MRemConTargetSelectorPluginObserver & CRemConTargetSelectorPlugin::Observer(void)
+	?OutgoingCommandAddressed@MRemConTargetSelectorPluginObserver@@QAEXH@Z @ 13 NONAME ; void MRemConTargetSelectorPluginObserver::OutgoingCommandAddressed(int)
+	?OutgoingCommandPermitted@MRemConTargetSelectorPluginObserver@@QAEXH@Z @ 14 NONAME ; void MRemConTargetSelectorPluginObserver::OutgoingCommandPermitted(int)
+	?ProcessId@TClientInfo@@QAEAAVTProcessId@@XZ @ 15 NONAME ; class TProcessId & TClientInfo::ProcessId(void)
+	?ProcessId@TClientInfo@@QBE?AVTProcessId@@XZ @ 16 NONAME ; class TProcessId TClientInfo::ProcessId(void) const
+	?SecureId@TClientInfo@@QAEAAVTSecureId@@XZ @ 17 NONAME ; class TSecureId & TClientInfo::SecureId(void)
+	?SecureId@TClientInfo@@QBE?AVTSecureId@@XZ @ 18 NONAME ; class TSecureId TClientInfo::SecureId(void) const
+	?SecurityPolicy@TBearerSecurity@@QBEABVTSecurityPolicy@@XZ @ 19 NONAME ; class TSecurityPolicy const & TBearerSecurity::SecurityPolicy(void) const
+	?GetConnections@MRemConTargetSelectorPluginObserver@@QAEHAAV?$TSglQue@VTRemConAddress@@@@@Z @ 20 NONAME ; int MRemConTargetSelectorPluginObserver::GetConnections(class TSglQue<class TRemConAddress> &)
+	?OutgoingResponsePermitted@MRemConTargetSelectorPluginObserver@@QAEXH@Z @ 21 NONAME ; void MRemConTargetSelectorPluginObserver::OutgoingResponsePermitted(int)
+	?IncomingNotifyAddressed@MRemConTargetSelectorPluginObserver@@QAEXPAVTClientInfo@@H@Z @ 22 NONAME ; void MRemConTargetSelectorPluginObserver::IncomingNotifyAddressed(class TClientInfo *, int)
+	?ReAddressNotifies@MRemConTargetSelectorPluginObserver@@QAEXXZ @ 23 NONAME ; void MRemConTargetSelectorPluginObserver::ReAddressNotifies(void)
+	?OutgoingNotifyCommandAddressed@MRemConTargetSelectorPluginObserver@@QAEXPAVTRemConAddress@@H@Z @ 24 NONAME ; void MRemConTargetSelectorPluginObserver::OutgoingNotifyCommandAddressed(class TRemConAddress *, int)
+	?OutgoingNotifyCommandPermitted@MRemConTargetSelectorPluginObserver@@QAEXH@Z @ 25 NONAME ; void MRemConTargetSelectorPluginObserver::OutgoingNotifyCommandPermitted(int)
+	?IncomingCommandPermitted@MRemConTargetSelectorPluginObserver@@QAEXH@Z @ 26 NONAME ; void MRemConTargetSelectorPluginObserver::IncomingCommandPermitted(int)
+	?IncomingNotifyPermitted@MRemConTargetSelectorPluginObserver@@QAEXH@Z @ 27 NONAME ; void MRemConTargetSelectorPluginObserver::IncomingNotifyPermitted(int)
+	?SetLocalAddressedClient@MRemConTargetSelectorPluginObserver@@QAEHABVTUid@@ABVTClientInfo@@@Z @ 28 NONAME ; int MRemConTargetSelectorPluginObserver::SetLocalAddressedClient(class TUid const &, class TClientInfo const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/eabi/remcontargetselectorpluginU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,38 @@
+EXPORTS
+	_ZN11TClientInfo7MessageEv @ 1 NONAME
+	_ZN11TClientInfo8SecureIdEv @ 2 NONAME
+	_ZN11TClientInfo9ProcessIdEv @ 3 NONAME
+	_ZN11TClientInfoC1Ev @ 4 NONAME
+	_ZN11TClientInfoC2Ev @ 5 NONAME
+	_ZN11TClientInfoD1Ev @ 6 NONAME
+	_ZN11TClientInfoD2Ev @ 7 NONAME
+	_ZN15TBearerSecurityC1E4TUidRK15TSecurityPolicy @ 8 NONAME
+	_ZN15TBearerSecurityC2E4TUidRK15TSecurityPolicy @ 9 NONAME
+	_ZN15TBearerSecurityD1Ev @ 10 NONAME
+	_ZN15TBearerSecurityD2Ev @ 11 NONAME
+	_ZN27CRemConTargetSelectorPlugin4NewLE4TUidR35MRemConTargetSelectorPluginObserver @ 12 NONAME
+	_ZN27CRemConTargetSelectorPlugin8ObserverEv @ 13 NONAME
+	_ZN27CRemConTargetSelectorPluginC2ER35MRemConTargetSelectorPluginObserver @ 14 NONAME
+	_ZN27CRemConTargetSelectorPluginD0Ev @ 15 NONAME
+	_ZN27CRemConTargetSelectorPluginD1Ev @ 16 NONAME
+	_ZN27CRemConTargetSelectorPluginD2Ev @ 17 NONAME
+	_ZN35MRemConTargetSelectorPluginObserver24IncomingCommandAddressedEi @ 18 NONAME
+	_ZN35MRemConTargetSelectorPluginObserver24OutgoingCommandAddressedEi @ 19 NONAME
+	_ZN35MRemConTargetSelectorPluginObserver24OutgoingCommandPermittedEi @ 20 NONAME
+	_ZNK11TClientInfo7MessageEv @ 21 NONAME
+	_ZNK11TClientInfo8SecureIdEv @ 22 NONAME
+	_ZNK11TClientInfo9ProcessIdEv @ 23 NONAME
+	_ZNK15TBearerSecurity14SecurityPolicyEv @ 24 NONAME
+	_ZNK15TBearerSecurity9BearerUidEv @ 25 NONAME
+	_ZTI27CRemConTargetSelectorPlugin @ 26 NONAME ; #<TI>#
+	_ZTV27CRemConTargetSelectorPlugin @ 27 NONAME ; #<VT>#
+	_ZN35MRemConTargetSelectorPluginObserver14GetConnectionsER7TSglQueI14TRemConAddressE @ 28 NONAME
+	_ZN35MRemConTargetSelectorPluginObserver25OutgoingResponsePermittedEi @ 29 NONAME
+	_ZN35MRemConTargetSelectorPluginObserver17ReAddressNotifiesEv @ 30 NONAME
+	_ZN35MRemConTargetSelectorPluginObserver23IncomingNotifyAddressedEP11TClientInfoi @ 31 NONAME
+	_ZN35MRemConTargetSelectorPluginObserver30OutgoingNotifyCommandAddressedEP14TRemConAddressi @ 32 NONAME
+	_ZN35MRemConTargetSelectorPluginObserver30OutgoingNotifyCommandPermittedEi @ 33 NONAME
+	_ZN35MRemConTargetSelectorPluginObserver23IncomingNotifyPermittedEi @ 34 NONAME
+	_ZN35MRemConTargetSelectorPluginObserver24IncomingCommandPermittedEi @ 35 NONAME
+	_ZN35MRemConTargetSelectorPluginObserver23SetLocalAddressedClientERK4TUidRK11TClientInfo @ 36 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remcontargetselectorplugin.mmp
+
+PRJ_EXPORTS
+../public/clientinfo.h				SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/clientinfo.h)
+../public/bearersecurity.h			SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/bearersecurity.h)
+../public/remcontargetselectorplugin.h		SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remcontargetselectorplugin.h)
+../public/remcontargetselectorplugininterface.h	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remcontargetselectorplugininterface.h)
+../public/remcontargetselectorpluginobserver.h	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remcontargetselectorpluginobserver.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/group/remcontargetselectorplugin.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,49 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remcontargetselectorplugin.dll Base DLL for Target Selector 
+// Plugins to RemCon.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconservercaps.mmh>
+
+TARGET			remcontargetselectorplugin.dll
+TARGETPATH		/system/libs
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			bearersecurity.cpp
+SOURCE			clientinfo.cpp
+SOURCE			targetselectorplugin.cpp
+SOURCE			targetselectorpluginobserver.cpp
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		ecom.lib
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/public/bearersecurity.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,70 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef BEARERSECURITY_H
+#define BEARERSECURITY_H
+
+#include <e32base.h>
+
+/**
+Wraps a bearer UID and the bearer's security policy.
+*/
+class TBearerSecurity
+	{
+public:
+	/** Link between elements of this type in a TSglQue. If this member 
+	changes offset, remconserver must be rebuilt. */
+	TSglQueLink iLink;
+
+public:
+	/** Constructor. */
+	IMPORT_C TBearerSecurity(TUid aUid, const TSecurityPolicy& aPolicy);
+
+	/** Destructor. */
+	IMPORT_C ~TBearerSecurity();
+
+public:
+	/** 
+	Accessor for bearer UID.
+	@return The bearer UID.
+	*/
+	IMPORT_C TUid BearerUid() const;
+
+	/**
+	Accessor for the bearer's security policy.
+	@return The security policy.
+	*/
+	IMPORT_C const TSecurityPolicy& SecurityPolicy() const;
+
+private:
+	/** The bearer UID. */
+	const TUid iBearerUid;
+
+	/** The bearer's security policy. */
+	const TSecurityPolicy iSecurityPolicy;
+
+	/** 
+	Pad for BC-friendly future change.
+	*/
+	TUint32 iPad;
+	};
+
+#endif // BEARERSECURITY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/public/clientinfo.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,137 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef CLIENTINFO_H
+#define CLIENTINFO_H
+
+#include <e32base.h>
+
+/**
+Contains information (of interest to the TSP) about a client of RemCon.
+Includes the client's process ID and the client's current send message 
+(RMessage2) which is triggering a request (AddressOutgoingCommand or 
+PermitOutgoingCommand) on the TSP. Via the RMessage2, the TSP can access the 
+client's secure ID and also do capability checks on the client.
+The process ID is also used by the server to police creation of target 
+sessions (only 1 is allowed per client process).
+*/
+class TClientInfo
+	{
+public:
+	/** Link between elements of this type in a TSglQue. If this member 
+	changes offset, remconserver must be rebuilt. */
+	TSglQueLink iLink;
+	TSglQueLink iLink2;
+
+public:
+	/** Constructor. */
+	IMPORT_C TClientInfo();
+
+	/** Destructor. */
+	IMPORT_C ~TClientInfo();
+
+public:
+	/** 
+	Accessor for process ID.
+	@return The process ID.
+	*/
+	IMPORT_C TProcessId& ProcessId();
+
+	/** 
+	Accessor for process ID.
+	@return The process ID.
+	*/
+	IMPORT_C TProcessId ProcessId() const;
+
+	/**
+	Accessor for message.
+	@return The message.
+	*/
+	IMPORT_C RMessage2& Message();
+
+	/**
+	Accessor for the client's current Send message. 
+	This is provided for the TSP to access the client's current Send message 
+	for capability checks only. The TSP must not Complete this message. Note 
+	that this message is only valid if AddressOutgoingCommand or 
+	PermitOutgoingCommand are being used (i.e. the client currently has a Send 
+	outstanding). 
+	For AddressIncomingCommand, the message returned will be invalid and must 
+	not be used by the TSP.
+	@return The message.
+	*/
+	IMPORT_C const RMessage2& Message() const;
+
+	/**
+	Accessor for the secure ID.
+	@return The secure ID.
+	*/
+	IMPORT_C TSecureId SecureId() const;
+
+	/**
+	Accessor for the secure ID.
+	@return The secure ID.
+	*/
+	IMPORT_C TSecureId& SecureId();
+
+private:
+	/** The process ID. */
+	TProcessId iProcessId;
+
+	/** The client's current send message. */
+	RMessage2 iMessage;
+
+	/** The secure ID. */
+	TSecureId iSecureId;
+	
+	// The previous BC pad has been used for iLink2. Further extensions will need to be implemented by moving data out
+	// into an extension class
+	
+	};
+
+class TClientInfoConstIter: TSglQueIter<TClientInfo>
+	{
+public:
+	inline TClientInfoConstIter(TSglQue<TClientInfo>& aQue);
+	inline void SetToFirst();
+	inline void Set(TClientInfo& aLink);
+	inline operator const TClientInfo*();	
+	inline const TClientInfo* operator++(TInt);
+	};
+
+inline TClientInfoConstIter::TClientInfoConstIter(TSglQue<TClientInfo>& aQue): TSglQueIter<TClientInfo>(aQue)
+	{ }
+
+inline void TClientInfoConstIter::SetToFirst()
+	{
+	TSglQueIter<TClientInfo>::SetToFirst();
+	}
+
+inline void TClientInfoConstIter::Set(TClientInfo& aLink)
+	{ DoSet(&aLink); }
+
+inline TClientInfoConstIter::operator const TClientInfo*()
+	{ return((const TClientInfo*)DoCurrent()); }
+
+inline const TClientInfo* TClientInfoConstIter::operator ++(TInt)
+	{ return((const TClientInfo *)DoPostInc()); }
+
+#endif // CLIENTINFO_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/public/remcontargetselectorplugin.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,93 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef TARGETSELECTORPLUGIN_H
+#define TARGETSELECTORPLUGIN_H
+
+#include <e32base.h>
+
+class MRemConTargetSelectorPluginObserver;
+class TRemConAddress;
+class TClientInfo;
+class TBearerSecurity;
+
+/**
+The UID of the Target Selector Plugin interface.
+*/
+const TInt KRemConTargetSelectorInterfaceUid = 0x10204B28;
+
+/**
+Abstract base class for target selector plugins.
+*/
+class CRemConTargetSelectorPlugin : public CBase
+	{
+public:
+	/** 
+	Constructor.
+	@param aImplementationUid The UID of the implementation.
+	@param aObserver The observer of the TSP.
+	*/
+	IMPORT_C static CRemConTargetSelectorPlugin* NewL(TUid aImplementationUid, 
+		MRemConTargetSelectorPluginObserver& aObserver);
+
+	/** Destructor. */
+	IMPORT_C ~CRemConTargetSelectorPlugin();
+
+public:
+	/**
+	Called by RemCon server to get a pointer to an object which implements the 
+	TSP interface with UID aUid. This is a mechanism for allowing future 
+	change to the TSP API without breaking BC in existing (non-updated) 
+	TSPs.
+	*/
+	virtual TAny* GetInterface(TUid aUid) = 0;
+
+protected:
+	/** 
+	Constructor.
+	@param aObserver The observer of the TSP.
+	*/
+	IMPORT_C CRemConTargetSelectorPlugin(MRemConTargetSelectorPluginObserver& aObserver);
+
+protected:
+	/**
+	Accessor for the observer.
+	@return The observer.
+	*/
+	IMPORT_C MRemConTargetSelectorPluginObserver& Observer();
+
+private: // owned
+	/**
+	UID set by ECOM when the instance is created. Used when the instance is 
+	destroyed.
+	*/
+	TUid iInstanceId;
+
+	/** 
+	Pad for BC-friendly future change.
+	*/
+	TAny* iPad;
+
+private: // unowned
+	MRemConTargetSelectorPluginObserver& iObserver;
+	};
+
+#endif // TARGETSELECTORPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/public/remcontargetselectorplugininterface.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,385 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef TARGETSELECTORPLUGININTERFACE_H
+#define TARGETSELECTORPLUGININTERFACE_H
+
+#include <e32base.h>
+
+class MRemConTargetSelectorPluginObserver;
+class TRemConAddress;
+class TClientInfo;
+class TBearerSecurity;
+class TClientInfoConstIter;
+
+/**
+The UID of this version of the Target Selector Plugin interface.
+*/
+const TInt KRemConTargetSelectorInterface1 = 0x10208BCD;
+
+
+/**
+Abstract base class for target selector plugins.
+*/
+class MRemConTargetSelectorPluginInterface
+	{
+public:
+	/**
+	Called by RemCon to get the TSP to address an outgoing command (from a 
+	connectionless controller client) to zero or more remotes. The implementor 
+	should add zero or more items to aConnections and then call 
+	OutgoingCommandAddressed on the observer with an appropriate error.
+	Note that only one of AddressOutgoingCommand and PermitOutgoingCommand is 
+	outstanding at once.
+	The implementor is responsible for the capability check. For this reason, 
+	aSender contains the client's current send message, and aBearerSecurity 
+	contains all the bearer security policies. To reiterate, RemCon does no 
+	security check on the client's send request either before calling 
+	AddressOutgoingCommand.
+	@param aInterfaceUid The UID of the client interface.
+	@param aOperationId The operation ID of the command.
+	@param aSender The TClientInfo of the sending session.
+	@param aConnections An empty collection of connections. NB On completion, 
+	an actual (bearer-level) connection does not need to exist for each item 
+	in the collection- RemCon passes responsibility to the bearer(s) for 
+	creating the specified connections. On successful completion, RemCon takes 
+	ownership of any items in the collection- new TRemConAddresses must be 
+	made on the heap.
+	@param aBearerSecurity Contains all the bearer security policies.
+	*/
+	virtual void AddressOutgoingCommand(
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		const TClientInfo& aSender,
+		TSglQue<TRemConAddress>& aConnections,
+		TSglQue<TBearerSecurity>& aBearerSecurity) = 0;
+
+	/**
+	Called by RemCon to find out from the TSP whether the given 
+	connection-oriented controller client is permitted to send the given 
+	command to the given remote at this time. The implementor should call 
+	PermitOutgoingCommand with either ETrue, if the send is permitted, or 
+	EFalse, if the send is not permitted.
+	Note that only one of AddressOutgoingCommand and PermitOutgoingCommand is 
+	outstanding at once.
+	Note that a capability check will have been done by RemCon before 
+	PermitOutgoingCommand is called- actually at GoConnectionOriented time. 
+	@param aInterfaceUid The UID of the client interface.
+	@param aOperationId The operation ID of the command.
+	@param aSender The TClientInfo of the sending session.
+	@param aConnection The remote the command will be sent over if permission 
+	is granted.
+	*/
+	virtual void PermitOutgoingCommand(
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		const TClientInfo& aSender,
+		const TRemConAddress& aConnection) = 0;
+
+	/** 
+	Called by RemCon to cancel the current AddressOutgoingCommand or 
+	PermitOutgoingCommand command.
+	On receipt, the TSP must stop dereferencing any data given in the 
+	AddressOutgoingCommand or PermitOutgoingCommand request. The TSP should 
+	not subsequently call OutgoingCommandAddressed or 
+	OutgoingCommandPermitted, except in response to a subsequent new 
+	AddressOutgoingCommand or PermitOutgoingCommand command.
+	If an AddressOutgoingCommand request is currently being processed, the TSP 
+	is responsible for deleting any TRemConAddresses it has already created.
+	*/
+	virtual void CancelOutgoingCommand() = 0;
+
+	/**
+	Called by RemCon to get the TSP to address an incoming command (from a 
+	remote to zero or more target clients). The implementor should add or 
+	remove zero or more items from aClients and then call 
+	IncomingCommandAddressed on the observer with a suitable error. 
+	@param aInterfaceUid The UID of the client interface.
+	@param aOperationId The operation ID of the command.
+	@param aClients A collection of existing target clients. The implementor 
+	may wish to start further target client(s) and add their process ID(s) to 
+	this collection. New TClientInfo items must be made on the stack. Note 
+	that when adding a TClientInfo to aClients, only the process ID needs to 
+	be correctly populated.
+	There is no 'cancel' method for AddressIncomingCommand. RemCon will only 
+	want to 'cancel' this when the server is terminating, at which point it 
+	will destroy the TSP anyway.
+	*/
+	virtual void AddressIncomingCommand(
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		TSglQue<TClientInfo>& aClients) = 0;
+			
+	};
+	
+/**
+The UID of this version of the Target Selector Plugin interface.
+*/
+const TInt KRemConTargetSelectorInterface2 = 0x102858CF;
+
+/**
+Additional functions for TSP Interface V2
+*/
+class MRemConTargetSelectorPluginInterfaceV2: public MRemConTargetSelectorPluginInterface
+	{
+public:
+	/**
+	Called by RemCon to get the TSP to decide which client should be
+	allowed to respond to a command.
+	This function is called as soon as each client returns a response, so
+	the order in which clients are offered to the TSP is not predetermined.
+	Since AV/C expects only a single response, the first response allowed by 
+	the TSP is the one which will be sent on-air.
+	The initial list of clients will be populated from the TSP's response 
+	to AddressIncomingCommand().
+	@param aInterfaceUid The UID of the client interface.
+	@param aOperationId The operation ID of the command.
+	@param aClient The client which is trying to send a response
+	@param aClients A list of clients which are still expected to respond,
+	including the one specified in aClient
+	*/
+	 
+	virtual void PermitOutgoingResponse(
+			TUid aInterfaceUid,
+			TUint aOperationId,
+			const TClientInfo& aClient,
+			TClientInfoConstIter& aClients) = 0;
+	
+	/**
+	Called by RemCon to get the TSP to address an incoming notify (from a 
+	remote to zero or more target clients). The implementor should call 
+	IncomingNotifyAddressed on the observer with a pointer to the chosen
+	client (or NULL if no client is to be addressed) from the list, and a
+	suitable error.
+	@param aInterfaceUid The UID of the client interface.
+	@param aOperationId The operation ID of the command.
+	@param aClients A collection of existing target clients. The implementor 
+	may wish to start a target client and call IncomingNotifyAddressed
+	with a new TClientInfo. The new TClientInfo item must be made on the stack. 
+	Note when creating the new TClientInfo, only the process ID needs to 
+	be correctly populated.
+	*/
+	virtual void AddressIncomingNotify(
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		TSglQue<TClientInfo>& aClients) = 0;
+	
+	/** 
+	Called by RemCon to cancel the current PermitOutgoingResponse request.
+	On receipt, the TSP must stop dereferencing any data given in the 
+	PermitOutgoingResponse request. The TSP should not subsequently call
+	OutgoingResponsePermitted, except in response to a subsequent new 
+	PermitOutgoingResponse request.
+	*/
+	virtual void CancelOutgoingResponse() = 0;
+	};
+
+/**
+The UID of this version of the Target Selector Plugin interface.
+*/
+const TInt KRemConTargetSelectorInterface3 = 0x102858D3;
+
+/**
+Additional functions for TSP Interface V3
+
+This interface must be implemented if the TSP wishes to support outgoing
+Notify commands (local role controller).
+*/
+class MRemConTargetSelectorPluginInterfaceV3
+	{
+public:
+	/**
+	Called by RemCon to get the TSP to address an outgoing notify command (from a 
+	connectionless controller client) to zero or one remote. The implementor 
+	need to get the connection list from which to chose the only one target device and then call 
+	OutgoingNotifyCommandAddressed on the observer with an appropriate error.
+	Note that only one of AddressOutgoingNotifyCommand and PermitOutgoingNotifyCommand is 
+	outstanding at once.
+	The implementor is responsible for the capability check. For this reason, 
+	aSender contains the client's current send message, and aBearerSecurity 
+	contains all the bearer security policies. To reiterate, RemCon does no 
+	security check on the client's send request either before calling 
+	AddressOutgoingNotify.
+	@param aInterfaceUid The UID of the client interface.
+	@param aOperationId The operation ID of the command.
+	@param aSender The TClientInfo of the sending session.
+	@param aBearerSecurity Contains all the bearer security policies.
+	*/
+	virtual void AddressOutgoingNotify(
+			TUid aInterfaceUid,
+			TUint aOperationId, 
+			const TClientInfo& aSender,
+			TSglQue<TBearerSecurity>& aBearerSecurity) = 0;
+	
+	/** 
+	Called by RemCon to cancel the current AddressOutgoingNotify or 
+	PermitOutgoingNotifyCommand command.
+	On receipt, the TSP must stop dereferencing any data given in the 
+	AddressOutgoingNotify or PermitOutgoingNotifyCommand request. The TSP should 
+	not subsequently call OutgoingNotifyCommandAddressed or 
+	OutgoingNotifyCommandPermitted, except in response to a subsequent new 
+	AddressOutgoingNotify or PermitOutgoingNotifyCommand command.
+	If an AddressOutgoingNotify request is currently being processed, the TSP 
+	is responsible for deleting any TRemConAddresses it has already created.
+	*/
+	virtual void CancelOutgoingNotifyCommand() = 0;
+	
+	/**
+	Called by RemCon to find out from the TSP whether the given 
+	connection-oriented controller client is permitted to send the given notify
+	command to the given remote at this time. The implementor should call 
+	PermitOutgoingNotifyCommand with either ETrue, if the send is permitted, or 
+	EFalse, if the send is not permitted.
+	Note that only one of AddressOutgoingNotify and PermitOutgoingNotifyCommand is 
+	outstanding at once.
+	Note that a capability check will have been done by RemCon before 
+	PermitOutgoingNotifyCommand is called- actually at GoConnectionOriented time. 
+	@param aInterfaceUid The UID of the client interface.
+	@param aOperationId The operation ID of the command.
+	@param aSender The TClientInfo of the sending session.
+	@param aConnection The remote the command will be sent over if permission 
+	is granted.
+	*/
+	virtual void PermitOutgoingNotifyCommand(
+			TUid aInterfaceUid,
+			TUint aOperationId, 
+			const TClientInfo& aSender,
+			const TRemConAddress& aConnection) = 0;
+	};
+
+/**
+The UID of this version of the Target Selector Plugin interface.
+*/
+const TInt KRemConTargetSelectorInterface4 = 0x10286A7;
+
+/**
+Additional functions for TSP Interface V4
+
+This interface must be implemented if the TSP wishes to support addressing
+by the bearer.  Bearer addressing will always be used if supported by the
+bearer.  When bearer addressing is used the TSP will not be given any
+option over which client receives a command, however if it implements this
+interface it has visibility of where each command goes and can reject the 
+command if it is not acceptable.
+
+If this interface is not implemented default implementations of these functions 
+will be used which will allow the command to be addressed to the bearer's 
+selected client.  This means that if the TSP does not implement this interface
+it will not see any commands which have been addressed by the bearer.
+
+Regardless of whether this interface is implemented commands which are not 
+addressed by the bearer will continue to be addressed by the TSP via earlier 
+versions of MRemConTargetSelectorPluginInterface.
+*/
+class MRemConTargetSelectorPluginInterfaceV4
+	{
+public:
+	/**
+	Called by RemCon to get the TSP to permit an incoming command. This is called
+	if the bearer has provided a target client for the command.  
+	
+	The implementor should decide if they wish to allow this command and then call
+	IncomingCommandPermitted on the observer with a suitable error. 
+	
+	@param aInterfaceUid The UID of the client interface.
+	@param aOperationId The operation ID of the command.
+	@param aClient a TClientInfo referring to the selected client
+	*/
+	virtual void PermitIncomingCommand(
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		const TClientInfo& aClient) = 0;
+	
+	/**
+	Called by RemCon to get the TSP to permit an incoming Notify. This is called
+	if the bearer has provided a target client for the Notify.  
+	
+	The implementor should decide if they wish to allow this Notify and then call
+	IncomingNotifyPermitted on the observer with a suitable error. 
+	
+	@param aInterfaceUid The UID of the client interface.
+	@param aOperationId The operation ID of the Notify.
+	@param aClient a TClientInfo referring to the selected client
+	*/
+	virtual void PermitIncomingNotify(
+		TUid aInterfaceUid,
+		TUint aOperationId, 
+		const TClientInfo& aClient) = 0;
+	
+	/** 
+	Called by RemCon when a bearer that can address commands wishes to
+	inform the system that there has been a remote user action to 
+	select a different addressed client.
+	
+	The bearer will then route addressed commands to this client until
+	such time as SetRemoteAddressedClient is called again or the TSP
+	calls SetLocalAddressedClient.
+	
+	@param aBearerUid The bearer that has changed its addressed client
+	@param aClient The RemCon client that is now selected by the bearer
+	*/
+	virtual void SetRemoteAddressedClient(const TUid& aBearerUid, 
+			const TClientInfo& aClient) = 0;
+	};
+
+/**
+The UID of this version of the Target Selector Plugin interface.
+*/
+const TInt KRemConTargetSelectorInterface5 = 0x2002e6e1;
+
+class MRemConTargetSelectorPluginInterfaceV5
+	{
+public:
+	/** Called by RemCon when a new target client has connected.
+	 
+	 @aClientInfo The information about the new client.
+	 */
+	virtual void TargetClientAvailable(const TClientInfo& aClientInfo) = 0;
+	
+	/** Called by RemCon when a target client has disconnected. 
+	 
+	 @aClientInfo The information about the client that has disconnected.
+	 */
+	virtual void TargetClientUnavailable(const TClientInfo& aClientInfo) = 0;
+	
+	/** Called by RemCon when a bearer wishes to begin being informed when
+	the locally addressed player changes.  Once this function has been called
+	the TSP should inform RemCon via SetLocalAddressedPlayer each time the
+	player to which incoming commands from aBearer would be routed changes.
+	This might occur for example if a new application is launched, or if the
+	foreground application changes, depending on what the TSP's rules are
+	for deciding the target of the incoming message.  These updates should
+	occur until UnregisterLocalAddressedClientObserver is called.
+	
+	@param aBearerUid The bearer that wishes to be informed of updates
+	*/
+	virtual TInt RegisterLocalAddressedClientObserver(const TUid& aBearerUid) = 0;
+
+	/** Called by RemCon when a bearer wishes to stop being informed of 
+	changes to the local addresse client.
+	
+	@param aBearerUid The bearer that no longer wishes to be informed of updates
+	*/
+	virtual TInt UnregisterLocalAddressedClientObserver(const TUid& aBearerUid) = 0;
+	};
+
+
+#endif // TARGETSELECTORPLUGININTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/public/remcontargetselectorpluginobserver.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,232 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef REMCONTARGETSELECTORPLUGINOBSERVER_H
+#define REMCONTARGETSELECTORPLUGINOBSERVER_H
+
+#include <e32base.h>
+
+class TRemConAddress;
+class TClientInfo;
+
+/**
+Interface presented by RemCon down to the concrete Target Selector Plugin. 
+This class is intended for derivation inside RemCon only.
+*/
+class MRemConTargetSelectorPluginObserver
+	{
+public:
+	/**
+	Called by the TSP to indicate that it has addressed the outgoing command 
+	from the previous AddressOutgoingCommand request.
+	@param aError The error with which the command was addressed. If other 
+	than KErrNone, the command will not be sent by RemCon.
+	*/
+	IMPORT_C void OutgoingCommandAddressed(TInt aError);
+
+	/**
+	Called by the TSP to indicate that it has decided whether the outgoing 
+	command (from the previous AllowOutgoingCommand request) is permitted or 
+	not.
+	@param aIsPermitted ETrue- the send is permitted, EFalse- the send is not 
+	permitted.
+	*/
+	IMPORT_C void OutgoingCommandPermitted(TBool aIsPermitted);
+
+	/**
+	Called by the TSP to indicate that it has addressed the incoming command 
+	from the previous AddressIncomingCommand request.
+	@param aError The error with which the command was addressed. If other 
+	than KErrNone, the command will be dropped.
+	*/
+	IMPORT_C void IncomingCommandAddressed(TInt aError);
+
+	/**
+	Called by the TSP to indicate that it has decided whether the outgoing 
+	response (from the previous AllowOutgoingResponse request) is permitted or 
+	not.
+	@param aIsPermitted ETrue- the send is permitted, EFalse- the send is not 
+	permitted.
+	*/
+	IMPORT_C void OutgoingResponsePermitted(TBool aIsPermitted);
+
+	/** Called by the TSP to address the incoming notify
+	from the previous AddressIncomingNotify request.
+	@param aClientInfo Pointer to the chosen client from the list of clients
+	passed to the TSP in the previous AddressIncomingNotify request, or a new
+	TClientInfo, with the correct process ID (the other fields will be ignored).
+	In the case of the TClientInfo being chosen from the list, the
+	ownership of the TClientInfo will be retained by RemCon server. In the case
+	of the TClientInfo being newly created because of the TSP starting and application,
+	RemCon Server will immediately take a copy of the TClientInfo, and the TSP will
+	retain ownership. aClientInfo should be NULL if no client is to be addressed.
+	@param aError The error with which the command was addressed. If other 
+	than KErrNone, the command will be dropped.
+	*/
+	
+	IMPORT_C void IncomingNotifyAddressed(TClientInfo* aClientInfo, TInt aError);
+	
+	/** Called by the TSP when the outstanding notifies need to be readdressed to
+	other clients. Calling this will result in AddressIncomingNotify requests for
+	each currently outstanding notify.
+	@note RemCon will do this automatically if a client with outstanding notifies
+	exits
+	*/
+	
+	IMPORT_C void ReAddressNotifies();
+	
+	/**
+	Utility for TSPs. Retrieves a list of currently extant bearer-level 
+	connections in RemCon server. May be used at any time between the end of 
+	TSP construction and the beginning of TSP destruction.
+	The TSP is responsible for cleaning up aConnections- the addresses will be 
+	on the heap.
+	@param aConnections A collection of remote addresses, representing all the 
+	currently extant connections. On entry this must be empty otherwise the 
+	server will panic.
+	@return Error.
+	*/
+	IMPORT_C TInt GetConnections(TSglQue<TRemConAddress>& aConnections);
+	
+	/**
+	Called by the TSP to indicate that it has addressed the outgoing notify command 
+	from the previous AddressOutgoingNotify request.
+	@param aConnection Pointer to the address of the chosen remote target device which is chose through
+	the use-defined way, e.g. choose from the user-defined ini file or any other file the TSP can 
+	read and make a choice from it.	For notify command addressing, the 	command will be addressed 
+	to the only one target device, so the TSP should only choose one target address. The ownership 
+	of TRemConAddress is retained by remcon server.The aConnection should be NULL if no target 
+	address is chose.
+	@param aError The error with which the command was addressed. If other 
+	than KErrNone, the command will not be sent by RemCon.
+	*/
+	IMPORT_C void OutgoingNotifyCommandAddressed(TRemConAddress* aConnection, TInt aError);
+	
+	/**
+	Called by the TSP to indicate that it has decided whether the outgoing notify
+	command (from the previous AllowOutgoingNotify request) is permitted or 
+	not.
+	@param aIsPermitted ETrue- the send is permitted, EFalse- the send is not 
+	permitted.
+	*/
+	IMPORT_C void OutgoingNotifyCommandPermitted(TBool aIsPermitted);
+	
+	/**
+	Called by the TSP to indicate that it has decided whether the incoming 
+	command (from the previous PermitIncomingCommand request) is permitted or 
+	not.
+	
+	@param aIsPermitted ETrue- the send is permitted, EFalse- the send is not 
+	permitted.
+	*/
+	IMPORT_C void IncomingCommandPermitted(TBool aIsPermitted);
+	
+	/**
+	Called by the TSP to indicate that it has decided whether the incoming notify
+	command (from the previous PermitIncomingNotify request) is permitted or 
+	not.
+	
+	@param aIsPermitted ETrue- the send is permitted, EFalse- the send is not 
+	permitted.
+	*/
+	IMPORT_C void IncomingNotifyPermitted(TBool aIsPermitted);
+	
+	/**
+	Called by the TSP to indicate that a user action has occurred which means
+	that the specified bearer should address commands to the specified client.
+	Addressed commands from that bearer will then be routed to this client until
+	either the TSP calls SetLocalAddressedClient again or RemCon calls
+	SetRemoteAddressedClient.
+	
+	@param aBearerUid The bearer that should change its addressed client
+	@param aClient The client which the bearer should route addressed commands to.
+	@return KErrNone if the request has been accepted.
+			KErrNotFound if the supplied client info does not refer to a target client
+			Other system wide error code if the request was unable to be handled for 
+			another reason.
+	*/
+	IMPORT_C TInt SetLocalAddressedClient(const TUid& aBearerUid, const TClientInfo& aClientInfo);
+	
+private:
+	/**
+	@see OutgoingCommandAddressed.
+	*/
+	virtual void MrctspoDoOutgoingCommandAddressed(TInt aError) = 0;
+
+	/**
+	@see OutgoingCommandPermitted.
+	*/
+	virtual void MrctspoDoOutgoingCommandPermitted(TBool aIsPermitted) = 0;
+
+	/**
+	@see IncomingCommandAddressed.
+	*/
+	virtual void MrctspoDoIncomingCommandAddressed(TInt aError) = 0;
+
+	/**
+	@see GetConnections.
+	*/
+	virtual TInt MrctspoDoGetConnections(TSglQue<TRemConAddress>& aConnections) = 0;
+	
+	/**
+	@see OutgoingResponsePermitted.
+	*/
+	virtual void MrctspoDoOutgoingResponsePermitted(TBool aIsPermitted) = 0;
+	
+	/**
+	@see IncomingNotifyAddressed.
+	*/
+	
+	virtual void MrctspoDoIncomingNotifyAddressed(TClientInfo* aClientInfo, TInt aError) = 0;
+	
+	/**
+	@see ReAddressNotifies
+	*/
+	
+	virtual void MrctspoDoReAddressNotifies() = 0;
+	
+	/**
+	@see OutgoingNotifyCommandAddressed
+	*/
+	virtual void MrctspoDoOutgoingNotifyCommandAddressed(TRemConAddress* aConnection, TInt aError) = 0;
+	
+	/**
+	@see OutgoingNotifyCommandPermitted.
+	*/
+	virtual void MrctspoDoOutgoingNotifyCommandPermitted(TBool aIsPermitted) = 0;
+	
+	/**
+	@see IncomingCommandPermitted.
+	*/
+	virtual void MrctspoDoIncomingCommandPermitted(TBool aIsPermitted) = 0;
+	
+	/**
+	@see IncomingNotifyPermitted.
+	*/
+	virtual void MrctspoDoIncomingNotifyPermitted(TBool aIsPermitted) = 0;
+	
+	/**
+	@see SetLocalAddressedClient.
+	*/
+	virtual TInt MrctspoSetLocalAddressedClient(const TUid& aBearerUid, const TClientInfo& aClientInfo) = 0;
+	};
+
+#endif // REMCONTARGETSELECTORPLUGINOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/src/bearersecurity.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/bearersecurity.h>
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+EXPORT_C TBearerSecurity::TBearerSecurity(TUid aUid, const TSecurityPolicy& aPolicy)
+:	iBearerUid(aUid),
+	iSecurityPolicy(aPolicy)
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C TBearerSecurity::~TBearerSecurity()
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C TUid TBearerSecurity::BearerUid() const
+	{
+	return iBearerUid;
+	}
+
+EXPORT_C const TSecurityPolicy& TBearerSecurity::SecurityPolicy() const
+	{
+	return iSecurityPolicy;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/src/clientinfo.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,66 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/clientinfo.h>
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+EXPORT_C TClientInfo::TClientInfo()
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C TClientInfo::~TClientInfo()
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C TProcessId& TClientInfo::ProcessId()
+	{
+	return iProcessId;
+	}
+
+EXPORT_C TProcessId TClientInfo::ProcessId() const
+	{
+	return iProcessId;
+	}
+
+EXPORT_C RMessage2& TClientInfo::Message()
+	{
+	return iMessage;
+	}
+
+EXPORT_C const RMessage2& TClientInfo::Message() const
+	{
+	return iMessage;
+	}
+
+EXPORT_C TSecureId& TClientInfo::SecureId()
+	{
+	return iSecureId;
+	}
+
+EXPORT_C TSecureId TClientInfo::SecureId() const
+	{
+	return iSecureId;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/src/targetselectorplugin.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,58 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Implementation of Rem Con target selector plugin.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remcontargetselectorplugin.h>
+#include <ecom/ecom.h>
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+EXPORT_C CRemConTargetSelectorPlugin::~CRemConTargetSelectorPlugin()
+	{
+	LOG_STATIC_FUNC
+	REComSession::DestroyedImplementation(iInstanceId);
+	}
+
+EXPORT_C CRemConTargetSelectorPlugin::CRemConTargetSelectorPlugin(MRemConTargetSelectorPluginObserver& aObserver)
+:	iObserver(aObserver)
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C CRemConTargetSelectorPlugin* CRemConTargetSelectorPlugin::NewL(TUid aImplementationUid, 
+																		MRemConTargetSelectorPluginObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+	return reinterpret_cast<CRemConTargetSelectorPlugin*>(
+		REComSession::CreateImplementationL(
+			aImplementationUid, 
+			_FOFF(CRemConTargetSelectorPlugin, iInstanceId),
+			(TAny*)&aObserver)
+		);
+	}
+
+EXPORT_C MRemConTargetSelectorPluginObserver& CRemConTargetSelectorPlugin::Observer()
+	{
+	return iObserver;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/targetselectorplugin/src/targetselectorpluginobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,84 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remcontargetselectorpluginobserver.h>
+
+
+EXPORT_C void MRemConTargetSelectorPluginObserver::OutgoingNotifyCommandAddressed(TRemConAddress* aConnection, TInt aError)
+	{
+	MrctspoDoOutgoingNotifyCommandAddressed(aConnection, aError);
+	}
+
+EXPORT_C void MRemConTargetSelectorPluginObserver::OutgoingCommandAddressed(TInt aError)
+	{
+	MrctspoDoOutgoingCommandAddressed(aError);
+	}
+
+EXPORT_C void MRemConTargetSelectorPluginObserver::OutgoingCommandPermitted(TBool aIsPermitted)
+	{
+	MrctspoDoOutgoingCommandPermitted(aIsPermitted);
+	}
+
+EXPORT_C void MRemConTargetSelectorPluginObserver::OutgoingNotifyCommandPermitted(TBool aIsPermitted)
+	{
+	MrctspoDoOutgoingNotifyCommandPermitted(aIsPermitted);
+	}
+
+EXPORT_C void MRemConTargetSelectorPluginObserver::IncomingCommandAddressed(TInt aError)
+	{
+	MrctspoDoIncomingCommandAddressed(aError);
+	}
+
+EXPORT_C TInt MRemConTargetSelectorPluginObserver::GetConnections(TSglQue<TRemConAddress>& aConnections)
+	{
+	return MrctspoDoGetConnections(aConnections);
+	}
+
+EXPORT_C void MRemConTargetSelectorPluginObserver::OutgoingResponsePermitted(TBool aIsPermitted)
+	{
+	MrctspoDoOutgoingResponsePermitted(aIsPermitted);
+	}
+
+EXPORT_C void MRemConTargetSelectorPluginObserver::IncomingNotifyAddressed(TClientInfo* aClientInfo, TInt aError)
+	{
+	MrctspoDoIncomingNotifyAddressed(aClientInfo, aError);
+	}
+
+EXPORT_C void MRemConTargetSelectorPluginObserver::ReAddressNotifies()
+	{
+	MrctspoDoReAddressNotifies();
+	}
+
+EXPORT_C void MRemConTargetSelectorPluginObserver::IncomingCommandPermitted(TBool aIsPermitted)
+	{
+	MrctspoDoIncomingCommandPermitted(aIsPermitted);
+	}
+
+EXPORT_C void MRemConTargetSelectorPluginObserver::IncomingNotifyPermitted(TBool aIsPermitted)
+	{
+	MrctspoDoIncomingNotifyPermitted(aIsPermitted);
+	}
+
+EXPORT_C TInt MRemConTargetSelectorPluginObserver::SetLocalAddressedClient(const TUid& aBearerUid, const TClientInfo& aClientInfo)
+	{
+	return MrctspoSetLocalAddressedClient(aBearerUid, aClientInfo);
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,23 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// bld.inf for Rem Con test components.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "headercheck/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,25 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Tests that public header files are compilable on their own, not only in the 
+// context they're #included in remotecontrol code.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_TESTMMPFILES
+t_remconheadercheck.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/group/t_remconheadercheck.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,73 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconservercaps.mmh>
+
+target			t_remconheadercheck.exe
+targettype		exe
+uid 			0
+VENDORID		0x70000001
+
+sourcepath		../src
+source			main.cpp
+source			t_bearerparams.cpp
+source			t_remconbearerobserver.cpp
+source			t_remconbearerplugin.cpp
+source			t_remconbearerinterface.cpp
+source			t_remconcoreapi.cpp
+source			t_remconcoreapicontroller.cpp
+source			t_remconcoreapicontrollerobserver.cpp
+source			t_remconcoreapitarget.cpp
+source			t_remconcoreapitargetobserver.cpp
+source			t_remconclient.cpp
+source			t_remconinterfacebase.cpp
+source			t_remconinterfaceselector.cpp
+source			t_remconinterfaceif.cpp
+source			t_remconextapi1.cpp
+source			t_remcontrackinfocontroller.cpp
+source			t_remcontrackinfocontrollerobserver.cpp
+source			t_remcontrackinfotarget.cpp
+source			t_remcontrackinfotargetobserver.cpp
+source			t_remconabsvolcontroller.cpp
+source			t_remconabsvolcontrollerobserver.cpp
+source			t_remconabsvoltarget.cpp
+source			t_remconabsvoltargetobserver.cpp
+source			t_remconconverterplugin.cpp
+source			t_remconconverterinterface.cpp
+source			t_remconserverpanic.cpp
+source			t_bearersecurity.cpp
+source			t_clientinfo.cpp
+source			t_remcontargetselectorplugin.cpp
+source			t_remcontargetselectorplugininterface.cpp
+source			t_remcontargetselectorpluginobserver.cpp
+source			t_remconserialbeareruid.cpp
+source			t_clienttype.cpp
+source			t_messagetype.cpp
+source			t_remconaddress.cpp
+source			t_remconerrorobserver.cpp
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+USERINCLUDE ../../../client/common
+USERINCLUDE ../../../common
+USERINCLUDE ../../../reference/serialbearer/inc/
+
+library 		euser.lib
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/main.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,26 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <e32std.h>
+
+GLDEF_C TInt E32Main()
+	{
+	return KErrNone;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_bearerparams.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/bearerparams.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_bearersecurity.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/bearersecurity.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_clientinfo.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/clientinfo.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_clienttype.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/clienttype.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_messagetype.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/messagetype.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconabsvolcontroller.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconabsvolcontroller.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconabsvolcontrollerobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconabsvolcontrollerobserver.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconabsvoltarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconabsvoltarget.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconabsvoltargetobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconabsvoltargetobserver.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconaddress.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconaddress.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconbearerinterface.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconbearerinterface.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconbearerobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconbearerobserver.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconbearerplugin.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconbearerplugin.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconclient.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "remconclient.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconconverterinterface.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconconverterinterface.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconconverterplugin.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconconverterplugin.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconcoreapi.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconcoreapi.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconcoreapicontroller.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconcoreapicontroller.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconcoreapicontrollerobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconcoreapicontrollerobserver.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconcoreapitarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconcoreapitarget.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconcoreapitargetobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconcoreapitargetobserver.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconerrorobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconerrorobserver.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconextapi1.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconextapi1.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconinterfacebase.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconinterfacebase.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconinterfaceif.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconinterfaceif.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconinterfaceselector.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconinterfaceselector.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconserialbeareruid.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "remconserialbeareruid.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconserverid.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remconserverid.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remconserverpanic.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remconserverpanic.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontargetselectorplugin.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remcontargetselectorplugin.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontargetselectorplugininterface.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remcontargetselectorplugininterface.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontargetselectorpluginobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcon/remcontargetselectorpluginobserver.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontrackinfocontroller.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcontrackinfocontroller.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontrackinfocontrollerobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcontrackinfocontrollerobserver.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontrackinfotarget.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcontrackinfotarget.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/test/headercheck/src/t_remcontrackinfotargetobserver.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <remcontrackinfotargetobserver.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/bwins/remcontypesU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,22 @@
+EXPORTS
+	??0TRemConAddress@@QAE@XZ @ 1 NONAME ; TRemConAddress::TRemConAddress(void)
+	??1TRemConAddress@@QAE@XZ @ 2 NONAME ; TRemConAddress::~TRemConAddress(void)
+	??8TRemConAddress@@QBEHABV0@@Z @ 3 NONAME ; int TRemConAddress::operator==(class TRemConAddress const &) const
+	?Addr@TRemConAddress@@QAEAAV?$TBuf8@$0BM@@@XZ @ 4 NONAME ; class TBuf8<28> & TRemConAddress::Addr(void)
+	?Addr@TRemConAddress@@QBEABV?$TBuf8@$0BM@@@XZ @ 5 NONAME ; class TBuf8<28> const & TRemConAddress::Addr(void) const
+	?BearerUid@TRemConAddress@@QAEAAVTUid@@XZ @ 6 NONAME ; class TUid & TRemConAddress::BearerUid(void)
+	?BearerUid@TRemConAddress@@QBE?AVTUid@@XZ @ 7 NONAME ; class TUid TRemConAddress::BearerUid(void) const
+	?IsNull@TRemConAddress@@QBEHXZ @ 8 NONAME ; int TRemConAddress::IsNull(void) const
+	?Uid@CRemConInterfaceDetails@@QBE?AVTUid@@XZ @ 9 NONAME ; class TUid CRemConInterfaceDetails::Uid(void) const
+	?NewLC@CRemConInterfaceDetails@@SAPAV1@VTUid@@W4TRemConClientType@@HPAVCRemConInterfaceBase@@ABVTDesC8@@@Z @ 10 NONAME ; class CRemConInterfaceDetails * CRemConInterfaceDetails::NewLC(class TUid, enum TRemConClientType, int, class CRemConInterfaceBase *, class TDesC8 const &)
+	?Array@CRemConInterfaceDetailsArray@@QBE?AV?$TArray@PAVCRemConInterfaceDetails@@@@XZ @ 11 NONAME ; class TArray<class CRemConInterfaceDetails *> CRemConInterfaceDetailsArray::Array(void) const
+	?ExternalizeL@CRemConInterfaceDetailsArray@@QAEXAAVRWriteStream@@W4TRemConClientType@@@Z @ 12 NONAME ; void CRemConInterfaceDetailsArray::ExternalizeL(class RWriteStream &, enum TRemConClientType)
+	?DeleteFeatures@CRemConInterfaceDetails@@QAEXXZ @ 13 NONAME ; void CRemConInterfaceDetails::DeleteFeatures(void)
+	?Interface@CRemConInterfaceDetails@@QAEAAPAVCRemConInterfaceBase@@XZ @ 14 NONAME ; class CRemConInterfaceBase * & CRemConInterfaceDetails::Interface(void)
+	?InternalizeL@CRemConInterfaceDetailsArray@@SAPAV1@AAVRReadStream@@@Z @ 15 NONAME ; class CRemConInterfaceDetailsArray * CRemConInterfaceDetailsArray::InternalizeL(class RReadStream &)
+	?NewL@CRemConInterfaceDetailsArray@@SAPAV1@XZ @ 16 NONAME ; class CRemConInterfaceDetailsArray * CRemConInterfaceDetailsArray::NewL(void)
+	?GetRemConInterfaceFeaturesL@CRemConInterfaceDetails@@QBEXAAV?$RArray@I@@@Z @ 17 NONAME ; void CRemConInterfaceDetails::GetRemConInterfaceFeaturesL(class RArray<unsigned int> &) const
+	?IsBulk@CRemConInterfaceDetails@@QBEHXZ @ 18 NONAME ; int CRemConInterfaceDetails::IsBulk(void) const
+	?Type@CRemConInterfaceDetails@@QBE?AW4TRemConClientType@@XZ @ 19 NONAME ; enum TRemConClientType CRemConInterfaceDetails::Type(void) const
+	?AppendL@CRemConInterfaceDetailsArray@@QAEXPAVCRemConInterfaceDetails@@@Z @ 20 NONAME ; void CRemConInterfaceDetailsArray::AppendL(class CRemConInterfaceDetails *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/eabi/remcontypesU.DEF	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,24 @@
+EXPORTS
+	_ZN14TRemConAddress4AddrEv @ 1 NONAME
+	_ZN14TRemConAddress9BearerUidEv @ 2 NONAME
+	_ZN14TRemConAddressC1Ev @ 3 NONAME
+	_ZN14TRemConAddressC2Ev @ 4 NONAME
+	_ZN14TRemConAddressD1Ev @ 5 NONAME
+	_ZN14TRemConAddressD2Ev @ 6 NONAME
+	_ZNK14TRemConAddress4AddrEv @ 7 NONAME
+	_ZNK14TRemConAddress6IsNullEv @ 8 NONAME
+	_ZNK14TRemConAddress9BearerUidEv @ 9 NONAME
+	_ZNK14TRemConAddresseqERKS_ @ 10 NONAME
+	_ZN23CRemConInterfaceDetails14DeleteFeaturesEv @ 11 NONAME
+	_ZN23CRemConInterfaceDetails5NewLCE4TUid17TRemConClientTypeiP20CRemConInterfaceBaseRK6TDesC8 @ 12 NONAME
+	_ZN23CRemConInterfaceDetails9InterfaceEv @ 13 NONAME
+	_ZN28CRemConInterfaceDetailsArray12ExternalizeLER12RWriteStream17TRemConClientType @ 14 NONAME
+	_ZN28CRemConInterfaceDetailsArray12InternalizeLER11RReadStream @ 15 NONAME
+	_ZN28CRemConInterfaceDetailsArray4NewLEv @ 16 NONAME
+	_ZN28CRemConInterfaceDetailsArray7AppendLEP23CRemConInterfaceDetails @ 17 NONAME
+	_ZNK23CRemConInterfaceDetails27GetRemConInterfaceFeaturesLER6RArrayIjE @ 18 NONAME
+	_ZNK23CRemConInterfaceDetails3UidEv @ 19 NONAME
+	_ZNK23CRemConInterfaceDetails4TypeEv @ 20 NONAME
+	_ZNK23CRemConInterfaceDetails6IsBulkEv @ 21 NONAME
+	_ZNK28CRemConInterfaceDetailsArray5ArrayEv @ 22 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/group/bld.inf	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,30 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remcontypes.mmp
+
+PRJ_EXPORTS
+../public/remconaddress.h				SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remconaddress.h)
+../public/playertype.h					SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remcon/playertype.h)
+../public/messagetype.h 				SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remcon/messagetype.h)
+../public/clienttype.h					SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(remcon/clienttype.h)
+../public/clientid.h					SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/clientid.h)
+../public/remconifdetails.h				SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconifdetails.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/group/remcontypes.mmp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remcontypes.dll Utility DLL containing shared types for RemCon.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+// As well as RemCon server, this DLL has to work when linked to by any 
+// conceivable RemCon client.
+CAPABILITY		All -Tcb
+
+TARGET			remcontypes.dll
+TARGETPATH		/system/libs
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			remconaddress.cpp remconifdetails.cpp
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+library			estor.lib
+
+#include <bluetooth/btlogger.mmh>
+
+UNPAGED
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/public/clientid.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,33 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef REMCONCLIENTID_H
+#define REMCONCLIENTID_H
+
+#include <e32base.h>
+
+const TUint KNullClientId = KNullProcessId;
+typedef TUint TRemConClientId;
+
+
+#endif //REMCONCLIENTID_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/public/clienttype.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,41 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef CLIENTTYPE_H
+#define CLIENTTYPE_H
+
+/**
+Client type enumeration.
+*/
+enum TRemConClientType
+	{
+	/** Undefined client type. */
+	ERemConClientTypeUndefined = 0,
+
+	/** Controller. */
+	ERemConClientTypeController,
+
+	/** Target. */
+	ERemConClientTypeTarget,
+	
+	};
+
+#endif // CLIENTTYPE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/public/messagetype.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,68 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef MESSAGETYPE_H
+#define MESSAGETYPE_H
+
+/**
+Message type enumeration.
+*/
+enum TRemConMessageType
+	{
+	/** Undefined message type. */
+	ERemConMessageTypeUndefined = 0,
+
+	/** Command. */
+	ERemConCommand,
+	
+	/** Response. */
+	ERemConResponse,
+
+	/** Errored Response or Reject. */
+	/** Treated as a command completion by RemCon */
+	ERemConReject,
+	
+	/** NotifyCommand */
+	ERemConNotifyCommand,
+	};
+	
+/**
+Message subtype enumeration.
+*/
+enum TRemConMessageSubType
+	{
+	/** Default command or response */
+	ERemConMessageDefault = 0,
+	
+	/** Notify command requiring an interim response and (later) changed response */
+	ERemConNotifyCommandAwaitingInterim,
+	
+	/** Notify command requiring only a changed response, after notify has been readdressed */
+	ERemConNotifyCommandAwaitingChanged,
+	
+	/** Notify interim response */
+	ERemConNotifyResponseInterim,
+	
+	/** Notify changed response */
+	ERemConNotifyResponseChanged,
+	};
+
+#endif // MESSAGETYPE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/public/playertype.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef PLAYERTYPE_H
+#define PLAYERTYPE_H
+
+enum TPlayerType
+	{
+	ERemConAudioPlayer = 1,
+	ERemConVideoPlayer = 1<<1,
+	ERemConBroadcastingAudioPlayer = 1<<2,
+	ERemConBroadcastingVideoPlayer = 1<<3,
+	};
+
+enum TPlayerSubType
+	{
+	ERemConNoSubType = 0,
+	ERemConAudioBook = 1,
+	ERemConPodcast = 1<<1,
+	};
+
+class TPlayerTypeInformation
+	{
+public:
+	TPlayerType iPlayerType;
+	TPlayerSubType iPlayerSubType;
+	};
+
+#endif // PLAYERTYPE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/public/remconaddress.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,97 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONADDRESS_H
+#define REMCONADDRESS_H
+
+#include <e32base.h>
+
+/**
+Represents a single remote device address in terms of the bearer used to 
+connect to the device and some bearer-specific connection information.
+*/
+class TRemConAddress
+	{
+public:
+	/** This is maximum supported size for a bearer-specific remote device 
+	address (cf. TSockAddr). */
+	static const TUint KMaxAddrSize = 0x1c;
+
+	/** Link between elements of this type in a TSglQue. */
+	TSglQueLink iLink;
+
+public:
+	/** Constructor. */
+	IMPORT_C TRemConAddress();
+
+	/** Destructor. */
+	IMPORT_C ~TRemConAddress();
+
+public:
+	/**
+	The address is null if the bearer UID is the null UID.
+	@return ETrue if the address is invalid/null, EFalse otherwise.
+	*/
+	IMPORT_C TBool IsNull() const;
+
+	/**
+	@return The bearer UID. Set this to null to make the address
+	null.
+	*/
+	IMPORT_C TUid& BearerUid();
+
+	/**
+	@return The bearer UID.
+	*/
+	IMPORT_C TUid BearerUid() const;
+
+	/**
+	@return The bearer-specific address information.
+	*/
+	IMPORT_C TBuf8<KMaxAddrSize>& Addr();
+
+	/**
+	@return The bearer-specific address information.
+	*/
+	IMPORT_C const TBuf8<KMaxAddrSize>& Addr() const;
+
+	/**
+	Equality operator.
+	@param An address to compare with.
+	@return ETrue if both bearer UIDs and sets of bearer-specific information 
+	match, EFalse otherwise.
+	*/
+	IMPORT_C TBool operator==(const TRemConAddress& aRhs) const;
+
+private:
+	/** Implementation UID of bearer (ECOM) plugin. */
+	TUid iBearerUid;
+
+	/** Buffer for bearer-specific connection address information. */
+	TBuf8<KMaxAddrSize> iAddr;
+
+	/** 
+	Pad for BC-friendly future change.
+	*/
+	TUint32 iPad;
+	};
+
+#endif // REMCONADDRESS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/public/remconifdetails.h	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,85 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef REMCONIFDETAILS_H
+#define REMCONIFDETAILS_H
+
+#include <e32base.h>
+#include <remcon/clienttype.h>
+
+class CRemConInterfaceBase;
+class RReadStream;
+class RWriteStream;
+
+NONSHARABLE_CLASS(CRemConInterfaceDetails) : public CBase
+	{
+public:
+	IMPORT_C static CRemConInterfaceDetails* NewLC(TUid aUid, TRemConClientType aType, TBool aIsBulk, CRemConInterfaceBase* aInterface, const TDesC8& aFeatures);
+	~CRemConInterfaceDetails();
+	
+	IMPORT_C TUid Uid() const;
+	IMPORT_C TRemConClientType Type() const;
+	IMPORT_C void GetRemConInterfaceFeaturesL(RArray<TUint>& aRemConInterfaceFeatures) const;
+	IMPORT_C TBool IsBulk() const;
+	
+	IMPORT_C CRemConInterfaceBase*& Interface();
+	
+	IMPORT_C void DeleteFeatures();
+	
+	static CRemConInterfaceDetails* InternalizeL(RReadStream& aStream);
+	void ExternalizeL(RWriteStream& aStream);
+	
+private:
+	CRemConInterfaceDetails(TUid aUid, TRemConClientType aType, TBool aIsBulk, CRemConInterfaceBase* aInterface);
+	void ConstructL(const TDesC8& aFeatures);
+	void AddFeatures(RBuf8& aFeatures);
+	
+private:
+	CRemConInterfaceBase*	iInterface;
+	
+	TUid					iUid;
+	TRemConClientType		iType;
+	RBuf8					iFeatures;
+	TBool					iBulk;
+	};
+
+
+NONSHARABLE_CLASS(CRemConInterfaceDetailsArray)
+	: public CBase
+	{
+public:
+	IMPORT_C static CRemConInterfaceDetailsArray* NewL();
+	~CRemConInterfaceDetailsArray();
+	
+	IMPORT_C TArray<CRemConInterfaceDetails*> Array() const;
+	
+	IMPORT_C static CRemConInterfaceDetailsArray* InternalizeL(RReadStream& aStream);
+	IMPORT_C void ExternalizeL(RWriteStream& aStream, TRemConClientType aTypeFilter = ERemConClientTypeUndefined);
+	
+	IMPORT_C void AppendL(CRemConInterfaceDetails* aDetails);
+	
+private:
+	CRemConInterfaceDetailsArray();
+	
+private:
+	RPointerArray<CRemConInterfaceDetails> iArray;
+	};
+
+#endif // REMCONIFDETAILS_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/src/remconaddress.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,73 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <e32base.h>
+#include <remconaddress.h>
+#include <bluetooth/logger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_TYPES);
+#endif
+
+EXPORT_C TRemConAddress::TRemConAddress()
+	{
+	LOG_FUNC
+	iBearerUid = KNullUid;
+	iAddr.Zero();
+	}
+
+EXPORT_C TRemConAddress::~TRemConAddress()
+	{
+	LOG_FUNC
+	}
+
+EXPORT_C TBool TRemConAddress::IsNull() const
+	{
+	return ( iBearerUid == KNullUid );
+	}
+
+EXPORT_C TUid& TRemConAddress::BearerUid()
+	{
+	return iBearerUid;
+	}
+
+EXPORT_C TUid TRemConAddress::BearerUid() const
+	{
+	return iBearerUid;
+	}
+
+EXPORT_C TBuf8<TRemConAddress::KMaxAddrSize>& TRemConAddress::Addr()
+	{
+	return iAddr;
+	}
+
+EXPORT_C const TBuf8<TRemConAddress::KMaxAddrSize>& TRemConAddress::Addr() const
+	{
+	return iAddr;
+	}
+	
+EXPORT_C TBool TRemConAddress::operator==(const TRemConAddress& aRhs) const
+	{
+	if ( iBearerUid == aRhs.iBearerUid && iAddr == aRhs.iAddr )
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/remotecontrol/remotecontrolfw/types/src/remconifdetails.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -0,0 +1,207 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+/**
+ @file
+ @internalComponent
+*/
+#include <e32base.h>
+#include <remcon/remconifdetails.h>
+#include <s32strm.h>
+
+
+EXPORT_C CRemConInterfaceDetailsArray* CRemConInterfaceDetailsArray::NewL()
+	{
+	CRemConInterfaceDetailsArray* self = new(ELeave) CRemConInterfaceDetailsArray();
+	return self;
+	}
+
+CRemConInterfaceDetailsArray::CRemConInterfaceDetailsArray()
+	{
+	}
+
+CRemConInterfaceDetailsArray::~CRemConInterfaceDetailsArray()
+	{
+	iArray.ResetAndDestroy();
+	}
+
+EXPORT_C TArray<CRemConInterfaceDetails*> CRemConInterfaceDetailsArray::Array() const
+	{
+	return iArray.Array();
+	}
+	
+EXPORT_C CRemConInterfaceDetailsArray* CRemConInterfaceDetailsArray::InternalizeL(RReadStream& aStream)
+	{
+	CRemConInterfaceDetailsArray* self = new(ELeave) CRemConInterfaceDetailsArray();
+	CleanupStack::PushL(self);
+	TInt count = aStream.ReadInt32L();
+	for(TInt ix=0; ix<count; ++ix)
+		{
+		CRemConInterfaceDetails* details = CRemConInterfaceDetails::InternalizeL(aStream);
+		CleanupStack::PushL(details);
+		self->iArray.AppendL(details);
+		CleanupStack::Pop(details);
+		}
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+EXPORT_C void CRemConInterfaceDetailsArray::ExternalizeL(RWriteStream& aStream, TRemConClientType aTypeFilter)
+	{
+	TInt arrayCount = iArray.Count();
+	TInt count = arrayCount;
+#ifdef _DEBUG
+	TInt checkCount = arrayCount;
+#endif //_DEBUG
+	
+	if(aTypeFilter != ERemConClientTypeUndefined)
+		{
+		count = 0;
+		for(TInt ix=0; ix<arrayCount; ++ix)
+			{
+			if(iArray[ix]->Type() == aTypeFilter)
+				{
+				++count;
+				}
+			}
+#ifdef _DEBUG
+		checkCount = count;
+#endif // _DEBUG
+		}
+	aStream.WriteInt32L(count);
+	for(TInt ix=0; ix<arrayCount; ++ix)
+		{
+		if(aTypeFilter == ERemConClientTypeUndefined || aTypeFilter == iArray[ix]->Type())
+			{
+			iArray[ix]->ExternalizeL(aStream);
+#ifdef _DEBUG
+			--checkCount;
+#endif // _DEBUG
+			}
+		}
+	ASSERT(checkCount == 0);
+	}
+	
+EXPORT_C void CRemConInterfaceDetailsArray::AppendL(CRemConInterfaceDetails* aDetails)
+	{
+	iArray.AppendL(aDetails);
+	}
+
+
+
+EXPORT_C CRemConInterfaceDetails* CRemConInterfaceDetails::NewLC(TUid aUid, TRemConClientType aType, TBool aIsBulk, CRemConInterfaceBase* aInterface, const TDesC8& aFeatures)
+	{
+	CRemConInterfaceDetails* self = new(ELeave) CRemConInterfaceDetails(aUid, aType, aIsBulk, aInterface);
+	CleanupStack::PushL(self);
+	self->ConstructL(aFeatures);
+	return self;
+	}
+
+CRemConInterfaceDetails::CRemConInterfaceDetails(TUid aUid, TRemConClientType aType, TBool aIsBulk, CRemConInterfaceBase* aInterface)
+	: iInterface(aInterface)
+	, iUid(aUid)
+	, iType(aType)
+	, iBulk(aIsBulk)
+	{
+	}
+
+CRemConInterfaceDetails::~CRemConInterfaceDetails()
+	{
+	ASSERT(!iInterface);
+	iFeatures.Close();
+	}
+
+void CRemConInterfaceDetails::ConstructL(const TDesC8& aFeatures)
+	{
+	if(aFeatures.Length() % sizeof(TUint) != 0)
+		{
+		User::Leave(KErrCorrupt);
+		}
+	iFeatures.Assign(aFeatures.AllocL());
+	}
+
+void CRemConInterfaceDetails::AddFeatures(RBuf8& aFeatures)
+	{
+	iFeatures.Close();
+	iFeatures.Swap(aFeatures);
+	}
+
+EXPORT_C void CRemConInterfaceDetails::DeleteFeatures()
+	{
+	iFeatures.Close();
+	}
+
+EXPORT_C CRemConInterfaceBase*& CRemConInterfaceDetails::Interface()
+	{
+	return iInterface;
+	}
+
+EXPORT_C TUid CRemConInterfaceDetails::Uid() const
+	{
+	return iUid;
+	}
+
+EXPORT_C TBool CRemConInterfaceDetails::IsBulk() const
+	{
+	return iBulk;
+	}
+
+EXPORT_C TRemConClientType CRemConInterfaceDetails::Type() const
+	{
+	return iType;
+	}
+
+EXPORT_C void CRemConInterfaceDetails::GetRemConInterfaceFeaturesL(RArray<TUint>& aRemConInterfaceFeatures) const
+	{
+	aRemConInterfaceFeatures.Reset();
+	CleanupClosePushL(aRemConInterfaceFeatures);
+
+	TInt numFeatures = iFeatures.Length() / sizeof(TUint);
+	for(TInt i=0; i<numFeatures; ++i)
+		{
+		TPtrC8 ptr = iFeatures.Mid(i*sizeof(TUint), sizeof(TUint));
+		TPckgC<TUint>& val = *reinterpret_cast<TPckgC<TUint>*>(&ptr);
+		aRemConInterfaceFeatures.AppendL(val());
+		}
+
+	CleanupStack::Pop(&aRemConInterfaceFeatures);
+	}
+
+
+CRemConInterfaceDetails* CRemConInterfaceDetails::InternalizeL(RReadStream& aStream)
+	{
+	TUid uid = TUid::Uid(aStream.ReadInt32L());
+	TRemConClientType type = static_cast<TRemConClientType>(aStream.ReadInt32L());
+	TBool bulk = aStream.ReadUint8L();
+	TInt featureSize = aStream.ReadInt32L();
+	RBuf8 features;
+	features.CreateL(featureSize);
+	features.CleanupClosePushL();
+	aStream.ReadL(features);
+	CRemConInterfaceDetails* self = new(ELeave) CRemConInterfaceDetails(uid, type, bulk, NULL);
+	self->AddFeatures(features);
+	CleanupStack::PopAndDestroy(&features);
+	return self;
+	}
+
+void CRemConInterfaceDetails::ExternalizeL(RWriteStream& aStream)
+	{
+	aStream.WriteInt32L(iUid.iUid);
+	aStream.WriteInt32L(iType);
+	aStream.WriteUint8L(!!iBulk);
+	aStream.WriteInt32L(iFeatures.Size());
+	aStream.WriteL(iFeatures);
+	}