-
Notifications
You must be signed in to change notification settings - Fork 3k
Stack refactoring #6411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack refactoring #6411
Conversation
- Only internal changes, no functionality changes - Some minor improvements to LoRaWanStack
… instead of a boolean Removed the while loop checking the return value from set_next_channel (GitHub Issue Lora-net/LoRaMac-node#357) The new return values are: LORAWAN_STATUS_OK : A channel has been found. LORAWAN_STATUS_NO_FREE_CHANNEL_FOUND : No free channel has been found (AS923 and KR920 regions) LORAWAN_STATUS_DUTYCYCLE_RESTRICTED : No channel found due to the duty-cycle or JoinReq back-off restrictions. Trial must be delayed. LORAWAN_STATUS_NO_CHANNEL_FOUND : No channel has been found. Re-enabled the default channels.
This issue is only present for a device in class c mode, which has perform unconfirmed uplinks. Lora-net/LoRaMac-node#327
Store the rx slot temporarily. When in class C, this variable will be changed in function OpenContinuousRx2Window.
Perform only an assignment. Lora-net/LoRaMac-node#282
1. Do not stop the 2nd window timer, as it is not running. 2. Wait for the OnAckTimeout event, before setting MacDone 3. Process for class c also the 2nd window timeout part, as we do not have a 2nd window timer.
This is especially important for class c devices.
In the DevStatusAns format, the protocol requires RFU(7:6) value = 0
This API can be used to runtime change device class. Please note that only class A and C are supported at the moment. Trying to set class B will return LORAWAN_STATUS_UNSUPPORTED. Fix set_device_class documentation fix documentation
- Do not put radio into sleep when message is received in class c mode - Experimental feature for acknowledging confirmed downlink messages
Since our timers are now already using events, we no longer need to defer timer callback calls.
- This is internal change, no functionality has been changed - LoRaWanInterface cleaned up and code moved to LoRaMacStack - Compliance code in LoRaMacStack moved to EOF - Green tea tests have been run manually - Doxygen updated accordingly LoRA: reorder class members
- Only internal changes, no API has been broke. - Tested by manually running Green tea tests
- Internal change only, no functional changes - Tested by running Green tea tests manually
- Unneeded structs removed and replaced by variables in functions
@kivaisan @kjbracey-arm Please review |
Fix compilation of compilance test and at the same time refactor compliance test handler. Renamed mcps_request as test_request as it is only used for compliance test. Also fixed a bug with null buffer in send_compliance_test_frame_to_mac.
@AnttiKauppila Can this be done in smaller related PR ? (I set PR type in your first comment to only refactoring, but after looking at these changes, it's not just refactor. this is also introducing new API). |
I will start my Winter holiday today and because my previous commit took more than 2 weeks, this one got bigger and bigger meanwhile. I will be out next week and LoRa team needs this to proceed. |
/morph build |
Build : FAILUREBuild number : 1551 |
Poor time for an ARM license issue... |
/morph build |
Build : ABORTEDBuild number : 1552 |
Build : SUCCESSBuild number : 1553 Triggering tests/morph test |
Exporter Build : FAILUREBuild number : 1191 |
/morph export-build |
Exporter Build : SUCCESSBuild number : 1193 |
} else { | ||
return val_in_range(datarate, phy_params.dwell_limit_datarate, | ||
phy_params.max_tx_datarate); | ||
if (is_datarate_supported(datarate)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need to change it this time, but general style suggestion - use early exit for parameter validation
if (!is_datarate_supported(datarate)) {
return false;
}
Saves indenting all the body of the function, reducing diffs and merge conflicts. This style doesn't scale well as the number of parameter checks increases.
|
||
typedef struct { | ||
/*! | ||
* Compiliance test request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compliance
features/lorawan/LoRaWANStack.cpp
Outdated
lorawan_connect_t connection_params; | ||
|
||
//TODO: LoRaWANStack don't need to know these values, move to LoRaMac (or below) | ||
#if (1 == MBED_CONF_LORA_OVER_THE_AIR_ACTIVATION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just #if MBED_CONF_LORA_OVER_THE_AIR_ACTIVATION
, surely?
You're not doing #if (1 == defined(XXX))
...
features/lorawan/LoRaWANStack.cpp
Outdated
|
||
//TODO: LoRaWANStack don't need to know these values, move to LoRaMac (or below) | ||
#if (1 == MBED_CONF_LORA_OVER_THE_AIR_ACTIVATION) | ||
static uint8_t dev_eui[] = MBED_CONF_LORA_DEVICE_EUI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be const
to save RAM.
features/lorawan/LoRaWANBase.h
Outdated
* LORAWAN_STATUS_UNSUPPORTED is requested class is not supported, | ||
* or other negative error code if request failed. | ||
*/ | ||
virtual lorawan_status_t set_device_class(const device_class_t device_class) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The const
here is meaningless - remove it to avoid confusion.
stk_obj().set_lora_callbacks(callbacks); | ||
return LORAWAN_STATUS_OK; | ||
} | ||
lorawan_status_t LoRaWANInterface::set_device_class(const device_class_t device_class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(You could keep the const
here though, meaning "I don't change device_class
after function entry" - just doesn't need to be in the prototype).
- changed few static variables to have const
@kjbracey-arm I have modified the code as you suggested, can you please re-review |
@0xc0170 Could you trigger build for this? |
/morph build |
Build : SUCCESSBuild number : 1648 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 1280 |
@cmonr Will you do the trick and merge this in? |
Description
set_device_class() function added to LoRaWANInterface class to switch between classes at runtime
This is Mbed OS 5.9 content
Pull request type