2017-12-08 2 views
0

내가 파이썬 사용하여 특정 (대부분)이 BlueZ MediaPlayer1 인터페이스의 특성에 액세스 할 수없는 것 읽어BlueZ (5.43) MediaPlayer1 특성 (파이썬)

dbus.Dictionary({dbus.String(u'Device'): dbus.ObjectPath('/org/bluez/hci0/dev_78_6A_89_FA_1C_95', variant_level=1), dbus.String(u'Position'): dbus.UInt32(0L, variant_level=1)}, signature=dbus.Signature('sv')) 

API (https://kernel.googlesource.com/pub/scm/bluetooth/bluez/+/5.43/doc/media-api.txt)와 내성에 따르면 더 많은 속성을 사용할 수 있습니다.

dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0/dev_78_6A_89_FA_1C_95/player0 org.freedesktop.DBus.Introspectable.Introspect 

반환 :

내성적 쿼리 방법이 잘 작동

<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" 
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> 
<node> 
<interface name="org.freedesktop.DBus.Introspectable"> 
    <method name="Introspect"><arg name="xml" type="s" direction="out"/></method> 
</interface> 
<interface name="org.bluez.MediaPlayer1"> 
    <method name="Play"></method> 
    <method name="Pause"></method> 
    <method name="Stop"></method> 
    <method name="Next"></method> 
    <method name="Previous"></method> 
    <method name="FastForward"></method> 
    <method name="Rewind"></method> 
    <property name="Name" type="s" access="read"></property> 
    <property name="Type" type="s" access="read"></property> 
    <property name="Subtype" type="s" access="read"></property> 
    <property name="Position" type="u" access="read"></property> 
    <property name="Status" type="s" access="read"></property> 
    <property name="Equalizer" type="s" access="readwrite"></property> 
    <property name="Repeat" type="s" access="readwrite"></property> 
    <property name="Shuffle" type="s" access="readwrite"></property> 
    <property name="Scan" type="s" access="readwrite"></property> 
    <property name="Track" type="a{sv}" access="read"></property> 
    <property name="Device" type="o" access="read"></property> 
    <property name="Browsable" type="b" access="read"></property> 
    <property name="Searchable" type="b" access="read"></property> 
    <property name="Playlist" type="o" access="read"></property> 
    </interface> 
    <interface name="org.freedesktop.DBus.Properties"> 
    <method name="Get"><arg name="interface" type="s" direction="in"/><arg name="name" type="s" direction="in"/><arg name="value" type="v" direction="out"/></method> 
    <method name="Set"><arg name="interface" type="s" direction="in"/><arg name="name" type="s" direction="in"/><arg name="value" type="v" direction="in"/></method> 
    <method name="GetAll"><arg name="interface" type="s" direction="in"/><arg name="properties" type="a{sv}" direction="out"/></method> 
    <signal name="PropertiesChanged"><arg name="interface" type="s"/><arg name="changed_properties" type="a{sv}"/><arg name="invalidated_properties" type="as"/></signal> 
</interface> 
</node> 

, 그러나 나는 또한 셔플 설정과 같은 물건을 액세스하고 사전 객체를 추적하는 기대했다. 호스트 (Raspberry Pi Zero W)가 거기에서 음악을 재생하는 Android 휴대 전화에 연결됩니다.

답변

0

Bluez는 DBus 등록 정보에서 대상이 지원하는 응용 프로그램 설정 만 표시합니다. 즉, DBus 인트로 스펙 션에서 볼 수있는 속성은 가능한 설정 및 속성이며 GetAll 메서드가 반환하는 속성은 대상 장치의 지원되는 설정입니다. AVRCP Bluetooth 컨트롤러의 컨트롤러 역할을하는 Bluez는 연결 설정 후 대상 장치에 "List Player Application Settings (11)"명령을 보냅니다. 이 명령에 대한 응답은 대상에서 지원하는 모든 응용 프로그램 설정을 알려줍니다. 따라서 컨트롤러 (예 : 케이스의 Raspberry Pi)는 타겟의 설정 만 변경할 수 있습니다. 더 나은 이해를 위해 bluez 소스의 profile/avtcp.c에있는 코드를 참조하십시오.

유효성을 검사하려면 "반복"과 같은 설정을 변경하고 휴대 전화에서 작동하는지 여부를 확인하는 옵션이있는 다른 AVRCP 프로파일 지원 헤드셋을 연결할 수 있습니다.

+0

예, Windows 10 시스템에서 재생할 때 몇 가지 설정이 추가로 제공됩니다. 어떤 플레이어 애플리케이션을 대상에서 사용 하느냐는 중요하지 않습니다. 애플리케이션간에 전환해도 사용 가능한 속성은 변경되지 않습니다. – svenema

관련 문제