We provide now downlink channel frequency and time on air for the
received frame in the RX metadata.
Previously the channel information in both TX and RX metada contained
the index number of the channel. That information wasn't very useful
except the index numbers of default channels. To make more sense of the
meta data, we now store the channel frequency in the channel parameter
rather than the index number of the channel.
RX time on air is collected from the radio driver and it is assumed that
the downlink frame had 8 downlink preamble symbols (plus 4.25 of the
preambles added by the chip) for LoRa modulation.
This commit also include a bit of tidying of RX frequency storage in rx
configuration parameters storage. Previously we were missing filling in
the RX1 frequency correctly.
Previously we had been incrementing UL frame counter for a CONFIRMED
message only when the transmission was deemed successful i.e., we would
have received an ack before all the retries would have exhausted.
Now we have opted to increment the frame counter if all the retries are
exhausted considering the fact that we essentially treat the next
message after retry exhaustion as a new packet so we should also
increment the frame counter.
The idea behind the method post_process_no_reception() is to post
process any outgoing TX but we shouldn't do that if a CONFIRMED message
is outgoing and there are still some retries left.
After transmission we should change the state before invoking opening of
slots as we may start receiving in the rx slots and the state would
suddenly change from SENDING to RECEIVING without going through the
ACK_WAIT state (in case of CONFIRMED messages). Tests show that after
this slight adjustment, our number of ack retries have significantly
reduced.
LinkADRReq mac command can be used by the network server to set a
certain level of QOS using NbTrans field which is applicable to
Unconfirmed traffic only for 1.0.2 spec.
This commit introduces mechanisms to facilitate this QOS. It means to
repeat an outgoing unconfirmed message NbTrans times without changing
its frame counter.
For class C, we have retired the ack_expiry_timer_for_class_c and have
replaced it with another timer which mimics the RX2 closure as in Class
A but doesn't actually close RX2 window. It's just a mechanism by which
the state machine is informed that the you can proceed forward, we have
not received anything in RX2 window either. This is needed as RX2
doesn't timeout in class C (i.e., the radio remains in continuous mode).
In addition to that we need to close any pending timers for Receive
windows after the MIC has passed and the Duplicate counter check has
also been passed.
Before going after an automatic uplink, we should check if there was an
automatic uplink already ongoing, i.e., the ack for the previous
automatic uplink cycle has not been received.
If there is we shouldn't queue the new automatic uplink and wait for
the previous Ack cycle to complete.
If the packet is already handed over to the PHY layer, we shouldn't be
able to cancel that particular transmission. In addition to that if the
backoff timer is either not applied or has been deactivated, should end
up in no-op rather than having normal termination. A new error code has
been introduced to cover no-op cases. This error code replaces the
compliance test related error code which is no longer relevant.
clear_tx_pipe() does nothing if:
- The stack cannot cancel TX (already handed over to PHY)
- The backoff timer is not active at all
- The event is disaptched to schedule
stop_sending() will only post process ongoin TX if the pipe was
definitely cleared.
The idea behind the method post_process_no_reception() is to post
process any outgoing TX but we shouldn't do that if a CONFIRMED message
is outgoing and there are still some retries left.
After transmission we should change the state before invoking opening of
slots as we may start receiving in the rx slots and the state would
suddenly change from SENDING to RECEIVING without going through the
ACK_WAIT state (in case of CONFIRMED messages). Tests show that after
this slight adjustment, our number of ack retries have significantly
reduced.
LinkADRReq mac command can be used by the network server to set a
certain level of QOS using NbTrans field which is applicable to
Unconfirmed traffic only for 1.0.2 spec.
This commit introduces mechanisms to facilitate this QOS. It means to
repeat an outgoing unconfirmed message NbTrans times without changing
its frame counter.
For class C, we have retired the ack_expiry_timer_for_class_c and have
replaced it with another timer which mimics the RX2 closure as in Class
A but doesn't actually close RX2 window. It's just a mechanism by which
the state machine is informed that the you can proceed forward, we have
not received anything in RX2 window either. This is needed as RX2
doesn't timeout in class C (i.e., the radio remains in continuous mode).
In addition to that we need to close any pending timers for Receive
windows after the MIC has passed and the Duplicate counter check has
also been passed.
Before going after an automatic uplink, we should check if there was an
automatic uplink already ongoing, i.e., the ack for the previous
automatic uplink cycle has not been received.
If there is we shouldn't queue the new automatic uplink and wait for
the previous Ack cycle to complete.
While performing compliance tests with an industry tester, we realized
that there was no need for any extra handling code for the compliance
tests. The tests would run fine, if we only have a handling application.
However, in normal operation we wouldn't like the network to send us any
traffic on compliance testing port. To mitigate that, on the reception
path we filter out any traffic on compliance testing port if compliance
testing is not underway. User should define LORAWAN_COMPLIANCE_TEST macro
in mbed_app.json to enable traffic on compliance test port.
When application requests link check request with add_link_check_request()
it was added to MAC command buffer. Again when actual TX was started,
stack cherry-picked the request into MAC buffer again resulting in a duplicate
entry in the buffer.
Functionality is changed now so that add_link_check_request() does not add
the request into MAC command buffer but it is cherry-picked into the buffer when
TX is issued.
In order have a consistent return value for all methods in case of system is uninitialized
now also send and receive methods can return LORAWAN_STATUS_NOT_INITIALIZED.
Thix commit fixes a bug where stack was resending join-accept already
after RX1 if received join-response was invalid.
Stack should wait for RX2 before resending the join-accept.
When node sends a CONFIRMED message and gateway sends ACK in RX1 window but the
message gets corrupted during the transmission (e.g. MIC fails), currently
our stack already checks for retransmission after RX1 and if retries attemps are
exhausted, TX_ERROR event is sent to application. This is wrong as MAC layer
will still attempt reception in RX2 window.
This commit fixes the behaviour so that TX_ERROR is not sent until RX2 window
has been closed.
It is quite possible that the user request for scheduling an uplink is deferred because of backoff or if it was a CONFIRMED message, a retry may take place on a different datarate and different channel.
We didn't have a hook for such deferred scheduling, telling the user whether the async rescheduling worked or not. This commit adds that capability and now we can tell the application if a scheduling failure took place after the original schedule request was accepted.
failed of its own accord) would prevent futher connect()'s due to the
CONN_IN_PROGRESS_FLAG remaining set. This change clears that flag in
the two cases described.
In the case when an automatic uplink was queued and the user do have something send,
we should give priority to user data instead od automatic uplink message.
This commit fixes some bugs from cancel_sending() method:
- System crashed if method was called before initialization.
Now LORAWAN_STATUS_NOT_INITIALIZED will be returned.
- Method returned LORAWAN_STATUS_BUSY error when no send request was pending.
LORAWAN_STATUS_OK should be returned in this case.
- LORAWAN_STATUS_BUSY is now returned if backoff timer is just about to be
dispatched (time_left returns 0).
For ABP: First call to connect() or connect(params) will return LORAWAN_STATUS_OK
and a CONNECTED event will be sent. Any subsequent call will return
LORAWAN_STATUS_ALREADY_CONNECTED (posix EISCONN) and no event is generated.
FOR OTAA: First call to connect() or connect(params) will return LORAWAN_STATUS_CONNECT_IN_PROGRESS
and a CONNECTED event will be sent whenever the JoinAccept is received. If the application
calls connect again before receiving the CONNECTED event, LORAWAN_STATUS_BUSY will be returned.
After the CONNECTED event is dispatched, any subsequent call to connect() or connect(params) API
will be returned with LORWAN_STATUS_ALREADY_CONNECTED.
No new parameters are accepted after the first call. The application must disconnect before making
a connect() call with new parameters.
This is a remedy for the issue #7230.
While the device is joining, LORAWAN_STATUS_CONNECT_IN_PROGRESS is returned.
However, if the device is already joined, we will return LORAWAN_STATUS_ALREADY_CONNECTED.
This commit fixes the issue reported in #7285.
If the radio is unable to transmit, its a fatal error and can happen
both while joining or sending a normal packet. In the case of such
a catastrophy we ought to tell the application that this happened.
A fix for the radio driver will also be patched.
If the automatic uplink is sent directly the call-stack becomes larger than 1K
which may cause serious problems in debug builds. Just to have a respite between
RX and TX we queue an event for the automatic uplink rather than directly undergoing
an automatic uplink.
RX1 and 2 delays needed to be more precise and aggregate tx time was
drifiting because of timing difference between actual tx interrupt and
our processing of that interrupt ever so slightly.
We now take a timestamp of the tx interrupt and take a time diff while
instantiating delay timers. The timestamp is then used to update the aggregate
tx time.
Two new methods are introduced in the LoRaMac class which provide current
timing and current receive slot. These functions are used by LoRaWANStack
for its processing.
Travis astyle check pointed out some of the style mismatches in the code.
Not all of them are worth changing as they make the code unreadable and
some of them are semantically wrong.
So in this commit, we have attempted to pick the most important style
mismatches and rectify.
General stability improvements are performed.
A flag is added if a Class C RX2 window is open.
We shouldn't open it again if its already opened.
TX_CRYPTO_ERROR is renamed to CRYPTO_ERROR.
Keeping TX_CRYPTO_ERROR for backwards compatibility.
In Class C, rx timeout does not take place for RX2 windows, so if we have
not received anything, we would be retrying but if the no. of retries are
maxed out, and we have not recieved anything yet, we need a mechanism to
tell the upper layer that this has happened.