diff --git a/features/cellular/UNITTESTS/common/util/Makefile b/features/cellular/UNITTESTS/common/util/Makefile index 9e7614bf0b..bcfa9092b2 100644 --- a/features/cellular/UNITTESTS/common/util/Makefile +++ b/features/cellular/UNITTESTS/common/util/Makefile @@ -10,6 +10,7 @@ TEST_SRC_FILES = \ main.cpp \ utiltest.cpp \ test_util.cpp \ + ../../stubs/randLIB_stub.cpp \ include ../../MakefileWorker.mk diff --git a/features/cellular/UNITTESTS/stubs/AT_CellularNetwork_stub.cpp b/features/cellular/UNITTESTS/stubs/AT_CellularNetwork_stub.cpp index 602717d029..c39de1c504 100644 --- a/features/cellular/UNITTESTS/stubs/AT_CellularNetwork_stub.cpp +++ b/features/cellular/UNITTESTS/stubs/AT_CellularNetwork_stub.cpp @@ -90,21 +90,6 @@ nsapi_error_t AT_CellularNetwork::set_blocking(bool blocking) return NSAPI_ERROR_OK;; } -nsapi_error_t AT_CellularNetwork::set_context_to_be_activated() -{ - return NSAPI_ERROR_OK; -} - -//bool AT_CellularNetwork::set_new_context(nsapi_ip_stack_t stack, int cid) -//{ -// return false; -//} - -//bool AT_CellularNetwork::get_context(nsapi_ip_stack_t requested_stack) -//{ -// return false; -//} - nsapi_ip_stack_t AT_CellularNetwork::string_to_stack_type(const char* pdp_type) { return IPV4_STACK; @@ -261,3 +246,11 @@ nsapi_error_t AT_CellularNetwork::get_operator_names(operator_names_list &op_nam { return NSAPI_ERROR_OK; } + +nsapi_error_t AT_CellularNetwork::do_user_authentication() +{ + return NSAPI_ERROR_OK; +} + + + diff --git a/features/cellular/UNITTESTS/stubs/AT_CellularPower_stub.cpp b/features/cellular/UNITTESTS/stubs/AT_CellularPower_stub.cpp index ef834c5dc0..8dc3f0aa4c 100644 --- a/features/cellular/UNITTESTS/stubs/AT_CellularPower_stub.cpp +++ b/features/cellular/UNITTESTS/stubs/AT_CellularPower_stub.cpp @@ -45,7 +45,7 @@ nsapi_error_t AT_CellularPower::set_at_mode() return NSAPI_ERROR_OK; } -nsapi_error_t AT_CellularPower::set_power_level(int func_level) +nsapi_error_t AT_CellularPower::set_power_level(int func_level, int do_reset) { return NSAPI_ERROR_OK; } diff --git a/features/cellular/UNITTESTS/stubs/randLIB_stub.cpp b/features/cellular/UNITTESTS/stubs/randLIB_stub.cpp new file mode 100644 index 0000000000..61cd893d0e --- /dev/null +++ b/features/cellular/UNITTESTS/stubs/randLIB_stub.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2017, 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. + */ +#include "randLIB.h" + +void randLIB_seed_random(void) +{ +} + +uint16_t randLIB_get_random_in_range(uint16_t min, uint16_t max) +{ + return min; +} + diff --git a/features/cellular/UNITTESTS/target_h/randLIB.h b/features/cellular/UNITTESTS/target_h/randLIB.h new file mode 100644 index 0000000000..a621be3688 --- /dev/null +++ b/features/cellular/UNITTESTS/target_h/randLIB.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2017, 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. + */ +#ifndef FEATURES_CELLULAR_UNITTESTS_TARGET_H_RANDLIB_H_ +#define FEATURES_CELLULAR_UNITTESTS_TARGET_H_RANDLIB_H_ + +#include + +extern void randLIB_seed_random(void); + +uint16_t randLIB_get_random_in_range(uint16_t min, uint16_t max); + + +#endif /* FEATURES_CELLULAR_UNITTESTS_TARGET_H_RANDLIB_H_ */ diff --git a/features/cellular/framework/AT/AT_CellularNetwork.h b/features/cellular/framework/AT/AT_CellularNetwork.h index 49be4f2524..c97381acc5 100644 --- a/features/cellular/framework/AT/AT_CellularNetwork.h +++ b/features/cellular/framework/AT/AT_CellularNetwork.h @@ -142,6 +142,7 @@ protected: */ virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology op_rat); + virtual nsapi_error_t do_user_authentication(); private: // "NO CARRIER" urc void urc_no_carrier(); @@ -179,7 +180,6 @@ protected: AuthenticationType _authentication_type; int _cell_id; nsapi_connection_status_t _connect_status; - virtual nsapi_error_t do_user_authentication(); bool _new_context_set; bool _is_context_active; RegistrationStatus _reg_status; diff --git a/features/cellular/framework/common/CellularUtil.cpp b/features/cellular/framework/common/CellularUtil.cpp index a49cd1c787..b342cf8b9f 100644 --- a/features/cellular/framework/common/CellularUtil.cpp +++ b/features/cellular/framework/common/CellularUtil.cpp @@ -334,7 +334,7 @@ uint16_t get_dynamic_ip_port() if (port_counter >= RANDOM_PORT_NUMBER_COUNT) { port_counter -= RANDOM_PORT_NUMBER_COUNT; } - + return (RANDOM_PORT_NUMBER_START + port_counter); }