• Hi,

    A few questions about BLE connection and download that I couldn't find answers for in the various (very good) BLE pages - related to logic I'm implementing for switching between the device active and debug/download mode. Just want to understand the "right" way to do things:

    • When using the CLI to download a program (> espruino file.js), it automatically finds/connects, but seems to stay connected after CLI has completed (on MacOS). Is there an option or preferred way to make it disconnect BLE once the application is downloaded?

    • On the device, how can you see if you are currently connected? I can happily hook NRF.on('connect', ... ) and NRF.on('disconnect', ...), but want to just ask the question e.g. I might already be connected when application starts, so won't have seen any events. Was expecting Bluetooth.connected() or NRF.connected(), but they are not available. What is the preferred way to understand (in particular when the application starts running) what the BLE connection state is?

    • If I do want to force a disconnect from the device side as part of my application once programming is complete (presumably using NRF.disconnect()), what is the best/preferred approach? Having disconnect as the last line in the file is probably not appropriate, as all actions of loading have probably not completed (maybe there is an onLoad() equivalent?). How do you elegantly disconnect from the device side after a programming event?

    Thanks!
    Simon

About

Avatar for mookstar @mookstar started