Skip to content

Commit 467ae09

Browse files
author
Teppo Järvelin
committed
Cellular: Updated target SARA4_PPP to use new CellularContext class.
1 parent 9fb8302 commit 467ae09

File tree

6 files changed

+76
-7
lines changed

6 files changed

+76
-7
lines changed

features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/SARA4_PPP.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "SARA4_PPP.h"
1919
#include "SARA4_PPP_CellularNetwork.h"
2020
#include "SARA4_PPP_CellularPower.h"
21+
#include "SARA4_PPP_CellularContext.h"
2122

2223
using namespace mbed;
2324
using namespace events;
@@ -47,3 +48,7 @@ AT_CellularPower *SARA4_PPP::open_power_impl(ATHandler &at)
4748
return new SARA4_PPP_CellularPower(at);
4849
}
4950

51+
AT_CellularContext *SARA4_PPP::create_context_impl(ATHandler &at, const char *apn)
52+
{
53+
return new SARA4_PPP_CellularContext(at, this, apn);
54+
}

features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/SARA4_PPP.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class SARA4_PPP : public AT_CellularDevice {
3131
public: // CellularDevice
3232
virtual AT_CellularNetwork *open_network_impl(ATHandler &at);
3333
virtual AT_CellularPower *open_power_impl(ATHandler &at);
34+
virtual AT_CellularContext *create_context_impl(ATHandler &at, const char *apn);
3435
};
3536

3637
} // namespace mbed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2018, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#include "SARA4_PPP_CellularContext.h"
18+
19+
namespace mbed {
20+
21+
SARA4_PPP_CellularContext::SARA4_PPP_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
22+
AT_CellularContext(at, device, apn)
23+
{
24+
}
25+
26+
SARA4_PPP_CellularContext::~SARA4_PPP_CellularContext()
27+
{
28+
}
29+
30+
bool SARA4_PPP_CellularContext::stack_type_supported(nsapi_ip_stack_t requested_stack)
31+
{
32+
return requested_stack == IPV4_STACK ? true : false;
33+
}
34+
35+
} /* namespace mbed */
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2018, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef SARA4_PPP_CELLULARCONTEXT_H_
18+
#define SARA4_PPP_CELLULARCONTEXT_H_
19+
20+
#include "AT_CellularContext.h"
21+
22+
namespace mbed {
23+
24+
class SARA4_PPP_CellularContext: public AT_CellularContext {
25+
public:
26+
SARA4_PPP_CellularContext(ATHandler &at, CellularDevice *device, const char *apn);
27+
virtual ~SARA4_PPP_CellularContext();
28+
29+
protected:
30+
virtual bool stack_type_supported(nsapi_ip_stack_t requested_stack);
31+
};
32+
33+
} /* namespace mbed */
34+
35+
#endif // SARA4_PPP_CELLULARCONTEXT_H_

features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/SARA4_PPP_CellularNetwork.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ SARA4_PPP_CellularNetwork::~SARA4_PPP_CellularNetwork()
2727
{
2828
}
2929

30-
bool SARA4_PPP_CellularNetwork::get_modem_stack_type(nsapi_ip_stack_t requested_stack)
31-
{
32-
return requested_stack == IPV4_STACK ? true : false;
33-
}
34-
3530
AT_CellularNetwork::RegistrationMode SARA4_PPP_CellularNetwork::has_registration(RegistrationType reg_type)
3631
{
3732
return (reg_type == C_REG || reg_type == C_GREG) ? RegistrationModeLAC : RegistrationModeDisable;

features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/SARA4_PPP_CellularNetwork.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class SARA4_PPP_CellularNetwork : public AT_CellularNetwork {
2828
virtual ~SARA4_PPP_CellularNetwork();
2929

3030
protected:
31-
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack);
32-
3331
virtual RegistrationMode has_registration(RegistrationType rat);
3432

3533
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opRat);

0 commit comments

Comments
 (0)