Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play sounds when devices connect/disconnect #22

Open
hadess opened this issue Jul 16, 2017 · 3 comments
Open

Play sounds when devices connect/disconnect #22

hadess opened this issue Jul 16, 2017 · 3 comments

Comments

@hadess
Copy link
Owner

hadess commented Jul 16, 2017

This makes it easier to know if the speaker's volume is correctly set, if we connected properly, etc.

The "device-added" and "device-removed" in sound-theme-freedesktop are probably pretty good sounds to start with.

@hadess
Copy link
Owner Author

hadess commented Jul 20, 2017

Using something similar to this script:
https://github.com/adenbeckitt/Bluez-AVRCP-Volume-Control
should work.

Connecting:

/org/bluez/hci0/dev_00_00_00_00_00_00: org.freedesktop.DBus.Properties.PropertiesChanged ('org.bluez.MediaControl1', {'Connected': <true>}, @as [])
<short pause>
/org/bluez/hci0/dev_00_00_00_00_00_00/fd1: org.freedesktop.DBus.Properties.PropertiesChanged ('org.bluez.MediaTransport1', {'State': <'active'>}, @as [])

Disconnecting:

/org/bluez/hci0/dev_00_00_00_00_00_00: org.freedesktop.DBus.Properties.PropertiesChanged ('org.bluez.MediaControl1', {'Connected': <false>}, @as [])

So, when Connected = true, we'd pause for about 0.5 sec, and play a sound if the State was anything but active. We'd always play a sound if Connected is false.

@hadess
Copy link
Owner Author

hadess commented Jul 20, 2017

The freedesktop sound theme has pretty good sounds we could use to play back.

@hadess
Copy link
Owner Author

hadess commented Jul 22, 2017

Note implemented exactly like the above. Note that we received a "Connected" signal even if the device was already connected, when we try to disconnect. The code also doesn't handle multiple devices being connected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant