Cellular: change stack_type_supported to get_property

Change usage of AT_CellularContext::stack_type_supported to
AT_CellularBase::get_property. This way we can rid of
targets overriding stack_type_supported and delete
unnecessary classes and simplify new targets.
pull/9472/head
Teppo Järvelin 2018-12-13 10:32:19 +02:00 committed by Ari Parkkila
parent 7c9f9d47ec
commit 0c9130efeb
41 changed files with 110 additions and 445 deletions

View File

@ -40,6 +40,9 @@ public:
0, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
set_cellular_properties(cellular_properties);
@ -116,7 +119,10 @@ TEST_F(TestAT_CellularBase, test_AT_CellularBase_set_cellular_properties)
AT_CellularNetwork::RegistrationModeLAC, // C_REG
0, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1 // AT_CGAUTH
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
at.set_cellular_properties(cellular_properties);
}

View File

@ -27,6 +27,7 @@
#include "Semaphore_stub.h"
#include "CellularDevice_stub.h"
#include "equeue_stub.h"
#include "AT_CellularBase_stub.h"
using namespace mbed;
using namespace events;
@ -114,12 +115,12 @@ public:
class my_AT_CTX : public AT_CellularContext {
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)
AT_CellularContext(at, device, apn), _st(at)
{
return false;
AT_CellularBase_stub::supported_bool = false;
}
virtual ~my_AT_CTX() {}
virtual NetworkStack *get_stack()
{
return &_st;

View File

@ -47,6 +47,8 @@ intptr_t AT_CellularBase::get_property(CellularProperty key)
return AT_CellularNetwork::RegistrationModeDisable;
} else if (key == PROPERTY_C_REG || key == PROPERTY_C_EREG) {
return AT_CellularNetwork::RegistrationModeEnable;
} else if (key == PROPERTY_AT_CGAUTH) {
return true;
}
return AT_CellularBase_stub::supported_bool;

View File

@ -135,9 +135,15 @@ const char *AT_CellularContext::get_gateway()
return NULL;
}
bool AT_CellularContext::stack_type_supported(nsapi_ip_stack_t stack_type)
AT_CellularBase::CellularProperty AT_CellularContext::nsapi_ip_stack_t_to_cellular_property(nsapi_ip_stack_t stack)
{
return true;
AT_CellularBase::CellularProperty prop = PROPERTY_IPV4_STACK;
if (stack == IPV6_STACK) {
prop = PROPERTY_IPV6_STACK;
} else if (stack == IPV4V6_STACK) {
prop = PROPERTY_IPV4V6_STACK;
}
return prop;
}
nsapi_ip_stack_t AT_CellularContext::get_stack_type()

View File

@ -43,12 +43,15 @@ public:
device_err_t get_device_error() const;
enum CellularProperty {
PROPERTY_C_EREG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_C_GREG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_C_REG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_AT_CGSN_WITH_TYPE, // 0 = not supported, 1 = supported. AT+CGSN without type is likely always supported similar to AT+GSN.
PROPERTY_AT_CGDATA, // 0 = not supported, 1 = supported. Alternative is to support only ATD*99***<cid>#
PROPERTY_AT_CGAUTH, // 0 = not supported, 1 = supported. APN authentication AT commands supported
PROPERTY_C_EREG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_C_GREG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_C_REG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_AT_CGSN_WITH_TYPE, // 0 = not supported, 1 = supported. AT+CGSN without type is likely always supported similar to AT+GSN.
PROPERTY_AT_CGDATA, // 0 = not supported, 1 = supported. Alternative is to support only ATD*99***<cid>#
PROPERTY_AT_CGAUTH, // 0 = not supported, 1 = supported. APN authentication AT commands supported
PROPERTY_IPV4_STACK, // 0 = not supported, 1 = supported
PROPERTY_IPV6_STACK, // 0 = not supported, 1 = supported
PROPERTY_IPV4V6_STACK, // 0 = not supported, 1 = supported
PROPERTY_MAX
};

View File

@ -239,15 +239,6 @@ void AT_CellularContext::set_credentials(const char *apn, const char *uname, con
_pwd = pwd;
}
bool AT_CellularContext::stack_type_supported(nsapi_ip_stack_t stack_type)
{
if (stack_type == _ip_stack_type) {
return true;
} else {
return false;
}
}
nsapi_ip_stack_t AT_CellularContext::get_stack_type()
{
return _ip_stack_type;
@ -306,6 +297,17 @@ nsapi_error_t AT_CellularContext::do_user_authentication()
return NSAPI_ERROR_OK;
}
AT_CellularBase::CellularProperty AT_CellularContext::nsapi_ip_stack_t_to_cellular_property(nsapi_ip_stack_t stack)
{
AT_CellularBase::CellularProperty prop = PROPERTY_IPV4_STACK;
if (stack == IPV6_STACK) {
prop = PROPERTY_IPV6_STACK;
} else if (stack == IPV4V6_STACK) {
prop = PROPERTY_IPV4V6_STACK;
}
return prop;
}
bool AT_CellularContext::get_context()
{
_at.cmd_start("AT+CGDCONT?");
@ -316,8 +318,8 @@ bool AT_CellularContext::get_context()
char apn[MAX_ACCESSPOINT_NAME_LENGTH];
int apn_len = 0;
bool modem_supports_ipv6 = stack_type_supported(IPV6_STACK);
bool modem_supports_ipv4 = stack_type_supported(IPV4_STACK);
bool modem_supports_ipv6 = get_property(PROPERTY_IPV6_STACK);
bool modem_supports_ipv4 = get_property(PROPERTY_IPV4_STACK);
while (_at.info_resp()) {
int cid = _at.read_int();
@ -334,7 +336,8 @@ bool AT_CellularContext::get_context()
}
nsapi_ip_stack_t pdp_stack = string_to_stack_type(pdp_type_from_context);
// Accept dual PDP context for IPv4/IPv6 only modems
if (pdp_stack != DEFAULT_STACK && (stack_type_supported(pdp_stack) || pdp_stack == IPV4V6_STACK)) {
if (pdp_stack != DEFAULT_STACK && (get_property(nsapi_ip_stack_t_to_cellular_property(pdp_stack))
|| pdp_stack == IPV4V6_STACK)) {
if (_ip_stack_type_requested == IPV4_STACK) {
if (pdp_stack == IPV4_STACK || pdp_stack == IPV4V6_STACK) {
_ip_stack_type = _ip_stack_type_requested;
@ -399,8 +402,8 @@ bool AT_CellularContext::set_new_context(int cid)
nsapi_ip_stack_t tmp_stack = _ip_stack_type_requested;
if (tmp_stack == DEFAULT_STACK) {
bool modem_supports_ipv6 = stack_type_supported(IPV6_STACK);
bool modem_supports_ipv4 = stack_type_supported(IPV4_STACK);
bool modem_supports_ipv6 = get_property(PROPERTY_IPV6_STACK);
bool modem_supports_ipv4 = get_property(PROPERTY_IPV4_STACK);
if (modem_supports_ipv6 && modem_supports_ipv4) {
tmp_stack = IPV4V6_STACK;

View File

@ -75,12 +75,6 @@ protected:
*/
virtual void do_connect();
/** Check if modem supports the given stack type. Can be overridden by the modem.
*
* @return true if supported
*/
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type);
/** Get the operation specific timeout. Used in synchronous mode when setting the maximum
* waiting time. Modem specific implementation can override this to provide different timeouts.
*
@ -107,6 +101,7 @@ private:
nsapi_ip_stack_t string_to_stack_type(const char *pdp_type);
nsapi_ip_stack_t get_stack_type();
nsapi_error_t check_operation(nsapi_error_t err, ContextOperation op);
AT_CellularBase::CellularProperty nsapi_ip_stack_t_to_cellular_property(nsapi_ip_stack_t stack);
private:
nsapi_ip_stack_t _ip_stack_type_requested;

View File

@ -71,8 +71,8 @@ static const char *const rat_str[AT_CellularNetwork::RAT_MAX] = {
AT_CellularNetwork::AT_CellularNetwork(ATHandler &atHandler) : AT_CellularBase(atHandler),
_connection_status_cb(NULL), _op_act(RAT_UNKNOWN), _connect_status(NSAPI_STATUS_DISCONNECTED),
_ciotopt_network_support_cb(NULL), _supported_network_opt(CIOT_OPT_MAX)
_connection_status_cb(NULL), _ciotopt_network_support_cb(NULL), _op_act(RAT_UNKNOWN),
_connect_status(NSAPI_STATUS_DISCONNECTED), _supported_network_opt(CIOT_OPT_MAX)
{
_urc_funcs[C_EREG] = callback(this, &AT_CellularNetwork::urc_cereg);

View File

@ -95,6 +95,9 @@ void GEMALTO_CINTERION::init_module_bgs2()
0, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
AT_CellularBase::set_cellular_properties(cellular_properties);
_module = ModuleBGS2;
@ -110,6 +113,9 @@ void GEMALTO_CINTERION::init_module_els61()
0, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
1, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
AT_CellularBase::set_cellular_properties(cellular_properties);
_module = ModuleELS61;
@ -125,6 +131,9 @@ void GEMALTO_CINTERION::init_module_ems31()
1, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
1, // PROPERTY_IPV6_STACK
1, // PROPERTY_IPV4V6_STACK
};
AT_CellularBase::set_cellular_properties(cellular_properties);
_module = ModuleEMS31;

View File

@ -16,7 +16,6 @@
*/
#include "GEMALTO_CINTERION_CellularContext.h"
#include "GEMALTO_CINTERION_CellularStack.h"
#include "GEMALTO_CINTERION.h"
namespace mbed {
@ -39,12 +38,4 @@ NetworkStack *GEMALTO_CINTERION_CellularContext::get_stack()
}
#endif // NSAPI_PPP_AVAILABLE
bool GEMALTO_CINTERION_CellularContext::stack_type_supported(nsapi_ip_stack_t requested_stack)
{
if (GEMALTO_CINTERION::get_module() == GEMALTO_CINTERION::ModuleBGS2) {
return (requested_stack == IPV4_STACK);
}
return (requested_stack == IPV4_STACK || requested_stack == IPV6_STACK);
}
} /* namespace mbed */

View File

@ -30,7 +30,6 @@ protected:
#if !NSAPI_PPP_AVAILABLE
virtual NetworkStack *get_stack();
#endif // NSAPI_PPP_AVAILABLE
virtual bool stack_type_supported(nsapi_ip_stack_t requested_stack);
};
} /* namespace mbed */

View File

@ -18,7 +18,6 @@
#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;
@ -30,6 +29,9 @@ static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
0, // AT_CGSN_WITH_TYPE
0, // AT_CGDATA
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
SARA4_PPP::SARA4_PPP(FileHandle *fh) : AT_CellularDevice(fh)
@ -51,7 +53,3 @@ 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,7 +31,6 @@ 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

@ -1,35 +0,0 @@
/*
* 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

@ -1,35 +0,0 @@
/*
* 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

@ -16,7 +16,6 @@
*/
#include "QUECTEL_BC95_CellularNetwork.h"
#include "QUECTEL_BC95_CellularPower.h"
#include "QUECTEL_BC95_CellularContext.h"
#include "QUECTEL_BC95_CellularInformation.h"
#include "QUECTEL_BC95.h"
@ -36,6 +35,9 @@ static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
1, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
0, // AT_CGAUTH, BC95_AT_Commands_Manual_V1.9
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
QUECTEL_BC95::QUECTEL_BC95(FileHandle *fh) : AT_CellularDevice(fh)
@ -69,11 +71,6 @@ AT_CellularNetwork *QUECTEL_BC95::open_network_impl(ATHandler &at)
return new QUECTEL_BC95_CellularNetwork(at);
}
AT_CellularPower *QUECTEL_BC95::open_power_impl(ATHandler &at)
{
return new QUECTEL_BC95_CellularPower(at);
}
AT_CellularContext *QUECTEL_BC95::create_context_impl(ATHandler &at, const char *apn)
{
return new QUECTEL_BC95_CellularContext(at, this, apn);

View File

@ -32,7 +32,6 @@ public: // AT_CellularDevice
protected: // AT_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);
virtual AT_CellularInformation *open_information_impl(ATHandler &at);
virtual nsapi_error_t init();

View File

@ -38,9 +38,4 @@ NetworkStack *QUECTEL_BC95_CellularContext::get_stack()
}
#endif // #if !NSAPI_PPP_AVAILABLE
bool QUECTEL_BC95_CellularContext::stack_type_supported(nsapi_ip_stack_t stack_type)
{
return stack_type == IPV4_STACK ? true : false;
}
} /* namespace mbed */

View File

@ -30,7 +30,6 @@ protected:
#if !NSAPI_PPP_AVAILABLE
virtual NetworkStack *get_stack();
#endif // #if !NSAPI_PPP_AVAILABLE
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type);
};
} /* namespace mbed */

View File

@ -1,30 +0,0 @@
/*
* Copyright (c) 2017, 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 "QUECTEL_BC95_CellularPower.h"
using namespace mbed;
QUECTEL_BC95_CellularPower::QUECTEL_BC95_CellularPower(ATHandler &atHandler) : AT_CellularPower(atHandler)
{
}
QUECTEL_BC95_CellularPower::~QUECTEL_BC95_CellularPower()
{
}

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 2017, 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 QUECTEL_BC95_CELLULAR_POWER_H_
#define QUECTEL_BC95_CELLULAR_POWER_H_
#include "AT_CellularPower.h"
namespace mbed {
class QUECTEL_BC95_CellularPower : public AT_CellularPower {
public:
QUECTEL_BC95_CellularPower(ATHandler &atHandler);
virtual ~QUECTEL_BC95_CellularPower();
};
} // namespace mbed
#endif // QUECTEL_BC95_CELLULAR_POWER_H_

View File

@ -19,7 +19,6 @@
#include "QUECTEL_BG96_CellularNetwork.h"
#include "QUECTEL_BG96_CellularStack.h"
#include "QUECTEL_BG96_CellularInformation.h"
#include "QUECTEL_BG96_CellularPower.h"
#include "QUECTEL_BG96_CellularContext.h"
using namespace mbed;
@ -37,7 +36,10 @@ static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
AT_CellularNetwork::RegistrationModeLAC, // C_REG
0, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH, BC95_AT_Commands_Manual_V1.9
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
QUECTEL_BG96::QUECTEL_BG96(FileHandle *fh) : AT_CellularDevice(fh)
@ -54,11 +56,6 @@ AT_CellularNetwork *QUECTEL_BG96::open_network_impl(ATHandler &at)
return new QUECTEL_BG96_CellularNetwork(at);
}
AT_CellularPower *QUECTEL_BG96::open_power_impl(ATHandler &at)
{
return new QUECTEL_BG96_CellularPower(at);
}
AT_CellularContext *QUECTEL_BG96::create_context_impl(ATHandler &at, const char *apn)
{
return new QUECTEL_BG96_CellularContext(at, this, apn);

View File

@ -29,7 +29,6 @@ public:
protected: // AT_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);
virtual AT_CellularInformation *open_information_impl(ATHandler &at);
virtual void set_ready_cb(Callback<void()> callback);

View File

@ -28,14 +28,6 @@ QUECTEL_BG96_CellularContext::~QUECTEL_BG96_CellularContext()
{
}
bool QUECTEL_BG96_CellularContext::stack_type_supported(nsapi_ip_stack_t stack_type)
{
if (stack_type == IPV4_STACK) {
return true;
}
return false;
}
#if !NSAPI_PPP_AVAILABLE
NetworkStack *QUECTEL_BG96_CellularContext::get_stack()
{

View File

@ -27,7 +27,6 @@ public:
virtual ~QUECTEL_BG96_CellularContext();
protected:
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type);
#if !NSAPI_PPP_AVAILABLE
virtual NetworkStack *get_stack();
#endif // #if !NSAPI_PPP_AVAILABLE

View File

@ -1,26 +0,0 @@
/*
* 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 "QUECTEL_BG96_CellularPower.h"
#define DEVICE_READY_URC "CPIN:"
using namespace mbed;
QUECTEL_BG96_CellularPower::QUECTEL_BG96_CellularPower(ATHandler &atHandler) : AT_CellularPower(atHandler)
{
}

View File

@ -1,32 +0,0 @@
/*
* 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 QUECTEL_BG96_CELLULAR_POWER_H_
#define QUECTEL_BG96_CELLULAR_POWER_H_
#include "AT_CellularPower.h"
namespace mbed {
class QUECTEL_BG96_CellularPower : public AT_CellularPower {
public:
QUECTEL_BG96_CellularPower(ATHandler &atHandler);
};
} // namespace mbed
#endif // QUECTEL_BG96_CELLULAR_POWER_H_

View File

@ -34,6 +34,9 @@ static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
1, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
QUECTEL_UG96::QUECTEL_UG96(FileHandle *fh) : AT_CellularDevice(fh)

View File

@ -27,11 +27,6 @@ QUECTEL_UG96_CellularContext::~QUECTEL_UG96_CellularContext()
{
}
bool QUECTEL_UG96_CellularContext::stack_type_supported(nsapi_ip_stack_t stack_type)
{
return stack_type == IPV4_STACK ? true : false;
}
nsapi_error_t QUECTEL_UG96_CellularContext::do_user_authentication()
{
if (_pwd && _uname) {

View File

@ -27,7 +27,6 @@ public:
virtual ~QUECTEL_UG96_CellularContext();
protected:
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type);
virtual nsapi_error_t do_user_authentication();
};

View File

@ -17,7 +17,6 @@
#include "TELIT_HE910.h"
#include "TELIT_HE910_CellularPower.h"
#include "TELIT_HE910_CellularContext.h"
#include "AT_CellularNetwork.h"
using namespace mbed;
@ -30,6 +29,9 @@ static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
0, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
0, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
TELIT_HE910::TELIT_HE910(FileHandle *fh) : AT_CellularDevice(fh)
@ -46,11 +48,6 @@ AT_CellularPower *TELIT_HE910::open_power_impl(ATHandler &at)
return new TELIT_HE910_CellularPower(at);
}
AT_CellularContext *TELIT_HE910::create_context_impl(ATHandler &at, const char *apn)
{
return new TELIT_HE910_CellularContext(at, this, apn);
}
uint16_t TELIT_HE910::get_send_delay() const
{
return DEFAULT_DELAY_BETWEEN_AT_COMMANDS;

View File

@ -32,7 +32,6 @@ public:
protected: // AT_CellularDevice
virtual AT_CellularPower *open_power_impl(ATHandler &at);
virtual AT_CellularContext *create_context_impl(ATHandler &at, const char *apn);
virtual uint16_t get_send_delay() const;
virtual nsapi_error_t init();
};

View File

@ -1,35 +0,0 @@
/*
* 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 "TELIT_HE910_CellularContext.h"
namespace mbed {
TELIT_HE910_CellularContext::TELIT_HE910_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
AT_CellularContext(at, device, apn)
{
}
TELIT_HE910_CellularContext::~TELIT_HE910_CellularContext()
{
}
bool TELIT_HE910_CellularContext::stack_type_supported(nsapi_ip_stack_t stack_type)
{
return stack_type == IPV4_STACK ? true : false;
}
} /* namespace mbed */

View File

@ -1,35 +0,0 @@
/*
* 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 TELIT_HE910_CELLULARCONTEXT_H_
#define TELIT_HE910_CELLULARCONTEXT_H_
#include "AT_CellularContext.h"
namespace mbed {
class TELIT_HE910_CellularContext: public AT_CellularContext {
public:
TELIT_HE910_CellularContext(ATHandler &at, CellularDevice *device, const char *apn);
virtual ~TELIT_HE910_CellularContext();
protected:
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type);
};
} /* namespace mbed */
#endif // TELIT_HE910_CELLULARCONTEXT_H_

View File

@ -28,9 +28,24 @@ static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
AT_CellularNetwork::RegistrationModeDisable,// C_EREG
AT_CellularNetwork::RegistrationModeLAC, // C_GREG
AT_CellularNetwork::RegistrationModeLAC, // C_REG
0, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH, BC95_AT_Commands_Manual_V1.9
0, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH,
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
#else
static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
AT_CellularNetwork::RegistrationModeDisable,// C_EREG
AT_CellularNetwork::RegistrationModeLAC, // C_GREG
AT_CellularNetwork::RegistrationModeLAC, // C_REG
1, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
#endif
@ -38,7 +53,6 @@ UBLOX_AT::UBLOX_AT(FileHandle *fh) : AT_CellularDevice(fh)
{
#ifdef TARGET_UBLOX_C030_R41XM
AT_CellularBase::set_cellular_properties(cellular_properties);
#endif
}
UBLOX_AT::~UBLOX_AT()

View File

@ -39,11 +39,6 @@ NetworkStack *UBLOX_AT_CellularContext::get_stack()
return _stack;
}
bool UBLOX_AT_CellularContext::stack_type_supported(nsapi_ip_stack_t stack_type)
{
return stack_type == IPV4_STACK ? true : false;
}
void UBLOX_AT_CellularContext::do_connect()
{
_at.lock();

View File

@ -31,7 +31,6 @@ public:
protected:
virtual NetworkStack *get_stack();
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type);
private:

View File

@ -17,7 +17,6 @@
#include "UBLOX_PPP.h"
#include "UBLOX_PPP_CellularPower.h"
#include "UBLOX_PPP_CellularContext.h"
#include "AT_CellularNetwork.h"
using namespace mbed;
@ -30,15 +29,28 @@ static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
AT_CellularNetwork::RegistrationModeLAC, // C_REG
0, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH, BC95_AT_Commands_Manual_V1.9
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
#else
static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
AT_CellularNetwork::RegistrationModeDisable,// C_EREG
AT_CellularNetwork::RegistrationModeLAC, // C_GREG
AT_CellularNetwork::RegistrationModeLAC, // C_REG
1, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
0, // PROPERTY_IPV4V6_STACK
};
#endif
UBLOX_PPP::UBLOX_PPP(FileHandle *fh) : AT_CellularDevice(fh)
{
#ifdef TARGET_UBLOX_C027
AT_CellularBase::set_cellular_properties(cellular_properties);
#endif
}
UBLOX_PPP::~UBLOX_PPP()
@ -49,8 +61,3 @@ AT_CellularPower *UBLOX_PPP::open_power_impl(ATHandler &at)
{
return new UBLOX_PPP_CellularPower(at);
}
AT_CellularContext *UBLOX_PPP::create_context_impl(ATHandler &at, const char *apn)
{
return new UBLOX_PPP_CellularContext(at, this, apn);
}

View File

@ -29,7 +29,6 @@ public:
protected: // AT_CellularDevice
virtual AT_CellularPower *open_power_impl(ATHandler &at);
virtual AT_CellularContext *create_context_impl(ATHandler &at, const char *apn);
};
} // namespace mbed

View File

@ -1,35 +0,0 @@
/*
* 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 "UBLOX_PPP_CellularContext.h"
namespace mbed {
UBLOX_PPP_CellularContext::UBLOX_PPP_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
AT_CellularContext(at, device, apn)
{
}
UBLOX_PPP_CellularContext::~UBLOX_PPP_CellularContext()
{
}
bool UBLOX_PPP_CellularContext::stack_type_supported(nsapi_ip_stack_t stack_type)
{
return stack_type == IPV4_STACK ? true : false;
}
} /* namespace mbed */

View File

@ -1,35 +0,0 @@
/*
* 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 UBLOX_PPP_CELLULARCONTEXT_H_
#define UBLOX_PPP_CELLULARCONTEXT_H_
#include "AT_CellularContext.h"
namespace mbed {
class UBLOX_PPP_CellularContext: public AT_CellularContext {
public:
UBLOX_PPP_CellularContext(ATHandler &at, CellularDevice *device, const char *apn);
virtual ~UBLOX_PPP_CellularContext();
protected:
virtual bool stack_type_supported(nsapi_ip_stack_t stack_type);
};
} /* namespace mbed */
#endif // UBLOX_PPP_CELLULARCONTEXT_H_