Utilising media keys on S60 devices

本文介绍如何在S60第三版设备上通过Remote Control API捕获媒体按键事件,如音量增减等,并提供了实现代码示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Description

Key presses of media keys cannot be detected in the same way as other key events. Media keys, such as Play/Pause, Stop, Volume Up/Down, Rewind, and Forward keys featured on some S60 3rd Edition devices do not generate normal key events that could be handled within the application framework, for example, in HandleKeyEventL() or OfferKeyEventL() .

Solution

Events from media keys can be handled with the Remote Control API . Below is a code snippet that demonstrates this.

Remote Control API requires ReadUserData capability.

 

To handle hardware keys the following approach can be followed.

1) Derive a class from MRemConCoreApiTargetObserver

2) Use the following code snippet in your class.
CRemConInterfaceSelector* iSelector;
CRemConCoreApiTarget* iTarget;

//preferably in the constructL()
iSelector=CRemConInterfaceSelector::NewL();
iTarget = CRemConCoreApiTarget::NewL( *iSelector, *this );
iSelector->OpenTargetL();


3) MrccatoCommand() api is an virtual method in MRemConCoreApiTargetObserver which should be implemented.This is a callback method which will be called by the framework when a hardware key is pressed.

void MrccatoCommand(TRemConCoreApiOperationId aOperationId,TRemConCoreApiButtonAction aButtonAct)
{

switch(aOperationId)
{
case ERemConCoreApiVolumeDown:
{
//do your own stuff
break;
}
case ERemConCoreApiVolumeUp:
{
//do your own stuff
break;
}
}
}

4) Header file for CRemConInterfaceSelector: remconinterfaceselector.h
Library: remconinterfacebase.lib
Header file for CRemConCoreApiTarget: remconcoreapitarget.h
Library:remconcoreapi.lib

资源下载链接为: https://pan.quark.cn/s/fe886b97b3d0 “优快云-中文IT社区-600万.rar” 这个文件名称表明它与优快云(中国软件开发者网络)有关,且包含600万份资源。优快云作为中国最大的IT技术交流平台,覆盖了编程语言、软件开发、网络安全、大数据、云计算等多个领域的知识和资讯。该压缩包可能包含用户数据、文章、讨论话题或学习资料等。其内容可能极为丰富,涵盖大量用户生成内容,如博客文章、论坛帖子、问答记录等,对于研究IT行业趋势、开发者行为和技术热点等具有重要价值。尽管目前没有具体内容,但推测可能涉及“编程”“开发”“社区数据”“技术文章”“学习资源”等标签。 从文件名称来看,压缩包的内容可能包括以下几类:一是用户数据,如注册信息、活动记录、帖子和评论等,可用于分析用户行为和社区活跃度;二是技术文章和博客,涵盖众多技术专家分享的教程、解决方案和经验;三是源代码和项目,供其他开发者学习参考;四是论坛讨论,反映开发者关注的技术问题和热点;五是资源下载,如教程素材、工具软件、开发库等;六是会议和活动记录,包括报告、演讲稿和视频;七是学习路径和课程,帮助开发者提升技能;八是排行榜和奖项,体现社区的认可度和影响力。 “优快云-中文IT社区-600万.rar” 压缩包可能是一个极具价值的IT知识宝库,涵盖从基础编程到高级技术实践的广泛主题,反映了中国IT社区的发展动态。对于IT从业者、研究人员以及编程爱好者来说,它是一个极具价值的学习和研究资源,能够帮助人们洞察开发者需求、技术趋势和社区变化。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值