The LoRaWAN middleware End-node (lora-app.c) includes a "Join Switch" mechanism set up around the StopJoinTimer, the OnStopJointTimeEvent function, and the StopJoin() task function.
The StopJoin function appears to be used to toggle between ABP and OTAA Activation modes. I'm not sure why you might want to do that but Ok - it may have to do with other uses cases such as the AT command firmware.
As it stands within the End Node generated code, it appears to be dormant code as nothing ever seems to start the StopJoinTimer.
But, if it were started by the application, it looks like it may go into a bit of a loop. The StopJoin() function restarts the StopJoinTimer at the end of the function, which means it will called back after JOIN_TIME (2000ms) to swap activation mode again. As a Join usually requires about 5 seconds before the Rx window opens, I am thinking this might actually end up stopping any OTAA Join before it has a chance to succeed.
Possibly I have completely misunderstood what is going on here but so far I have not found any documentation that explains what is going on here, how to use it, or why it exists.
I'm also confused about this and do not understand, for what use case this shall be implemented in a real end node application.
It seems to be (only) example, demonstration or test code to switch from OTAA to ABP (and maybe back) using
LmHandlerStop() and LmHandlerJoin(), triggered by BUT2_Pin and StopJoinTimer.
I think that with the "AT" command style firmware, you should be able to switch between activation modes as the device is acting as a modem with fixed firmware under the control of a separate MCU. This is the only scenario that I have been able to think of.
As far as a given LNS is concerned, the node is exclusively OTAA or ABP.