SmartSpin2k icon indicating copy to clipboard operation
SmartSpin2k copied to clipboard

[BUG] Multiple Clients can control

Open doudar opened this issue 4 years ago • 7 comments

Description

After the feature addition of multiple client connections, multiple clients can now connect and control a single SS2K.

Steps to reproduce

  1. Connect more than one Client to the SS2K with different apps running.
  2. Watch the SS2K try to control the knob for two completely different requests.
  3. Enjoy!

Expected behavior

SS2K should ignore the second client attempt to control incline while still providing HR, Watts and Cadence to all remote connected clients.

Additionally it would be nice for the user to be able to either select which client gets the control or remove clients that are not actively controlling the resistance/incline/ERG Target.

Actual behavior

SS2K allows multiple controlling clients and acts erratically.

Additional Information

image

doudar avatar Mar 29 '21 17:03 doudar

Interesting issue here. It seems you would need priority levels for each client connected to determine which one is "in charge" in the current instance. What data would you base the priority level on? This could become a little complex algorithmically, assuming multiple clients are trying to access the same resource, it would make sense that the first successful write is top priority and the next is second etc. but then you need to deal with disconnect/timeout/reconnect and so on. Sounds like a fun puzzle if taken to that level, I'm interested to see what you all come up with.

h2zero avatar Mar 31 '21 04:03 h2zero

You can also reject the second BLE connection with a profile who is requesting the incline control. As far as I know, BLE is organized in profiles. If it is possible to reject a connection request to a "controlling" profile after one client with control request is connected, we don't need priorities or must manage clients and there rights.

MarkusSchneider avatar Dec 06 '21 14:12 MarkusSchneider

That’s a good idea

doudar avatar Dec 07 '21 14:12 doudar

I'm not sure what you mean by profiles?

When a BLE client connects to a server the server only knows the address and connection parameters of the client.

The client then requests services from the server, at that time the server could reject the request if the resource is in use.

That's assuming there isn't some special protocol implemented.

h2zero avatar Dec 07 '21 23:12 h2zero

@h2zero , I think that’s what he means.

doudar avatar Dec 08 '21 00:12 doudar

@doudar Yeah, that's what I assumed, the terminology got me though. Sort of sounded like a Bluetooth classic reference.

h2zero avatar Dec 08 '21 00:12 h2zero

Sorry for the confusion. With profile I had FTMS in mind: https://www.noble-pro.com/information/what-is-ftms/

MarkusSchneider avatar Dec 08 '21 09:12 MarkusSchneider