mirror of https://github.com/ARMmbed/mbed-os.git
Cellular: Fixed network registration on Gemalto AT drivers
parent
9d0e3d8797
commit
90fe9de8ed
|
@ -41,21 +41,28 @@ NetworkStack *GEMALTO_CINTERION_CellularNetwork::get_stack()
|
|||
|
||||
bool GEMALTO_CINTERION_CellularNetwork::get_modem_stack_type(nsapi_ip_stack_t requested_stack)
|
||||
{
|
||||
#if NSAPI_PPP_AVAILABLE
|
||||
return (requested_stack == IPV4_STACK || requested_stack == IPV6_STACK);
|
||||
#else
|
||||
if (GEMALTO_CINTERION_Module::get_model() == GEMALTO_CINTERION_Module::ModelBGS2) {
|
||||
return (requested_stack == IPV4_STACK);
|
||||
}
|
||||
return (requested_stack == IPV4_STACK || requested_stack == IPV6_STACK);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GEMALTO_CINTERION_CellularNetwork::has_registration(RegistrationType reg_type)
|
||||
AT_CellularNetwork::RegistrationMode GEMALTO_CINTERION_CellularNetwork::has_registration(RegistrationType reg_type)
|
||||
{
|
||||
if (GEMALTO_CINTERION_Module::get_model() == GEMALTO_CINTERION_Module::ModelEMS31) {
|
||||
return (reg_type == C_EREG);
|
||||
return (reg_type == C_EREG) ? RegistrationModeLAC : RegistrationModeDisable;
|
||||
}
|
||||
if (GEMALTO_CINTERION_Module::get_model() == GEMALTO_CINTERION_Module::ModelBGS2) {
|
||||
return (reg_type == C_REG || reg_type == C_GREG);
|
||||
if (reg_type == C_GREG) {
|
||||
return RegistrationModeEnable;
|
||||
}
|
||||
return (reg_type == C_REG) ? RegistrationModeLAC : RegistrationModeDisable;
|
||||
}
|
||||
return (reg_type == C_REG || reg_type == C_GREG || reg_type == C_EREG);
|
||||
return (reg_type == C_REG || reg_type == C_GREG || reg_type == C_EREG) ? RegistrationModeLAC : RegistrationModeDisable;
|
||||
}
|
||||
|
||||
nsapi_error_t GEMALTO_CINTERION_CellularNetwork::set_access_technology_impl(RadioAccessTechnology opsAct)
|
||||
|
|
|
@ -32,7 +32,7 @@ protected:
|
|||
virtual NetworkStack *get_stack();
|
||||
#endif // NSAPI_PPP_AVAILABLE
|
||||
|
||||
virtual bool has_registration(RegistrationType reg_type);
|
||||
virtual RegistrationMode has_registration(RegistrationType reg_type);
|
||||
|
||||
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack);
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ void GEMALTO_CINTERION_CellularStack::urc_sis()
|
|||
{
|
||||
int sock_id = _at.read_int();
|
||||
int urc_code = _at.read_int();
|
||||
//tr_debug("Socket ready: id=%d, urc=%d", sock_id, urc_code);
|
||||
CellularSocket *sock = find_socket(sock_id);
|
||||
if (sock) {
|
||||
if (urc_code == 5) { // data available
|
||||
|
@ -79,7 +78,6 @@ void GEMALTO_CINTERION_CellularStack::urc_sisw()
|
|||
{
|
||||
int sock_id = _at.read_int();
|
||||
int urc_code = _at.read_int();
|
||||
//tr_debug("TX event: socket=%d, urc=%d", sock_id, urc_code);
|
||||
CellularSocket *sock = find_socket(sock_id);
|
||||
if (sock) {
|
||||
if (urc_code == 1) { // ready
|
||||
|
@ -100,7 +98,6 @@ void GEMALTO_CINTERION_CellularStack::urc_sisr()
|
|||
{
|
||||
int sock_id = _at.read_int();
|
||||
int urc_code = _at.read_int();
|
||||
//tr_debug("RX event: socket=%d, urc=%d", sock_id, urc_code);
|
||||
CellularSocket *sock = find_socket(sock_id);
|
||||
if (sock) {
|
||||
if (urc_code == 1) { // data available
|
||||
|
@ -221,11 +218,9 @@ nsapi_error_t GEMALTO_CINTERION_CellularStack::create_socket_impl(CellularSocket
|
|||
char paramTag[16];
|
||||
int paramTagLen = _at.read_string(paramTag, sizeof(paramTag));
|
||||
if (paramTagLen > 0) {
|
||||
//tr_debug("paramTag %s", paramTag);
|
||||
char paramValue[100 + 1]; // APN may be up to 100 chars
|
||||
int paramValueLen = _at.read_string(paramValue, sizeof(paramValue));
|
||||
if (paramValueLen >= 0) {
|
||||
//tr_debug("paramValue %s", paramValue);
|
||||
if (strcmp(paramTag, "srvType") == 0) {
|
||||
if (strcmp(paramValue, "Socket") == 0) {
|
||||
tr_debug("srvType %s", paramValue);
|
||||
|
@ -298,13 +293,12 @@ nsapi_size_or_error_t GEMALTO_CINTERION_CellularStack::socket_sendto_impl(Cellul
|
|||
socket_close_impl(socket->id);
|
||||
_at.clear_error();
|
||||
}
|
||||
// socket->started = false;
|
||||
|
||||
if (socket_open_defer(socket, &address) != NSAPI_ERROR_OK) {
|
||||
tr_error("Failed to open socket %d", socket->id);
|
||||
return NSAPI_ERROR_NO_SOCKET;
|
||||
}
|
||||
socket->remoteAddress = address;
|
||||
// return NSAPI_ERROR_WOULD_BLOCK;
|
||||
_at.resp_start("^SISW:");
|
||||
int sock_id = _at.read_int();
|
||||
int urc_code = _at.read_int();
|
||||
|
|
|
@ -46,13 +46,21 @@ protected:
|
|||
void *buffer, nsapi_size_t size);
|
||||
|
||||
private:
|
||||
// find the socket handle based on socket identifier
|
||||
CellularSocket *find_socket(int sock_id);
|
||||
|
||||
// socket URC handlers as per Cinterion AT manuals
|
||||
void urc_sis();
|
||||
void urc_sisw();
|
||||
void urc_sisr();
|
||||
|
||||
// sockets need a connection profile, one profile is enough to support single stack sockets
|
||||
bool create_connection_profile();
|
||||
|
||||
// socket open need to be deferred until sendto due to BGS2 does not support UDP server endpoint
|
||||
nsapi_error_t socket_open_defer(CellularSocket *socket, const SocketAddress *address = NULL);
|
||||
|
||||
// connection profile configuration needs Access Point Name
|
||||
const char *_apn;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue