Skip to content

Commit

Permalink
GEMALTO_CINTERION_CellularContext: add return value to enable_access_…
Browse files Browse the repository at this point in the history
…technology()
  • Loading branch information
pennam committed Nov 10, 2023
1 parent 915ad28 commit 64e0c1f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class AT_CellularContext : public CellularContext {
* @return NIDD context text, e.g. Non-IP or NONIP
*/
virtual const char *get_nonip_context_type_str();
virtual void enable_access_technology();
virtual nsapi_error_t enable_access_technology();
virtual void set_cid(int cid);

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,9 @@ bool AT_CellularContext::set_new_context(int cid)
return success;
}

void AT_CellularContext::enable_access_technology()
nsapi_error_t AT_CellularContext::enable_access_technology()
{
enable_access_technology();
return enable_access_technology();
}

nsapi_error_t AT_CellularContext::do_activate_context()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,30 +148,35 @@ NetworkStack *GEMALTO_CINTERION_CellularContext::get_stack()
}
#endif // NSAPI_PPP_AVAILABLE

void GEMALTO_CINTERION_CellularContext::enable_access_technology()
nsapi_error_t GEMALTO_CINTERION_CellularContext::enable_access_technology()
{
char *buffer = new char [8];
memset(buffer, 0, 8);
sprintf(buffer,"%08X", _band);
nsapi_error_t error = NSAPI_ERROR_OK;
char buffer[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};

snprintf(buffer, 9, "%08X", _band);
switch (_rat)
{
case CATM1:
_at.at_cmd_discard("^SXRAT", "=","%d", _rat);
_at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatM",buffer);
error = _at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatM", buffer);
break;

case CATNB:
_at.at_cmd_discard("^SXRAT", "=","%d", _rat);
_at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatNB",buffer);
error = _at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatNB", buffer);
break;

default:
break;
}
if (error != NSAPI_ERROR_OK) {
return error;
}

_at.at_cmd_discard("^SCFG", "=", "%s%s", "Tcp/withURCs", "on");
free(buffer);
error = _at.at_cmd_discard("^SXRAT", "=","%d", _rat);
if (error != NSAPI_ERROR_OK) {
return error;
}

return _at.at_cmd_discard("^SCFG", "=", "%s%s", "Tcp/withURCs", "on");
}

} /* namespace mbed */
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GEMALTO_CINTERION_CellularContext: public AT_CellularContext {
virtual NetworkStack *get_stack();
#endif // NSAPI_PPP_AVAILABLE
virtual nsapi_error_t do_user_authentication();
virtual void enable_access_technology();
virtual nsapi_error_t enable_access_technology();
};

} /* namespace mbed */
Expand Down

0 comments on commit 64e0c1f

Please sign in to comment.