BLE Host - Set state before tx HCI enable.
BLE Host - Set state before tx HCI enable.

Prior to this change, for advertising, connecting, and scanning, the
host didn't update its GAP state until after all HCI commands were sent
to the controller.  This creates a race condition, because the
controller may act on the enable command before the host GAP state has
been updated.

For example, as soon as the host tells the controlller to
start scanning, the controller may send an advertisement report event.
If the host has not updated its state yet, the advertising report gets
dropped.

Now, the host updates its state before sending the enable command to the
controller.  Unfortunately, this means the host needs to undo the state
update if the enable command fails to be sent.

X-Original-Commit: defcd4195f1c4e4d80935f371a0677ff66c0a42e

apache/mynewt-nimble,apache/mynewt-nimble,apache/mynewt-nimble,apache/mynewt-nimble,apache/mynewt-nimble