Cellular: Updated target SARA4_PPP to use new CellularContext class.

pull/8579/head
Teppo Järvelin 2018-11-02 14:01:21 +02:00
parent 9fb83024ea
commit 467ae09bef
6 changed files with 76 additions and 7 deletions

View File

@ -18,6 +18,7 @@
#include "SARA4_PPP.h"
#include "SARA4_PPP_CellularNetwork.h"
#include "SARA4_PPP_CellularPower.h"
#include "SARA4_PPP_CellularContext.h"
using namespace mbed;
using namespace events;
@ -47,3 +48,7 @@ AT_CellularPower *SARA4_PPP::open_power_impl(ATHandler &at)
return new SARA4_PPP_CellularPower(at);
}
AT_CellularContext *SARA4_PPP::create_context_impl(ATHandler &at, const char *apn)
{
return new SARA4_PPP_CellularContext(at, this, apn);
}

View File

@ -31,6 +31,7 @@ public:
public: // CellularDevice
virtual AT_CellularNetwork *open_network_impl(ATHandler &at);
virtual AT_CellularPower *open_power_impl(ATHandler &at);
virtual AT_CellularContext *create_context_impl(ATHandler &at, const char *apn);
};
} // namespace mbed

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "SARA4_PPP_CellularContext.h"
namespace mbed {
SARA4_PPP_CellularContext::SARA4_PPP_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
AT_CellularContext(at, device, apn)
{
}
SARA4_PPP_CellularContext::~SARA4_PPP_CellularContext()
{
}
bool SARA4_PPP_CellularContext::stack_type_supported(nsapi_ip_stack_t requested_stack)
{
return requested_stack == IPV4_STACK ? true : false;
}
} /* namespace mbed */

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef SARA4_PPP_CELLULARCONTEXT_H_
#define SARA4_PPP_CELLULARCONTEXT_H_
#include "AT_CellularContext.h"
namespace mbed {
class SARA4_PPP_CellularContext: public AT_CellularContext {
public:
SARA4_PPP_CellularContext(ATHandler &at, CellularDevice *device, const char *apn);
virtual ~SARA4_PPP_CellularContext();
protected:
virtual bool stack_type_supported(nsapi_ip_stack_t requested_stack);
};
} /* namespace mbed */
#endif // SARA4_PPP_CELLULARCONTEXT_H_

View File

@ -27,11 +27,6 @@ SARA4_PPP_CellularNetwork::~SARA4_PPP_CellularNetwork()
{
}
bool SARA4_PPP_CellularNetwork::get_modem_stack_type(nsapi_ip_stack_t requested_stack)
{
return requested_stack == IPV4_STACK ? true : false;
}
AT_CellularNetwork::RegistrationMode SARA4_PPP_CellularNetwork::has_registration(RegistrationType reg_type)
{
return (reg_type == C_REG || reg_type == C_GREG) ? RegistrationModeLAC : RegistrationModeDisable;

View File

@ -28,8 +28,6 @@ public:
virtual ~SARA4_PPP_CellularNetwork();
protected:
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack);
virtual RegistrationMode has_registration(RegistrationType rat);
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opRat);