首页 > 编程知识 正文

avrcp未连接是什么意思,avr studio使用教程

时间:2023-05-05 03:44:43 阅读:162898 作者:1196

安卓11 avrcp连接流程本篇整理了安卓11 avrcp的连接流程。 故事必须从A2DP连接开始。

Android-11.0.0 _ R3/packages/apps/bluetooth/src/com/Android/bluetooth/a2dp/请参阅a2dp service.Java-------------a2dp servicetheactivedevice * @ returntrueonsucce Otherwisefalse*/publicbooleansetactivedevice (蓝牙设备) enforcecallingorselfpermission (蓝牙_ ad mision synchronized (最大同步) ) )/removeactivedeviceandcontinueplayingaudioonlyifnecessary return true; } A2dpStateMachine sm=null; buetoothdevicepreviousactivedevice=null; 同步(mstate machines ) if ) objects.equals (device,mActiveDevice ) ) log.I ) tag,' setactivedevice ' ) device ) }if(DBG ) log.d ) tag,' setactivedevice ' ) device ) : current is ' mActiveDevice ); }sm=mstatemachines.get(device ); if(sm==null ) log.e ) tag,' setactivedevice('device ' ) : cannotsetasactive 3360 ' ' nostatemachine ' ); 返回假; (if ) sm.getconnectionstate )!=蓝牙配置文件. state _ connected (log.e ) tag,' setactivedevice('device ' ) 3360 cannotsetasactive 360 ' device } previousactivedevice=mactive device; //switchfromonea2dptoanothera2dpdeviceif (dbg ) log.d ) tag, ' switch a2 dpdevicesto ' device ' from ' previousactiveddeded//thisneedstohappenbeforeweinformtheaudiomanagerthattthedevice disconnected.pleaseseecommentinupdateandbroadcastactivity for why.//通知系统A2DP相关模块,最新的Pb DWDM设备是updateandbroadcaste //makesuretheaudiomanagerknowsthepreviousactivedeviceisdisconnected、 //andthenewactivedeviceisconnected.if (=null (maudiomanager.setbluetootha2dpdeviceconnectionstatesupressnoisyintent ) 。

//thisneedstorunbeforeanyoftheaudiomanagerconnectionfunctionssince/avrcpneedstobeawaretheaudiodeviceischangedbeforethet changesthevolumeoftheoutputdevices.privatevoidupdateandbroadcastactivedevice (bluetoothdevicedevice ) if ) DBG )/makesurevolumehasbeenstorebeforedevicebeenremovefromactive.if (=null () { mfactory.getavrcptargetservice ().volumeded }synchronized(mstatemachines ) { mActiveDevice=device; //2 .广播通知(蓝牙a2dp.action _ active _ device _ changed )蓝牙statslog.write )蓝牙hstatslog .蓝牙madapterservice.obfuscate address,madapterservice.getmetricid,device; intent intent=new intent (bluetooth a2dp.action _ active _ device _ changed ); intent.put extra (bluetooth device.extra _ device,device ); intent.add flags (intent.flag _ receiver _ registered _ only _ before _ boot|intent.flag _ receiver _ include ) }接下来进入avrcp服务

packages/apps/bluetooth/src/com/Android/bluetooth/avrcp/avrcptargetservice.Java/* * * signaltotheservicethatthecurrentaudiooutdevicehaschangedandtoinform * theaudioservicewhetherthenewdevicesupportsabsolutevolume also * settheabsolutevolumelevelontheremotedevice.*/publicvoidvolumedeviceswitched { if } { debug } mvolumemanager.vole }-- packages/apps/bluetooth/src/com/Android/bluetooth/avrcp/avrcpvolumemanager.javasynchronizedvoidvoidvolumedeviceswitched (@ nullablebluetoothdevicedevice ) d ) volumedeviceswitced if () //waituntilaudiomanagerinformsusthatthenewdeviceisconnectedmcurrentdevice=device; }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。