《Android 蓝牙AVRCP功能的实现.docx》由会员分享,可在线阅读,更多相关《Android 蓝牙AVRCP功能的实现.docx(9页珍藏版)》请在第壹文秘上搜索。
1、Android蓝牙AVRCP功能的实现作者:ICaCro1.iuAVRCP的按便定义:sdkcmu1.atorkeymapsAVRCP.k1.key200MEDIAP1.AYPAUSEWAKEkey201MEDIAP1.AYPAUSEWAKEkey166VEDIA_SToPWAKEkey163MEDIA_NEXTWAKEkey165MEDIAPREVIOUSWKEkey168MEDIA_REWNDWAKEkey208MEDIA_FASFORWARDWAKEBCM(broadco,REWINDOP,FASTFORWARDKEYM-XTSONG,keyirevIoussong,KEYRCTIND,
2、OP1KEY_FASTrORWARD),staticvoidhand1.epane1.passthrough(structcontro1.*contro1.,or(i=0;keympi.nkeyquirkskcy_mapi.avrcp;if(keyquirks&QUIRKNORE1.EASE)if(!pressed)DBG(AYRCP:Ignoringre1.ease*):break:)DBG(,AVRCP:treatingkeypressaspressre1.ease*);st?nd_key(contro1.-uinput,keymapfi.uinput,1):sendkey(contro1
3、.uiput,keyapij.uinput,0);break;)sendkey(conIro1.uiput,keymaj,i.uinput,pressed);break:)HC1.iMJMP数据分析以Sony耳机DRC-BT15为例Sadbshe1.14hcidunp-X左犍:AC1.data:hand1.e12f1.ags0x02dien121.2CAP(d):ci0x0042Ien8psn00000:3011Oe00487c4c000.H1.HCICoounand:ExitSniffMode(0x02OxOOO1.)P1.en2OOOO:Oc00IIC1.Event:MaxS1.otsCh
4、ange(Ox1.b)p1.en3050000:Oc00HCIEvent:ModeChange(0x14)p1.en0000:006Oc00000000HCIEvent:CommandStatus(OxOf)408AC1.data:hand1.e12f1.ags0x02dien121.2CAP(d):ci1.0x0042Ien8psm0Oe00487ccc0000:401100HCI00data:hand1.e12f1.ags0x00dien120000:08004b004211Oc09487ccc00Event:NumberofComp1.etedPackets(0x13)0000:01Ip
5、1.en5Oc.I1.?00.K.B.H?02播放/哲停:AC1.data:hand1.e12f1.ags0x02dien121.2CP(d):ciOxOO42Ien8psm00000:50I1.OOC1.data:hand1.e12f1.ags0x02dien121.2CAP(d):ciJ0x0042Ien8psm00000:6011OOHC1.Event:NumberofComp1.etedPackets(0x13)0000:0100OeOcIp1.en5Oc00P.00HK.H?4848007c4b.K.R.HK.7ccb.K.b.Hi?02右键:AC1.00AC1.00HCI00HCI
6、data:hand1.e12f1.ags0x02dien121.2CAP(d):cid0x0012Ien8psm00000:70Hdata:hand1.e12f1.ags0x00dien120000:0800Ib007211Oe09487c4600data:hand1.e12f1.ags0x02dien121.2CAP(d):cidOxOO42Ien8psm00000:8011data:hand1.e12f1.ags0x00dien120000:08004b0082IIOe09487cc6OOEvent:NunberofComp1.etedPackets(0x13)0000:01Event:M
7、axS1.otsChange(Ox1.b)p1.en3OeOeIp1.en5Oc00p00*HF.H?4848007c46.K.r.HF.7cc6.KH?02O1.HCIEvent:ModeChange(0x14)p1.en60000:00Oc0002c800.?然后将ntro1.c的日志打印出来:按一次“播放/暂停键:D/ACRVP(237):hand1e_pane1_passthroughD/ACRVP(237):operands0=46对庖PAUSEj)PD/ACRVP(237):koy_quirks=0,pressed=1底键按下D/ACRVP(237):contro1.-uinput
8、=fffffffe,sendkey=201对应MED1.AP1.AY_PAUSED/ACRVP(237):hand1e_pane1_passthroughD/ACRVP(237):operands0=c6(=0x460x80表示按键择放了)D/ACRVP(237):key_quirks=0,pressed=0按键释放D/ACRVP(237):contro1.-uinput=ffffffe,sendkey=201对应MEDIAP1.YPAUSE再按次”播放/否停犍:D/ACRVP(237):hand1.epane1.passthroughD/ACRVP(237):operands0=44对应P1
9、.AY_OPD/ACRVP(237):key_quirks=0,pressed=1按键按下D/ACRVP(237):contro1.-uinput=fffffffe,send_key=200对应MEDIA_P1.APAUSED/ACRVP(237):hand1.epane1.passthroughD/ACRVP(237):operands0=c4D/ACRVP(237):key_quirks=0,pressed=0按键释放D/ACRVP(237):contro1.-uinput=fffffffe,sendkey=200对应MED1.A_P1.AY_PAUSEnextkey:D/ACRVP(23
10、7):hand1e_pane1_passthroughD/ACRVP(237):operandsf=4b对应F0R*ARD_()PD/ACRVP(237):keyquirks=0,pressed=1D/ACRVP(237);contro1.-uinput=fffffffe,send_key=163对应MED1.A_NEXTD/ACRVP(237):hand1e_pane1_passthroughD/ACRVP(237):operands0=cbD/ACRVP(237):keyquirks=0,pressed=0D/ACRVP(237);contro1.-uinput=fffffffe,send
11、_key=163prevkey:D/ACRVP(237):-hand1.epane1.passthroughD/ACRVP(237):operands0=4c对应BACKWARDJ)PD/ACRVP(237):key_quirks=0,pressed=1D/ACRVP(237):contro1.-uinput=fffffff。,send_key=165对应D/ACRVP(237):hand1.epane1.passthroughDCRVP(237):operands=ccD/ACRVP(237);key_quirks=0,pressed=0D/ACRVP(237):contro1.-uinput=fffffffe,send_key=165NED1.A.PREVIOUS从上面可以看到b1.uetooth的协议栈b1.ueZ是没有问题的将fraeorksbase1.ibsuiEventHub.cpp的1.oGiB开,只能看到了8ntro1.c的日志,EventHub的getEvent完全不响应观察所有1.og日志发现,openDevice里也没有装载AVRCI.k1.