Skip to content

cellular: astyle fix #7621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions features/cellular/TESTS/api/cellular_device/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,25 @@ static void open_close_interfaces()
nw = device->open_network(NULL);
TEST_ASSERT(nw == NULL);

CellularSIM* sim = device->open_sim(&cellular_serial);
CellularSIM *sim = device->open_sim(&cellular_serial);
TEST_ASSERT(sim != NULL);
device->close_sim();
sim = device->open_sim(NULL);
TEST_ASSERT(sim == NULL);

CellularInformation* info = device->open_information(&cellular_serial);
CellularInformation *info = device->open_information(&cellular_serial);
TEST_ASSERT(info != NULL);
device->close_information();
info = device->open_information(NULL);
TEST_ASSERT(info == NULL);

CellularPower* power = device->open_power(&cellular_serial);
CellularPower *power = device->open_power(&cellular_serial);
TEST_ASSERT(power != NULL);
device->close_power();
power = device->open_power(NULL);
TEST_ASSERT(power == NULL);

CellularSMS* sms = device->open_sms(&cellular_serial);
CellularSMS *sms = device->open_sms(&cellular_serial);
TEST_ASSERT(sms != NULL);
device->close_sms();
sms = device->open_sms(NULL);
Expand All @@ -86,7 +86,7 @@ static void other_methods()
device->set_timeout(5000);
device->modem_debug_on(true);
device->modem_debug_on(false);
NetworkStack* stack = device->get_stack();
NetworkStack *stack = device->get_stack();
TEST_ASSERT(stack == NULL);

CellularNetwork *nw = device->open_network(&cellular_serial);
Expand Down Expand Up @@ -124,7 +124,7 @@ static Case cases[] = {

static utest::v1::status_t test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(10*60, "default_auto");
GREENTEA_SETUP(10 * 60, "default_auto");
return verbose_test_setup_handler(number_of_cases);
}

Expand Down
4 changes: 2 additions & 2 deletions features/cellular/TESTS/api/cellular_information/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static void test_information_interface()
{
CellularInformation *info = cellular.get_device()->open_information(&cellular_serial);
const int kbuf_size = 100;
char *buf = (char*)malloc(sizeof(char) * kbuf_size);
char *buf = (char *)malloc(sizeof(char) * kbuf_size);

TEST_ASSERT(info->get_manufacturer(buf, kbuf_size) == NSAPI_ERROR_OK);
TEST_ASSERT(info->get_model(buf, kbuf_size) == NSAPI_ERROR_OK);
Expand Down Expand Up @@ -112,7 +112,7 @@ static Case cases[] = {

static utest::v1::status_t test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(10*60, "default_auto");
GREENTEA_SETUP(10 * 60, "default_auto");
return verbose_test_setup_handler(number_of_cases);
}

Expand Down
54 changes: 27 additions & 27 deletions features/cellular/TESTS/api/cellular_network/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static rtos::Semaphore network_semaphore(0);
static CellularConnectionFSM cellular;
static CellularConnectionFSM::CellularState cellular_target_state;
static CELLULAR_DEVICE *device;
static CellularNetwork* nw;
static CellularNetwork *nw;


static bool fsm_callback(int state, int next_state)
Expand All @@ -73,7 +73,7 @@ static void test_network_interface_fsm()
device = new CELLULAR_DEVICE(queue);
TEST_ASSERT(device != NULL);

CellularNetwork* nw = device->open_network(&cellular_serial);
CellularNetwork *nw = device->open_network(&cellular_serial);
TEST_ASSERT(nw != NULL);
TEST_ASSERT(nw->init() == NSAPI_ERROR_OK);

Expand All @@ -99,7 +99,7 @@ static void init_network_interface()


static bool get_network_registration(CellularNetwork::RegistrationType type,
CellularNetwork::RegistrationStatus &status, bool &is_registered)
CellularNetwork::RegistrationStatus &status, bool &is_registered)
{
is_registered = false;
nsapi_error_t err = nw->get_registration_status(type, status);
Expand Down Expand Up @@ -147,7 +147,7 @@ static void nw_callback(nsapi_event_t ev, intptr_t intptr)

static void test_network_registration()
{
cellular.get_device()->set_timeout(10*1000);
cellular.get_device()->set_timeout(10 * 1000);
nw = cellular.get_network();
TEST_ASSERT(nw != NULL);

Expand Down Expand Up @@ -224,8 +224,8 @@ static void test_other()
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
#if CELLULAR_DEVICE != QUECTEL_BG96 // QUECTEL_BG96 does not give any specific reason for device error
if (err == NSAPI_ERROR_DEVICE_ERROR) {
TEST_ASSERT(((AT_CellularNetwork*)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork*)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
}
#endif

Expand All @@ -234,8 +234,8 @@ static void test_other()
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
if (err == NSAPI_ERROR_DEVICE_ERROR) {
#if CELLULAR_DEVICE != QUECTEL_BG96 // QUECTEL_BG96 does not give any specific reason for device error
TEST_ASSERT(((AT_CellularNetwork*)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork*)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
#endif
} else {
TEST_ASSERT(uplinkRate >= 0);
Expand All @@ -245,10 +245,10 @@ static void test_other()
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_UNSUPPORTED);

// scanning of operators might take a long time
cellular.get_device()->set_timeout(240*1000);
cellular.get_device()->set_timeout(240 * 1000);
CellularNetwork::operList_t operators;
TEST_ASSERT(nw->scan_plmn(operators, uplinkRate) == NSAPI_ERROR_OK);
cellular.get_device()->set_timeout(10*1000);
cellular.get_device()->set_timeout(10 * 1000);


// all current targets support IPV4
Expand All @@ -262,12 +262,12 @@ static void test_other()
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
if (err == NSAPI_ERROR_DEVICE_ERROR) {
#if CELLULAR_DEVICE != TELIT_HE910 // TELIT_HE910 just gives an error and no specific error number so we can't know is this real error or that modem/network does not support the command
TEST_ASSERT(((AT_CellularNetwork*)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork*)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
#endif
} else {
// should have some values, only not optional are apn and bearer id
CellularNetwork::pdpcontext_params_t* params = params_list.get_head();
CellularNetwork::pdpcontext_params_t *params = params_list.get_head();
TEST_ASSERT(strlen(params->apn) > 0);
TEST_ASSERT(params->bearer_id >= 0)
}
Expand All @@ -277,8 +277,8 @@ static void test_other()
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
if (err == NSAPI_ERROR_DEVICE_ERROR) {
#if CELLULAR_DEVICE != QUECTEL_BG96 // QUECTEL_BG96 does not give any specific reason for device error
TEST_ASSERT(((AT_CellularNetwork*)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork*)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
#endif
} else {
// we should have some values which are not optional
Expand All @@ -290,8 +290,8 @@ static void test_other()
err = nw->get_signal_quality(rssi, ber);
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
if (err == NSAPI_ERROR_DEVICE_ERROR) {
TEST_ASSERT(((AT_CellularNetwork*)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork*)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
} else {
// test for values
TEST_ASSERT(rssi >= 0);
Expand Down Expand Up @@ -319,10 +319,10 @@ static void test_other()
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
if (err == NSAPI_ERROR_DEVICE_ERROR) {
// if device error then we must check was that really device error or that modem/network does not support the commands
TEST_ASSERT(((AT_CellularNetwork*)nw)->get_device_error().errCode == 4// 4 == NOT SUPPORTED BY THE MODEM
&& ((AT_CellularNetwork*)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 4 // 4 == NOT SUPPORTED BY THE MODEM
&& ((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
} else {
CellularNetwork::operator_names_t* opn = op_names.get_head();
CellularNetwork::operator_names_t *opn = op_names.get_head();
TEST_ASSERT(strlen(opn->numeric) > 0);
TEST_ASSERT(strlen(opn->alpha > 0));
}
Expand All @@ -336,8 +336,8 @@ static void test_other()
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
if (err == NSAPI_ERROR_DEVICE_ERROR) {
// if device error then we must check was that really device error or that modem/network does not support the commands
TEST_ASSERT(((AT_CellularNetwork*)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork*)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
} else {
TEST_ASSERT(supported_opt != SUPPORTED_UE_OPT_MAX);
TEST_ASSERT(preferred_opt != PREFERRED_UE_OPT_MAX);
Expand All @@ -347,8 +347,8 @@ static void test_other()
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
if (err == NSAPI_ERROR_DEVICE_ERROR) {
// if device error then we must check was that really device error or that modem/network does not support the commands
TEST_ASSERT(((AT_CellularNetwork*)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork*)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
}
#endif

Expand All @@ -364,8 +364,8 @@ static void test_disconnect()
static void test_detach()
{
// in PPP mode there is NO CARRIER waiting so flush it out
rtos::Thread::wait(6*1000);
((AT_CellularNetwork*)nw)->get_at_handler().flush();
rtos::Thread::wait(6 * 1000);
((AT_CellularNetwork *)nw)->get_at_handler().flush();

nsapi_connection_status_t st = nw->get_connection_status();
TEST_ASSERT(st == NSAPI_STATUS_DISCONNECTED);
Expand Down Expand Up @@ -399,7 +399,7 @@ static Case cases[] = {

static utest::v1::status_t test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(10*60, "default_auto");
GREENTEA_SETUP(10 * 60, "default_auto");
return verbose_test_setup_handler(number_of_cases);
}

Expand Down
10 changes: 5 additions & 5 deletions features/cellular/TESTS/api/cellular_power/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
#define NETWORK_TIMEOUT (180*1000)

static UARTSerial cellular_serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
static CELLULAR_DEVICE* cellular_device;
static CELLULAR_DEVICE *cellular_device;
static EventQueue queue(2 * EVENTS_EVENT_SIZE);

static void urc_callback()
{
}

static void wait_for_power(CellularPower* pwr)
static void wait_for_power(CellularPower *pwr)
{
nsapi_error_t err = pwr->set_device_ready_urc_cb(&urc_callback);
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_UNSUPPORTED);
Expand All @@ -72,13 +72,13 @@ static void wait_for_power(CellularPower* pwr)
static void test_power_interface()
{
cellular_device = new CELLULAR_DEVICE(queue);
CellularPower* pwr = cellular_device->open_power(&cellular_serial);
CellularPower *pwr = cellular_device->open_power(&cellular_serial);

nsapi_error_t err = pwr->on();
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_UNSUPPORTED);
wait_for_power(pwr);

TEST_ASSERT(pwr->set_power_level(1,0) == NSAPI_ERROR_OK);
TEST_ASSERT(pwr->set_power_level(1, 0) == NSAPI_ERROR_OK);

err = pwr->reset();
TEST_ASSERT(err == NSAPI_ERROR_OK);
Expand All @@ -102,7 +102,7 @@ static Case cases[] = {

static utest::v1::status_t test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(10*60, "default_auto");
GREENTEA_SETUP(10 * 60, "default_auto");
return verbose_test_setup_handler(number_of_cases);
}

Expand Down
4 changes: 2 additions & 2 deletions features/cellular/TESTS/api/cellular_sim/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static char *get_rand_string(char *str, size_t size)
if (size) {
--size;
for (size_t n = 0; n < size; n++) {
int key = rand() % (int) (sizeof charset - 1);
int key = rand() % (int)(sizeof charset - 1);
str[n] = charset[key];
}
str[size] = '\0';
Expand Down Expand Up @@ -144,7 +144,7 @@ static Case cases[] = {

static utest::v1::status_t test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(10*60, "default_auto");
GREENTEA_SETUP(10 * 60, "default_auto");
return verbose_test_setup_handler(number_of_cases);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,23 @@
#include "test_at_cellularbase.h"
#include "AT_CellularBase.h"

// AStyle ignored as the definition is not clear due to preprocessor usage
// *INDENT-OFF*
TEST_GROUP(AT_CellularBase)
{
Test_AT_CellularBase* unit;
Test_AT_CellularBase *unit;

void setup()
void setup()
{
unit = new Test_AT_CellularBase();
}

void teardown()
void teardown()
{
delete unit;
}
};
// *INDENT-ON*

TEST(AT_CellularBase, Create)
{
Expand Down
2 changes: 1 addition & 1 deletion features/cellular/UNITTESTS/at/at_cellularbase/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTestExt/MockSupportPlugin.h"
int main(int ac, char** av)
int main(int ac, char **av)
{
return CommandLineTestRunner::RunAllTests(ac, av);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ using namespace events;

class my_base : public AT_CellularBase {
public:
my_base(ATHandler &at) : AT_CellularBase(at) {
my_base(ATHandler &at) : AT_CellularBase(at)
{
}
bool check_not_supported() {
bool check_not_supported()
{
static const AT_CellularBase::SupportedFeature unsupported_features[] = {
AT_CellularBase::AT_CGSN_WITH_TYPE,
AT_CellularBase::SUPPORTED_FEATURE_END_MARK
Expand All @@ -38,12 +40,14 @@ class my_base : public AT_CellularBase {
return is_supported(AT_CGSN_WITH_TYPE);
}

bool check_supported() {
bool check_supported()
{
set_unsupported_features(NULL);
return is_supported(AT_CGSN_WITH_TYPE);
}

bool check_supported_not_found() {
bool check_supported_not_found()
{
static const AT_CellularBase::SupportedFeature unsupported_features[] = {
AT_CellularBase::AT_CGSN_WITH_TYPE,
AT_CellularBase::SUPPORTED_FEATURE_END_MARK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
#ifndef TEST_AT_CELLULARBASE_H
#define TEST_AT_CELLULARBASE_H

class Test_AT_CellularBase
{
class Test_AT_CellularBase {
public:
Test_AT_CellularBase();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@

TEST_GROUP(AT_CellularDevice)
{
Test_AT_CellularDevice* unit;
Test_AT_CellularDevice *unit;

void setup()
{
void setup() {
unit = new Test_AT_CellularDevice();
}

void teardown()
{
void teardown() {
delete unit;
}
};
Expand Down
2 changes: 1 addition & 1 deletion features/cellular/UNITTESTS/at/at_cellulardevice/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTestExt/MockSupportPlugin.h"
int main(int ac, char** av)
int main(int ac, char **av)
{
return CommandLineTestRunner::RunAllTests(ac, av);
}
Expand Down
Loading