-
Oh, got it. There is no
startAdvertising
/stopAdvertising
and currentlyNRF.setAdvertising
is not a substitute for that. It only sets the data but currently does not affect whether it is on or off. So calling it after being connected may modify the data but does not turn it back on now. That's why the flag is needed. So if it is already off because it is connected thewhileConnected:true
would turn it on (andfalse
would turn it off if it was on). That looks sensible.
Yes, I think it should do that...
Well what if you want it to not advertise when connected?
I think not everyone will want setAdvertising to always enable advertising. I can imagine it getting very confusing if they see the device but then can't connect to it because it's already got something connected to it.
... also, if the default behaviour changes it may well mess with existing code :)
Yes, that makes sense. It's another reason to have the flag, because without it, calls to setAdvertising that used to work would then throw an exception ('can't advertise as connectable when already connected')