Skip to content

Commit 1dc1995

Browse files
author
Ari Parkkila
committed
Cellular: Add NIDD for Quectel/BC95
1 parent 1664db2 commit 1dc1995

File tree

5 files changed

+43
-6
lines changed

5 files changed

+43
-6
lines changed

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
4242
1, // PROPERTY_IPV4_STACK
4343
1, // PROPERTY_IPV6_STACK
4444
0, // PROPERTY_IPV4V6_STACK
45-
0, // PROPERTY_NON_IP_PDP_TYPE
45+
1, // PROPERTY_NON_IP_PDP_TYPE
4646
0, // PROPERTY_AT_CGEREP
4747
};
4848

@@ -88,11 +88,18 @@ nsapi_error_t QUECTEL_BC95::init()
8888

8989
_at->lock();
9090
_at->flush();
91-
_at->at_cmd_discard("", ""); //Send AT
92-
93-
_at->at_cmd_discard("+CMEE", "=1"); // verbose responses
94-
95-
return _at->unlock_return_error();
91+
nsapi_error_t err = _at->at_cmd_discard("", ""); //Send AT
92+
if (!err) {
93+
err = _at->at_cmd_discard("+CMEE", "=1"); // verbose responses
94+
}
95+
if (!err) {
96+
err = _at->at_cmd_discard("+CFUN", "=", "%d", 1);
97+
}
98+
if (!err) {
99+
err = _at->get_last_error();
100+
}
101+
_at->unlock();
102+
return err;
96103
}
97104

98105
nsapi_error_t QUECTEL_BC95::set_baud_rate_impl(int baud_rate)

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularContext.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,9 @@ NetworkStack *QUECTEL_BC95_CellularContext::get_stack()
4444
}
4545
#endif // #if !NSAPI_PPP_AVAILABLE
4646

47+
const char* QUECTEL_BC95_CellularContext::get_nonip_context_type_str()
48+
{
49+
return "NONIP";
50+
}
51+
4752
} /* namespace mbed */

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularContext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class QUECTEL_BC95_CellularContext: public AT_CellularContext {
3030
#if !NSAPI_PPP_AVAILABLE
3131
virtual NetworkStack *get_stack();
3232
#endif // #if !NSAPI_PPP_AVAILABLE
33+
virtual const char* get_nonip_context_type_str();
3334
};
3435

3536
} /* namespace mbed */

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularNetwork.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,26 @@ nsapi_error_t QUECTEL_BC95_CellularNetwork::set_access_technology_impl(RadioAcce
3838

3939
return NSAPI_ERROR_OK;
4040
}
41+
42+
nsapi_error_t QUECTEL_BC95_CellularNetwork::clear()
43+
{
44+
nsapi_error_t err = AT_CellularNetwork::clear();
45+
#if MBED_CONF_CELLULAR_CONTROL_PLANE_OPT
46+
if (!err) {
47+
err = _at.at_cmd_discard("+CGDCONT", "=", "%d", 0);
48+
#ifdef MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN
49+
err = _at.at_cmd_discard("+CGDCONT", "=", "%d%s%s", 1, "NONIP", MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN);
50+
#endif
51+
if (!err) {
52+
err = _at.at_cmd_discard("+CIPCA", "=", "%d%d", 3, 1); // EPS Attach without PDN connection
53+
}
54+
if (!err) {
55+
_at.lock();
56+
_at.cmd_start("AT+NCONFIG=\"AUTOCONNECT\",\"TRUE\""); // disable auto connect to IP context
57+
_at.cmd_stop_read_resp();
58+
err = _at.unlock_return_error();
59+
}
60+
}
61+
#endif
62+
return err;
63+
}

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularNetwork.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class QUECTEL_BC95_CellularNetwork : public AT_CellularNetwork {
2929

3030
protected:
3131
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opRat);
32+
virtual nsapi_error_t clear();
3233
};
3334
} // namespace mbed
3435
#endif // QUECTEL_BC95_CELLULAR_NETWORK_H_

0 commit comments

Comments
 (0)