I'm using a raspberry pi zero w, with the latest Raspbian release, node version 9.7.1.
I have run sudo systemctl disable bluetooth and then sudo hciconfig hci0 up.
My script is at /home/pi/bluetooth/bluetoothCore.js. This script imports bleno and begins advertising.
In /etc/rc.local I have a line node /home/pi/bluetooth/bluetoothCore.js &.
Here's my problem:
After a certain number of seconds rc.local gets run and therefore my script gets run. The iPhone app I'm developing detects the device (because it has started advertising), but when it connects and tries to discover services it sees 0 services. After another 30-40 seconds of startup my app can see the services. What I want is to not run my script (not start advertising) until all necessary system services have been initialized so that I do not have this period of apparent broken functionality upon startup. Unfortunately, I do not have any clue which component is missing at that early startup phase that causes the services to be non-discoverable. Furthermore, even if I knew the moment which would be the right moment to run my script, I have a very limited understanding of the phases of startup and how to run code at different parts of it. What can I do to ensure that my bleno js code only runs when the system is actually ready to begin partaking in bluetooth interaction?
Here's my setup:
sudo systemctl disable bluetooth
and thensudo hciconfig hci0 up
.node /home/pi/bluetooth/bluetoothCore.js &
.Here's my problem:
After a certain number of seconds rc.local gets run and therefore my script gets run. The iPhone app I'm developing detects the device (because it has started advertising), but when it connects and tries to discover services it sees 0 services. After another 30-40 seconds of startup my app can see the services. What I want is to not run my script (not start advertising) until all necessary system services have been initialized so that I do not have this period of apparent broken functionality upon startup. Unfortunately, I do not have any clue which component is missing at that early startup phase that causes the services to be non-discoverable. Furthermore, even if I knew the moment which would be the right moment to run my script, I have a very limited understanding of the phases of startup and how to run code at different parts of it. What can I do to ensure that my bleno js code only runs when the system is actually ready to begin partaking in bluetooth interaction?