ukBaz / python-bluezero

A simple Python interface to Bluez
MIT License
395 stars 112 forks source link

What is srv_id 0 zero? #404

Open chadrockey opened 8 months ago

chadrockey commented 8 months ago

Looks like all of our servers (peripherals) start with srv_id 1.

What is srv_id zero?

https://github.com/ukBaz/python-bluezero/blob/2b0aba891655bae44c1f281852d5669d5dc9db19/bluezero/peripheral.py#L35

ukBaz commented 8 months ago

Anything that is created and put on the D-Bus needs to have a unique that to identify it. The path of the service on the D-Bus needs to be made unique. Which is done here by using the srv_id that is passed in to the peripheral. https://github.com/ukBaz/python-bluezero/blob/2b0aba891655bae44c1f281852d5669d5dc9db19/bluezero/localGATT.py#L115

If all your paths are having 1 in them then I'm guessing that is because you are setting it to 1. The value doesn't matter as long as different paths have different values. You can create random numbers if you want.