mirror of https://github.com/ARMmbed/mbed-os.git
Add possibility to test URC handlers
parent
d83f52a2a1
commit
5778bc7326
|
@ -54,6 +54,8 @@ int ATHandler_stub::int_valid_count_table[kRead_int_table_size];
|
|||
int ATHandler_stub::int_count = kRead_int_table_size;
|
||||
bool ATHandler_stub::process_oob_urc = false;
|
||||
|
||||
std::vector<ATHandler_stub::urc_handler> ATHandler_stub::urc_handlers;
|
||||
|
||||
int ATHandler_stub::read_string_index = kRead_string_table_size;
|
||||
const char *ATHandler_stub::read_string_table[kRead_string_table_size];
|
||||
int ATHandler_stub::resp_stop_success_count = kResp_stop_count_default;
|
||||
|
@ -111,6 +113,7 @@ bool ATHandler::get_debug() const
|
|||
|
||||
ATHandler::~ATHandler()
|
||||
{
|
||||
ATHandler_stub::urc_handlers.clear();
|
||||
}
|
||||
|
||||
void ATHandler::inc_ref_count()
|
||||
|
@ -149,6 +152,9 @@ void ATHandler::set_urc_handler(const char *urc, mbed::Callback<void()> cb)
|
|||
return;
|
||||
}
|
||||
|
||||
ATHandler_stub::urc_handler handler = { .urc = urc, .cb = cb };
|
||||
ATHandler_stub::urc_handlers.push_back(handler);
|
||||
|
||||
if (ATHandler_stub::call_immediately) {
|
||||
cb();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "ATHandler.h"
|
||||
#include "FileHandle_stub.h"
|
||||
#include "Callback.h"
|
||||
#include "vector"
|
||||
|
||||
#ifndef __AT_HANDLER_STUB_H__
|
||||
#define __AT_HANDLER_STUB_H__
|
||||
|
@ -61,6 +62,12 @@ extern int int_count;
|
|||
extern int resp_stop_success_count;
|
||||
extern bool process_oob_urc;
|
||||
|
||||
struct urc_handler {
|
||||
const char *urc;
|
||||
mbed::Callback<void()> cb;
|
||||
};
|
||||
extern std::vector<urc_handler> urc_handlers;
|
||||
|
||||
extern bool get_debug_flag;
|
||||
bool is_get_debug_run();
|
||||
void get_debug_clear();
|
||||
|
|
Loading…
Reference in New Issue