mirror of https://github.com/ARMmbed/mbed-os.git
astyles fixes for UNITESTS.
parent
e5c3024849
commit
24213b4601
|
@ -104,7 +104,10 @@ public:
|
||||||
return 100;
|
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 {
|
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) :
|
my_AT_CTX(ATHandler &at, CellularDevice *device, const char *apn = MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN) :
|
||||||
AT_CellularContext(at, device, apn), _st(at) {}
|
AT_CellularContext(at, device, apn), _st(at) {}
|
||||||
virtual ~my_AT_CTX() {}
|
virtual ~my_AT_CTX() {}
|
||||||
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type) { return false;}
|
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type)
|
||||||
virtual NetworkStack *get_stack() {return &_st;}
|
{
|
||||||
virtual uint32_t get_timeout_for_operation(ContextOperation op) const { return 10;}
|
return false;
|
||||||
virtual void cellular_callback(nsapi_event_t ev, intptr_t ptr) { AT_CellularContext::cellular_callback(ev, ptr);}
|
}
|
||||||
|
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;
|
my_stack _st;
|
||||||
};
|
};
|
||||||
|
@ -125,9 +140,18 @@ public:
|
||||||
my_AT_CTXIPV6(ATHandler &at, CellularDevice *device, const char *apn = MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN) :
|
my_AT_CTXIPV6(ATHandler &at, CellularDevice *device, const char *apn = MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN) :
|
||||||
AT_CellularContext(at, device, apn), _st(at) {}
|
AT_CellularContext(at, device, apn), _st(at) {}
|
||||||
virtual ~my_AT_CTXIPV6() {}
|
virtual ~my_AT_CTXIPV6() {}
|
||||||
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type) {return true;}
|
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type)
|
||||||
virtual NetworkStack *get_stack() {return &_st;}
|
{
|
||||||
virtual uint32_t get_timeout_for_operation(ContextOperation op) const { return 10;}
|
return true;
|
||||||
|
}
|
||||||
|
virtual NetworkStack *get_stack()
|
||||||
|
{
|
||||||
|
return &_st;
|
||||||
|
}
|
||||||
|
virtual uint32_t get_timeout_for_operation(ContextOperation op) const
|
||||||
|
{
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
my_stack _st;
|
my_stack _st;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -258,7 +282,7 @@ TEST_F(TestAT_CellularContext, get_netmask_gateway)
|
||||||
ATHandler at(&fh1, que, 0, ",");
|
ATHandler at(&fh1, que, 0, ",");
|
||||||
AT_CellularDevice dev(&fh1);
|
AT_CellularDevice dev(&fh1);
|
||||||
AT_CellularContext ctx(at, &dev);
|
AT_CellularContext ctx(at, &dev);
|
||||||
const char* gg = ctx.get_netmask();
|
const char *gg = ctx.get_netmask();
|
||||||
EXPECT_TRUE(gg == NULL);
|
EXPECT_TRUE(gg == NULL);
|
||||||
gg = ctx.get_gateway();
|
gg = ctx.get_gateway();
|
||||||
EXPECT_TRUE(gg == NULL);
|
EXPECT_TRUE(gg == NULL);
|
||||||
|
|
|
@ -28,7 +28,7 @@ enum CellularStubState {
|
||||||
STATE_MANUAL_REGISTERING_NETWORK,
|
STATE_MANUAL_REGISTERING_NETWORK,
|
||||||
STATE_ATTACHING_NETWORK,
|
STATE_ATTACHING_NETWORK,
|
||||||
STATE_MAX_FSM_STATE
|
STATE_MAX_FSM_STATE
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace CellularStateMachine_stub {
|
namespace CellularStateMachine_stub {
|
||||||
extern nsapi_error_t nsapi_error_value;
|
extern nsapi_error_t nsapi_error_value;
|
||||||
|
|
|
@ -34,57 +34,91 @@ class CellularInformation;
|
||||||
class CellularContext;
|
class CellularContext;
|
||||||
class FileHandle;
|
class FileHandle;
|
||||||
|
|
||||||
class myCellularDevice : public CellularDevice
|
class myCellularDevice : public CellularDevice {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
myCellularDevice(FileHandle *fh) : CellularDevice (fh), _context_list(0), _network(0) {}
|
myCellularDevice(FileHandle *fh) : CellularDevice(fh), _context_list(0), _network(0) {}
|
||||||
~myCellularDevice() {
|
~myCellularDevice()
|
||||||
|
{
|
||||||
delete _context_list;
|
delete _context_list;
|
||||||
delete _network;
|
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;
|
EventQueue que;
|
||||||
FileHandle_stub fh1;
|
FileHandle_stub fh1;
|
||||||
ATHandler at(&fh1, que, 0, ",");
|
ATHandler at(&fh1, que, 0, ",");
|
||||||
_context_list = new AT_CellularContext(at, NULL);
|
_context_list = new AT_CellularContext(at, NULL);
|
||||||
return _context_list;}
|
return _context_list;
|
||||||
virtual void delete_context(CellularContext *context) { delete _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;
|
EventQueue que;
|
||||||
FileHandle_stub fh1;
|
FileHandle_stub fh1;
|
||||||
ATHandler at(&fh1, que, 0, ",");
|
ATHandler at(&fh1, que, 0, ",");
|
||||||
_network = new AT_CellularNetwork(at);
|
_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;}
|
virtual CellularContext *get_context_list() const
|
||||||
void cellular_callback(nsapi_event_t ev, intptr_t ptr) {CellularDevice::cellular_callback(ev, ptr);}
|
{
|
||||||
|
return _context_list;
|
||||||
|
}
|
||||||
|
void cellular_callback(nsapi_event_t ev, intptr_t ptr)
|
||||||
|
{
|
||||||
|
CellularDevice::cellular_callback(ev, ptr);
|
||||||
|
}
|
||||||
AT_CellularNetwork *_network;
|
AT_CellularNetwork *_network;
|
||||||
AT_CellularContext *_context_list;
|
AT_CellularContext *_context_list;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue