Replies: 4 comments 6 replies
-
|
My understanding is that what you're describing is inherent to how Central and Peripheral devices are intended to function. Peripherals serve data to Central devices, while central devices connect to and read/write to peripheral data. Peripherals control advertising, while clients control the connection. Because multiple clients could be connected at one time, it would be difficult for the peripheral to know whether it should disconnect all or just a specific one. Even if you got a handle on the device you wanted to disconnect, attempting to close the connection would depend on whether the device has no other app connections (See here) If you truly need to stop all connections, you could consider shutting down the bluetooth module. You could also consider implementing a protocol, where the Let me know if I'm way off here or if there is more to this than I'm understanding. |
Beta Was this translation helpful? Give feedback.
-
In my usage, the script by python-bless is the only application connected to the central device.
Is there a way to implement shutting down and re-start the Bluetooth module in Bless?
I use WIDI Master which is BLE-MIDI adapter as the central device. |
Beta Was this translation helpful? Give feedback.
-
At the moment, it cannot enumerate connected central devices
I'm assuming you're referring to this method on Microsoft's Bluetooth API? A quick search on their sample code shows that this method is typically used by client (central) devices, not peripheral devices. So currently there isn't a way to call this from
Currently, no. Though I'm open to exploring this.
Is your script attempting to control the standard bluetooth specification of the BLE-MIDI or are you attempting to use the BLE-MIDI specification to connect to your WIDI Master? From the BLE-MIDI Specification, it looks like the WIDI functions as a bluetooth peripheral device (aka server) which broadcasts its information. If you're attempting to connect to the WIDI over python, you should be using Bleak as you pointed out earlier. Since this doesn't seem to be a direct issue with bless. I'm converting this to a discussion so we can continue hashing out the problems you're having. If there really is a lack on the Bless side or a potential feature implementation, I'll open this back up as an issue. |
Beta Was this translation helpful? Give feedback.
-
|
I'd like to +1 the request for enumerating connected central devices and selectively terminating the connections. One example I'm struggling with is hardware testing. I'm using bless to mock a BLE central and I would like to simulate a connection drop. If you have some ideas where to look for this functionality (bleak package?), I could try. The tricky part will probably be the cross-platform aspect of it - I'm mainly on Windows and Linux without access to a Mac. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the solution you'd like
I would like to disconnect by bless (i.e., by peripheral), not by central.
If I understand correctly,
BlessServer.stop()stops advertising but does not disconnect.The destructor of
BlessServerclass also does not disconnect.Therefore, unless disconnected by central, the connection keeps to remain even if the Python script that imports bless exits.
Describe alternatives you've considered
BleakClientclass hasdisconnect()method.But,
BlessServerclass does not have thedisconnect()method.Additional context
I use Windows 10.
Beta Was this translation helpful? Give feedback.
All reactions