diff --git a/UNITTESTS/features/cellular/framework/AT/athandler/athandlertest.cpp b/UNITTESTS/features/cellular/framework/AT/athandler/athandlertest.cpp index 4dfee8ec35..292f48fc6f 100644 --- a/UNITTESTS/features/cellular/framework/AT/athandler/athandlertest.cpp +++ b/UNITTESTS/features/cellular/framework/AT/athandler/athandlertest.cpp @@ -143,7 +143,7 @@ TEST_F(TestATHandler, test_ATHandler_remove_urc_handler) at.set_urc_handler(ch, cb); //This does nothing!!! - at.remove_urc_handler(ch, cb); + at.remove_urc_handler(ch); } TEST_F(TestATHandler, test_ATHandler_get_last_error) diff --git a/UNITTESTS/stubs/ATHandler_stub.cpp b/UNITTESTS/stubs/ATHandler_stub.cpp index b7523f2e7b..06e6fbfc09 100644 --- a/UNITTESTS/stubs/ATHandler_stub.cpp +++ b/UNITTESTS/stubs/ATHandler_stub.cpp @@ -105,7 +105,7 @@ nsapi_error_t ATHandler::set_urc_handler(const char *urc, mbed::Callback return ATHandler_stub::nsapi_error_value; } -void ATHandler::remove_urc_handler(const char *prefix, mbed::Callback callback) +void ATHandler::remove_urc_handler(const char *prefix) { } diff --git a/features/cellular/framework/AT/ATHandler.cpp b/features/cellular/framework/AT/ATHandler.cpp index b9fe397c1b..4d1e4b0866 100644 --- a/features/cellular/framework/AT/ATHandler.cpp +++ b/features/cellular/framework/AT/ATHandler.cpp @@ -159,7 +159,7 @@ void ATHandler::set_is_filehandle_usable(bool usable) nsapi_error_t ATHandler::set_urc_handler(const char *prefix, mbed::Callback callback) { - if (find_urc_handler(prefix, &callback)) { + if (find_urc_handler(prefix)) { tr_warn("URC already added with prefix: %s", prefix); return NSAPI_ERROR_OK; } @@ -186,12 +186,12 @@ nsapi_error_t ATHandler::set_urc_handler(const char *prefix, mbed::Callback callback) +void ATHandler::remove_urc_handler(const char *prefix) { struct oob_t *current = _oobs; struct oob_t *prev = NULL; while (current) { - if (strcmp(prefix, current->prefix) == 0 && current->cb == callback) { + if (strcmp(prefix, current->prefix) == 0) { if (prev) { prev->next = current->next; } else { @@ -205,11 +205,11 @@ void ATHandler::remove_urc_handler(const char *prefix, mbed::Callback ca } } -bool ATHandler::find_urc_handler(const char *prefix, mbed::Callback *callback) +bool ATHandler::find_urc_handler(const char *prefix) { struct oob_t *oob = _oobs; while (oob) { - if (strcmp(prefix, oob->prefix) == 0 && oob->cb == *callback) { + if (strcmp(prefix, oob->prefix) == 0) { return true; } oob = oob->next; diff --git a/features/cellular/framework/AT/ATHandler.h b/features/cellular/framework/AT/ATHandler.h index e9dc690fb6..8c5713d166 100644 --- a/features/cellular/framework/AT/ATHandler.h +++ b/features/cellular/framework/AT/ATHandler.h @@ -109,9 +109,8 @@ public: /** Remove urc handler from linked list of urc's * * @param prefix Register urc prefix for callback. Urc could be for example "+CMTI: " - * @param callback Callback, which is called if urc is found in AT response */ - void remove_urc_handler(const char *prefix, mbed::Callback callback); + void remove_urc_handler(const char *prefix); ATHandler *_nextATHandler; // linked list @@ -515,7 +514,7 @@ private: const char *mem_str(const char *dest, size_t dest_len, const char *src, size_t src_len); // check is urc is already added - bool find_urc_handler(const char *prefix, mbed::Callback *callback); + bool find_urc_handler(const char *prefix); // print contents of a buffer to trace log void debug_print(char *p, int len); diff --git a/features/cellular/framework/AT/AT_CellularNetwork.cpp b/features/cellular/framework/AT/AT_CellularNetwork.cpp index 0575ded434..c99c6eaa79 100644 --- a/features/cellular/framework/AT/AT_CellularNetwork.cpp +++ b/features/cellular/framework/AT/AT_CellularNetwork.cpp @@ -56,12 +56,12 @@ AT_CellularNetwork::~AT_CellularNetwork() for (int type = 0; type < CellularNetwork::C_MAX; type++) { if (has_registration((RegistrationType)type) != RegistrationModeDisable) { - _at.remove_urc_handler(at_reg[type].urc_prefix, _urc_funcs[type]); + _at.remove_urc_handler(at_reg[type].urc_prefix); } } - _at.remove_urc_handler("NO CARRIER", callback(this, &AT_CellularNetwork::urc_no_carrier)); - _at.remove_urc_handler("+CGEV:", callback(this, &AT_CellularNetwork::urc_cgev)); + _at.remove_urc_handler("NO CARRIER"); + _at.remove_urc_handler("+CGEV:"); free_credentials(); } @@ -456,7 +456,7 @@ nsapi_error_t AT_CellularNetwork::disconnect() _at.restore_at_timeout(); - _at.remove_urc_handler("+CGEV:", callback(this, &AT_CellularNetwork::urc_cgev)); + _at.remove_urc_handler("+CGEV:"); call_network_cb(NSAPI_STATUS_DISCONNECTED); return _at.unlock_return_error(); diff --git a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp index 4cfaedff63..d9f2a35a4c 100644 --- a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +++ b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp @@ -39,9 +39,9 @@ GEMALTO_CINTERION_CellularStack::GEMALTO_CINTERION_CellularStack(ATHandler &atHa GEMALTO_CINTERION_CellularStack::~GEMALTO_CINTERION_CellularStack() { - _at.remove_urc_handler("^SIS:", mbed::Callback(this, &GEMALTO_CINTERION_CellularStack::urc_sis)); - _at.remove_urc_handler("^SISW:", mbed::Callback(this, &GEMALTO_CINTERION_CellularStack::urc_sisw)); - _at.remove_urc_handler("^SISR:", mbed::Callback(this, &GEMALTO_CINTERION_CellularStack::urc_sisr)); + _at.remove_urc_handler("^SIS:"); + _at.remove_urc_handler("^SISW:"); + _at.remove_urc_handler("^SISR:"); } GEMALTO_CINTERION_CellularStack::CellularSocket *GEMALTO_CINTERION_CellularStack::find_socket(int sock_id) diff --git a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularPower.cpp b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularPower.cpp index 019f728721..f6e35196a0 100644 --- a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularPower.cpp +++ b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularPower.cpp @@ -32,5 +32,5 @@ nsapi_error_t QUECTEL_BG96_CellularPower::set_device_ready_urc_cb(mbed::Callback void QUECTEL_BG96_CellularPower::remove_device_ready_urc_cb(mbed::Callback callback) { - _at.remove_urc_handler(DEVICE_READY_URC, callback); + _at.remove_urc_handler(DEVICE_READY_URC); }