|
20 | 20 | #ifdef CELLULAR_DEVICE
|
21 | 21 | using namespace mbed;
|
22 | 22 | MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use CellularBase::get_default_instance() instead.")
|
23 |
| -class OnboardCellularInterface : public CellularBase |
24 |
| -{ |
| 23 | +class OnboardCellularInterface : public CellularBase { |
25 | 24 | public:
|
26 |
| - OnboardCellularInterface() { |
| 25 | + OnboardCellularInterface() |
| 26 | + { |
27 | 27 | context = CellularContext::get_default_instance();
|
28 | 28 | MBED_ASSERT(context != NULL);
|
29 | 29 | }
|
30 | 30 | public: // from NetworkInterface
|
31 |
| - virtual nsapi_error_t set_blocking(bool blocking) {return context->set_blocking(blocking);} |
32 |
| - virtual NetworkStack *get_stack() {return context->get_stack();} |
33 |
| - virtual const char *get_ip_address() {return context->get_ip_address();} |
34 |
| - virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb) {context->attach(status_cb);} |
35 |
| - virtual nsapi_error_t connect() {return context->connect();} |
36 |
| - virtual nsapi_error_t disconnect() {return context->disconnect();} |
| 31 | + virtual nsapi_error_t set_blocking(bool blocking) |
| 32 | + { |
| 33 | + return context->set_blocking(blocking); |
| 34 | + } |
| 35 | + virtual NetworkStack *get_stack() |
| 36 | + { |
| 37 | + return context->get_stack(); |
| 38 | + } |
| 39 | + virtual const char *get_ip_address() |
| 40 | + { |
| 41 | + return context->get_ip_address(); |
| 42 | + } |
| 43 | + virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb) |
| 44 | + { |
| 45 | + context->attach(status_cb); |
| 46 | + } |
| 47 | + virtual nsapi_error_t connect() |
| 48 | + { |
| 49 | + return context->connect(); |
| 50 | + } |
| 51 | + virtual nsapi_error_t disconnect() |
| 52 | + { |
| 53 | + return context->disconnect(); |
| 54 | + } |
37 | 55 |
|
38 | 56 | // from CellularBase
|
39 |
| - virtual void set_plmn(const char *plmn) {context->set_plmn(plmn);} |
40 |
| - virtual void set_sim_pin(const char *sim_pin) {context->set_sim_pin(sim_pin);} |
| 57 | + virtual void set_plmn(const char *plmn) |
| 58 | + { |
| 59 | + context->set_plmn(plmn); |
| 60 | + } |
| 61 | + virtual void set_sim_pin(const char *sim_pin) |
| 62 | + { |
| 63 | + context->set_sim_pin(sim_pin); |
| 64 | + } |
41 | 65 | virtual nsapi_error_t connect(const char *sim_pin, const char *apn = 0, const char *uname = 0,
|
42 | 66 | const char *pwd = 0)
|
43 |
| - {return context->connect(sim_pin, apn, uname, pwd);} |
| 67 | + { |
| 68 | + return context->connect(sim_pin, apn, uname, pwd); |
| 69 | + } |
44 | 70 | virtual void set_credentials(const char *apn, const char *uname = 0, const char *pwd = 0)
|
45 |
| - {context->set_credentials(apn, uname, pwd);} |
46 |
| - virtual const char *get_netmask() {return context->get_netmask();} |
47 |
| - virtual const char *get_gateway() {return context->get_gateway();} |
48 |
| - virtual bool is_connected() {return context->is_connected();} |
| 71 | + { |
| 72 | + context->set_credentials(apn, uname, pwd); |
| 73 | + } |
| 74 | + virtual const char *get_netmask() |
| 75 | + { |
| 76 | + return context->get_netmask(); |
| 77 | + } |
| 78 | + virtual const char *get_gateway() |
| 79 | + { |
| 80 | + return context->get_gateway(); |
| 81 | + } |
| 82 | + virtual bool is_connected() |
| 83 | + { |
| 84 | + return context->is_connected(); |
| 85 | + } |
49 | 86 |
|
50 | 87 | private:
|
51 | 88 | CellularContext *context;
|
|
0 commit comments