Fix unit tests

Code review requested changes
feature-lorawan-1-1
Unknown 2019-07-10 10:04:59 -04:00 committed by Antti Kauppila
parent 672de92e4a
commit 042a2f58cc
4 changed files with 27 additions and 4 deletions

View File

@ -37,6 +37,7 @@ loramac_mlme_indication_t *LoRaMac_stub::mlme_ind_ptr = NULL;
device_class_t LoRaMac_stub::dev_class_value = CLASS_A;
mbed::Callback<void(void)> LoRaMac_stub::_scheduling_failure_handler = NULL;
LoRaWANTimeHandler *LoRaMac_stub::time_handler_ptr = NULL;
lorawan_gps_time_t LoRaMac_stub::gps_time_value = 0;
LoRaMac::LoRaMac()
: _lora_time(),
@ -510,12 +511,11 @@ lorawan_status_t LoRaMac::rejoin(join_req_type_t rejoin_type, bool is_forced, ui
lorawan_gps_time_t LoRaMac::get_gps_time(void)
{
return _lora_time.get_gps_time();
return LoRaMac_stub::gps_time_value;
}
void LoRaMac::set_gps_time(lorawan_gps_time_t gps_time)
{
_lora_time.set_gps_time(gps_time);
}
lorawan_status_t LoRaMac::add_ping_slot_info_req()

View File

@ -38,4 +38,5 @@ extern loramac_mlme_indication_t *mlme_ind_ptr;
extern device_class_t dev_class_value;
extern mbed::Callback<void(void)> _scheduling_failure_handler;
extern LoRaWANTimeHandler *time_handler_ptr;
extern lorawan_gps_time_t gps_time_value;
}

View File

@ -19,10 +19,13 @@
#include <stdlib.h>
#include "LoRaWANStack.h"
#include "LoRaWANStack_stub.h"
using namespace mbed;
using namespace events;
lorawan_gps_time_t LoRaWANStack_stub::gps_time_value = 0;
/*****************************************************************************
* Constructor *
****************************************************************************/
@ -312,12 +315,11 @@ void LoRaWANStack::remove_device_time_request(void)
lorawan_gps_time_t LoRaWANStack::get_current_gps_time()
{
return _loramac.get_gps_time();
return LoRaWANStack_stub::gps_time_value;
}
void LoRaWANStack::set_current_gps_time(lorawan_gps_time_t gps_time)
{
_loramac.set_gps_time(gps_time);
}
lorawan_status_t LoRaWANStack::add_ping_slot_info_request(uint8_t periodicity)

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace LoRaWANStack_stub {
extern lorawan_gps_time_t gps_time_value;
}