kradhub / zik2ctl

Command line tools to display and configure Parrot Zik2 Headphones
GNU Lesser General Public License v3.0
12 stars 4 forks source link

ZIK 3.0 support #1

Closed fcrozat closed 8 years ago

fcrozat commented 8 years ago

Zik 3.0 seems to be backward compatible with Zik 2.0: the UUID is different 8b6814d3-6ce7-4498-9700-9312c1711f64 but so far, your software is working nicely to toggle noise cancelling.

kradhub commented 8 years ago

Hi Frederic,

Thanks for your test with the Zik3.0. I just check out the Zik3 API and it seems to be quite common with the zik2 with just a little more commands. Hence I think I could add support of zik3 in the future easily. But first, the code need some refactor and cleanup, supports other commands and provide a README...

By the way, could you tell me which version of Bluez is installed on your system ? I asked that because I currently need to compile the current master of Bluez to make the app works on my side.

fcrozat commented 8 years ago

I tested with BlueZ 5.35 (openSUSE Leap 42.1).

kradhub commented 8 years ago

I begin to look at zik3 support and for now I hack the application to recognized Zik3 as a Zik2 and pushed the result in the 'dev-zik3-support' branch: https://github.com/kradhub/zik2ctl/tree/dev-zik3-support It will likely not fully work but you should at least be able to list and connect to a Zik3. If you have some time, feel free to try this branch ?

Also can you run the following command which will dump Zik reply to some request, and paste the result: $ zik2ctl --dump-api-xml

It may help me implement Zik3 support.

Thanks

fcrozat commented 8 years ago

Just tested the branch, I got some errors: \ (zik2ctl:21622): CRITICAL **: failed to parse request reply: 1:141: attribute 'auto_nc' invalid for element 'noise_control'

\ (zik2ctl:21622): CRITICAL **: failed to parse request reply '/api/audio/noise_control/get with args (null)'

\ (zik2ctl:21622): WARNING **: failed to get noise control

\ (zik2ctl:21622): CRITICAL **: failed to parse request reply: 1:163: attribute 'mode' invalid for element 'sound_effect'

\ (zik2ctl:21622): CRITICAL **: failed to parse request reply '/api/audio/sound_effect/get with args (null)'

\ (zik2ctl:21622): WARNING **: failed to get sound effect info

fcrozat commented 8 years ago

dump-api-xml:

- ZIK2_API_AUDIO_TRACK_METADATA_PATH
custom request '/api/audio/track/metadata/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/track/metadata/get"><audio><track><metadata playing="false" title="" artist="" album="" genre=""/></track></audio></answer>
- ZIK2_API_AUDIO_NOISE_CONTROL_ENABLED_PATH
custom request '/api/audio/noise_control/enabled/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/noise_control/enabled/get"><audio><noise_control enabled="true"/></audio></answer>
- ZIK2_API_AUDIO_NOISE_CONTROL_PATH
custom request '/api/audio/noise_control/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/noise_control/get"><audio><noise_control type="anc" value="2" auto_nc="true"/></audio></answer>
- ZIK2_API_AUDIO_NOISE_CONTROL_PHONE_MODE_PATH
custom request '/api/audio/noise_control/phone_mode/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/noise_control/phone_mode/get"><audio><noise_control phone_mode="aoc" phone_mode_value="1"/></audio></answer>
- ZIK2_API_AUDIO_THUMB_EQUALIZER_VALUE_PATH
custom request '/api/audio/thumb_equalizer/value/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/thumb_equalizer/value/get"><audio><thumb_equalizer r="84" theta="151"/></audio></answer>
- ZIK2_API_AUDIO_EQUALIZER_ENABLED_PATH
custom request '/api/audio/equalizer/enabled/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/equalizer/enabled/get"><audio><equalizer enabled="false"/></audio></answer>
- ZIK2_API_AUDIO_SMART_AUDIO_TUNE_PATH
custom request '/api/audio/smart_audio_tune/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/smart_audio_tune/get"><audio><smart_audio_tune enabled="false"/></audio></answer>
- ZIK2_API_AUDIO_PRESET_BYPASS_PATH
custom request '/api/audio/preset/bypass/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/preset/bypass/get"><audio><preset bypass="false"/></audio></answer>
- ZIK2_API_AUDIO_PRESET_CURRENT_PATH
custom request '/api/audio/preset/current/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/preset/current/get"><audio><preset id="0"/></audio></answer>
- ZIK2_API_AUDIO_SOUND_EFFECT_ENABLED_PATH
custom request '/api/audio/sound_effect/enabled/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/sound_effect/enabled/get"><audio><sound_effect enabled="true"/></audio></answer>
- ZIK2_API_AUDIO_SOUND_EFFECT_PATH
custom request '/api/audio/sound_effect/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/sound_effect/get"><audio><sound_effect enabled="true" room_size="silent" angle="120" mode="stereo"/></audio></answer>
- ZIK2_API_AUDIO_NOISE_PATH
custom request '/api/audio/noise/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/noise/get"><audio><noise internal="-1" external="-1" reduction="-16"/></audio></answer>
- ZIK2_API_AUDIO_VOLUME_PATH
custom request '/api/audio/volume/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/volume/get"><audio><volume value="370"/></audio></answer>
- ZIK2_API_AUDIO_SOURCE_PATH
custom request '/api/audio/source/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/audio/source/get"><audio><source type="NoSource"/></audio></answer>
- ZIK2_API_SOFTWARE_VERSION_PATH
custom request '/api/software/version/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/software/version/get"><software sip6="3.02" pic="29" tts="fr-FR"/></answer>
- ZIK2_API_BLUETOOTH_FRIENDLY_NAME_PATH
custom request '/api/bluetooth/friendlyname/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/bluetooth/friendlyname/get"><bluetooth friendlyname="Parrot ZIK 3.0"/></answer>
- ZIK2_API_SYSTEM_BATTERY_PATH
custom request '/api/system/battery/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/system/battery/get"><system><battery state="in_use" percent="98" timeleft="-1"/></system></answer>
- ZIK2_API_SYSTEM_BATTERY_FORECAST_PATH
custom request '/api/system/battery/forecast/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/system/battery/forecast/get"><system><battery type="effects" forecasted_state="disabled" value="-1"/><battery type="noise_control" forecasted_state="disabled" value="-1"/><battery type="audio" forecasted_state="bluetooth" value="-1"/></system></answer>
- ZIK2_API_SYSTEM_AUTO_CONNECTION_ENABLED_PATH
custom request '/api/system/auto_connection/enabled/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/system/auto_connection/enabled/get"><system><auto_connection enabled="true"/></system></answer>
- ZIK2_API_SYSTEM_ANC_PHONE_MODE_ENABLED_PATH
custom request '/api/system/anc_phone_mode/enabled/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/system/anc_phone_mode/enabled/get"><system><anc_phone_mode enabled="false"/></system></answer>
- ZIK2_API_SYSTEM_DEVICE_TYPE_PATH
custom request '/api/system/device_type/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/system/device_type/get"><system><device_type value="5"/></system></answer>
- ZIK2_API_SYSTEM_COLOR_PATH
custom request '/api/system/color/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/system/color/get"><system><color value="1"/></system></answer>
- ZIK2_API_SYSTEM_PI_PATH
custom request '/api/system/pi/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/system/pi/get"><system pi="PI040372AA5K004699"/></answer>
- ZIK2_API_SYSTEM_HEAD_DETECTION_ENABLED_PATH
custom request '/api/system/head_detection/enabled/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/system/head_detection/enabled/get"><system><head_detection enabled="true"/></system></answer>
- ZIK2_API_SYSTEM_FLIGHT_MODE_PATH
custom request '/api/flight_mode/get?arg=(null)' reply:
<?xml version="1.0" encoding="UTF-8"?><answer path="/api/flight_mode/get"><flight_mode enabled="false"/></answer>
kradhub commented 8 years ago

Thanks for information.

I've updated the 'dev-zik3-branch', could you test it and tell me if it's work without error ?

fcrozat commented 8 years ago

Just tested, everything works fine.

I just noticed the new "sound effect mode" can't be set from zik2ctl ;)

kradhub commented 8 years ago

I found no explicit API for it.

Do you know if official Parrot application can set it ?

fcrozat commented 8 years ago

I haven't seen anything in that regard ATM, maybe they will enable it later. Or it is only used when Zik3 is receiving audio through USB (I tested on Linux with pulseaudio properly configured, you can get 5.1 surround)..

kradhub commented 8 years ago

Ok, so for now, I think we can safely assume this "mode" is informative. If in a future release software release, Parrot add an API to set it, we could easily add it.

kradhub commented 8 years ago

Closing this issue as 'dev-zik3-support' branch has been merged into master.

Thanks for your help and feel free to report bugs or features requests about Zik3.