-
Notifications
You must be signed in to change notification settings - Fork 17
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
stopping nymea after network established and running secondary ble #43
Comments
thanks for our feedback! Depending on the mode you are running the nymea-networkmanager (default is You can try following:
We had the issue, that with bluetooth 4.0 you are not allowed to run a server and being a client (connect to an other bluetooth le device simultaneously), se we stop all connections while the bluetooth server is running (we provide a dbus interface for that) and re-enable all connections after the server stopped. Having a second bluetooth server advertising right after the nymea-networkmanager one I have not tried yet. I will check here what happens on bluez with the advertising service data once the server stopped. |
Hi @t-mon
In your experience what time does nymea need to completely stop and re-enable after wifi is set up ? It may be possible we are starting our service too soon? if it matter we are using rpi4b (which is bluetooth 5, but we use ble) Regards |
The server remains until the client application (connected to the bluetooth server) closes the connection, not when the system is online. The offline mode only makes sure the bluetooth server will not be started again if the system is online. The server shutdown can take a few seconds after the disconnect. |
Okay, we will keep this in consideration for testing and revert with an update, thank you. |
hi @t-mon I have tested and confirm there is no bug.
to save from closing the client application and switch from one ble service to the second in a more seamless fashion within the same app, do you have suggestion for nymea server shutdown after a wifi is established? The few methods I have tried shuts the nymea server down prematurely when attempting to setup wifi. |
The bluetooth service is designed in a way to have all the time you want to establish a network connection, follow the connection state changes and never have a blind situation where you don't know what the device is doing or if the network connection failed. It was originally also designed to do other stuff too, switch the connection, or reconfigure something. Shutting down the connection right after you are online kills almost the entire usecase (like fetching the ip the device got, or doing further configuration) and many possibilities. One thing I could suggest is offering a local socket or something, giving you information if the bluetooth server is running or not, with that you would be able to start your bluetooth server right after the nymea networkmanager one has shut down. In your client application (communicating to both servers) you just need to disconnect from the nyma bt server, that shuts it down, you can start your bt server using the suggested mechanism, and connect to your bt server. |
FYI: I'm currently reworking the entire bluetooth server, introducing encryption and dynamic service registration. The current service for networkmanagment will remain for backwards compatibility, but new features will only implemented in the new service infrastructure and using encryption. |
This might work better, at the moment we use ping to determine if there is connectivity and start when there is, but as mentioned it still uses nymeas endpoints when it starts and continues until nymea properly shutsdown ( rpi or app is rebooted). |
Hello,
Thank you for the daemon, it is great!
I have a scenario where I need to run a secondary ble service after internet connectivity is established.
ExecStartPre=/bin/sh -c 'until ping -c1 google.com; do sleep 5; done;'
I have noticed that when my broadcast starts it still uses nymea's characteristics. I have to disconnect + refresh several times + connect in order to see mine.So we tried the following to check + stop nymea before starting ours
Which seems to properly stop and broadcast the correct ble characteristics. However it prematurely stops nymea during the wifi setup (whenever there is no wlan set up).
Any suggestions to properly stopping nymea after setup and starting a second ble service?
if it makes a difference we are using the installation as noted on berrylan repo.
The text was updated successfully, but these errors were encountered: