mirror of https://github.com/ARMmbed/mbed-os.git
unittests: fix astyle
parent
4b3a031087
commit
3a5ef5ee24
|
|
@ -26,10 +26,12 @@ using namespace events;
|
||||||
class TestAT_CellularDevice : public testing::Test {
|
class TestAT_CellularDevice : public testing::Test {
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void SetUp() {
|
void SetUp()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() {
|
void TearDown()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params)
|
||||||
EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_registration_params(CellularNetwork::C_EREG, reg_params));
|
EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_registration_params(CellularNetwork::C_EREG, reg_params));
|
||||||
EXPECT_TRUE(reg_params._cell_id == 305463233);
|
EXPECT_TRUE(reg_params._cell_id == 305463233);
|
||||||
EXPECT_TRUE(reg_params._active_time == 240);
|
EXPECT_TRUE(reg_params._active_time == 240);
|
||||||
EXPECT_TRUE(reg_params._periodic_tau == 70 * 60 *60);
|
EXPECT_TRUE(reg_params._periodic_tau == 70 * 60 * 60);
|
||||||
ATHandler_stub::read_string_index = kRead_string_table_size;
|
ATHandler_stub::read_string_index = kRead_string_table_size;
|
||||||
ATHandler_stub::read_string_value = NULL;
|
ATHandler_stub::read_string_value = NULL;
|
||||||
ATHandler_stub::ssize_value = 0;
|
ATHandler_stub::ssize_value = 0;
|
||||||
|
|
@ -469,7 +469,7 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params)
|
||||||
EXPECT_TRUE(reg_params_check._act == CellularNetwork::RAT_EGPRS);
|
EXPECT_TRUE(reg_params_check._act == CellularNetwork::RAT_EGPRS);
|
||||||
EXPECT_TRUE(reg_params_check._cell_id == 305463233);
|
EXPECT_TRUE(reg_params_check._cell_id == 305463233);
|
||||||
EXPECT_TRUE(reg_params_check._active_time == 240);
|
EXPECT_TRUE(reg_params_check._active_time == 240);
|
||||||
EXPECT_TRUE(reg_params_check._periodic_tau == 70 * 60 *60);
|
EXPECT_TRUE(reg_params_check._periodic_tau == 70 * 60 * 60);
|
||||||
|
|
||||||
reg_params._status = CellularNetwork::NotRegistered;
|
reg_params._status = CellularNetwork::NotRegistered;
|
||||||
reg_params._act = CellularNetwork::RAT_GSM;
|
reg_params._act = CellularNetwork::RAT_GSM;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ protected:
|
||||||
|
|
||||||
TEST_F(Testutil, test_util_binary_str_to_uint)
|
TEST_F(Testutil, test_util_binary_str_to_uint)
|
||||||
{
|
{
|
||||||
char binary_str[]="011001011101101000";
|
char binary_str[] = "011001011101101000";
|
||||||
uint32_t value = binary_str_to_uint(binary_str, strlen(binary_str) + 1);
|
uint32_t value = binary_str_to_uint(binary_str, strlen(binary_str) + 1);
|
||||||
EXPECT_TRUE(value == 104296);
|
EXPECT_TRUE(value == 104296);
|
||||||
value = binary_str_to_uint(binary_str, strlen(binary_str));
|
value = binary_str_to_uint(binary_str, strlen(binary_str));
|
||||||
|
|
@ -210,7 +210,7 @@ TEST_F(Testutil, get_dynamic_ip_port)
|
||||||
TEST_F(Testutil, int_to_hex_str)
|
TEST_F(Testutil, int_to_hex_str)
|
||||||
{
|
{
|
||||||
char buf[2];
|
char buf[2];
|
||||||
int_to_hex_str(100, (char*)buf);
|
int_to_hex_str(100, (char *)buf);
|
||||||
|
|
||||||
EXPECT_TRUE(buf[0] == '6');
|
EXPECT_TRUE(buf[0] == '6');
|
||||||
EXPECT_TRUE(buf[1] == '4');
|
EXPECT_TRUE(buf[1] == '4');
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,11 @@
|
||||||
|
|
||||||
using namespace events;
|
using namespace events;
|
||||||
|
|
||||||
class my_phy : public LoRaPHY
|
class my_phy : public LoRaPHY {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
my_phy(){};
|
my_phy() {};
|
||||||
|
|
||||||
virtual ~my_phy(){};
|
virtual ~my_phy() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Test_LoRaMac : public testing::Test {
|
class Test_LoRaMac : public testing::Test {
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,11 @@
|
||||||
#include "LoRaPHY_stub.h"
|
#include "LoRaPHY_stub.h"
|
||||||
#include "LoRaPHY.h"
|
#include "LoRaPHY.h"
|
||||||
|
|
||||||
class my_LoRaPHY : public LoRaPHY
|
class my_LoRaPHY : public LoRaPHY {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
my_LoRaPHY(){};
|
my_LoRaPHY() {};
|
||||||
|
|
||||||
virtual ~my_LoRaPHY(){};
|
virtual ~my_LoRaPHY() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,11 @@
|
||||||
|
|
||||||
#include "LoRaPHY_stub.h"
|
#include "LoRaPHY_stub.h"
|
||||||
|
|
||||||
class my_LoRaPHY : public LoRaPHY
|
class my_LoRaPHY : public LoRaPHY {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
my_LoRaPHY(){};
|
my_LoRaPHY() {};
|
||||||
|
|
||||||
virtual ~my_LoRaPHY(){};
|
virtual ~my_LoRaPHY() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t my_cb()
|
uint8_t my_cb()
|
||||||
|
|
@ -153,7 +152,7 @@ TEST_F(Test_LoRaMacCommand, copy_repeat_commands_to_buffer)
|
||||||
|
|
||||||
TEST_F(Test_LoRaMacCommand, get_repeat_commands_length)
|
TEST_F(Test_LoRaMacCommand, get_repeat_commands_length)
|
||||||
{
|
{
|
||||||
EXPECT_TRUE(object->get_repeat_commands_length() == 0 );
|
EXPECT_TRUE(object->get_repeat_commands_length() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Test_LoRaMacCommand, clear_sticky_mac_cmd)
|
TEST_F(Test_LoRaMacCommand, clear_sticky_mac_cmd)
|
||||||
|
|
@ -222,7 +221,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
|
||||||
//Overflow add_link_adr_ans function here
|
//Overflow add_link_adr_ans function here
|
||||||
object->clear_command_buffer();
|
object->clear_command_buffer();
|
||||||
buf[0] = 3;
|
buf[0] = 3;
|
||||||
for (int i=0; i < 64; i++) {
|
for (int i = 0; i < 64; i++) {
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
||||||
}
|
}
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
||||||
|
|
@ -234,7 +233,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
|
||||||
|
|
||||||
//Overflow add_duty_cycle_ans()
|
//Overflow add_duty_cycle_ans()
|
||||||
object->clear_command_buffer();
|
object->clear_command_buffer();
|
||||||
for (int i=0; i < 128; i++) {
|
for (int i = 0; i < 128; i++) {
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
||||||
}
|
}
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
||||||
|
|
@ -251,7 +250,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
|
||||||
//Overflow add_rx_param_setup_ans
|
//Overflow add_rx_param_setup_ans
|
||||||
object->clear_command_buffer();
|
object->clear_command_buffer();
|
||||||
LoRaPHY_stub::uint8_value = 7;
|
LoRaPHY_stub::uint8_value = 7;
|
||||||
for (int i=0; i < 64; i++) {
|
for (int i = 0; i < 64; i++) {
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
||||||
}
|
}
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 5, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
||||||
|
|
@ -263,7 +262,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
|
||||||
|
|
||||||
//overflow add_dev_status_ans
|
//overflow add_dev_status_ans
|
||||||
object->clear_command_buffer();
|
object->clear_command_buffer();
|
||||||
for (int i=0; i < 42; i++) {
|
for (int i = 0; i < 42; i++) {
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
||||||
}
|
}
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 1, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
||||||
|
|
@ -280,7 +279,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
|
||||||
//Overflow add_new_channel_ans
|
//Overflow add_new_channel_ans
|
||||||
object->clear_command_buffer();
|
object->clear_command_buffer();
|
||||||
LoRaPHY_stub::uint8_value = 7;
|
LoRaPHY_stub::uint8_value = 7;
|
||||||
for (int i=0; i < 64; i++) {
|
for (int i = 0; i < 64; i++) {
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 6, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 6, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
||||||
}
|
}
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 6, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 6, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
||||||
|
|
@ -293,7 +292,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
|
||||||
//Overflow add_rx_timing_setup_ans
|
//Overflow add_rx_timing_setup_ans
|
||||||
object->clear_command_buffer();
|
object->clear_command_buffer();
|
||||||
LoRaPHY_stub::uint8_value = 7;
|
LoRaPHY_stub::uint8_value = 7;
|
||||||
for (int i=0; i < 128; i++) {
|
for (int i = 0; i < 128; i++) {
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 2, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 2, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
||||||
}
|
}
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 2, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 2, 0, mlme, params, phy) == LORAWAN_STATUS_LENGTH_ERROR);
|
||||||
|
|
@ -308,7 +307,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
|
||||||
LoRaPHY_stub::bool_table[0] = true;
|
LoRaPHY_stub::bool_table[0] = true;
|
||||||
object->clear_command_buffer();
|
object->clear_command_buffer();
|
||||||
LoRaPHY_stub::uint8_value = 7;
|
LoRaPHY_stub::uint8_value = 7;
|
||||||
for (int i=0; i < 128; i++) {
|
for (int i = 0; i < 128; i++) {
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 2, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 2, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
||||||
LoRaPHY_stub::bool_counter = 0;
|
LoRaPHY_stub::bool_counter = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -326,7 +325,7 @@ TEST_F(Test_LoRaMacCommand, process_mac_commands)
|
||||||
LoRaPHY_stub::bool_table[0] = true;
|
LoRaPHY_stub::bool_table[0] = true;
|
||||||
object->clear_command_buffer();
|
object->clear_command_buffer();
|
||||||
LoRaPHY_stub::uint8_value = 7;
|
LoRaPHY_stub::uint8_value = 7;
|
||||||
for (int i=0; i < 64; i++) {
|
for (int i = 0; i < 64; i++) {
|
||||||
EXPECT_TRUE(object->process_mac_commands(buf, 0, 4, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
EXPECT_TRUE(object->process_mac_commands(buf, 0, 4, 0, mlme, params, phy) == LORAWAN_STATUS_OK);
|
||||||
LoRaPHY_stub::bool_counter = 0;
|
LoRaPHY_stub::bool_counter = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,74 +20,85 @@
|
||||||
|
|
||||||
#include "LoRaWANTimer_stub.h"
|
#include "LoRaWANTimer_stub.h"
|
||||||
|
|
||||||
class my_LoRaPHY : public LoRaPHY
|
class my_LoRaPHY : public LoRaPHY {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
my_LoRaPHY(){phy_params.adr_ack_delay = 1;}
|
my_LoRaPHY()
|
||||||
|
{
|
||||||
|
phy_params.adr_ack_delay = 1;
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~my_LoRaPHY(){}
|
virtual ~my_LoRaPHY() {}
|
||||||
|
|
||||||
loraphy_params_t &get_phy_params() {
|
loraphy_params_t &get_phy_params()
|
||||||
|
{
|
||||||
return phy_params;
|
return phy_params;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class my_radio : public LoRaRadio
|
class my_radio : public LoRaRadio {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void init_radio(radio_events_t *events){};
|
virtual void init_radio(radio_events_t *events) {};
|
||||||
|
|
||||||
virtual void radio_reset(){};
|
virtual void radio_reset() {};
|
||||||
|
|
||||||
virtual void sleep(void){};
|
virtual void sleep(void) {};
|
||||||
|
|
||||||
virtual void standby(void){};
|
virtual void standby(void) {};
|
||||||
|
|
||||||
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
|
virtual void set_rx_config(radio_modems_t modem, uint32_t bandwidth,
|
||||||
uint32_t datarate, uint8_t coderate,
|
uint32_t datarate, uint8_t coderate,
|
||||||
uint32_t bandwidth_afc, uint16_t preamble_len,
|
uint32_t bandwidth_afc, uint16_t preamble_len,
|
||||||
uint16_t symb_timeout, bool fix_len,
|
uint16_t symb_timeout, bool fix_len,
|
||||||
uint8_t payload_len,
|
uint8_t payload_len,
|
||||||
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
||||||
bool iq_inverted, bool rx_continuous){};
|
bool iq_inverted, bool rx_continuous) {};
|
||||||
|
|
||||||
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
||||||
uint32_t bandwidth, uint32_t datarate,
|
uint32_t bandwidth, uint32_t datarate,
|
||||||
uint8_t coderate, uint16_t preamble_len,
|
uint8_t coderate, uint16_t preamble_len,
|
||||||
bool fix_len, bool crc_on, bool freq_hop_on,
|
bool fix_len, bool crc_on, bool freq_hop_on,
|
||||||
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
|
uint8_t hop_period, bool iq_inverted, uint32_t timeout) {};
|
||||||
|
|
||||||
virtual void send(uint8_t *buffer, uint8_t size){};
|
virtual void send(uint8_t *buffer, uint8_t size) {};
|
||||||
|
|
||||||
virtual void receive(void){};
|
virtual void receive(void) {};
|
||||||
|
|
||||||
virtual void set_channel(uint32_t freq){};
|
virtual void set_channel(uint32_t freq) {};
|
||||||
|
|
||||||
virtual uint32_t random(void){};
|
virtual uint32_t random(void) {};
|
||||||
|
|
||||||
virtual uint8_t get_status(void){return uint8_value;};
|
virtual uint8_t get_status(void)
|
||||||
|
{
|
||||||
|
return uint8_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
|
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max) {};
|
||||||
|
|
||||||
virtual void set_public_network(bool enable){};
|
virtual void set_public_network(bool enable) {};
|
||||||
|
|
||||||
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
|
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len) {};
|
||||||
|
|
||||||
virtual bool perform_carrier_sense(radio_modems_t modem,
|
virtual bool perform_carrier_sense(radio_modems_t modem,
|
||||||
uint32_t freq,
|
uint32_t freq,
|
||||||
int16_t rssi_threshold,
|
int16_t rssi_threshold,
|
||||||
uint32_t max_carrier_sense_time){ return bool_value;};
|
uint32_t max_carrier_sense_time)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void start_cad(void){};
|
virtual void start_cad(void) {};
|
||||||
|
|
||||||
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
|
virtual bool check_rf_frequency(uint32_t frequency)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
|
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time) {};
|
||||||
|
|
||||||
virtual void lock(void){};
|
virtual void lock(void) {};
|
||||||
|
|
||||||
virtual void unlock(void){};
|
virtual void unlock(void) {};
|
||||||
|
|
||||||
bool bool_value;
|
bool bool_value;
|
||||||
uint8_t uint8_value;
|
uint8_t uint8_value;
|
||||||
|
|
@ -410,7 +421,7 @@ TEST_F(Test_LoRaPHY, tx_config)
|
||||||
object->get_phy_params().bands.table = &b;
|
object->get_phy_params().bands.table = &b;
|
||||||
channel_params_t pp;
|
channel_params_t pp;
|
||||||
memset(&pp, 0, sizeof(channel_params_t));
|
memset(&pp, 0, sizeof(channel_params_t));
|
||||||
pp.band=0;
|
pp.band = 0;
|
||||||
object->get_phy_params().channels.channel_list = &pp;
|
object->get_phy_params().channels.channel_list = &pp;
|
||||||
uint32_t list[1];
|
uint32_t list[1];
|
||||||
list[0] = 125000;
|
list[0] = 125000;
|
||||||
|
|
@ -422,7 +433,7 @@ TEST_F(Test_LoRaPHY, tx_config)
|
||||||
object->set_radio_instance(radio);
|
object->set_radio_instance(radio);
|
||||||
tx_config_params_t p;
|
tx_config_params_t p;
|
||||||
memset(&p, 0, sizeof(tx_config_params_t));
|
memset(&p, 0, sizeof(tx_config_params_t));
|
||||||
p.channel=0;
|
p.channel = 0;
|
||||||
int8_t i = 20;
|
int8_t i = 20;
|
||||||
lorawan_time_t t = 36;
|
lorawan_time_t t = 36;
|
||||||
object->tx_config(&p, &i, &t);
|
object->tx_config(&p, &i, &t);
|
||||||
|
|
@ -688,7 +699,7 @@ TEST_F(Test_LoRaPHY, add_channel)
|
||||||
TEST_F(Test_LoRaPHY, remove_channel)
|
TEST_F(Test_LoRaPHY, remove_channel)
|
||||||
{
|
{
|
||||||
channel_params_t pp;
|
channel_params_t pp;
|
||||||
pp.band=0;
|
pp.band = 0;
|
||||||
object->get_phy_params().channels.channel_list = &pp;
|
object->get_phy_params().channels.channel_list = &pp;
|
||||||
uint16_t list[16];
|
uint16_t list[16];
|
||||||
list[0] = 1;
|
list[0] = 1;
|
||||||
|
|
@ -710,7 +721,7 @@ TEST_F(Test_LoRaPHY, remove_channel)
|
||||||
TEST_F(Test_LoRaPHY, set_tx_cont_mode)
|
TEST_F(Test_LoRaPHY, set_tx_cont_mode)
|
||||||
{
|
{
|
||||||
channel_params_t pp;
|
channel_params_t pp;
|
||||||
pp.band=0;
|
pp.band = 0;
|
||||||
object->get_phy_params().channels.channel_list = &pp;
|
object->get_phy_params().channels.channel_list = &pp;
|
||||||
band_t b;
|
band_t b;
|
||||||
b.max_tx_pwr = 10;
|
b.max_tx_pwr = 10;
|
||||||
|
|
@ -791,7 +802,7 @@ TEST_F(Test_LoRaPHY, get_default_tx_power)
|
||||||
|
|
||||||
TEST_F(Test_LoRaPHY, get_max_payload)
|
TEST_F(Test_LoRaPHY, get_max_payload)
|
||||||
{
|
{
|
||||||
uint8_t list=8;
|
uint8_t list = 8;
|
||||||
object->get_phy_params().payloads.table = &list;
|
object->get_phy_params().payloads.table = &list;
|
||||||
object->get_phy_params().payloads_with_repeater.table = &list;
|
object->get_phy_params().payloads_with_repeater.table = &list;
|
||||||
EXPECT_TRUE(8 == object->get_max_payload(0));
|
EXPECT_TRUE(8 == object->get_max_payload(0));
|
||||||
|
|
|
||||||
|
|
@ -20,62 +20,70 @@
|
||||||
|
|
||||||
#include "LoRaPHY_stub.h"
|
#include "LoRaPHY_stub.h"
|
||||||
|
|
||||||
class my_radio : public LoRaRadio
|
class my_radio : public LoRaRadio {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void init_radio(radio_events_t *events){};
|
virtual void init_radio(radio_events_t *events) {};
|
||||||
|
|
||||||
virtual void radio_reset(){};
|
virtual void radio_reset() {};
|
||||||
|
|
||||||
virtual void sleep(void){};
|
virtual void sleep(void) {};
|
||||||
|
|
||||||
virtual void standby(void){};
|
virtual void standby(void) {};
|
||||||
|
|
||||||
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
|
virtual void set_rx_config(radio_modems_t modem, uint32_t bandwidth,
|
||||||
uint32_t datarate, uint8_t coderate,
|
uint32_t datarate, uint8_t coderate,
|
||||||
uint32_t bandwidth_afc, uint16_t preamble_len,
|
uint32_t bandwidth_afc, uint16_t preamble_len,
|
||||||
uint16_t symb_timeout, bool fix_len,
|
uint16_t symb_timeout, bool fix_len,
|
||||||
uint8_t payload_len,
|
uint8_t payload_len,
|
||||||
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
||||||
bool iq_inverted, bool rx_continuous){};
|
bool iq_inverted, bool rx_continuous) {};
|
||||||
|
|
||||||
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
||||||
uint32_t bandwidth, uint32_t datarate,
|
uint32_t bandwidth, uint32_t datarate,
|
||||||
uint8_t coderate, uint16_t preamble_len,
|
uint8_t coderate, uint16_t preamble_len,
|
||||||
bool fix_len, bool crc_on, bool freq_hop_on,
|
bool fix_len, bool crc_on, bool freq_hop_on,
|
||||||
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
|
uint8_t hop_period, bool iq_inverted, uint32_t timeout) {};
|
||||||
|
|
||||||
virtual void send(uint8_t *buffer, uint8_t size){};
|
virtual void send(uint8_t *buffer, uint8_t size) {};
|
||||||
|
|
||||||
virtual void receive(void){};
|
virtual void receive(void) {};
|
||||||
|
|
||||||
virtual void set_channel(uint32_t freq){};
|
virtual void set_channel(uint32_t freq) {};
|
||||||
|
|
||||||
virtual uint32_t random(void){};
|
virtual uint32_t random(void) {};
|
||||||
|
|
||||||
virtual uint8_t get_status(void){return uint8_value;};
|
virtual uint8_t get_status(void)
|
||||||
|
{
|
||||||
|
return uint8_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
|
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max) {};
|
||||||
|
|
||||||
virtual void set_public_network(bool enable){};
|
virtual void set_public_network(bool enable) {};
|
||||||
|
|
||||||
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
|
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len) {};
|
||||||
|
|
||||||
virtual bool perform_carrier_sense(radio_modems_t modem,
|
virtual bool perform_carrier_sense(radio_modems_t modem,
|
||||||
uint32_t freq,
|
uint32_t freq,
|
||||||
int16_t rssi_threshold,
|
int16_t rssi_threshold,
|
||||||
uint32_t max_carrier_sense_time){ return bool_value;};
|
uint32_t max_carrier_sense_time)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void start_cad(void){};
|
virtual void start_cad(void) {};
|
||||||
|
|
||||||
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
|
virtual bool check_rf_frequency(uint32_t frequency)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
|
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time) {};
|
||||||
|
|
||||||
virtual void lock(void){};
|
virtual void lock(void) {};
|
||||||
|
|
||||||
virtual void unlock(void){};
|
virtual void unlock(void) {};
|
||||||
|
|
||||||
bool bool_value;
|
bool bool_value;
|
||||||
uint8_t uint8_value;
|
uint8_t uint8_value;
|
||||||
|
|
@ -135,8 +143,8 @@ TEST_F(Test_LoRaPHYAS923, set_next_channel)
|
||||||
TEST_F(Test_LoRaPHYAS923, apply_DR_offset)
|
TEST_F(Test_LoRaPHYAS923, apply_DR_offset)
|
||||||
{
|
{
|
||||||
//0, 1, 2, 3, 4, 5, -1, -2
|
//0, 1, 2, 3, 4, 5, -1, -2
|
||||||
for (int i=0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
uint8_t val = i>5?5:2;
|
uint8_t val = i > 5 ? 5 : 2;
|
||||||
EXPECT_TRUE(object->apply_DR_offset(0, i));
|
EXPECT_TRUE(object->apply_DR_offset(0, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,62 +20,70 @@
|
||||||
|
|
||||||
#include "LoRaPHY_stub.h"
|
#include "LoRaPHY_stub.h"
|
||||||
|
|
||||||
class my_radio : public LoRaRadio
|
class my_radio : public LoRaRadio {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void init_radio(radio_events_t *events){};
|
virtual void init_radio(radio_events_t *events) {};
|
||||||
|
|
||||||
virtual void radio_reset(){};
|
virtual void radio_reset() {};
|
||||||
|
|
||||||
virtual void sleep(void){};
|
virtual void sleep(void) {};
|
||||||
|
|
||||||
virtual void standby(void){};
|
virtual void standby(void) {};
|
||||||
|
|
||||||
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
|
virtual void set_rx_config(radio_modems_t modem, uint32_t bandwidth,
|
||||||
uint32_t datarate, uint8_t coderate,
|
uint32_t datarate, uint8_t coderate,
|
||||||
uint32_t bandwidth_afc, uint16_t preamble_len,
|
uint32_t bandwidth_afc, uint16_t preamble_len,
|
||||||
uint16_t symb_timeout, bool fix_len,
|
uint16_t symb_timeout, bool fix_len,
|
||||||
uint8_t payload_len,
|
uint8_t payload_len,
|
||||||
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
||||||
bool iq_inverted, bool rx_continuous){};
|
bool iq_inverted, bool rx_continuous) {};
|
||||||
|
|
||||||
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
||||||
uint32_t bandwidth, uint32_t datarate,
|
uint32_t bandwidth, uint32_t datarate,
|
||||||
uint8_t coderate, uint16_t preamble_len,
|
uint8_t coderate, uint16_t preamble_len,
|
||||||
bool fix_len, bool crc_on, bool freq_hop_on,
|
bool fix_len, bool crc_on, bool freq_hop_on,
|
||||||
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
|
uint8_t hop_period, bool iq_inverted, uint32_t timeout) {};
|
||||||
|
|
||||||
virtual void send(uint8_t *buffer, uint8_t size){};
|
virtual void send(uint8_t *buffer, uint8_t size) {};
|
||||||
|
|
||||||
virtual void receive(void){};
|
virtual void receive(void) {};
|
||||||
|
|
||||||
virtual void set_channel(uint32_t freq){};
|
virtual void set_channel(uint32_t freq) {};
|
||||||
|
|
||||||
virtual uint32_t random(void){};
|
virtual uint32_t random(void) {};
|
||||||
|
|
||||||
virtual uint8_t get_status(void){return uint8_value;};
|
virtual uint8_t get_status(void)
|
||||||
|
{
|
||||||
|
return uint8_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
|
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max) {};
|
||||||
|
|
||||||
virtual void set_public_network(bool enable){};
|
virtual void set_public_network(bool enable) {};
|
||||||
|
|
||||||
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
|
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len) {};
|
||||||
|
|
||||||
virtual bool perform_carrier_sense(radio_modems_t modem,
|
virtual bool perform_carrier_sense(radio_modems_t modem,
|
||||||
uint32_t freq,
|
uint32_t freq,
|
||||||
int16_t rssi_threshold,
|
int16_t rssi_threshold,
|
||||||
uint32_t max_carrier_sense_time){ return bool_value;};
|
uint32_t max_carrier_sense_time)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void start_cad(void){};
|
virtual void start_cad(void) {};
|
||||||
|
|
||||||
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
|
virtual bool check_rf_frequency(uint32_t frequency)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
|
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time) {};
|
||||||
|
|
||||||
virtual void lock(void){};
|
virtual void lock(void) {};
|
||||||
|
|
||||||
virtual void unlock(void){};
|
virtual void unlock(void) {};
|
||||||
|
|
||||||
bool bool_value;
|
bool bool_value;
|
||||||
uint8_t uint8_value;
|
uint8_t uint8_value;
|
||||||
|
|
@ -224,11 +232,15 @@ TEST_F(Test_LoRaPHYAU915, apply_DR_offset)
|
||||||
// { DR_13, DR_13, DR_12, DR_11, DR_10, DR_9 }, // DR_6
|
// { DR_13, DR_13, DR_12, DR_11, DR_10, DR_9 }, // DR_6
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
for (int j=0; j < 6; j++ ) {
|
for (int j = 0; j < 6; j++) {
|
||||||
uint8_t val = 8 + i;
|
uint8_t val = 8 + i;
|
||||||
val -= j;
|
val -= j;
|
||||||
if (val > 13) val = 13;
|
if (val > 13) {
|
||||||
if (val < 8) val = 8;
|
val = 13;
|
||||||
|
}
|
||||||
|
if (val < 8) {
|
||||||
|
val = 8;
|
||||||
|
}
|
||||||
EXPECT_TRUE(val == object->apply_DR_offset(i, j));
|
EXPECT_TRUE(val == object->apply_DR_offset(i, j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,62 +20,70 @@
|
||||||
|
|
||||||
#include "LoRaPHY_stub.h"
|
#include "LoRaPHY_stub.h"
|
||||||
|
|
||||||
class my_radio : public LoRaRadio
|
class my_radio : public LoRaRadio {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void init_radio(radio_events_t *events){};
|
virtual void init_radio(radio_events_t *events) {};
|
||||||
|
|
||||||
virtual void radio_reset(){};
|
virtual void radio_reset() {};
|
||||||
|
|
||||||
virtual void sleep(void){};
|
virtual void sleep(void) {};
|
||||||
|
|
||||||
virtual void standby(void){};
|
virtual void standby(void) {};
|
||||||
|
|
||||||
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
|
virtual void set_rx_config(radio_modems_t modem, uint32_t bandwidth,
|
||||||
uint32_t datarate, uint8_t coderate,
|
uint32_t datarate, uint8_t coderate,
|
||||||
uint32_t bandwidth_afc, uint16_t preamble_len,
|
uint32_t bandwidth_afc, uint16_t preamble_len,
|
||||||
uint16_t symb_timeout, bool fix_len,
|
uint16_t symb_timeout, bool fix_len,
|
||||||
uint8_t payload_len,
|
uint8_t payload_len,
|
||||||
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
||||||
bool iq_inverted, bool rx_continuous){};
|
bool iq_inverted, bool rx_continuous) {};
|
||||||
|
|
||||||
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
||||||
uint32_t bandwidth, uint32_t datarate,
|
uint32_t bandwidth, uint32_t datarate,
|
||||||
uint8_t coderate, uint16_t preamble_len,
|
uint8_t coderate, uint16_t preamble_len,
|
||||||
bool fix_len, bool crc_on, bool freq_hop_on,
|
bool fix_len, bool crc_on, bool freq_hop_on,
|
||||||
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
|
uint8_t hop_period, bool iq_inverted, uint32_t timeout) {};
|
||||||
|
|
||||||
virtual void send(uint8_t *buffer, uint8_t size){};
|
virtual void send(uint8_t *buffer, uint8_t size) {};
|
||||||
|
|
||||||
virtual void receive(void){};
|
virtual void receive(void) {};
|
||||||
|
|
||||||
virtual void set_channel(uint32_t freq){};
|
virtual void set_channel(uint32_t freq) {};
|
||||||
|
|
||||||
virtual uint32_t random(void){};
|
virtual uint32_t random(void) {};
|
||||||
|
|
||||||
virtual uint8_t get_status(void){return uint8_value;};
|
virtual uint8_t get_status(void)
|
||||||
|
{
|
||||||
|
return uint8_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
|
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max) {};
|
||||||
|
|
||||||
virtual void set_public_network(bool enable){};
|
virtual void set_public_network(bool enable) {};
|
||||||
|
|
||||||
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
|
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len) {};
|
||||||
|
|
||||||
virtual bool perform_carrier_sense(radio_modems_t modem,
|
virtual bool perform_carrier_sense(radio_modems_t modem,
|
||||||
uint32_t freq,
|
uint32_t freq,
|
||||||
int16_t rssi_threshold,
|
int16_t rssi_threshold,
|
||||||
uint32_t max_carrier_sense_time){ return bool_value;};
|
uint32_t max_carrier_sense_time)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void start_cad(void){};
|
virtual void start_cad(void) {};
|
||||||
|
|
||||||
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
|
virtual bool check_rf_frequency(uint32_t frequency)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
|
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time) {};
|
||||||
|
|
||||||
virtual void lock(void){};
|
virtual void lock(void) {};
|
||||||
|
|
||||||
virtual void unlock(void){};
|
virtual void unlock(void) {};
|
||||||
|
|
||||||
bool bool_value;
|
bool bool_value;
|
||||||
uint8_t uint8_value;
|
uint8_t uint8_value;
|
||||||
|
|
|
||||||
|
|
@ -20,62 +20,67 @@
|
||||||
#include "LoRaPHY_stub.h"
|
#include "LoRaPHY_stub.h"
|
||||||
#include "LoRaRadio.h"
|
#include "LoRaRadio.h"
|
||||||
|
|
||||||
class my_radio : public LoRaRadio
|
class my_radio : public LoRaRadio {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void init_radio(radio_events_t *events){};
|
virtual void init_radio(radio_events_t *events) {};
|
||||||
|
|
||||||
virtual void radio_reset(){};
|
virtual void radio_reset() {};
|
||||||
|
|
||||||
virtual void sleep(void){};
|
virtual void sleep(void) {};
|
||||||
|
|
||||||
virtual void standby(void){};
|
virtual void standby(void) {};
|
||||||
|
|
||||||
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
|
virtual void set_rx_config(radio_modems_t modem, uint32_t bandwidth,
|
||||||
uint32_t datarate, uint8_t coderate,
|
uint32_t datarate, uint8_t coderate,
|
||||||
uint32_t bandwidth_afc, uint16_t preamble_len,
|
uint32_t bandwidth_afc, uint16_t preamble_len,
|
||||||
uint16_t symb_timeout, bool fix_len,
|
uint16_t symb_timeout, bool fix_len,
|
||||||
uint8_t payload_len,
|
uint8_t payload_len,
|
||||||
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
||||||
bool iq_inverted, bool rx_continuous){};
|
bool iq_inverted, bool rx_continuous) {};
|
||||||
|
|
||||||
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
||||||
uint32_t bandwidth, uint32_t datarate,
|
uint32_t bandwidth, uint32_t datarate,
|
||||||
uint8_t coderate, uint16_t preamble_len,
|
uint8_t coderate, uint16_t preamble_len,
|
||||||
bool fix_len, bool crc_on, bool freq_hop_on,
|
bool fix_len, bool crc_on, bool freq_hop_on,
|
||||||
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
|
uint8_t hop_period, bool iq_inverted, uint32_t timeout) {};
|
||||||
|
|
||||||
virtual void send(uint8_t *buffer, uint8_t size){};
|
virtual void send(uint8_t *buffer, uint8_t size) {};
|
||||||
|
|
||||||
virtual void receive(void){};
|
virtual void receive(void) {};
|
||||||
|
|
||||||
virtual void set_channel(uint32_t freq){};
|
virtual void set_channel(uint32_t freq) {};
|
||||||
|
|
||||||
virtual uint32_t random(void){};
|
virtual uint32_t random(void) {};
|
||||||
|
|
||||||
virtual uint8_t get_status(void){};
|
virtual uint8_t get_status(void) {};
|
||||||
|
|
||||||
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
|
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max) {};
|
||||||
|
|
||||||
virtual void set_public_network(bool enable){};
|
virtual void set_public_network(bool enable) {};
|
||||||
|
|
||||||
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
|
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len) {};
|
||||||
|
|
||||||
virtual bool perform_carrier_sense(radio_modems_t modem,
|
virtual bool perform_carrier_sense(radio_modems_t modem,
|
||||||
uint32_t freq,
|
uint32_t freq,
|
||||||
int16_t rssi_threshold,
|
int16_t rssi_threshold,
|
||||||
uint32_t max_carrier_sense_time){ return bool_value;};
|
uint32_t max_carrier_sense_time)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void start_cad(void){};
|
virtual void start_cad(void) {};
|
||||||
|
|
||||||
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
|
virtual bool check_rf_frequency(uint32_t frequency)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
|
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time) {};
|
||||||
|
|
||||||
virtual void lock(void){};
|
virtual void lock(void) {};
|
||||||
|
|
||||||
virtual void unlock(void){};
|
virtual void unlock(void) {};
|
||||||
|
|
||||||
bool bool_value;
|
bool bool_value;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -19,62 +19,70 @@
|
||||||
#include "LoRaPHYUS915.h"
|
#include "LoRaPHYUS915.h"
|
||||||
#include "LoRaPHY_stub.h"
|
#include "LoRaPHY_stub.h"
|
||||||
|
|
||||||
class my_radio : public LoRaRadio
|
class my_radio : public LoRaRadio {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void init_radio(radio_events_t *events){};
|
virtual void init_radio(radio_events_t *events) {};
|
||||||
|
|
||||||
virtual void radio_reset(){};
|
virtual void radio_reset() {};
|
||||||
|
|
||||||
virtual void sleep(void){};
|
virtual void sleep(void) {};
|
||||||
|
|
||||||
virtual void standby(void){};
|
virtual void standby(void) {};
|
||||||
|
|
||||||
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
|
virtual void set_rx_config(radio_modems_t modem, uint32_t bandwidth,
|
||||||
uint32_t datarate, uint8_t coderate,
|
uint32_t datarate, uint8_t coderate,
|
||||||
uint32_t bandwidth_afc, uint16_t preamble_len,
|
uint32_t bandwidth_afc, uint16_t preamble_len,
|
||||||
uint16_t symb_timeout, bool fix_len,
|
uint16_t symb_timeout, bool fix_len,
|
||||||
uint8_t payload_len,
|
uint8_t payload_len,
|
||||||
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
||||||
bool iq_inverted, bool rx_continuous){};
|
bool iq_inverted, bool rx_continuous) {};
|
||||||
|
|
||||||
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
||||||
uint32_t bandwidth, uint32_t datarate,
|
uint32_t bandwidth, uint32_t datarate,
|
||||||
uint8_t coderate, uint16_t preamble_len,
|
uint8_t coderate, uint16_t preamble_len,
|
||||||
bool fix_len, bool crc_on, bool freq_hop_on,
|
bool fix_len, bool crc_on, bool freq_hop_on,
|
||||||
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
|
uint8_t hop_period, bool iq_inverted, uint32_t timeout) {};
|
||||||
|
|
||||||
virtual void send(uint8_t *buffer, uint8_t size){};
|
virtual void send(uint8_t *buffer, uint8_t size) {};
|
||||||
|
|
||||||
virtual void receive(void){};
|
virtual void receive(void) {};
|
||||||
|
|
||||||
virtual void set_channel(uint32_t freq){};
|
virtual void set_channel(uint32_t freq) {};
|
||||||
|
|
||||||
virtual uint32_t random(void){};
|
virtual uint32_t random(void) {};
|
||||||
|
|
||||||
virtual uint8_t get_status(void){return uint8_value;};
|
virtual uint8_t get_status(void)
|
||||||
|
{
|
||||||
|
return uint8_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
|
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max) {};
|
||||||
|
|
||||||
virtual void set_public_network(bool enable){};
|
virtual void set_public_network(bool enable) {};
|
||||||
|
|
||||||
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
|
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len) {};
|
||||||
|
|
||||||
virtual bool perform_carrier_sense(radio_modems_t modem,
|
virtual bool perform_carrier_sense(radio_modems_t modem,
|
||||||
uint32_t freq,
|
uint32_t freq,
|
||||||
int16_t rssi_threshold,
|
int16_t rssi_threshold,
|
||||||
uint32_t max_carrier_sense_time){ return bool_value;};
|
uint32_t max_carrier_sense_time)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void start_cad(void){};
|
virtual void start_cad(void) {};
|
||||||
|
|
||||||
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
|
virtual bool check_rf_frequency(uint32_t frequency)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
|
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time) {};
|
||||||
|
|
||||||
virtual void lock(void){};
|
virtual void lock(void) {};
|
||||||
|
|
||||||
virtual void unlock(void){};
|
virtual void unlock(void) {};
|
||||||
|
|
||||||
bool bool_value;
|
bool bool_value;
|
||||||
uint8_t uint8_value;
|
uint8_t uint8_value;
|
||||||
|
|
@ -221,11 +229,15 @@ TEST_F(Test_LoRaPHYUS915, apply_DR_offset)
|
||||||
//13, 13, 12, 11
|
//13, 13, 12, 11
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
for (int j=0; j < 4; j++ ) {
|
for (int j = 0; j < 4; j++) {
|
||||||
uint8_t val = 10 + i;
|
uint8_t val = 10 + i;
|
||||||
val -= j;
|
val -= j;
|
||||||
if (val > 13) val = 13;
|
if (val > 13) {
|
||||||
if (val < 8) val = 8;
|
val = 13;
|
||||||
|
}
|
||||||
|
if (val < 8) {
|
||||||
|
val = 8;
|
||||||
|
}
|
||||||
EXPECT_TRUE(val == object->apply_DR_offset(i, j));
|
EXPECT_TRUE(val == object->apply_DR_offset(i, j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,70 +18,68 @@
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "LoRaWANInterface.h"
|
#include "LoRaWANInterface.h"
|
||||||
|
|
||||||
class my_radio : public LoRaRadio
|
class my_radio : public LoRaRadio {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void init_radio(radio_events_t *events){};
|
virtual void init_radio(radio_events_t *events) {};
|
||||||
|
|
||||||
virtual void radio_reset(){};
|
virtual void radio_reset() {};
|
||||||
|
|
||||||
virtual void sleep(void){};
|
virtual void sleep(void) {};
|
||||||
|
|
||||||
virtual void standby(void){};
|
virtual void standby(void) {};
|
||||||
|
|
||||||
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
|
virtual void set_rx_config(radio_modems_t modem, uint32_t bandwidth,
|
||||||
uint32_t datarate, uint8_t coderate,
|
uint32_t datarate, uint8_t coderate,
|
||||||
uint32_t bandwidth_afc, uint16_t preamble_len,
|
uint32_t bandwidth_afc, uint16_t preamble_len,
|
||||||
uint16_t symb_timeout, bool fix_len,
|
uint16_t symb_timeout, bool fix_len,
|
||||||
uint8_t payload_len,
|
uint8_t payload_len,
|
||||||
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
||||||
bool iq_inverted, bool rx_continuous){};
|
bool iq_inverted, bool rx_continuous) {};
|
||||||
|
|
||||||
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
||||||
uint32_t bandwidth, uint32_t datarate,
|
uint32_t bandwidth, uint32_t datarate,
|
||||||
uint8_t coderate, uint16_t preamble_len,
|
uint8_t coderate, uint16_t preamble_len,
|
||||||
bool fix_len, bool crc_on, bool freq_hop_on,
|
bool fix_len, bool crc_on, bool freq_hop_on,
|
||||||
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
|
uint8_t hop_period, bool iq_inverted, uint32_t timeout) {};
|
||||||
|
|
||||||
virtual void send(uint8_t *buffer, uint8_t size){};
|
virtual void send(uint8_t *buffer, uint8_t size) {};
|
||||||
|
|
||||||
virtual void receive(void){};
|
virtual void receive(void) {};
|
||||||
|
|
||||||
virtual void set_channel(uint32_t freq){};
|
virtual void set_channel(uint32_t freq) {};
|
||||||
|
|
||||||
virtual uint32_t random(void){};
|
virtual uint32_t random(void) {};
|
||||||
|
|
||||||
virtual uint8_t get_status(void){};
|
virtual uint8_t get_status(void) {};
|
||||||
|
|
||||||
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
|
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max) {};
|
||||||
|
|
||||||
virtual void set_public_network(bool enable){};
|
virtual void set_public_network(bool enable) {};
|
||||||
|
|
||||||
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
|
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len) {};
|
||||||
|
|
||||||
virtual bool perform_carrier_sense(radio_modems_t modem,
|
virtual bool perform_carrier_sense(radio_modems_t modem,
|
||||||
uint32_t freq,
|
uint32_t freq,
|
||||||
int16_t rssi_threshold,
|
int16_t rssi_threshold,
|
||||||
uint32_t max_carrier_sense_time){};
|
uint32_t max_carrier_sense_time) {};
|
||||||
|
|
||||||
virtual void start_cad(void){};
|
virtual void start_cad(void) {};
|
||||||
|
|
||||||
virtual bool check_rf_frequency(uint32_t frequency){};
|
virtual bool check_rf_frequency(uint32_t frequency) {};
|
||||||
|
|
||||||
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
|
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time) {};
|
||||||
|
|
||||||
virtual void lock(void){};
|
virtual void lock(void) {};
|
||||||
|
|
||||||
virtual void unlock(void){};
|
virtual void unlock(void) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class my_LoRaPHY : public LoRaPHY
|
class my_LoRaPHY : public LoRaPHY {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
my_LoRaPHY(){};
|
my_LoRaPHY() {};
|
||||||
|
|
||||||
virtual ~my_LoRaPHY(){};
|
virtual ~my_LoRaPHY() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Test_LoRaWANInterface : public testing::Test {
|
class Test_LoRaWANInterface : public testing::Test {
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,11 @@ static uint8_t batt_level = 0;
|
||||||
|
|
||||||
using namespace events;
|
using namespace events;
|
||||||
|
|
||||||
class my_LoRaPHY : public LoRaPHY
|
class my_LoRaPHY : public LoRaPHY {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
my_LoRaPHY(){};
|
my_LoRaPHY() {};
|
||||||
|
|
||||||
virtual ~my_LoRaPHY(){};
|
virtual ~my_LoRaPHY() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t my_cb()
|
uint8_t my_cb()
|
||||||
|
|
@ -41,63 +40,74 @@ uint8_t my_cb()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
class my_radio : public LoRaRadio
|
class my_radio : public LoRaRadio {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
radio_events_t *_ev;
|
radio_events_t *_ev;
|
||||||
|
|
||||||
virtual void init_radio(radio_events_t *events){_ev = events;};
|
virtual void init_radio(radio_events_t *events)
|
||||||
|
{
|
||||||
|
_ev = events;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void radio_reset(){};
|
virtual void radio_reset() {};
|
||||||
|
|
||||||
virtual void sleep(void){};
|
virtual void sleep(void) {};
|
||||||
|
|
||||||
virtual void standby(void){};
|
virtual void standby(void) {};
|
||||||
|
|
||||||
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
|
virtual void set_rx_config(radio_modems_t modem, uint32_t bandwidth,
|
||||||
uint32_t datarate, uint8_t coderate,
|
uint32_t datarate, uint8_t coderate,
|
||||||
uint32_t bandwidth_afc, uint16_t preamble_len,
|
uint32_t bandwidth_afc, uint16_t preamble_len,
|
||||||
uint16_t symb_timeout, bool fix_len,
|
uint16_t symb_timeout, bool fix_len,
|
||||||
uint8_t payload_len,
|
uint8_t payload_len,
|
||||||
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
||||||
bool iq_inverted, bool rx_continuous){};
|
bool iq_inverted, bool rx_continuous) {};
|
||||||
|
|
||||||
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
||||||
uint32_t bandwidth, uint32_t datarate,
|
uint32_t bandwidth, uint32_t datarate,
|
||||||
uint8_t coderate, uint16_t preamble_len,
|
uint8_t coderate, uint16_t preamble_len,
|
||||||
bool fix_len, bool crc_on, bool freq_hop_on,
|
bool fix_len, bool crc_on, bool freq_hop_on,
|
||||||
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
|
uint8_t hop_period, bool iq_inverted, uint32_t timeout) {};
|
||||||
|
|
||||||
virtual void send(uint8_t *buffer, uint8_t size){};
|
virtual void send(uint8_t *buffer, uint8_t size) {};
|
||||||
|
|
||||||
virtual void receive(void){};
|
virtual void receive(void) {};
|
||||||
|
|
||||||
virtual void set_channel(uint32_t freq){};
|
virtual void set_channel(uint32_t freq) {};
|
||||||
|
|
||||||
virtual uint32_t random(void){};
|
virtual uint32_t random(void) {};
|
||||||
|
|
||||||
virtual uint8_t get_status(void){return uint8_value;};
|
virtual uint8_t get_status(void)
|
||||||
|
{
|
||||||
|
return uint8_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
|
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max) {};
|
||||||
|
|
||||||
virtual void set_public_network(bool enable){};
|
virtual void set_public_network(bool enable) {};
|
||||||
|
|
||||||
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
|
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len) {};
|
||||||
|
|
||||||
virtual bool perform_carrier_sense(radio_modems_t modem,
|
virtual bool perform_carrier_sense(radio_modems_t modem,
|
||||||
uint32_t freq,
|
uint32_t freq,
|
||||||
int16_t rssi_threshold,
|
int16_t rssi_threshold,
|
||||||
uint32_t max_carrier_sense_time){ return bool_value;};
|
uint32_t max_carrier_sense_time)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void start_cad(void){};
|
virtual void start_cad(void) {};
|
||||||
|
|
||||||
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
|
virtual bool check_rf_frequency(uint32_t frequency)
|
||||||
|
{
|
||||||
|
return bool_value;
|
||||||
|
};
|
||||||
|
|
||||||
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
|
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time) {};
|
||||||
|
|
||||||
virtual void lock(void){};
|
virtual void lock(void) {};
|
||||||
|
|
||||||
virtual void unlock(void){};
|
virtual void unlock(void) {};
|
||||||
|
|
||||||
bool bool_value;
|
bool bool_value;
|
||||||
uint8_t uint8_value;
|
uint8_t uint8_value;
|
||||||
|
|
@ -442,7 +452,7 @@ TEST_F(Test_LoRaWANStack, handle_rx)
|
||||||
LoRaMac_stub::mlme_ind_ptr = &mlme_ind;
|
LoRaMac_stub::mlme_ind_ptr = &mlme_ind;
|
||||||
|
|
||||||
uint8_t ind_buf[150];
|
uint8_t ind_buf[150];
|
||||||
for (int i= 0; i < 110; i++) {
|
for (int i = 0; i < 110; i++) {
|
||||||
ind_buf[i] = i;
|
ind_buf[i] = i;
|
||||||
}
|
}
|
||||||
ind.buffer = ind_buf;
|
ind.buffer = ind_buf;
|
||||||
|
|
@ -497,7 +507,7 @@ TEST_F(Test_LoRaWANStack, handle_rx)
|
||||||
EXPECT_EQ(100, data[0]);
|
EXPECT_EQ(100, data[0]);
|
||||||
|
|
||||||
//read can fit the buffer
|
//read can fit the buffer
|
||||||
for (int i= 0; i < 110; i++) {
|
for (int i = 0; i < 110; i++) {
|
||||||
ind_buf[i] = i;
|
ind_buf[i] = i;
|
||||||
}
|
}
|
||||||
ind.buffer = ind_buf;
|
ind.buffer = ind_buf;
|
||||||
|
|
@ -847,7 +857,7 @@ TEST_F(Test_LoRaWANStack, process_reception)
|
||||||
LoRaMac_stub::mlme_ind_ptr = &mlme_ind;
|
LoRaMac_stub::mlme_ind_ptr = &mlme_ind;
|
||||||
|
|
||||||
uint8_t ind_buf[150];
|
uint8_t ind_buf[150];
|
||||||
for (int i= 0; i < 110; i++) {
|
for (int i = 0; i < 110; i++) {
|
||||||
ind_buf[i] = i;
|
ind_buf[i] = i;
|
||||||
}
|
}
|
||||||
ind.buffer = ind_buf;
|
ind.buffer = ind_buf;
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,7 @@ uint32_t rtos::EventFlags::wait_all(uint32_t flags, uint32_t timeout, bool clear
|
||||||
}
|
}
|
||||||
uint32_t rtos::EventFlags::wait_any(uint32_t flags, uint32_t timeout, bool clear)
|
uint32_t rtos::EventFlags::wait_any(uint32_t flags, uint32_t timeout, bool clear)
|
||||||
{
|
{
|
||||||
if (!eventFlagsStubNextRetval.empty())
|
if (!eventFlagsStubNextRetval.empty()) {
|
||||||
{
|
|
||||||
uint32_t ret = eventFlagsStubNextRetval.front();
|
uint32_t ret = eventFlagsStubNextRetval.front();
|
||||||
eventFlagsStubNextRetval.pop_front();
|
eventFlagsStubNextRetval.pop_front();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,7 @@
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
namespace EventQueue_stub
|
namespace EventQueue_stub {
|
||||||
{
|
|
||||||
extern int int_value;
|
extern int int_value;
|
||||||
extern unsigned unsigned_value;
|
extern unsigned unsigned_value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,27 +20,26 @@
|
||||||
|
|
||||||
#include "FileHandle.h"
|
#include "FileHandle.h"
|
||||||
|
|
||||||
namespace mbed
|
namespace mbed {
|
||||||
{
|
|
||||||
|
|
||||||
static uint8_t filehandle_stub_short_value_counter = 0;
|
static uint8_t filehandle_stub_short_value_counter = 0;
|
||||||
static char *filehandle_stub_table = NULL;
|
static char *filehandle_stub_table = NULL;
|
||||||
static uint8_t filehandle_stub_table_pos = 0;
|
static uint8_t filehandle_stub_table_pos = 0;
|
||||||
|
|
||||||
class FileHandle_stub : public FileHandle
|
class FileHandle_stub : public FileHandle {
|
||||||
{
|
public:
|
||||||
public:
|
|
||||||
ssize_t size_value;
|
ssize_t size_value;
|
||||||
|
|
||||||
FileHandle_stub() { size_value = 0; }
|
FileHandle_stub()
|
||||||
|
{
|
||||||
|
size_value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
virtual ssize_t read(void *buffer, size_t size)
|
virtual ssize_t read(void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
if (filehandle_stub_table)
|
if (filehandle_stub_table) {
|
||||||
{
|
|
||||||
ssize_t ret = strlen(filehandle_stub_table) - filehandle_stub_table_pos;
|
ssize_t ret = strlen(filehandle_stub_table) - filehandle_stub_table_pos;
|
||||||
if (size < ret)
|
if (size < ret) {
|
||||||
{
|
|
||||||
ret = size;
|
ret = size;
|
||||||
}
|
}
|
||||||
memcpy(buffer, filehandle_stub_table, ret);
|
memcpy(buffer, filehandle_stub_table, ret);
|
||||||
|
|
@ -52,33 +51,35 @@ class FileHandle_stub : public FileHandle
|
||||||
|
|
||||||
virtual ssize_t write(const void *buffer, size_t size)
|
virtual ssize_t write(const void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
if (size_value > 0)
|
if (size_value > 0) {
|
||||||
{
|
|
||||||
size_value--;
|
size_value--;
|
||||||
return size;
|
return size;
|
||||||
}
|
} else if (size_value < 0) {
|
||||||
else if (size_value < 0)
|
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual off_t seek(off_t offset, int whence = SEEK_SET) { return 0; }
|
virtual off_t seek(off_t offset, int whence = SEEK_SET)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int close() {}
|
virtual int close() {}
|
||||||
|
|
||||||
virtual short poll(short events) const
|
virtual short poll(short events) const
|
||||||
{
|
{
|
||||||
if (filehandle_stub_short_value_counter)
|
if (filehandle_stub_short_value_counter) {
|
||||||
{
|
|
||||||
filehandle_stub_short_value_counter--;
|
filehandle_stub_short_value_counter--;
|
||||||
return short_value;
|
return short_value;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void sigio(Callback<void()> func) { func(); }
|
virtual void sigio(Callback<void()> func)
|
||||||
|
{
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
|
||||||
short short_value;
|
short short_value;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@ void LoRaMacChannelPlan::activate_channelplan_subsystem(LoRaPHY *phy)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
lorawan_status_t LoRaMacChannelPlan::set_plan(const lorawan_channelplan_t& plan)
|
lorawan_status_t LoRaMacChannelPlan::set_plan(const lorawan_channelplan_t &plan)
|
||||||
{
|
{
|
||||||
return LORAWAN_STATUS_OK;
|
return LORAWAN_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
lorawan_status_t LoRaMacChannelPlan::get_plan(lorawan_channelplan_t& plan,
|
lorawan_status_t LoRaMacChannelPlan::get_plan(lorawan_channelplan_t &plan,
|
||||||
const channel_params_t* channel_list)
|
const channel_params_t *channel_list)
|
||||||
{
|
{
|
||||||
return LORAWAN_STATUS_OK;
|
return LORAWAN_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ bool LoRaMacCommand::has_sticky_mac_cmd() const
|
||||||
|
|
||||||
lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, uint8_t mac_index,
|
lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, uint8_t mac_index,
|
||||||
uint8_t commands_size, uint8_t snr,
|
uint8_t commands_size, uint8_t snr,
|
||||||
loramac_mlme_confirm_t& mlme_conf,
|
loramac_mlme_confirm_t &mlme_conf,
|
||||||
lora_mac_system_params_t &mac_sys_params,
|
lora_mac_system_params_t &mac_sys_params,
|
||||||
LoRaPHY &lora_phy)
|
LoRaPHY &lora_phy)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "lorawan_types.h"
|
#include "lorawan_types.h"
|
||||||
|
|
||||||
namespace LoRaMacCommand_stub
|
namespace LoRaMacCommand_stub {
|
||||||
{
|
|
||||||
extern lorawan_status_t status_value;
|
extern lorawan_status_t status_value;
|
||||||
extern bool bool_value;
|
extern bool bool_value;
|
||||||
extern uint8_t uint8_value;
|
extern uint8_t uint8_value;
|
||||||
|
|
|
||||||
|
|
@ -30,25 +30,25 @@ LoRaMacCrypto::LoRaMacCrypto()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int LoRaMacCrypto::compute_mic(const uint8_t *, uint16_t , const uint8_t *, uint32_t, uint32_t,
|
int LoRaMacCrypto::compute_mic(const uint8_t *, uint16_t, const uint8_t *, uint32_t, uint32_t,
|
||||||
uint8_t dir, uint32_t, uint32_t *)
|
uint8_t dir, uint32_t, uint32_t *)
|
||||||
{
|
{
|
||||||
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
||||||
}
|
}
|
||||||
|
|
||||||
int LoRaMacCrypto::encrypt_payload(const uint8_t *, uint16_t , const uint8_t *, uint32_t, uint32_t,
|
int LoRaMacCrypto::encrypt_payload(const uint8_t *, uint16_t, const uint8_t *, uint32_t, uint32_t,
|
||||||
uint8_t , uint32_t , uint8_t *)
|
uint8_t, uint32_t, uint8_t *)
|
||||||
{
|
{
|
||||||
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
||||||
}
|
}
|
||||||
|
|
||||||
int LoRaMacCrypto::decrypt_payload(const uint8_t *, uint16_t , const uint8_t *, uint32_t, uint32_t,
|
int LoRaMacCrypto::decrypt_payload(const uint8_t *, uint16_t, const uint8_t *, uint32_t, uint32_t,
|
||||||
uint8_t , uint32_t , uint8_t *)
|
uint8_t, uint32_t, uint8_t *)
|
||||||
{
|
{
|
||||||
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
||||||
}
|
}
|
||||||
|
|
||||||
int LoRaMacCrypto::compute_join_frame_mic(const uint8_t *, uint16_t , const uint8_t *, uint32_t, uint32_t *)
|
int LoRaMacCrypto::compute_join_frame_mic(const uint8_t *, uint16_t, const uint8_t *, uint32_t, uint32_t *)
|
||||||
{
|
{
|
||||||
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +59,7 @@ int LoRaMacCrypto::decrypt_join_frame(const uint8_t *in, uint16_t size, const ui
|
||||||
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
||||||
}
|
}
|
||||||
|
|
||||||
int LoRaMacCrypto::compute_skeys_for_join_frame(const uint8_t *, uint32_t, const uint8_t *, uint16_t ,
|
int LoRaMacCrypto::compute_skeys_for_join_frame(const uint8_t *, uint32_t, const uint8_t *, uint16_t,
|
||||||
uint8_t *, uint8_t *)
|
uint8_t *, uint8_t *)
|
||||||
{
|
{
|
||||||
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,7 @@
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
namespace LoRaMacCrypto_stub
|
namespace LoRaMacCrypto_stub {
|
||||||
{
|
|
||||||
extern int int_table_idx_value;
|
extern int int_table_idx_value;
|
||||||
extern int int_table[20];
|
extern int int_table[20];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,7 @@
|
||||||
#include "lorawan_types.h"
|
#include "lorawan_types.h"
|
||||||
#include "lorawan_data_structures.h"
|
#include "lorawan_data_structures.h"
|
||||||
|
|
||||||
namespace LoRaMac_stub
|
namespace LoRaMac_stub {
|
||||||
{
|
|
||||||
extern bool bool_value;
|
extern bool bool_value;
|
||||||
extern int bool_false_counter;
|
extern int bool_false_counter;
|
||||||
extern int bool_true_counter;
|
extern int bool_true_counter;
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
|
|
||||||
#include "lorawan_types.h"
|
#include "lorawan_types.h"
|
||||||
|
|
||||||
namespace LoRaPHY_stub
|
namespace LoRaPHY_stub {
|
||||||
{
|
|
||||||
extern LoRaRadio *radio;
|
extern LoRaRadio *radio;
|
||||||
extern uint8_t bool_counter;
|
extern uint8_t bool_counter;
|
||||||
extern bool bool_table[20];
|
extern bool bool_table[20];
|
||||||
|
|
@ -33,7 +32,7 @@ extern int int_value;
|
||||||
extern double double_value;
|
extern double double_value;
|
||||||
extern uint16_t uint16_value;
|
extern uint16_t uint16_value;
|
||||||
extern lorawan_status_t lorawan_status_value;
|
extern lorawan_status_t lorawan_status_value;
|
||||||
extern channel_params_t* channel_params_ptr;
|
extern channel_params_t *channel_params_ptr;
|
||||||
extern uint8_t linkAdrNbBytesParsed;
|
extern uint8_t linkAdrNbBytesParsed;
|
||||||
extern uint8_t ch_mask_value;
|
extern uint8_t ch_mask_value;
|
||||||
extern uint8_t adr_parse_count;
|
extern uint8_t adr_parse_count;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ void LoRaWANTimeHandler::activate_timer_subsystem(events::EventQueue *queue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
lorawan_time_t LoRaWANTimeHandler::get_current_time( void )
|
lorawan_time_t LoRaWANTimeHandler::get_current_time(void)
|
||||||
{
|
{
|
||||||
return LoRaWANTimer_stub::time_value;
|
return LoRaWANTimer_stub::time_value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,7 @@
|
||||||
|
|
||||||
#include "LoRaWANTimer.h"
|
#include "LoRaWANTimer.h"
|
||||||
|
|
||||||
namespace LoRaWANTimer_stub
|
namespace LoRaWANTimer_stub {
|
||||||
{
|
|
||||||
extern lorawan_time_t time_value;
|
extern lorawan_time_t time_value;
|
||||||
extern bool call_cb_immediately;
|
extern bool call_cb_immediately;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,9 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual nsapi_error_t socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto)
|
virtual nsapi_error_t socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto)
|
||||||
{
|
{
|
||||||
if (return_value == NSAPI_ERROR_OK && return_values.front() == NSAPI_ERROR_OK)
|
if (return_value == NSAPI_ERROR_OK && return_values.front() == NSAPI_ERROR_OK) {
|
||||||
{
|
|
||||||
// Make sure a non-NULL value is returned if error is not expected
|
// Make sure a non-NULL value is returned if error is not expected
|
||||||
*handle = reinterpret_cast<nsapi_socket_t*>(1234);
|
*handle = reinterpret_cast<nsapi_socket_t *>(1234);
|
||||||
}
|
}
|
||||||
return return_value;
|
return return_value;
|
||||||
};
|
};
|
||||||
|
|
@ -68,8 +67,7 @@ protected:
|
||||||
};
|
};
|
||||||
virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address)
|
virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address)
|
||||||
{
|
{
|
||||||
if (!return_values.empty())
|
if (!return_values.empty()) {
|
||||||
{
|
|
||||||
nsapi_error_t ret = return_values.front();
|
nsapi_error_t ret = return_values.front();
|
||||||
return_values.pop_front();
|
return_values.pop_front();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -84,8 +82,7 @@ protected:
|
||||||
virtual nsapi_size_or_error_t socket_send(nsapi_socket_t handle,
|
virtual nsapi_size_or_error_t socket_send(nsapi_socket_t handle,
|
||||||
const void *data, nsapi_size_t size)
|
const void *data, nsapi_size_t size)
|
||||||
{
|
{
|
||||||
if (!return_values.empty())
|
if (!return_values.empty()) {
|
||||||
{
|
|
||||||
nsapi_error_t ret = return_values.front();
|
nsapi_error_t ret = return_values.front();
|
||||||
return_values.pop_front();
|
return_values.pop_front();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -95,8 +92,7 @@ protected:
|
||||||
virtual nsapi_size_or_error_t socket_recv(nsapi_socket_t handle,
|
virtual nsapi_size_or_error_t socket_recv(nsapi_socket_t handle,
|
||||||
void *data, nsapi_size_t size)
|
void *data, nsapi_size_t size)
|
||||||
{
|
{
|
||||||
if (!return_values.empty())
|
if (!return_values.empty()) {
|
||||||
{
|
|
||||||
nsapi_error_t ret = return_values.front();
|
nsapi_error_t ret = return_values.front();
|
||||||
return_values.pop_front();
|
return_values.pop_front();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -111,8 +107,7 @@ protected:
|
||||||
virtual nsapi_size_or_error_t socket_recvfrom(nsapi_socket_t handle, SocketAddress *address,
|
virtual nsapi_size_or_error_t socket_recvfrom(nsapi_socket_t handle, SocketAddress *address,
|
||||||
void *buffer, nsapi_size_t size)
|
void *buffer, nsapi_size_t size)
|
||||||
{
|
{
|
||||||
if (!return_values.empty())
|
if (!return_values.empty()) {
|
||||||
{
|
|
||||||
nsapi_error_t ret = return_values.front();
|
nsapi_error_t ret = return_values.front();
|
||||||
return_values.pop_front();
|
return_values.pop_front();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
|
|
@ -30,27 +30,27 @@
|
||||||
aes_stub_def aes_stub;
|
aes_stub_def aes_stub;
|
||||||
|
|
||||||
|
|
||||||
void mbedtls_aes_init( mbedtls_aes_context *ctx )
|
void mbedtls_aes_init(mbedtls_aes_context *ctx)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbedtls_aes_free( mbedtls_aes_context *ctx )
|
void mbedtls_aes_free(mbedtls_aes_context *ctx)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
||||||
void mbedtls_aes_xts_init( mbedtls_aes_xts_context *ctx )
|
void mbedtls_aes_xts_init(mbedtls_aes_xts_context *ctx)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbedtls_aes_xts_free( mbedtls_aes_xts_context *ctx )
|
void mbedtls_aes_xts_free(mbedtls_aes_xts_context *ctx)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(MBEDTLS_AES_SETKEY_ENC_ALT)
|
#if !defined(MBEDTLS_AES_SETKEY_ENC_ALT)
|
||||||
int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
|
int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key,
|
||||||
unsigned int keybits )
|
unsigned int keybits)
|
||||||
{
|
{
|
||||||
if (aes_stub.int_zero_counter) {
|
if (aes_stub.int_zero_counter) {
|
||||||
aes_stub.int_zero_counter--;
|
aes_stub.int_zero_counter--;
|
||||||
|
|
@ -61,8 +61,8 @@ int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
|
#if !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
|
||||||
int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
|
int mbedtls_aes_setkey_dec(mbedtls_aes_context *ctx, const unsigned char *key,
|
||||||
unsigned int keybits )
|
unsigned int keybits)
|
||||||
{
|
{
|
||||||
if (aes_stub.int_zero_counter) {
|
if (aes_stub.int_zero_counter) {
|
||||||
aes_stub.int_zero_counter--;
|
aes_stub.int_zero_counter--;
|
||||||
|
|
@ -73,7 +73,7 @@ int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
||||||
int mbedtls_aes_xts_setkey_enc( mbedtls_aes_xts_context *ctx,
|
int mbedtls_aes_xts_setkey_enc(mbedtls_aes_xts_context *ctx,
|
||||||
const unsigned char *key,
|
const unsigned char *key,
|
||||||
unsigned int keybits)
|
unsigned int keybits)
|
||||||
{
|
{
|
||||||
|
|
@ -84,7 +84,7 @@ int mbedtls_aes_xts_setkey_enc( mbedtls_aes_xts_context *ctx,
|
||||||
return aes_stub.int_value;
|
return aes_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_aes_xts_setkey_dec( mbedtls_aes_xts_context *ctx,
|
int mbedtls_aes_xts_setkey_dec(mbedtls_aes_xts_context *ctx,
|
||||||
const unsigned char *key,
|
const unsigned char *key,
|
||||||
unsigned int keybits)
|
unsigned int keybits)
|
||||||
{
|
{
|
||||||
|
|
@ -96,9 +96,9 @@ int mbedtls_aes_xts_setkey_dec( mbedtls_aes_xts_context *ctx,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
|
int mbedtls_internal_aes_encrypt(mbedtls_aes_context *ctx,
|
||||||
const unsigned char input[16],
|
const unsigned char input[16],
|
||||||
unsigned char output[16] )
|
unsigned char output[16])
|
||||||
{
|
{
|
||||||
if (aes_stub.int_zero_counter) {
|
if (aes_stub.int_zero_counter) {
|
||||||
aes_stub.int_zero_counter--;
|
aes_stub.int_zero_counter--;
|
||||||
|
|
@ -107,15 +107,15 @@ int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
|
||||||
return aes_stub.int_value;
|
return aes_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
|
void mbedtls_aes_encrypt(mbedtls_aes_context *ctx,
|
||||||
const unsigned char input[16],
|
const unsigned char input[16],
|
||||||
unsigned char output[16] )
|
unsigned char output[16])
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx,
|
int mbedtls_internal_aes_decrypt(mbedtls_aes_context *ctx,
|
||||||
const unsigned char input[16],
|
const unsigned char input[16],
|
||||||
unsigned char output[16] )
|
unsigned char output[16])
|
||||||
{
|
{
|
||||||
if (aes_stub.int_zero_counter) {
|
if (aes_stub.int_zero_counter) {
|
||||||
aes_stub.int_zero_counter--;
|
aes_stub.int_zero_counter--;
|
||||||
|
|
@ -124,16 +124,16 @@ int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx,
|
||||||
return aes_stub.int_value;
|
return aes_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
|
void mbedtls_aes_decrypt(mbedtls_aes_context *ctx,
|
||||||
const unsigned char input[16],
|
const unsigned char input[16],
|
||||||
unsigned char output[16] )
|
unsigned char output[16])
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
|
int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx,
|
||||||
int mode,
|
int mode,
|
||||||
const unsigned char input[16],
|
const unsigned char input[16],
|
||||||
unsigned char output[16] )
|
unsigned char output[16])
|
||||||
{
|
{
|
||||||
if (aes_stub.int_zero_counter) {
|
if (aes_stub.int_zero_counter) {
|
||||||
aes_stub.int_zero_counter--;
|
aes_stub.int_zero_counter--;
|
||||||
|
|
@ -142,12 +142,12 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
|
||||||
return aes_stub.int_value;
|
return aes_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
|
int mbedtls_aes_crypt_cbc(mbedtls_aes_context *ctx,
|
||||||
int mode,
|
int mode,
|
||||||
size_t length,
|
size_t length,
|
||||||
unsigned char iv[16],
|
unsigned char iv[16],
|
||||||
const unsigned char *input,
|
const unsigned char *input,
|
||||||
unsigned char *output )
|
unsigned char *output)
|
||||||
{
|
{
|
||||||
if (aes_stub.int_zero_counter) {
|
if (aes_stub.int_zero_counter) {
|
||||||
aes_stub.int_zero_counter--;
|
aes_stub.int_zero_counter--;
|
||||||
|
|
@ -158,12 +158,12 @@ int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
|
||||||
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
||||||
int mbedtls_aes_crypt_xts( mbedtls_aes_xts_context *ctx,
|
int mbedtls_aes_crypt_xts(mbedtls_aes_xts_context *ctx,
|
||||||
int mode,
|
int mode,
|
||||||
size_t length,
|
size_t length,
|
||||||
const unsigned char data_unit[16],
|
const unsigned char data_unit[16],
|
||||||
const unsigned char *input,
|
const unsigned char *input,
|
||||||
unsigned char *output )
|
unsigned char *output)
|
||||||
{
|
{
|
||||||
if (aes_stub.int_zero_counter) {
|
if (aes_stub.int_zero_counter) {
|
||||||
aes_stub.int_zero_counter--;
|
aes_stub.int_zero_counter--;
|
||||||
|
|
@ -173,13 +173,13 @@ int mbedtls_aes_crypt_xts( mbedtls_aes_xts_context *ctx,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
|
int mbedtls_aes_crypt_cfb128(mbedtls_aes_context *ctx,
|
||||||
int mode,
|
int mode,
|
||||||
size_t length,
|
size_t length,
|
||||||
size_t *iv_off,
|
size_t *iv_off,
|
||||||
unsigned char iv[16],
|
unsigned char iv[16],
|
||||||
const unsigned char *input,
|
const unsigned char *input,
|
||||||
unsigned char *output )
|
unsigned char *output)
|
||||||
{
|
{
|
||||||
if (aes_stub.int_zero_counter) {
|
if (aes_stub.int_zero_counter) {
|
||||||
aes_stub.int_zero_counter--;
|
aes_stub.int_zero_counter--;
|
||||||
|
|
@ -188,12 +188,12 @@ int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
|
||||||
return aes_stub.int_value;
|
return aes_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_aes_crypt_cfb8( mbedtls_aes_context *ctx,
|
int mbedtls_aes_crypt_cfb8(mbedtls_aes_context *ctx,
|
||||||
int mode,
|
int mode,
|
||||||
size_t length,
|
size_t length,
|
||||||
unsigned char iv[16],
|
unsigned char iv[16],
|
||||||
const unsigned char *input,
|
const unsigned char *input,
|
||||||
unsigned char *output )
|
unsigned char *output)
|
||||||
{
|
{
|
||||||
if (aes_stub.int_zero_counter) {
|
if (aes_stub.int_zero_counter) {
|
||||||
aes_stub.int_zero_counter--;
|
aes_stub.int_zero_counter--;
|
||||||
|
|
@ -202,12 +202,12 @@ int mbedtls_aes_crypt_cfb8( mbedtls_aes_context *ctx,
|
||||||
return aes_stub.int_value;
|
return aes_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_aes_crypt_ofb( mbedtls_aes_context *ctx,
|
int mbedtls_aes_crypt_ofb(mbedtls_aes_context *ctx,
|
||||||
size_t length,
|
size_t length,
|
||||||
size_t *iv_off,
|
size_t *iv_off,
|
||||||
unsigned char iv[16],
|
unsigned char iv[16],
|
||||||
const unsigned char *input,
|
const unsigned char *input,
|
||||||
unsigned char *output )
|
unsigned char *output)
|
||||||
{
|
{
|
||||||
if (aes_stub.int_zero_counter) {
|
if (aes_stub.int_zero_counter) {
|
||||||
aes_stub.int_zero_counter--;
|
aes_stub.int_zero_counter--;
|
||||||
|
|
@ -216,13 +216,13 @@ int mbedtls_aes_crypt_ofb( mbedtls_aes_context *ctx,
|
||||||
return aes_stub.int_value;
|
return aes_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_aes_crypt_ctr( mbedtls_aes_context *ctx,
|
int mbedtls_aes_crypt_ctr(mbedtls_aes_context *ctx,
|
||||||
size_t length,
|
size_t length,
|
||||||
size_t *nc_off,
|
size_t *nc_off,
|
||||||
unsigned char nonce_counter[16],
|
unsigned char nonce_counter[16],
|
||||||
unsigned char stream_block[16],
|
unsigned char stream_block[16],
|
||||||
const unsigned char *input,
|
const unsigned char *input,
|
||||||
unsigned char *output )
|
unsigned char *output)
|
||||||
{
|
{
|
||||||
if (aes_stub.int_zero_counter) {
|
if (aes_stub.int_zero_counter) {
|
||||||
aes_stub.int_zero_counter--;
|
aes_stub.int_zero_counter--;
|
||||||
|
|
|
||||||
|
|
@ -44,37 +44,37 @@
|
||||||
|
|
||||||
cipher_stub_def cipher_stub;
|
cipher_stub_def cipher_stub;
|
||||||
|
|
||||||
const int *mbedtls_cipher_list( void )
|
const int *mbedtls_cipher_list(void)
|
||||||
{
|
{
|
||||||
return cipher_stub.int_ptr;
|
return cipher_stub.int_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_type( const mbedtls_cipher_type_t cipher_type )
|
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_type(const mbedtls_cipher_type_t cipher_type)
|
||||||
{
|
{
|
||||||
return cipher_stub.info_value;
|
return cipher_stub.info_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_string( const char *cipher_name )
|
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_string(const char *cipher_name)
|
||||||
{
|
{
|
||||||
return cipher_stub.info_value;
|
return cipher_stub.info_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_values( const mbedtls_cipher_id_t cipher_id,
|
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_values(const mbedtls_cipher_id_t cipher_id,
|
||||||
int key_bitlen,
|
int key_bitlen,
|
||||||
const mbedtls_cipher_mode_t mode )
|
const mbedtls_cipher_mode_t mode)
|
||||||
{
|
{
|
||||||
return cipher_stub.info_value;
|
return cipher_stub.info_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbedtls_cipher_init( mbedtls_cipher_context_t *ctx )
|
void mbedtls_cipher_init(mbedtls_cipher_context_t *ctx)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbedtls_cipher_free( mbedtls_cipher_context_t *ctx )
|
void mbedtls_cipher_free(mbedtls_cipher_context_t *ctx)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx, const mbedtls_cipher_info_t *cipher_info )
|
int mbedtls_cipher_setup(mbedtls_cipher_context_t *ctx, const mbedtls_cipher_info_t *cipher_info)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -83,8 +83,8 @@ int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx, const mbedtls_cipher_in
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx, const unsigned char *key,
|
int mbedtls_cipher_setkey(mbedtls_cipher_context_t *ctx, const unsigned char *key,
|
||||||
int key_bitlen, const mbedtls_operation_t operation )
|
int key_bitlen, const mbedtls_operation_t operation)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -93,8 +93,8 @@ int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx, const unsigned char *k
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_set_iv( mbedtls_cipher_context_t *ctx,
|
int mbedtls_cipher_set_iv(mbedtls_cipher_context_t *ctx,
|
||||||
const unsigned char *iv, size_t iv_len )
|
const unsigned char *iv, size_t iv_len)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -103,7 +103,7 @@ int mbedtls_cipher_set_iv( mbedtls_cipher_context_t *ctx,
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_reset( mbedtls_cipher_context_t *ctx )
|
int mbedtls_cipher_reset(mbedtls_cipher_context_t *ctx)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -112,8 +112,8 @@ int mbedtls_cipher_reset( mbedtls_cipher_context_t *ctx )
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_update_ad( mbedtls_cipher_context_t *ctx,
|
int mbedtls_cipher_update_ad(mbedtls_cipher_context_t *ctx,
|
||||||
const unsigned char *ad, size_t ad_len )
|
const unsigned char *ad, size_t ad_len)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -122,8 +122,8 @@ int mbedtls_cipher_update_ad( mbedtls_cipher_context_t *ctx,
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_update( mbedtls_cipher_context_t *ctx, const unsigned char *input,
|
int mbedtls_cipher_update(mbedtls_cipher_context_t *ctx, const unsigned char *input,
|
||||||
size_t ilen, unsigned char *output, size_t *olen )
|
size_t ilen, unsigned char *output, size_t *olen)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -132,8 +132,8 @@ int mbedtls_cipher_update( mbedtls_cipher_context_t *ctx, const unsigned char *i
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_finish( mbedtls_cipher_context_t *ctx,
|
int mbedtls_cipher_finish(mbedtls_cipher_context_t *ctx,
|
||||||
unsigned char *output, size_t *olen )
|
unsigned char *output, size_t *olen)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -142,7 +142,7 @@ int mbedtls_cipher_finish( mbedtls_cipher_context_t *ctx,
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_set_padding_mode( mbedtls_cipher_context_t *ctx, mbedtls_cipher_padding_t mode )
|
int mbedtls_cipher_set_padding_mode(mbedtls_cipher_context_t *ctx, mbedtls_cipher_padding_t mode)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -151,8 +151,8 @@ int mbedtls_cipher_set_padding_mode( mbedtls_cipher_context_t *ctx, mbedtls_ciph
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_write_tag( mbedtls_cipher_context_t *ctx,
|
int mbedtls_cipher_write_tag(mbedtls_cipher_context_t *ctx,
|
||||||
unsigned char *tag, size_t tag_len )
|
unsigned char *tag, size_t tag_len)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -161,8 +161,8 @@ int mbedtls_cipher_write_tag( mbedtls_cipher_context_t *ctx,
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_check_tag( mbedtls_cipher_context_t *ctx,
|
int mbedtls_cipher_check_tag(mbedtls_cipher_context_t *ctx,
|
||||||
const unsigned char *tag, size_t tag_len )
|
const unsigned char *tag, size_t tag_len)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -171,10 +171,10 @@ int mbedtls_cipher_check_tag( mbedtls_cipher_context_t *ctx,
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_crypt( mbedtls_cipher_context_t *ctx,
|
int mbedtls_cipher_crypt(mbedtls_cipher_context_t *ctx,
|
||||||
const unsigned char *iv, size_t iv_len,
|
const unsigned char *iv, size_t iv_len,
|
||||||
const unsigned char *input, size_t ilen,
|
const unsigned char *input, size_t ilen,
|
||||||
unsigned char *output, size_t *olen )
|
unsigned char *output, size_t *olen)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -183,12 +183,12 @@ int mbedtls_cipher_crypt( mbedtls_cipher_context_t *ctx,
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_auth_encrypt( mbedtls_cipher_context_t *ctx,
|
int mbedtls_cipher_auth_encrypt(mbedtls_cipher_context_t *ctx,
|
||||||
const unsigned char *iv, size_t iv_len,
|
const unsigned char *iv, size_t iv_len,
|
||||||
const unsigned char *ad, size_t ad_len,
|
const unsigned char *ad, size_t ad_len,
|
||||||
const unsigned char *input, size_t ilen,
|
const unsigned char *input, size_t ilen,
|
||||||
unsigned char *output, size_t *olen,
|
unsigned char *output, size_t *olen,
|
||||||
unsigned char *tag, size_t tag_len )
|
unsigned char *tag, size_t tag_len)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
@ -197,12 +197,12 @@ int mbedtls_cipher_auth_encrypt( mbedtls_cipher_context_t *ctx,
|
||||||
return cipher_stub.int_value;
|
return cipher_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_auth_decrypt( mbedtls_cipher_context_t *ctx,
|
int mbedtls_cipher_auth_decrypt(mbedtls_cipher_context_t *ctx,
|
||||||
const unsigned char *iv, size_t iv_len,
|
const unsigned char *iv, size_t iv_len,
|
||||||
const unsigned char *ad, size_t ad_len,
|
const unsigned char *ad, size_t ad_len,
|
||||||
const unsigned char *input, size_t ilen,
|
const unsigned char *input, size_t ilen,
|
||||||
unsigned char *output, size_t *olen,
|
unsigned char *output, size_t *olen,
|
||||||
const unsigned char *tag, size_t tag_len )
|
const unsigned char *tag, size_t tag_len)
|
||||||
{
|
{
|
||||||
if (cipher_stub.int_zero_counter) {
|
if (cipher_stub.int_zero_counter) {
|
||||||
cipher_stub.int_zero_counter--;
|
cipher_stub.int_zero_counter--;
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@
|
||||||
|
|
||||||
cmac_stub_def cmac_stub;
|
cmac_stub_def cmac_stub;
|
||||||
|
|
||||||
int mbedtls_cipher_cmac_starts( mbedtls_cipher_context_t *ctx,
|
int mbedtls_cipher_cmac_starts(mbedtls_cipher_context_t *ctx,
|
||||||
const unsigned char *key, size_t keybits )
|
const unsigned char *key, size_t keybits)
|
||||||
{
|
{
|
||||||
if (cmac_stub.int_zero_counter) {
|
if (cmac_stub.int_zero_counter) {
|
||||||
cmac_stub.int_zero_counter--;
|
cmac_stub.int_zero_counter--;
|
||||||
|
|
@ -40,8 +40,8 @@ int mbedtls_cipher_cmac_starts( mbedtls_cipher_context_t *ctx,
|
||||||
return cmac_stub.int_value;
|
return cmac_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_cmac_update( mbedtls_cipher_context_t *ctx,
|
int mbedtls_cipher_cmac_update(mbedtls_cipher_context_t *ctx,
|
||||||
const unsigned char *input, size_t ilen )
|
const unsigned char *input, size_t ilen)
|
||||||
{
|
{
|
||||||
if (cmac_stub.int_zero_counter) {
|
if (cmac_stub.int_zero_counter) {
|
||||||
cmac_stub.int_zero_counter--;
|
cmac_stub.int_zero_counter--;
|
||||||
|
|
@ -50,8 +50,8 @@ int mbedtls_cipher_cmac_update( mbedtls_cipher_context_t *ctx,
|
||||||
return cmac_stub.int_value;
|
return cmac_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_cmac_finish( mbedtls_cipher_context_t *ctx,
|
int mbedtls_cipher_cmac_finish(mbedtls_cipher_context_t *ctx,
|
||||||
unsigned char *output )
|
unsigned char *output)
|
||||||
{
|
{
|
||||||
if (cmac_stub.int_zero_counter) {
|
if (cmac_stub.int_zero_counter) {
|
||||||
cmac_stub.int_zero_counter--;
|
cmac_stub.int_zero_counter--;
|
||||||
|
|
@ -60,7 +60,7 @@ int mbedtls_cipher_cmac_finish( mbedtls_cipher_context_t *ctx,
|
||||||
return cmac_stub.int_value;
|
return cmac_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_cmac_reset( mbedtls_cipher_context_t *ctx )
|
int mbedtls_cipher_cmac_reset(mbedtls_cipher_context_t *ctx)
|
||||||
{
|
{
|
||||||
if (cmac_stub.int_zero_counter) {
|
if (cmac_stub.int_zero_counter) {
|
||||||
cmac_stub.int_zero_counter--;
|
cmac_stub.int_zero_counter--;
|
||||||
|
|
@ -69,10 +69,10 @@ int mbedtls_cipher_cmac_reset( mbedtls_cipher_context_t *ctx )
|
||||||
return cmac_stub.int_value;
|
return cmac_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_cipher_cmac( const mbedtls_cipher_info_t *cipher_info,
|
int mbedtls_cipher_cmac(const mbedtls_cipher_info_t *cipher_info,
|
||||||
const unsigned char *key, size_t keylen,
|
const unsigned char *key, size_t keylen,
|
||||||
const unsigned char *input, size_t ilen,
|
const unsigned char *input, size_t ilen,
|
||||||
unsigned char *output )
|
unsigned char *output)
|
||||||
{
|
{
|
||||||
if (cmac_stub.int_zero_counter) {
|
if (cmac_stub.int_zero_counter) {
|
||||||
cmac_stub.int_zero_counter--;
|
cmac_stub.int_zero_counter--;
|
||||||
|
|
@ -81,9 +81,9 @@ int mbedtls_cipher_cmac( const mbedtls_cipher_info_t *cipher_info,
|
||||||
return cmac_stub.int_value;
|
return cmac_stub.int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_length,
|
int mbedtls_aes_cmac_prf_128(const unsigned char *key, size_t key_length,
|
||||||
const unsigned char *input, size_t in_len,
|
const unsigned char *input, size_t in_len,
|
||||||
unsigned char *output )
|
unsigned char *output)
|
||||||
{
|
{
|
||||||
if (cmac_stub.int_zero_counter) {
|
if (cmac_stub.int_zero_counter) {
|
||||||
cmac_stub.int_zero_counter--;
|
cmac_stub.int_zero_counter--;
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ void equeue_event_dtor(void *event, void (*dtor)(void *))
|
||||||
|
|
||||||
int equeue_post(equeue_t *queue, void (*cb)(void *), void *event)
|
int equeue_post(equeue_t *queue, void (*cb)(void *), void *event)
|
||||||
{
|
{
|
||||||
struct equeue_event *e = (struct equeue_event*)event - 1;
|
struct equeue_event *e = (struct equeue_event *)event - 1;
|
||||||
if (cb && equeue_stub.call_cb_immediately) {
|
if (cb && equeue_stub.call_cb_immediately) {
|
||||||
cb(e + 1);
|
cb(e + 1);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -108,7 +108,8 @@ void equeue_chain(equeue_t *queue, equeue_t *target)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int equeue_call_in(equeue_t *q, int ms, void (*cb)(void*), void *data) {
|
int equeue_call_in(equeue_t *q, int ms, void (*cb)(void *), void *data)
|
||||||
|
{
|
||||||
// The stub does not implement the delay mechanism.
|
// The stub does not implement the delay mechanism.
|
||||||
return equeue_post(q, cb, data);
|
return equeue_post(q, cb, data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public:
|
||||||
|
|
||||||
Mutex(const char *name);
|
Mutex(const char *name);
|
||||||
|
|
||||||
osStatus lock(uint32_t millisec=osWaitForever);
|
osStatus lock(uint32_t millisec = osWaitForever);
|
||||||
|
|
||||||
bool trylock();
|
bool trylock();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue