Lora-net / SWL2001

LoRa Basics Modem LoRaWAN stack
BSD 3-Clause Clear License
104 stars 60 forks source link

Class C reception active after session end #25

Closed HernandoSergio closed 5 months ago

HernandoSergio commented 10 months ago

After the end of a Class C multicast session, the device seems to keep the reception active, as the log shows receptions

imagen

Making some tests I can see that when the multicast class C session ends, it enables the unicast class C instead of just reverting to Class A (configuration prior to multicast session). Problem is in "lrlmac_class_c_multicast_stop_session", that enables the unicast class C session but "class_c_obj->started" is kept as true:

https://github.com/Lora-net/SWL2001/blob/45e19e5bf783bf874b8c9825b76c4c5befa8bcba/smtc_modem_core/lr1mac/src/lr1mac_class_c/lr1mac_class_c.c#L513-L520

lbm-team commented 10 months ago

Hi @HernandoSergio, This is an expected behavior: An internal package cannot take the decision to stop the unicast session of class C or class B at the end of a multicast session as the user may has started it at any time.
To inform the upper layer, the modem will generate 2 dedicated events SMTC_MODEM_EVENT_NO_MORE_MULTICAST_SESSION_CLASS_C and SMTC_MODEM_EVENT_NO_MORE_MULTICAST_SESSION_CLASS_B so that the modem user can decide whether or not return to class A by calling smtc_modem_set_class with SMTC_MODEM_CLASS_A

HernandoSergio commented 10 months ago

Yes, I understand what you say, but the Class C unicast was not active before the multicast session, the device was in Class A.