Merge pull request #7621 from 0xc0170/fix_cellular_style

cellular: astyle fix
pull/7675/head
Cruz Monrreal 2018-08-01 08:57:07 -05:00 committed by GitHub
commit 94d1b98d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
110 changed files with 983 additions and 873 deletions

View File

@ -18,6 +18,8 @@
#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;
@ -32,6 +34,7 @@ TEST_GROUP(AT_CellularBase)
delete unit;
}
};
// *INDENT-ON*
TEST(AT_CellularBase, Create)
{

View File

@ -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
@ -38,12 +40,14 @@ public:
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

View File

@ -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();

View File

@ -21,13 +21,11 @@ TEST_GROUP(AT_CellularDevice)
{
Test_AT_CellularDevice *unit;
void setup()
{
void setup() {
unit = new Test_AT_CellularDevice();
}
void teardown()
{
void teardown() {
delete unit;
}
};

View File

@ -17,8 +17,7 @@
#ifndef TEST_AT_CELLULARDEVICE_H
#define TEST_AT_CELLULARDEVICE_H
class Test_AT_CellularDevice
{
class Test_AT_CellularDevice {
public:
Test_AT_CellularDevice();

View File

@ -17,6 +17,8 @@
#include "CppUTest/TestHarness.h"
#include "test_at_cellularinformation.h"
// AStyle ignored as the definition is not clear due to preprocessor usage
// *INDENT-OFF*
TEST_GROUP(AT_CellularInformation)
{
Test_AT_CellularInformation *unit;
@ -31,6 +33,7 @@ TEST_GROUP(AT_CellularInformation)
delete unit;
}
};
// *INDENT-ON*
TEST(AT_CellularInformation, Create)
{

View File

@ -17,8 +17,7 @@
#ifndef TEST_AT_CELLULARINFORMATION_H
#define TEST_AT_CELLULARINFORMATION_H
class Test_AT_CellularInformation
{
class Test_AT_CellularInformation {
public:
Test_AT_CellularInformation();

View File

@ -18,6 +18,8 @@
#include "test_at_cellularnetwork.h"
#include "ATHandler_stub.h"
// AStyle ignored as the definition is not clear due to preprocessor usage
// *INDENT-OFF*
TEST_GROUP(AT_CellularNetwork)
{
Test_AT_CellularNetwork *unit;
@ -35,6 +37,7 @@ TEST_GROUP(AT_CellularNetwork)
delete unit;
}
};
// *INDENT-ON*
TEST(AT_CellularNetwork, Create)
{

View File

@ -32,35 +32,63 @@ using namespace events;
class my_stack : public AT_CellularStack {
public:
my_stack(ATHandler &atHandler) : AT_CellularStack(atHandler, 1, IPV4_STACK) {}
virtual int get_max_socket_count() { return 1;}
virtual int get_max_packet_size() {return 200;}
virtual bool is_protocol_supported(nsapi_protocol_t protocol) {return true;}
virtual nsapi_error_t socket_close_impl(int sock_id) {return NSAPI_ERROR_OK;}
virtual nsapi_error_t create_socket_impl(CellularSocket *socket) {return NSAPI_ERROR_OK;}
virtual int get_max_socket_count()
{
return 1;
}
virtual int get_max_packet_size()
{
return 200;
}
virtual bool is_protocol_supported(nsapi_protocol_t protocol)
{
return true;
}
virtual nsapi_error_t socket_close_impl(int sock_id)
{
return NSAPI_ERROR_OK;
}
virtual nsapi_error_t create_socket_impl(CellularSocket *socket)
{
return NSAPI_ERROR_OK;
}
virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address,
const void *data, nsapi_size_t size) {return 100;}
const void *data, nsapi_size_t size)
{
return 100;
}
virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address,
void *buffer, nsapi_size_t size) {return 100;}
void *buffer, nsapi_size_t size)
{
return 100;
}
};
class my_AT_CN : public AT_CellularNetwork {
public:
my_AT_CN(ATHandler &atHandler) : AT_CellularNetwork(atHandler) {}
virtual ~my_AT_CN() {}
NetworkStack *get_stack() {
NetworkStack *get_stack()
{
if (!_stack) {
return new my_stack(get_at_handler());
} else {
return _stack;
}}
virtual bool has_registration(RegistrationType reg_type) {
}
}
virtual bool has_registration(RegistrationType reg_type)
{
if (reg_type == C_GREG) {
return false;
}
return true;
}
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology op_rat) { return NSAPI_ERROR_OK;}
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack) {
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology op_rat)
{
return NSAPI_ERROR_OK;
}
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack)
{
if (requested_stack == IPV4_STACK || requested_stack == DEFAULT_STACK) {
return true;
}
@ -72,20 +100,27 @@ class my_AT_CNipv6 : public AT_CellularNetwork {
public:
my_AT_CNipv6(ATHandler &atHandler) : AT_CellularNetwork(atHandler) {}
virtual ~my_AT_CNipv6() {}
NetworkStack *get_stack() {
NetworkStack *get_stack()
{
if (!_stack) {
return new my_stack(get_at_handler());
} else {
return _stack;
}}
virtual bool has_registration(RegistrationType reg_type) {
}
}
virtual bool has_registration(RegistrationType reg_type)
{
if (reg_type == C_GREG) {
return false;
}
return true;
}
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology op_rat) { return NSAPI_ERROR_OK;}
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack) {
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology op_rat)
{
return NSAPI_ERROR_OK;
}
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack)
{
if (requested_stack == IPV6_STACK || requested_stack == DEFAULT_STACK) {
return true;
}

View File

@ -17,8 +17,7 @@
#ifndef TEST_AT_CELLULARNETWORK_H
#define TEST_AT_CELLULARNETWORK_H
class Test_AT_CellularNetwork
{
class Test_AT_CellularNetwork {
public:
Test_AT_CellularNetwork();

View File

@ -17,20 +17,21 @@
#include "CppUTest/TestHarness.h"
#include "test_at_cellularpower.h"
// AStyle ignored as the definition is not clear due to preprocessor usage
// *INDENT-OFF*
TEST_GROUP(AT_CellularPower)
{
Test_AT_CellularPower *unit;
void setup()
{
void setup() {
unit = new Test_AT_CellularPower();
}
void teardown()
{
void teardown() {
delete unit;
}
};
// *INDENT-ON*
TEST(AT_CellularPower, Create)
{

View File

@ -17,8 +17,7 @@
#ifndef TEST_AT_CELLULARPOWER_H
#define TEST_AT_CELLULARPOWER_H
class Test_AT_CellularPower
{
class Test_AT_CellularPower {
public:
Test_AT_CellularPower();

View File

@ -18,6 +18,8 @@
#include "test_at_cellularsim.h"
#include "ATHandler_stub.h"
// AStyle ignored as the definition is not clear due to preprocessor usage
// *INDENT-OFF*
TEST_GROUP(AT_CellularSIM)
{
Test_AT_CellularSIM *unit;
@ -33,6 +35,7 @@ TEST_GROUP(AT_CellularSIM)
delete unit;
}
};
// *INDENT-ON*
TEST(AT_CellularSIM, Create)
{

View File

@ -17,8 +17,7 @@
#ifndef TEST_AT_CELLULARSIM_H
#define TEST_AT_CELLULARSIM_H
class Test_AT_CellularSIM
{
class Test_AT_CellularSIM {
public:
Test_AT_CellularSIM();

View File

@ -17,6 +17,8 @@
#include "CppUTest/TestHarness.h"
#include "test_at_cellularsms.h"
// AStyle ignored as the definition is not clear due to preprocessor usage
// *INDENT-OFF*
TEST_GROUP(AT_CellularSMS)
{
Test_AT_CellularSMS *unit;
@ -31,6 +33,7 @@ TEST_GROUP(AT_CellularSMS)
delete unit;
}
};
// *INDENT-ON*
TEST(AT_CellularSMS, Create)
{

View File

@ -17,8 +17,7 @@
#ifndef TEST_AT_CELLULARSMS_H
#define TEST_AT_CELLULARSMS_H
class Test_AT_CellularSMS
{
class Test_AT_CellularSMS {
public:
Test_AT_CellularSMS();

View File

@ -17,6 +17,8 @@
#include "CppUTest/TestHarness.h"
#include "test_at_cellularstack.h"
// AStyle ignored as the definition is not clear due to preprocessor usage
// *INDENT-OFF*
TEST_GROUP(AT_CellularStack)
{
Test_AT_CellularStack *unit;
@ -31,6 +33,7 @@ TEST_GROUP(AT_CellularStack)
delete unit;
}
};
// *INDENT-ON*
TEST(AT_CellularStack, Create)
{

View File

@ -43,46 +43,97 @@ public:
create_error = NSAPI_ERROR_OK;
}
virtual int get_max_socket_count(){return max_sock_value;}
virtual int get_max_socket_count()
{
return max_sock_value;
}
virtual bool is_protocol_supported(nsapi_protocol_t protocol){return bool_value;}
virtual bool is_protocol_supported(nsapi_protocol_t protocol)
{
return bool_value;
}
virtual nsapi_error_t socket_close_impl(int sock_id){return NSAPI_ERROR_OK;}
virtual nsapi_error_t socket_close_impl(int sock_id)
{
return NSAPI_ERROR_OK;
}
virtual nsapi_error_t create_socket_impl(CellularSocket *socket){return create_error;}
virtual nsapi_error_t create_socket_impl(CellularSocket *socket)
{
return create_error;
}
virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address,
const void *data, nsapi_size_t size){return NSAPI_ERROR_OK;}
const void *data, nsapi_size_t size)
{
return NSAPI_ERROR_OK;
}
virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address,
void *buffer, nsapi_size_t size) {return NSAPI_ERROR_OK;}
void *buffer, nsapi_size_t size)
{
return NSAPI_ERROR_OK;
}
virtual nsapi_error_t socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto) {return AT_CellularStack::socket_open(handle, proto);}
virtual nsapi_error_t socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto)
{
return AT_CellularStack::socket_open(handle, proto);
}
virtual nsapi_error_t socket_close(nsapi_socket_t handle) {return AT_CellularStack::socket_close(handle);}
virtual nsapi_error_t socket_close(nsapi_socket_t handle)
{
return AT_CellularStack::socket_close(handle);
}
virtual nsapi_error_t socket_bind(nsapi_socket_t handle, const SocketAddress &address) {return AT_CellularStack::socket_bind(handle, address);}
virtual nsapi_error_t socket_bind(nsapi_socket_t handle, const SocketAddress &address)
{
return AT_CellularStack::socket_bind(handle, address);
}
virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog) {return AT_CellularStack::socket_listen(handle, backlog);}
virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog)
{
return AT_CellularStack::socket_listen(handle, backlog);
}
virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address) {return AT_CellularStack::socket_connect(handle, address);}
virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address)
{
return AT_CellularStack::socket_connect(handle, address);
}
virtual nsapi_error_t socket_accept(nsapi_socket_t server,
nsapi_socket_t *handle, SocketAddress *address=0) {return AT_CellularStack::socket_accept(server, handle, address);}
nsapi_socket_t *handle, SocketAddress *address = 0)
{
return AT_CellularStack::socket_accept(server, handle, address);
}
virtual nsapi_size_or_error_t socket_send(nsapi_socket_t handle,
const void *data, nsapi_size_t size) {return AT_CellularStack::socket_send(handle, data, size);}
const void *data, nsapi_size_t size)
{
return AT_CellularStack::socket_send(handle, data, size);
}
virtual nsapi_size_or_error_t socket_recv(nsapi_socket_t handle,
void *data, nsapi_size_t size) {return AT_CellularStack::socket_recv(handle, data, size);}
void *data, nsapi_size_t size)
{
return AT_CellularStack::socket_recv(handle, data, size);
}
virtual nsapi_size_or_error_t socket_sendto(nsapi_socket_t handle, const SocketAddress &address,
const void *data, nsapi_size_t size) {return AT_CellularStack::socket_sendto(handle, address, data, size);}
const void *data, nsapi_size_t size)
{
return AT_CellularStack::socket_sendto(handle, address, data, size);
}
virtual nsapi_size_or_error_t socket_recvfrom(nsapi_socket_t handle, SocketAddress *address,
void *buffer, nsapi_size_t size) {return AT_CellularStack::socket_recvfrom(handle, address, buffer, size);}
void *buffer, nsapi_size_t size)
{
return AT_CellularStack::socket_recvfrom(handle, address, buffer, size);
}
virtual void socket_attach(nsapi_socket_t handle, void (*callback)(void *), void *data) {return AT_CellularStack::socket_attach(handle, callback, data);}
virtual void socket_attach(nsapi_socket_t handle, void (*callback)(void *), void *data)
{
return AT_CellularStack::socket_attach(handle, callback, data);
}
};
Test_AT_CellularStack::Test_AT_CellularStack()

View File

@ -17,8 +17,7 @@
#ifndef TEST_AT_CELLULARSTACK_H
#define TEST_AT_CELLULARSTACK_H
class Test_AT_CellularStack
{
class Test_AT_CellularStack {
public:
Test_AT_CellularStack();

View File

@ -17,6 +17,8 @@
#include "CppUTest/TestHarness.h"
#include "test_athandler.h"
// AStyle ignored as the definition is not clear due to preprocessor usage
// *INDENT-OFF*
TEST_GROUP(ATHandler)
{
Test_ATHandler *unit;
@ -31,6 +33,7 @@ TEST_GROUP(ATHandler)
delete unit;
}
};
// *INDENT-ON*
TEST(ATHandler, Create)
{

View File

@ -17,8 +17,7 @@
#ifndef TEST_ATHANDLER_H
#define TEST_ATHANDLER_H
class Test_ATHandler
{
class Test_ATHandler {
public:
Test_ATHandler();

View File

@ -17,8 +17,7 @@
#ifndef TEST_UTIL_H
#define TEST_UTIL_H
class Test_util
{
class Test_util {
public:
Test_util();

View File

@ -17,6 +17,8 @@
#include "CppUTest/TestHarness.h"
#include "test_util.h"
// AStyle ignored as the definition is not clear due to preprocessor usage
// *INDENT-OFF*
TEST_GROUP(util)
{
Test_util *unit;
@ -31,6 +33,7 @@ TEST_GROUP(util)
delete unit;
}
};
// *INDENT-ON*
TEST(util, Create)
{

View File

@ -146,7 +146,8 @@ void ATHandler::clear_error()
ATHandler_stub::nsapi_error_ok_counter++;
}
void ATHandler::skip_param(uint32_t count) {
void ATHandler::skip_param(uint32_t count)
{
}

View File

@ -70,7 +70,8 @@ nsapi_error_t AT_CellularPower::set_device_ready_urc_cb(mbed::Callback<void()> c
return NSAPI_ERROR_OK;
}
void AT_CellularPower::remove_device_ready_urc_cb(mbed::Callback<void()> callback){
void AT_CellularPower::remove_device_ready_urc_cb(mbed::Callback<void()> callback)
{
}

View File

@ -22,29 +22,37 @@ using namespace mbed;
namespace events {
EventQueue::EventQueue(unsigned event_size, unsigned char *event_pointer) {
EventQueue::EventQueue(unsigned event_size, unsigned char *event_pointer)
{
}
EventQueue::~EventQueue() {
EventQueue::~EventQueue()
{
}
void EventQueue::dispatch(int ms) {
void EventQueue::dispatch(int ms)
{
}
void EventQueue::break_dispatch() {
void EventQueue::break_dispatch()
{
}
unsigned EventQueue::tick() {
unsigned EventQueue::tick()
{
return 0;
}
void EventQueue::cancel(int id) {
void EventQueue::cancel(int id)
{
}
void EventQueue::background(Callback<void(int)> update) {
void EventQueue::background(Callback<void(int)> update)
{
}
void EventQueue::chain(EventQueue *target) {
void EventQueue::chain(EventQueue *target)
{
}
}

View File

@ -26,14 +26,17 @@ static uint8_t filehandle_stub_short_value_counter = 0;
static char *filehandle_stub_table = NULL;
static uint8_t filehandle_stub_table_pos = 0;
class FileHandle_stub : public FileHandle
{
class FileHandle_stub : public FileHandle {
public:
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) {
ssize_t ret = strlen(filehandle_stub_table) - filehandle_stub_table_pos;
if (ret >= 0 && size < ret) {
@ -49,7 +52,8 @@ public:
return 0;
}
virtual ssize_t write(const void *buffer, size_t size){
virtual ssize_t write(const void *buffer, size_t size)
{
if (size_value > 0) {
size_value--;
return size;
@ -59,11 +63,15 @@ public:
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 short poll(short events) const{
virtual short poll(short events) const
{
if (filehandle_stub_short_value_counter) {
filehandle_stub_short_value_counter--;
return short_value;
@ -71,7 +79,10 @@ public:
return 0;
}
virtual void sigio(Callback<void()> func){func();}
virtual void sigio(Callback<void()> func)
{
func();
}
short short_value;
};

View File

@ -19,7 +19,8 @@
namespace rtos {
osStatus Thread::wait_until(uint64_t millisec) {
osStatus Thread::wait_until(uint64_t millisec)
{
return 0;
}

View File

@ -20,35 +20,45 @@
namespace mbed {
Timer::Timer() {
Timer::Timer()
{
}
Timer::Timer(const ticker_data_t *data) {
Timer::Timer(const ticker_data_t *data)
{
}
Timer::~Timer() {
Timer::~Timer()
{
}
void Timer::start() {
void Timer::start()
{
}
void Timer::stop() {;
void Timer::stop()
{
;
}
int Timer::read_us() {
int Timer::read_us()
{
return 0;
}
float Timer::read() {
float Timer::read()
{
return 0;
}
int Timer::read_ms() {
int Timer::read_ms()
{
timer_stub_value += timer_stub_step;
return timer_stub_value;
}
us_timestamp_t Timer::read_high_resolution_us() {
us_timestamp_t Timer::read_high_resolution_us()
{
return 0;
}
@ -56,7 +66,8 @@ void Timer::reset()
{
}
Timer::operator float() {
Timer::operator float()
{
return 0;
}

View File

@ -17,11 +17,14 @@
#include "mbed_wait_api.h"
void wait(float s) {
void wait(float s)
{
}
void wait_ms(int ms) {
void wait_ms(int ms)
{
}
void wait_us(int us) {
void wait_us(int us)
{
}

View File

@ -21,8 +21,7 @@
#include <cstdarg>
#include "FileHandle.h"
class ATCmdParser
{
class ATCmdParser {
public:
ATCmdParser(mbed::FileHandle *fh, const char *output_delimiter = "\r",
int buffer_size = 256, int timeout = 8000, bool debug = false) {}

View File

@ -73,14 +73,17 @@ static const APN_t apnlut[] = {
// 460 China - CN
{ /* CN Mobile */"460-00", _APN("cmnet",,)
_APN("cmwap",,) },
_APN("cmwap",,)
},
{ /* Unicom */ "460-01", _APN("3gnet",,)
_APN("uninet","uninet","uninet") },
_APN("uninet", "uninet", "uninet")
},
// 262 Germany - DE
{ /* T-Mobile */ "262-01", _APN("internet.t-mobile", "t-mobile", "tm") },
{ /* T-Mobile */ "262-02,06",
_APN("m2m.business",,) },
_APN("m2m.business",,)
},
// 222 Italy - IT
{ /* TIM */ "222-01", _APN("ibox.tim.it",,) },
@ -91,13 +94,15 @@ static const APN_t apnlut[] = {
{ /* Softbank */ "440-04,06,20,40,41,42,43,44,45,46,47,48,90,91,92,93,94,95"
",96,97,98"
_APN("open.softbank.ne.jp", "opensoftbank", "ebMNuX1FIHg9d3DA")
_APN("smile.world","dna1trop","so2t3k3m2a") },
_APN("smile.world", "dna1trop", "so2t3k3m2a")
},
{ /* NTTDoCoMo */"440-09,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,"
"28,29,30,31,32,33,34,35,36,37,38,39,58,59,60,61,62,63,"
"64,65,66,67,68,69,87,99",
_APN("bmobilewap",,) /*BMobile*/
_APN("mpr2.bizho.net", "Mopera U",) /* DoCoMo */
_APN("bmobile.ne.jp","bmobile@wifi2","bmobile") /*BMobile*/ },
_APN("bmobile.ne.jp", "bmobile@wifi2", "bmobile") /*BMobile*/
},
// 204 Netherlands - NL
{ /* Vodafone */ "204-04", _APN("public4.m2minternet.com",,) },
@ -109,32 +114,38 @@ static const APN_t apnlut[] = {
// 240 Sweden SE
{ /* Telia */ "240-01", _APN("online.telia.se",,) },
{ /* Telenor */ "240-06,08",
_APN("services.telenor.se",,) },
_APN("services.telenor.se",,)
},
{ /* Tele2 */ "240-07", _APN("mobileinternet.tele2.se",,) },
// 228 Switzerland - CH
{ /* Swisscom */ "228-01", _APN("gprs.swisscom.ch",,) },
{ /* Orange */ "228-03", _APN("internet",,) /* contract */
_APN("click",,) /* pre-pay */ },
_APN("click",,) /* pre-pay */
},
// 234 United Kingdom - GB
{ /* O2 */ "234-02,10,11",
_APN("mobile.o2.co.uk", "faster", "web") /* contract */
_APN("mobile.o2.co.uk", "bypass", "web") /* pre-pay */
_APN("payandgo.o2.co.uk","payandgo","payandgo") },
_APN("payandgo.o2.co.uk", "payandgo", "payandgo")
},
{ /* Vodafone */ "234-15", _APN("internet", "web", "web") /* contract */
_APN("pp.vodafone.co.uk","wap","wap") /* pre-pay */ },
_APN("pp.vodafone.co.uk", "wap", "wap") /* pre-pay */
},
{ /* Three */ "234-20", _APN("three.co.uk",,) },
{ /* Jersey */ "234-50", _APN("jtm2m",,) /* as used on u-blox C030 U201 boards */ },
// 310 United States of America - US
{ /* T-Mobile */ "310-026,260,490",
_APN("epc.tmobile.com",,)
_APN("fast.tmobile.com",,) /* LTE */ },
_APN("fast.tmobile.com",,) /* LTE */
},
{ /* AT&T */ "310-030,150,170,260,410,560,680",
_APN("phone",,)
_APN("wap.cingular", "WAP@CINGULARGPRS.COM", "CINGULAR1")
_APN("isp.cingular","ISP@CINGULARGPRS.COM","CINGULAR1") },
_APN("isp.cingular", "ISP@CINGULARGPRS.COM", "CINGULAR1")
},
// 901 International - INT
{ /* Transatel */ "901-37", _APN("netgprs.com", "tsl", "tsl") },
@ -161,8 +172,9 @@ inline const char* apnconfig(const char* imsi)
(p[1] >= '0') && (p[1] <= '9') &&
(p[2] >= '0') && (p[2] <= '9') && !config) {
int l = ((p[3] >= '0') && (p[3] <= '9')) ? 3 : 2;
if (0 == memcmp(imsi+3,p+1,l))
if (0 == memcmp(imsi + 3, p + 1, l)) {
config = apnlut[i].cfg;
}
p += 1 + l;
}
}

View File

@ -37,8 +37,7 @@
#define RETRY_COUNT_DEFAULT 3
namespace mbed
{
namespace mbed {
CellularConnectionFSM::CellularConnectionFSM() :
_serial(0), _state(STATE_INIT), _next_state(_state), _status_callback(0), _event_status_cb(0), _network(0), _power(0), _sim(0),

View File

@ -43,8 +43,7 @@ const int MAX_RETRY_ARRAY_SIZE = 10;
*
* Finite State Machine for connecting to cellular network
*/
class CellularConnectionFSM
{
class CellularConnectionFSM {
public:
CellularConnectionFSM();
virtual ~CellularConnectionFSM();

View File

@ -25,15 +25,13 @@
#define USE_APN_LOOKUP (MBED_CONF_CELLULAR_USE_APN_LOOKUP || (NSAPI_PPP_AVAILABLE && MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP))
namespace mbed
{
namespace mbed {
/** EasyCellularConnection class
*
* Simplified adapter for cellular connection
*/
class EasyCellularConnection: public CellularBase
{
class EasyCellularConnection: public CellularBase {
public:
EasyCellularConnection(bool debug = false);

View File

@ -27,8 +27,7 @@
#include "CellularInformation.h"
#include "NetworkStack.h"
namespace mbed
{
namespace mbed {
/**
* Class CellularDevice
@ -36,8 +35,7 @@ namespace mbed
* An abstract interface that defines opening and closing of cellular interfaces.
* Deleting/Closing of opened interfaces can be done only via this class.
*/
class CellularDevice
{
class CellularDevice {
public:
/** virtual Destructor
*/

View File

@ -35,8 +35,7 @@ const int MAX_OPERATOR_NAME_SHORT = 8;
*
* An abstract interface for connecting to a network and getting information from it.
*/
class CellularNetwork : public NetworkInterface
{
class CellularNetwork : public NetworkInterface {
protected:
// friend of CellularDevice so that it's the only way to close/delete this class.
friend class CellularDevice;
@ -146,7 +145,8 @@ public:
RadioAccessTechnology op_rat;
operator_t *next;
operator_t() {
operator_t()
{
op_status = Unknown;
op_rat = RAT_UNKNOWN;
next = NULL;
@ -176,7 +176,8 @@ public:
int serving_plmn_rate_control_value;
pdpcontext_params_t *next;
pdpcontext_params_t() {
pdpcontext_params_t()
{
apn[0] = '\0';
local_addr[0] = '\0';
local_subnet_mask[0] = '\0';
@ -203,7 +204,8 @@ public:
char numeric[MAX_OPERATOR_NAME_SHORT + 1];
char alpha[MAX_OPERATOR_NAME_LONG + 1];
operator_names_t *next;
operator_names_t() {
operator_names_t()
{
numeric[0] = '\0';
alpha[0] = '\0';
next = NULL;

View File

@ -20,16 +20,14 @@
#include "nsapi_types.h"
#include "Callback.h"
namespace mbed
{
namespace mbed {
/**
* Class CellularPower
*
* An interface that provides power handling functions for modem/module.
*/
class CellularPower
{
class CellularPower {
protected:
// friend of CellularDevice so that it's the only way to close/delete this class.
friend class CellularDevice;

View File

@ -40,8 +40,7 @@ const int SMS_ERROR_MULTIPART_ALL_PARTS_NOT_READ = -5001;
*
* An abstract interface for SMS sending, reading and deleting.
*/
class CellularSMS
{
class CellularSMS {
protected:
// friend of CellularDevice so that it's the only way to close/delete this class.
friend class CellularDevice;

View File

@ -28,8 +28,7 @@
#include "ATHandler.h"
namespace mbed
{
namespace mbed {
/**
* Class AT_CellularDevice
@ -37,8 +36,7 @@ namespace mbed
* A class defines opening and closing of cellular interfaces.
* Deleting/Closing of opened interfaces can be done only through this class.
*/
class AT_CellularDevice : public CellularDevice
{
class AT_CellularDevice : public CellularDevice {
public:
AT_CellularDevice(events::EventQueue &queue);
virtual ~AT_CellularDevice();

View File

@ -31,8 +31,7 @@ namespace mbed {
*
* Class for connecting to a network and getting information from it.
*/
class AT_CellularNetwork : public CellularNetwork, public AT_CellularBase
{
class AT_CellularNetwork : public CellularNetwork, public AT_CellularBase {
public:

View File

@ -28,8 +28,7 @@ namespace mbed {
*
* Class that provides power handling functions for modem/module.
*/
class AT_CellularPower : public CellularPower, public AT_CellularBase
{
class AT_CellularPower : public CellularPower, public AT_CellularBase {
public:
AT_CellularPower(ATHandler &atHandler);
virtual ~AT_CellularPower();

View File

@ -635,8 +635,7 @@ nsapi_size_or_error_t AT_CellularSMS::read_sms_from_index(int msg_index, char* b
// Received message
if (phone_num) {
_at.read_string(phone_num, SMS_MAX_PHONE_NUMBER_SIZE);
}
else {
} else {
_at.skip_param(); // <oa>,<alpha>
}
_at.skip_param(); // <alpha>
@ -711,8 +710,7 @@ nsapi_size_or_error_t AT_CellularSMS::read_sms(sms_info_t* sms, char* buf, char*
}
buf[index] = '\0';
}
}
else {
} else {
tr_warn("NOT all concatenated parts were received...");
index = SMS_ERROR_MULTIPART_ALL_PARTS_NOT_READ;
}
@ -896,8 +894,7 @@ nsapi_size_or_error_t AT_CellularSMS::get_sms(char* buf, uint16_t len, char* pho
if (msg) {
// we are reading the message
err = read_pdu_payload(pdu + index, udl, dataScheme, msg, paddingBits);
}
else {
} else {
if (dataScheme == 0x00) {
// when listing messages we need to calculated length. Other way would be unpacking the whole message.
err = strlen(pdu + index) >> 1;
@ -911,15 +908,15 @@ nsapi_size_or_error_t AT_CellularSMS::get_sms(char* buf, uint16_t len, char* pho
}
return err;
}
else {
} else {
// message was not DELIVER so discard it
return NSAPI_ERROR_UNSUPPORTED;
}
}
// read params from User Defined Header
int AT_CellularSMS::read_udh_from_pdu(const char* pdu, sms_info_t *info, int &part_number, int &padding_bits) {
int AT_CellularSMS::read_udh_from_pdu(const char *pdu, sms_info_t *info, int &part_number, int &padding_bits)
{
int index = 0;
int udhLength = hex_str_to_int(pdu, 2);
@ -988,7 +985,8 @@ void AT_CellularSMS::free_linked_list()
_sms_info = NULL;
}
void AT_CellularSMS::add_info(sms_info_t* info, int index, int part_number) {
void AT_CellularSMS::add_info(sms_info_t *info, int index, int part_number)
{
// check for same message reference id. If found, update it and delete the given info.
// if NOT found then add to the end of the list.

View File

@ -30,8 +30,7 @@ namespace mbed {
*
* Class for SMS sending, reading and deleting.
*/
class AT_CellularSMS: public CellularSMS, public AT_CellularBase
{
class AT_CellularSMS: public CellularSMS, public AT_CellularBase {
public:
AT_CellularSMS(ATHandler &atHandler);

View File

@ -34,8 +34,7 @@ namespace mbed {
*
* Implements NetworkStack and introduces interface for modem specific stack implementations.
*/
class AT_CellularStack : public NetworkStack, public AT_CellularBase
{
class AT_CellularStack : public NetworkStack, public AT_CellularBase {
public:
AT_CellularStack(ATHandler &at, int cid, nsapi_ip_stack_t stack_type);
@ -82,8 +81,7 @@ protected: // NetworkStack
protected:
class CellularSocket
{
class CellularSocket {
public:
// Socket id from cellular device
int id;

View File

@ -27,8 +27,7 @@ namespace mbed {
* Templated linked list class for common usage.
*
*/
template <class T> class CellularList
{
template <class T> class CellularList {
private:
T *_head, *_tail;
public:

View File

@ -204,8 +204,7 @@ void separate_ip_addresses(char* orig, char* ip, size_t ip_size, char* ip2, size
orig[temp - orig - 1] = '\0';
separate_ip4like_addresses(orig, ip, ip_size, NULL, 0);
orig[temp - orig - 1] = ' '; // put space back to keep orig as original
}
else {
} else {
separate_ip4like_addresses(orig, ip, ip_size, ip2, ip2_size);
}
}

View File

@ -22,8 +22,7 @@
namespace mbed {
class QUECTEL_BC95 : public AT_CellularDevice
{
class QUECTEL_BC95 : public AT_CellularDevice {
public:
QUECTEL_BC95(events::EventQueue &queue);

View File

@ -22,8 +22,7 @@
namespace mbed {
class QUECTEL_BC95_CellularNetwork : public AT_CellularNetwork
{
class QUECTEL_BC95_CellularNetwork : public AT_CellularNetwork {
public:
QUECTEL_BC95_CellularNetwork(ATHandler &atHandler);
virtual ~QUECTEL_BC95_CellularNetwork();

View File

@ -22,8 +22,7 @@
namespace mbed {
class QUECTEL_BC95_CellularPower : public AT_CellularPower
{
class QUECTEL_BC95_CellularPower : public AT_CellularPower {
public:
QUECTEL_BC95_CellularPower(ATHandler &atHandler);
virtual ~QUECTEL_BC95_CellularPower();

View File

@ -24,8 +24,7 @@
namespace mbed {
class QUECTEL_BC95_CellularStack : public AT_CellularStack
{
class QUECTEL_BC95_CellularStack : public AT_CellularStack {
public:
QUECTEL_BC95_CellularStack(ATHandler &atHandler, int cid, nsapi_ip_stack_t stack_type);
virtual ~QUECTEL_BC95_CellularStack();

View File

@ -20,11 +20,9 @@
#include "AT_CellularDevice.h"
namespace mbed
{
namespace mbed {
class QUECTEL_BG96 : public AT_CellularDevice
{
class QUECTEL_BG96 : public AT_CellularDevice {
public:
QUECTEL_BG96(events::EventQueue &queue);

View File

@ -22,8 +22,7 @@
namespace mbed {
class QUECTEL_BG96_CellularNetwork : public AT_CellularNetwork
{
class QUECTEL_BG96_CellularNetwork : public AT_CellularNetwork {
public:
QUECTEL_BG96_CellularNetwork(ATHandler &atHandler);
virtual ~QUECTEL_BG96_CellularNetwork();

View File

@ -20,11 +20,9 @@
#include "AT_CellularPower.h"
namespace mbed
{
namespace mbed {
class QUECTEL_BG96_CellularPower : public AT_CellularPower
{
class QUECTEL_BG96_CellularPower : public AT_CellularPower {
public:
QUECTEL_BG96_CellularPower(ATHandler &atHandler);

View File

@ -25,8 +25,7 @@ namespace mbed {
#define BG96_SOCKET_MAX 12
#define BG96_CREATE_SOCKET_TIMEOUT 150000 //150 seconds
class QUECTEL_BG96_CellularStack : public AT_CellularStack
{
class QUECTEL_BG96_CellularStack : public AT_CellularStack {
public:
QUECTEL_BG96_CellularStack(ATHandler &atHandler, int cid, nsapi_ip_stack_t stack_type);
virtual ~QUECTEL_BG96_CellularStack();

View File

@ -30,8 +30,7 @@ namespace mbed {
#define CELLULAR_SERIAL_RX PC_0
#endif
class QUECTEL_UG96 : public AT_CellularDevice
{
class QUECTEL_UG96 : public AT_CellularDevice {
public:
QUECTEL_UG96(events::EventQueue &queue);

View File

@ -22,8 +22,7 @@
namespace mbed {
class QUECTEL_UG96_CellularNetwork : public AT_CellularNetwork
{
class QUECTEL_UG96_CellularNetwork : public AT_CellularNetwork {
public:
QUECTEL_UG96_CellularNetwork(ATHandler &atHandler);
virtual ~QUECTEL_UG96_CellularNetwork();

View File

@ -22,8 +22,7 @@
namespace mbed {
class QUECTEL_UG96_CellularPower : public AT_CellularPower
{
class QUECTEL_UG96_CellularPower : public AT_CellularPower {
public:
QUECTEL_UG96_CellularPower(ATHandler &atHandler);
virtual ~QUECTEL_UG96_CellularPower();

View File

@ -25,8 +25,7 @@
namespace mbed {
class TELIT_HE910 : public AT_CellularDevice
{
class TELIT_HE910 : public AT_CellularDevice {
public:
TELIT_HE910(events::EventQueue &queue);

View File

@ -22,8 +22,7 @@
namespace mbed {
class TELIT_HE910_CellularNetwork : public AT_CellularNetwork
{
class TELIT_HE910_CellularNetwork : public AT_CellularNetwork {
public:
TELIT_HE910_CellularNetwork(ATHandler &atHandler);
virtual ~TELIT_HE910_CellularNetwork();

View File

@ -22,8 +22,7 @@
namespace mbed {
class TELIT_HE910_CellularPower : public AT_CellularPower
{
class TELIT_HE910_CellularPower : public AT_CellularPower {
public:
TELIT_HE910_CellularPower(ATHandler &atHandler);
virtual ~TELIT_HE910_CellularPower();

View File

@ -22,8 +22,7 @@
namespace mbed {
class UBLOX_PPP : public AT_CellularDevice
{
class UBLOX_PPP : public AT_CellularDevice {
public:
UBLOX_PPP(events::EventQueue &queue);
@ -35,8 +34,7 @@ public: // CellularDevice
};
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, Use UBLOX_PPP instead of UBLOX_LISA_U.")
class UBLOX_LISA_U : public UBLOX_PPP
{
class UBLOX_LISA_U : public UBLOX_PPP {
};
} // namespace mbed

View File

@ -22,8 +22,7 @@
namespace mbed {
class UBLOX_PPP_CellularNetwork : public AT_CellularNetwork
{
class UBLOX_PPP_CellularNetwork : public AT_CellularNetwork {
public:
UBLOX_PPP_CellularNetwork(ATHandler &atHandler);
virtual ~UBLOX_PPP_CellularNetwork();
@ -37,8 +36,7 @@ protected:
};
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, Use UBLOX_PPP_CellularNetwork instead of UBLOX_LISA_U_CellularNetwork.")
class UBLOX_LISA_U_CellularNetwork : public UBLOX_PPP_CellularNetwork
{
class UBLOX_LISA_U_CellularNetwork : public UBLOX_PPP_CellularNetwork {
};
} // namespace mbed

View File

@ -22,8 +22,7 @@
namespace mbed {
class UBLOX_PPP_CellularPower : public AT_CellularPower
{
class UBLOX_PPP_CellularPower : public AT_CellularPower {
public:
UBLOX_PPP_CellularPower(ATHandler &atHandler);
virtual ~UBLOX_PPP_CellularPower();
@ -36,8 +35,7 @@ public: //from CellularPower
};
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, Use UBLOX_PPP_CellularPower instead of UBLOX_LISA_U_CellularPower.")
class UBLOX_LISA_U_CellularPower : public UBLOX_PPP_CellularPower
{
class UBLOX_LISA_U_CellularPower : public UBLOX_PPP_CellularPower {
};
} // namespace mbed