mirror of https://github.com/ARMmbed/mbed-os.git
astyles fixes for UNITESTS.
parent
e5c3024849
commit
24213b4601
|
@ -104,7 +104,10 @@ public:
|
|||
return 100;
|
||||
}
|
||||
|
||||
virtual const char *get_ip_address() { return "1.2.3.4";}
|
||||
virtual const char *get_ip_address()
|
||||
{
|
||||
return "1.2.3.4";
|
||||
}
|
||||
};
|
||||
|
||||
class my_AT_CTX : public AT_CellularContext {
|
||||
|
@ -112,10 +115,22 @@ public:
|
|||
my_AT_CTX(ATHandler &at, CellularDevice *device, const char *apn = MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN) :
|
||||
AT_CellularContext(at, device, apn), _st(at) {}
|
||||
virtual ~my_AT_CTX() {}
|
||||
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type) { return false;}
|
||||
virtual NetworkStack *get_stack() {return &_st;}
|
||||
virtual uint32_t get_timeout_for_operation(ContextOperation op) const { return 10;}
|
||||
virtual void cellular_callback(nsapi_event_t ev, intptr_t ptr) { AT_CellularContext::cellular_callback(ev, ptr);}
|
||||
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual NetworkStack *get_stack()
|
||||
{
|
||||
return &_st;
|
||||
}
|
||||
virtual uint32_t get_timeout_for_operation(ContextOperation op) const
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
virtual void cellular_callback(nsapi_event_t ev, intptr_t ptr)
|
||||
{
|
||||
AT_CellularContext::cellular_callback(ev, ptr);
|
||||
}
|
||||
|
||||
my_stack _st;
|
||||
};
|
||||
|
@ -125,9 +140,18 @@ public:
|
|||
my_AT_CTXIPV6(ATHandler &at, CellularDevice *device, const char *apn = MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN) :
|
||||
AT_CellularContext(at, device, apn), _st(at) {}
|
||||
virtual ~my_AT_CTXIPV6() {}
|
||||
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type) {return true;}
|
||||
virtual NetworkStack *get_stack() {return &_st;}
|
||||
virtual uint32_t get_timeout_for_operation(ContextOperation op) const { return 10;}
|
||||
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
virtual NetworkStack *get_stack()
|
||||
{
|
||||
return &_st;
|
||||
}
|
||||
virtual uint32_t get_timeout_for_operation(ContextOperation op) const
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
my_stack _st;
|
||||
};
|
||||
|
||||
|
@ -258,7 +282,7 @@ TEST_F(TestAT_CellularContext, get_netmask_gateway)
|
|||
ATHandler at(&fh1, que, 0, ",");
|
||||
AT_CellularDevice dev(&fh1);
|
||||
AT_CellularContext ctx(at, &dev);
|
||||
const char* gg = ctx.get_netmask();
|
||||
const char *gg = ctx.get_netmask();
|
||||
EXPECT_TRUE(gg == NULL);
|
||||
gg = ctx.get_gateway();
|
||||
EXPECT_TRUE(gg == NULL);
|
||||
|
|
|
@ -24,8 +24,8 @@ const int DEFAULT_AT_TIMEOUT = 1000;
|
|||
using namespace mbed;
|
||||
|
||||
AT_CellularDevice::AT_CellularDevice(FileHandle *fh) : CellularDevice(fh), _network(0), _sms(0),
|
||||
_sim(0), _power(0), _information(0), _context_list(0), _default_timeout(DEFAULT_AT_TIMEOUT),
|
||||
_modem_debug_on(false)
|
||||
_sim(0), _power(0), _information(0), _context_list(0), _default_timeout(DEFAULT_AT_TIMEOUT),
|
||||
_modem_debug_on(false)
|
||||
{
|
||||
_atHandlers = new ATHandler(fh, _queue, 0, ",");
|
||||
}
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
#include "CellularStateMachine.h"
|
||||
|
||||
enum CellularStubState {
|
||||
STATE_INIT = 0,
|
||||
STATE_POWER_ON,
|
||||
STATE_DEVICE_READY,
|
||||
STATE_SIM_PIN,
|
||||
STATE_REGISTERING_NETWORK,
|
||||
STATE_MANUAL_REGISTERING_NETWORK,
|
||||
STATE_ATTACHING_NETWORK,
|
||||
STATE_MAX_FSM_STATE
|
||||
};
|
||||
STATE_INIT = 0,
|
||||
STATE_POWER_ON,
|
||||
STATE_DEVICE_READY,
|
||||
STATE_SIM_PIN,
|
||||
STATE_REGISTERING_NETWORK,
|
||||
STATE_MANUAL_REGISTERING_NETWORK,
|
||||
STATE_ATTACHING_NETWORK,
|
||||
STATE_MAX_FSM_STATE
|
||||
};
|
||||
|
||||
namespace CellularStateMachine_stub {
|
||||
extern nsapi_error_t nsapi_error_value;
|
||||
|
|
|
@ -34,57 +34,91 @@ class CellularInformation;
|
|||
class CellularContext;
|
||||
class FileHandle;
|
||||
|
||||
class myCellularDevice : public CellularDevice
|
||||
{
|
||||
class myCellularDevice : public CellularDevice {
|
||||
public:
|
||||
myCellularDevice(FileHandle *fh) : CellularDevice (fh), _context_list(0), _network(0) {}
|
||||
~myCellularDevice() {
|
||||
myCellularDevice(FileHandle *fh) : CellularDevice(fh), _context_list(0), _network(0) {}
|
||||
~myCellularDevice()
|
||||
{
|
||||
delete _context_list;
|
||||
delete _network;
|
||||
}
|
||||
virtual CellularContext *create_context(FileHandle *fh = NULL, const char *apn = NULL) {
|
||||
virtual CellularContext *create_context(FileHandle *fh = NULL, const char *apn = NULL)
|
||||
{
|
||||
EventQueue que;
|
||||
FileHandle_stub fh1;
|
||||
ATHandler at(&fh1, que, 0, ",");
|
||||
_context_list = new AT_CellularContext(at, NULL);
|
||||
return _context_list;}
|
||||
virtual void delete_context(CellularContext *context) { delete _context_list;}
|
||||
return _context_list;
|
||||
}
|
||||
virtual void delete_context(CellularContext *context)
|
||||
{
|
||||
delete _context_list;
|
||||
}
|
||||
|
||||
virtual CellularNetwork *open_network(FileHandle *fh = NULL) {
|
||||
virtual CellularNetwork *open_network(FileHandle *fh = NULL)
|
||||
{
|
||||
EventQueue que;
|
||||
FileHandle_stub fh1;
|
||||
ATHandler at(&fh1, que, 0, ",");
|
||||
_network = new AT_CellularNetwork(at);
|
||||
return _network;}
|
||||
return _network;
|
||||
}
|
||||
|
||||
virtual CellularSMS *open_sms(FileHandle *fh = NULL) {return NULL;}
|
||||
virtual CellularSMS *open_sms(FileHandle *fh = NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual CellularPower *open_power(FileHandle *fh = NULL) {return NULL;}
|
||||
virtual CellularPower *open_power(FileHandle *fh = NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual CellularSIM *open_sim(FileHandle *fh = NULL) {return NULL;}
|
||||
virtual CellularSIM *open_sim(FileHandle *fh = NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual CellularInformation *open_information(FileHandle *fh = NULL) {return NULL;}
|
||||
virtual CellularInformation *open_information(FileHandle *fh = NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual void close_network(){delete _network;}
|
||||
virtual void close_network()
|
||||
{
|
||||
delete _network;
|
||||
}
|
||||
|
||||
virtual void close_sms(){}
|
||||
virtual void close_sms() {}
|
||||
|
||||
virtual void close_power(){}
|
||||
virtual void close_power() {}
|
||||
|
||||
virtual void close_sim(){}
|
||||
virtual void close_sim() {}
|
||||
|
||||
virtual void close_information(){}
|
||||
virtual void close_information() {}
|
||||
|
||||
virtual void set_timeout(int timeout){}
|
||||
virtual void set_timeout(int timeout) {}
|
||||
|
||||
virtual uint16_t get_send_delay() const{ return 0;}
|
||||
virtual uint16_t get_send_delay() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual void modem_debug_on(bool on){}
|
||||
virtual void modem_debug_on(bool on) {}
|
||||
|
||||
virtual nsapi_error_t init_module(){ return 0;}
|
||||
virtual nsapi_error_t init_module()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual CellularContext *get_context_list() const { return _context_list;}
|
||||
void cellular_callback(nsapi_event_t ev, intptr_t ptr) {CellularDevice::cellular_callback(ev, ptr);}
|
||||
virtual CellularContext *get_context_list() const
|
||||
{
|
||||
return _context_list;
|
||||
}
|
||||
void cellular_callback(nsapi_event_t ev, intptr_t ptr)
|
||||
{
|
||||
CellularDevice::cellular_callback(ev, ptr);
|
||||
}
|
||||
AT_CellularNetwork *_network;
|
||||
AT_CellularContext *_context_list;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue