mirror of https://github.com/ARMmbed/mbed-os.git
Cellular: Add NIDD for U-blox/N2XX
parent
f695e278ea
commit
85baad850f
|
@ -34,6 +34,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
||||||
1, // PROPERTY_IPV4_STACK
|
1, // PROPERTY_IPV4_STACK
|
||||||
0, // PROPERTY_IPV6_STACK
|
0, // PROPERTY_IPV6_STACK
|
||||||
0, // PROPERTY_IPV4V6_STACK
|
0, // PROPERTY_IPV4V6_STACK
|
||||||
|
1, // PROPERTY_NON_IP_PDP_TYPE
|
||||||
|
0, // PROPERTY_AT_CGEREP
|
||||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,6 +61,11 @@ void UBLOX_N2XX::NPIN_URC()
|
||||||
_at->read_string(simstr, sizeof(simstr));
|
_at->read_string(simstr, sizeof(simstr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AT_CellularNetwork *UBLOX_N2XX::open_network_impl(ATHandler &at)
|
||||||
|
{
|
||||||
|
return new UBLOX_N2XX_CellularNetwork(at, *this);
|
||||||
|
}
|
||||||
|
|
||||||
AT_CellularContext *UBLOX_N2XX::create_context_impl(ATHandler &at, const char *apn, bool cp_req, bool nonip_req)
|
AT_CellularContext *UBLOX_N2XX::create_context_impl(ATHandler &at, const char *apn, bool cp_req, bool nonip_req)
|
||||||
{
|
{
|
||||||
return new UBLOX_N2XX_CellularContext(at, this, apn, cp_req, nonip_req);
|
return new UBLOX_N2XX_CellularContext(at, this, apn, cp_req, nonip_req);
|
||||||
|
@ -94,8 +101,8 @@ nsapi_error_t UBLOX_N2XX::get_sim_state(SimState &state)
|
||||||
_at->lock();
|
_at->lock();
|
||||||
_at->flush();
|
_at->flush();
|
||||||
//Special case: Command put in cmd_chr to make a 1 liner
|
//Special case: Command put in cmd_chr to make a 1 liner
|
||||||
_at->at_cmd_str("", "+CFUN=1", simstr, sizeof(simstr));
|
error = _at->at_cmd_str("", "+CFUN=1", simstr, sizeof(simstr));
|
||||||
error = _at->unlock_return_error();
|
_at->unlock();
|
||||||
|
|
||||||
int len = strlen(simstr);
|
int len = strlen(simstr);
|
||||||
if (len > 0 || error == NSAPI_ERROR_OK) {
|
if (len > 0 || error == NSAPI_ERROR_OK) {
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "AT_CellularNetwork.h"
|
#include "AT_CellularNetwork.h"
|
||||||
#include "UBLOX_N2XX_CellularSMS.h"
|
#include "UBLOX_N2XX_CellularSMS.h"
|
||||||
#include "UBLOX_N2XX_CellularContext.h"
|
#include "UBLOX_N2XX_CellularContext.h"
|
||||||
|
#include "UBLOX_N2XX_CellularNetwork.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
|
@ -50,6 +51,7 @@ public:
|
||||||
|
|
||||||
protected: // AT_CellularDevice
|
protected: // AT_CellularDevice
|
||||||
|
|
||||||
|
virtual AT_CellularNetwork *open_network_impl(ATHandler &at);
|
||||||
virtual AT_CellularContext *create_context_impl(ATHandler &at, const char *apn, bool cp_req = false, bool nonip_req = false);
|
virtual AT_CellularContext *create_context_impl(ATHandler &at, const char *apn, bool cp_req = false, bool nonip_req = false);
|
||||||
#if MBED_CONF_CELLULAR_USE_SMS
|
#if MBED_CONF_CELLULAR_USE_SMS
|
||||||
virtual AT_CellularSMS *open_sms_impl(ATHandler &at);
|
virtual AT_CellularSMS *open_sms_impl(ATHandler &at);
|
||||||
|
|
|
@ -44,4 +44,9 @@ NetworkStack *UBLOX_N2XX_CellularContext::get_stack()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char* UBLOX_N2XX_CellularContext::get_nonip_context_type_str()
|
||||||
|
{
|
||||||
|
return "NONIP";
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace mbed */
|
} /* namespace mbed */
|
||||||
|
|
|
@ -34,6 +34,7 @@ protected:
|
||||||
virtual NetworkStack *get_stack();
|
virtual NetworkStack *get_stack();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
virtual const char* get_nonip_context_type_str();
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace mbed */
|
} /* namespace mbed */
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019, 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_N2XX_CellularNetwork.h"
|
||||||
|
|
||||||
|
using namespace mbed;
|
||||||
|
|
||||||
|
UBLOX_N2XX_CellularNetwork::UBLOX_N2XX_CellularNetwork(ATHandler &atHandler, AT_CellularDevice &device) : AT_CellularNetwork(atHandler, device)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
nsapi_error_t UBLOX_N2XX_CellularNetwork::clear()
|
||||||
|
{
|
||||||
|
nsapi_error_t err = AT_CellularNetwork::clear();
|
||||||
|
#if MBED_CONF_CELLULAR_CONTROL_PLANE_OPT
|
||||||
|
if (!err) {
|
||||||
|
#ifdef MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN
|
||||||
|
(void) _at.at_cmd_discard("+CGDCONT", "=", "%d%s%s", 1, "NONIP", MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN);
|
||||||
|
#endif
|
||||||
|
(void) _at.at_cmd_discard("+CIPCA", "=", "%d%d", 3, 1); // EPS Attach without PDN connection
|
||||||
|
_at.lock();
|
||||||
|
_at.cmd_start("AT+NCONFIG=\"AUTOCONNECT\",\"FALSE\""); // disable auto connect to IP context
|
||||||
|
_at.cmd_stop_read_resp();
|
||||||
|
_at.unlock();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsapi_error_t UBLOX_N2XX_CellularNetwork::set_ciot_optimization_config(CIoT_Supported_Opt supported_opt,
|
||||||
|
CIoT_Preferred_UE_Opt preferred_opt,
|
||||||
|
Callback<void(CIoT_Supported_Opt)> network_support_cb)
|
||||||
|
{
|
||||||
|
_ciotopt_network_support_cb = network_support_cb;
|
||||||
|
nsapi_error_t err = _at.at_cmd_discard("+CRTDCP", "=", "%d", 1);
|
||||||
|
return err;
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019, 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_N2XX_CELLULAR_NETWORK_H_
|
||||||
|
#define UBLOX_N2XX_CELLULAR_NETWORK_H_
|
||||||
|
|
||||||
|
#include "AT_CellularNetwork.h"
|
||||||
|
|
||||||
|
namespace mbed {
|
||||||
|
|
||||||
|
class UBLOX_N2XX_CellularNetwork : public AT_CellularNetwork {
|
||||||
|
public:
|
||||||
|
UBLOX_N2XX_CellularNetwork(ATHandler &atHandler, AT_CellularDevice &device);
|
||||||
|
virtual nsapi_error_t clear();
|
||||||
|
virtual nsapi_error_t set_ciot_optimization_config(CIoT_Supported_Opt supported_opt,
|
||||||
|
CIoT_Preferred_UE_Opt preferred_opt,
|
||||||
|
Callback<void(CIoT_Supported_Opt)> network_support_cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mbed
|
||||||
|
|
||||||
|
#endif // UBLOX_N2XX_CELLULAR_NETWORK_H_
|
Loading…
Reference in New Issue