Class B feature branch rebase conflict fixes

Picked the wrong diff a few times while resolving rebase conflicts.
feature-lorawan-1-1
Unknown 2019-09-09 14:48:56 -04:00 committed by Antti Kauppila
parent 042a2f58cc
commit 694790f5fe
9 changed files with 57 additions and 20 deletions

View File

@ -21,6 +21,7 @@
#include "LoRaWANInterface.h"
#include "lorastack/phy/loraphy_target.h"
#include "platform/mbed_rtc_time.h"
#include "mbed-trace/mbed_trace.h"
#define TRACE_GROUP "LSTK"

View File

@ -73,6 +73,35 @@ public:
*/
lorawan_status_t initialize(events::EventQueue *queue);
/** Sets up UTC system time
*
* This API provides a convenience utility to setup UTC system time.
* Please note that device level synchronization does not require any conversion
* from GPS time. That's why any application level or stack level APIs involved
* in time synchronization should always use 'get_current_gps_time()' and
* 'set_current_gps_time(time)' APIs. 'set_system_time_utc(...)' API can be used
* for other application purposes where acquisition of UTC time is important.
* In addition to that it should be taken into account that the internal network
* assisted GPS time acquisition may not be 100% accurate. It involves local monotonic
* network provided time-stamp for GPS time may also involve inaccuracies owing to the
* ticks (in ms) which is a direct function of CPU ticks and can be inaccurate. The
* fact that the device will never know at what instant the time-stamp was taken and hence
* cannot compensate for it.
*
* 'set_system_time_utc(...)' API utilizes stored network assisted GPS time
* always ahead of GPS time by 19 seconds, whereas in 2019 TAI is ahead of
* to convert for UTC time. The Temps Atomique International (TAI) time is
* UTC by 37 seconds. This difference between TAI and UTC must be provided
* by the user because this number is subject to change (to compensate for leap
* seconds).
*
* @param tai_utc_diff Number of seconds TAI is ahead of UTC time.
*
* @return LORAWAN_STATUS_OK if system time is set, negative error code
* otherwise.
*/
lorawan_status_t set_system_time_utc(unsigned int tai_utc_diff);
/** Connect OTAA or ABP using the Mbed OS config system
*
* Connect by Over The Air Activation or Activation By Personalization.

View File

@ -365,6 +365,7 @@ int16_t LoRaWANStack::handle_tx(const uint8_t port, const uint8_t *data,
_loramac.add_ping_slot_info_req();
}
_qos_cnt = 1;
lorawan_status_t status;
@ -705,8 +706,7 @@ void LoRaWANStack::process_transmission(void)
if (_loramac.get_server_type() == LW1_1 && _device_mode_ind_ongoing == true) {
_device_mode_ind_ongoing = false;
_loramac.set_device_class(device_class_t(_new_class_type),
mbed::callback(this, &LoRaWANStack::post_process_tx_no_reception));
_loramac.set_device_class(device_class_t(_new_class_type), mbed::callback(this, &LoRaWANStack::post_process_tx_no_reception));
send_event_to_application(CLASS_CHANGED);
}
}

View File

@ -869,13 +869,11 @@ void LoRaMac::on_radio_rx_done(const uint8_t *const payload, uint16_t size,
switch (mac_hdr.bits.mtype) {
case FRAME_TYPE_JOIN_ACCEPT:
// SKN: Local fix for unintentional processing of join accepts not for us
if (_params.is_last_tx_join_request) {
ret = handle_join_accept_frame(payload, size);
mlme.type = MLME_JOIN_ACCEPT;
mlme.status = ret;
confirm_handler(mlme);
}
ret = handle_join_accept_frame(payload, size);
mlme.type = MLME_JOIN_ACCEPT;
mlme.status = ret;
confirm_handler(mlme);
break;
@ -1728,7 +1726,6 @@ lorawan_status_t LoRaMac::set_device_class(const device_class_t &device_class,
}
if (CLASS_C == _device_class) {
tr_debug("Changing device class to -> CLASS_C");
open_rx2_window();
}

View File

@ -26,9 +26,7 @@ SPDX-License-Identifier: BSD-3-Clause
#include "platform/mbed_rtc_time.h"
#include "LoRaMacCommand.h"
#include "LoRaMac.h"
#include "platform/mbed_rtc_time.h"
#include "mbed-trace/mbed_trace.h"
#define TRACE_GROUP "LMACC"
using namespace mbed;

View File

@ -69,6 +69,7 @@ lorawan_status_t LoRaMacCrypto::set_keys(uint8_t *nwk_key, uint8_t *app_key, uin
memcpy(_keys.app_skey, app_skey,
sizeof(_keys.app_skey));
memcpy(_keys.nwk_skey, snwk_sintkey,
sizeof(_keys.nwk_skey));
@ -453,6 +454,7 @@ exit:
return ret;
}
int LoRaMacCrypto::compute_ping_slot_random_offset(uint32_t beacon_time, uint32_t dev_addr, uint16_t *rand)
{
uint8_t nonce[16];

View File

@ -422,7 +422,7 @@ float LoRaPHY::compute_symb_timeout_fsk(uint8_t phy_dr)
void LoRaPHY::get_rx_window_params(float t_symb, float max_preamble_len,
uint8_t min_rx_symb, float error_fudge,
float wakeup_time, uint32_t *window_length,
float wakeup_time, uint32_t *window_length, uint32_t *window_length_ms,
int32_t *window_offset, uint8_t phy_dr)
{
float target_rx_window_offset;
@ -919,6 +919,16 @@ bool LoRaPHY::compute_rx_win_params(int8_t datarate, uint8_t min_rx_symbols,
return true;
}
uint32_t LoRaPHY::get_rx_time_on_air(uint8_t modem, uint16_t pkt_len)
{
uint32_t toa = 0;
_radio->lock();
toa = _radio->time_on_air((radio_modems_t) modem, pkt_len);
_radio->unlock();
return toa;
}
bool LoRaPHY::rx_config(rx_config_params_t *rx_conf)
{

View File

@ -510,6 +510,9 @@ typedef struct {
uint8_t rfu2_size;
} loraphy_beacon_t;
/*!
* Global configuration parameters of a given PHY
*/
typedef struct {
bool duty_cycle_enabled;
bool accept_tx_param_setup_req;

View File

@ -394,7 +394,7 @@ typedef enum {
/*!
* ResetInd
*/
MOTE_MAC_RESET_IND = 0x01,
MOTE_MAC_RESET_IND = 0x01,
/*!
* LinkCheckReq
*/
@ -921,13 +921,9 @@ typedef enum {
*/
MLME_BEACON_ACQUISITION,
MLME_BEACON_LOCK,
MLME_BEACON_MISS,
/*!
* PingSlotInfoReq - Indicates ping unicast slot periodicity
* synchronized with the server
* Indicates ping unicast slot periodicity
* synchronized with the server
*
* LoRaWAN Specification V1.1, chapter 14.1
*/
@ -1579,6 +1575,7 @@ typedef struct {
* \brief forced_datarate See ForceRejoinReq LW 1.1 spec ch 5.13
*/
uint8_t forced_datarate;
} loramac_protocol_params;