Commit Graph

243 Commits (8561875284e0f375a2fe9de8af54ea65f9d35e8a)

Author SHA1 Message Date
Antti Kauppila f0864be1c5 Fixed lorawan unittests valgrind issues 2018-10-17 15:25:53 +03:00
Hasnain Virk 0a9417299b Fixing coverity findings
A couple of the coverity analysis findings are being treated here. For
the rest there will be a separate PR.
2018-10-16 12:23:21 +03:00
Hasnain Virk 7818733728 Proper handling of RX1 frequency in rx_config
Previously, we weren't filling in RX1 frequecny in rx_window1_config
structure. However, everything worked as in LoRaPHY::rx_config() API
there was a check which filled in correct RX1 frequency.
Now we are filling in RX1 freq. properly while we are computing
parameters for RX1 window.
2018-10-16 12:23:21 +03:00
Hasnain Virk 9e4487c850 TX post-process for CONFIRMED UL in no-reception case
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.
2018-10-16 12:23:21 +03:00
Hasnain Virk 8d4cda11f7 Making sure that RX slots open after state change
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.
2018-10-16 12:23:21 +03:00
Hasnain Virk d5ce0cc96f Adding QOS handling and fixing bugs for Class C
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.
2018-10-16 12:23:21 +03:00
Hasnain Virk dc702c2df9 Adding check for ongoing automatic-uplink
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.
2018-10-16 12:23:21 +03:00
Hasnain Virk 1fa2589c1e Style correction
LinkADRReq parameters and certain parameters used camel case
which is not the recommended style.
2018-10-16 12:23:21 +03:00
Cruz Monrreal b666cd68dc
Merge pull request #8299 from hasnainvirk/issue_8285
Making cancel_sending() API robust
2018-10-15 10:12:27 -05:00
Cruz Monrreal II dd8e9bb954 Revert "Merge pull request #8183 from hasnainvirk/QOS_impl"
This reverts commit 5c675d3688, reversing
changes made to 2b04a02eb2.
2018-10-11 16:51:46 -05:00
Cruz Monrreal 5c675d3688
Merge pull request #8183 from hasnainvirk/QOS_impl
Adding QOS in response to LinkADRReq and fixing class C bugs
2018-10-11 10:09:37 -05:00
Hasnain Virk 603ee28098 Making cancel_sending() API robust
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.
2018-10-02 14:07:52 +03:00
Antti Kauppila a54c271814 cmake Paths corrected 2018-09-27 11:30:52 +03:00
Antti Kauppila f6ecb319d0 LoRaMac unittested 2018-09-27 11:30:52 +03:00
Antti Kauppila bd9066431f LoRaWANStack unit tested 2018-09-27 11:30:52 +03:00
Antti Kauppila e07940d5e7 LoRaMacCrypto unittested 2018-09-27 10:49:07 +03:00
Antti Kauppila f3d402f70e LoRaPHY unittested, small fixed done during tests 2018-09-27 10:49:07 +03:00
Antti Kauppila 0f8cfd8631 LoRa regions unittested, stubs licences revisited 2018-09-27 10:49:07 +03:00
Antti Kauppila 0f83f08043 More lorawan unit tests added 2018-09-27 10:49:07 +03:00
Martin Kojtal a999289365
Merge pull request #8034 from EnsilicaEdd/snr_unsigned_signed
Changed the reported SNR from unsigned to signed.
2018-09-25 13:23:14 +02:00
Hasnain Virk bc976c6545 Fixing coverity findings
A couple of the coverity analysis findings are being treated here. For
the rest there will be a separate PR.
2018-09-21 15:55:30 +03:00
Hasnain Virk 0d3ec26b4a Proper handling of RX1 frequency in rx_config
Previously, we weren't filling in RX1 frequecny in rx_window1_config
structure. However, everything worked as in LoRaPHY::rx_config() API
there was a check which filled in correct RX1 frequency.
Now we are filling in RX1 freq. properly while we are computing
parameters for RX1 window.
2018-09-21 15:55:30 +03:00
Hasnain Virk 19e87ceab9 TX post-process for CONFIRMED UL in no-reception case
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.
2018-09-21 15:55:30 +03:00
Hasnain Virk c9d6741212 Making sure that RX slots open after state change
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.
2018-09-21 15:55:30 +03:00
Hasnain Virk 94eb4c0bc0 Adding QOS handling and fixing bugs for Class C
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.
2018-09-21 15:55:30 +03:00
Hasnain Virk 5bfa7c03ba Adding check for ongoing automatic-uplink
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.
2018-09-21 15:55:30 +03:00
Hasnain Virk 76814d4847 Style correction
LinkADRReq parameters and certain parameters used camel case
which is not the recommended style.
2018-09-21 15:55:30 +03:00
Martin Kojtal 0c8aa2823d
Merge pull request #8096 from kivaisan/fix_mac_command_retransmission
Lora: Fix sticky MAC command retransmissions
2018-09-21 09:47:47 +02:00
Cruz Monrreal 9346a7e781
Merge pull request #7935 from kivaisan/fix_invalid_mac_command_case
LoRa: Stop processing MAC commands if command id is unknown
2018-09-20 10:14:59 -05:00
Martin Kojtal f3af8267c5
Merge pull request #8074 from hasnainvirk/compliance_testing
LoRaWAN: Refactoring compliance test code
2018-09-20 13:10:47 +02:00
Kimmo Vaisanen 19d90bd25e Lora: Fix sticky MAC command retransmission
This commit fixes the bug where sticky MAC commands were duplicated in
send buffer everytime send() was called.
2018-09-20 12:20:17 +03:00
Martin Kojtal d8ec21a99a
Merge pull request #8054 from kivaisan/fix_ADRAckReq
Lora: Fix ADRAckReq
2018-09-19 16:59:08 +02:00
Martin Kojtal aca7740f00
Merge pull request #7982 from hasnainvirk/mem_overrun
LoRaWAN: Memory overrun correction
2018-09-17 14:43:13 +02:00
Hasnain Virk e110856941 LoRaWAN: Refactoring compliance test code
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.
2018-09-11 11:26:31 +03:00
Kimmo Vaisanen 782e470306 Lora: Fix ADRAckReq
This commit fixes two bugs related to ADRAckReq:
- adr_ack_counter must be incremented for all uplink messages (not just confirmed)
- When ADR_ACK_LIMIT + ADR_ACK_DELAY has been reached, stack decreased used
  datarate twice.
2018-09-10 13:39:47 +03:00
Edd Inglis 4a07adbac5 Changed the reported SNR from unsigned to signed.
Internally and logically it is a signed value.
2018-09-07 10:19:01 +01:00
Cruz Monrreal 6165386d34
Merge pull request #7893 from kivaisan/improve_callback_descriptions
Lora: Improve description of callback methods
2018-09-04 09:26:44 -05:00
Hasnain Virk 7b7d5ebc77 LoRaWAN: Memory overrun correction
A typo in LoRaPHYCN470 is causing memory overrun.
We were supposed to fill-in default channel mask and iterate over CN470_CHANNEL_MASK_SIZE times.
2018-09-04 15:21:40 +03:00
Anna Bridge 4fb3aec84a
Merge pull request #7895 from kivaisan/remove_duplicate_linkcheckreq
Lora: Remove duplicate LinkCheckReq MAC command
2018-09-03 16:43:02 +01:00
Anna Bridge c2fdc0d972
Merge pull request #7423 from mprse/mutex_lock_assert
Fix issue #6872 - Mutex lock has possibility to fail at runtime (returning status flag)
2018-09-03 14:14:24 +01:00
Kimmo Vaisanen f24623af97 LoRa: Stop processing MAC commands if command id is unknown
The length of a MAC command is not explicitly given and must be
implicitly known by the MAC implementation. Therefore unknown MAC
commands cannot be skipped and the first unknown MAC command
terminates the processing of the MAC command sequence.

This commit fixes the bug where MAC command processing was not
terminated when unknown MAC command was received.
2018-08-30 15:43:54 +03:00
Amanda Butler a779e6f3c2
Copy edit FSB_Usage.txt
Copy edit for active voice, consistent tense and precise language.
2018-08-27 10:06:21 -05:00
Amanda Butler e4c4e7cc8d
Copy edit lorawan_types.h
Copy edit for minor grammar nits and consistent tense across docs.
2018-08-27 09:51:27 -05:00
Kimmo Vaisanen 6dc83dd737 Lora: Remove duplicate LinkCheckReq MAC command
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.
2018-08-27 13:45:21 +03:00
Hasnain Virk 5cca2f2e76 Adding override for TX ch. selection in CN470 PHY
set_next_channel() is the base function provided by LoRaPHY class and should be overridden
by the PHYs who behave differently as compared to EU868 like PHY layers.
CN470 PHY had been missing such an override.
In addition to that we have provided a parameter "fsb-mask-china" that can be used to
enforce a custom frequency sub-band of operation as most of the base stations in the market
may not support all 96 channels. Such a strategy will help in rapid network acquisition.
2018-08-27 12:50:09 +03:00
Kimmo Vaisanen fdff9f0f5d Lora: Improve description of callback methods
Users often use "show declaration" (or similar) in their IDE to see descriptions of callback
methods so the function descriptions should be placed close to function declaration itself.
2018-08-27 12:37:29 +03:00
Przemyslaw Stekiel e7b8e303ef Fix usage of `Mutex::unlock()` function - ignore returned value. 2018-08-27 08:50:00 +02:00
Przemyslaw Stekiel 8482cdc70f Fix usage of `Mutex::lock()` function - ignore returned value. 2018-08-27 08:48:58 +02:00
Hasnain Virk 9b2507d71a Adding helpers for Channel mask manipulation
A few protected member functions are introduced in LoRaPHY class
that help manipulate channel masks in various ways.
2018-08-24 15:32:13 +03:00
Hasnain Virk 8f0bb07390 Removing US915Hybrid PHY
This phy implementation was just to support a single sub-band in US region.
As we have decided to make FSBs configurable, we do not need this class anymore.
2018-08-24 15:32:12 +03:00