You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/10/09 19:21:00 UTC

[GitHub] ccollins476ad opened a new pull request #216: Allow the host to be stopped and started again

ccollins476ad opened a new pull request #216: Allow the host to be stopped and started again
URL: https://github.com/apache/mynewt-nimble/pull/216
 
 
   #### 1. Host stop procedure
   The application can stop the host by calling `ble_hs_stop()`.  Stopping the host has the following effects:
   * Abort all active GAP procedures with status `BLE_HS_EPREEMPTED`.
   * Disallow any subsequent GAP procedures until the host is started again.
   * Terminate all established connections.
   
   If multiple clients attempt to stop the host simultaneously, all of their provided callbacks are executed when the host stops.  The purpose of this behavior is to guarantee a consistent shutdown procedure.
   
   #### 2. Perform stop on system shutdown (Mynewt only)
   This PR also configures the host package with a `pkg.down` shutdown callback.  This causes a system shutdown to trigger a host stop procedure.  This is a Mynewt only feature, so I enclosed this code in `#if MYNEWT` / `#endif`.  If we want to extend this to other OSes, we would need to add some additional definition to NPL (please let me know if this sounds like something we should do).  The auto-stop on shutdown behavior can be disabled by setting the `BLE_HS_STOP_ON_SHUTDOWN` syscfg setting to 0.
   
   #### Notes
   The code in this PR is pretty ugly.  I particularly dislike the requirement for multiple stop callbacks.  I couldn't think of another way to solve the problem of a system shutdown occurring while a manual stop procedure was already in progress.  The system shutdown code needs to be notified when the stop procedure is complete, regardless of who initiated the procedure, hence the need for multiple callbacks.  Anyway, I will not take offense if the reviewer(s) has lots of change requests.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services