mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #14716 from boraozgen/at-handler-buffer-size-config
Cellular: Add AT handler buffer size to configurationpull/14783/head
commit
16acae3bd0
|
@ -13,6 +13,7 @@ target_compile_definitions(mbed-stubs-connectivity
|
||||||
MBED_CONF_LORA_OVER_THE_AIR_ACTIVATION=true
|
MBED_CONF_LORA_OVER_THE_AIR_ACTIVATION=true
|
||||||
MBED_CONF_LORA_AUTOMATIC_UPLINK_MESSAGE=true
|
MBED_CONF_LORA_AUTOMATIC_UPLINK_MESSAGE=true
|
||||||
MBED_CONF_LORA_TX_MAX_SIZE=255
|
MBED_CONF_LORA_TX_MAX_SIZE=255
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
MDMTXD=NC
|
MDMTXD=NC
|
||||||
MDMRXD=NC
|
MDMRXD=NC
|
||||||
)
|
)
|
||||||
|
|
|
@ -50,8 +50,6 @@ class FileHandle;
|
||||||
extern const char *OK;
|
extern const char *OK;
|
||||||
extern const char *CRLF;
|
extern const char *CRLF;
|
||||||
|
|
||||||
#define BUFF_SIZE 32
|
|
||||||
|
|
||||||
/* AT Error types enumeration */
|
/* AT Error types enumeration */
|
||||||
enum DeviceErrorType {
|
enum DeviceErrorType {
|
||||||
DeviceErrorTypeNoError = 0,
|
DeviceErrorTypeNoError = 0,
|
||||||
|
@ -114,7 +112,7 @@ public:
|
||||||
|
|
||||||
/** Set callback function for URC
|
/** Set callback function for URC
|
||||||
*
|
*
|
||||||
* @param prefix URC text to look for, e.g. "+CMTI:". Maximum length is BUFF_SIZE.
|
* @param prefix URC text to look for, e.g. "+CMTI:". Maximum length is MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE.
|
||||||
* @param callback function to call on prefix, or 0 to remove callback
|
* @param callback function to call on prefix, or 0 to remove callback
|
||||||
*/
|
*/
|
||||||
void set_urc_handler(const char *prefix, Callback<void()> callback);
|
void set_urc_handler(const char *prefix, Callback<void()> callback);
|
||||||
|
@ -601,7 +599,7 @@ private: //Member variables
|
||||||
bool _is_fh_usable;
|
bool _is_fh_usable;
|
||||||
|
|
||||||
// should fit any prefix and int
|
// should fit any prefix and int
|
||||||
char _recv_buff[BUFF_SIZE];
|
char _recv_buff[MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE];
|
||||||
// reading position
|
// reading position
|
||||||
size_t _recv_len;
|
size_t _recv_len;
|
||||||
// reading length
|
// reading length
|
||||||
|
@ -630,7 +628,7 @@ private: //Member variables
|
||||||
size_t _max_resp_length;
|
size_t _max_resp_length;
|
||||||
|
|
||||||
// prefix set during resp_start and used to try matching possible information responses
|
// prefix set during resp_start and used to try matching possible information responses
|
||||||
char _info_resp_prefix[BUFF_SIZE];
|
char _info_resp_prefix[MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE];
|
||||||
bool _debug_on;
|
bool _debug_on;
|
||||||
bool _cmd_start;
|
bool _cmd_start;
|
||||||
bool _use_delimiter;
|
bool _use_delimiter;
|
||||||
|
@ -640,7 +638,7 @@ private: //Member variables
|
||||||
// eventqueue event id
|
// eventqueue event id
|
||||||
int _event_id;
|
int _event_id;
|
||||||
|
|
||||||
char _cmd_buffer[BUFF_SIZE];
|
char _cmd_buffer[MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
"plmn-fallback-auto" : {
|
"plmn-fallback-auto" : {
|
||||||
"help": "If manual PLMN is selected, use mode 4 manual/automatic in AT+COPS to try automatic mode if manual selection fails. Set to null to disable",
|
"help": "If manual PLMN is selected, use mode 4 manual/automatic in AT+COPS to try automatic mode if manual selection fails. Set to null to disable",
|
||||||
"value": null
|
"value": null
|
||||||
|
},
|
||||||
|
"at-handler-buffer-size" : {
|
||||||
|
"help": "Size of the AT handler buffer",
|
||||||
|
"value": 32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -683,7 +683,7 @@ int32_t ATHandler::read_int()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char buff[BUFF_SIZE];
|
char buff[MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE];
|
||||||
if (read_string(buff, sizeof(buff)) == 0) {
|
if (read_string(buff, sizeof(buff)) == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -960,7 +960,7 @@ void ATHandler::resp_start(const char *prefix, bool stop)
|
||||||
(void)fill_buffer(false);
|
(void)fill_buffer(false);
|
||||||
|
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
MBED_ASSERT(strlen(prefix) < BUFF_SIZE);
|
MBED_ASSERT(strlen(prefix) < MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE);
|
||||||
strcpy(_info_resp_prefix, prefix); // copy prefix so we can later use it without having to provide again for info_resp
|
strcpy(_info_resp_prefix, prefix); // copy prefix so we can later use it without having to provide again for info_resp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1225,7 +1225,7 @@ void ATHandler::handle_start(const char *cmd, const char *cmd_chr)
|
||||||
if (cmd_chr) {
|
if (cmd_chr) {
|
||||||
cmd_char_len = strlen(cmd_chr);
|
cmd_char_len = strlen(cmd_chr);
|
||||||
}
|
}
|
||||||
MBED_ASSERT((3 + strlen(cmd) + cmd_char_len) < BUFF_SIZE);
|
MBED_ASSERT((3 + strlen(cmd) + cmd_char_len) < MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE);
|
||||||
|
|
||||||
memcpy(_cmd_buffer + len, cmd, strlen(cmd));
|
memcpy(_cmd_buffer + len, cmd, strlen(cmd));
|
||||||
len += strlen(cmd);
|
len += strlen(cmd);
|
||||||
|
@ -1258,7 +1258,7 @@ void ATHandler::cmd_start_stop(const char *cmd, const char *cmd_chr, const char
|
||||||
|
|
||||||
nsapi_error_t ATHandler::at_cmd_str(const char *cmd, const char *cmd_chr, char *resp_buf, size_t buf_size, const char *format, ...)
|
nsapi_error_t ATHandler::at_cmd_str(const char *cmd, const char *cmd_chr, char *resp_buf, size_t buf_size, const char *format, ...)
|
||||||
{
|
{
|
||||||
MBED_ASSERT(strlen(cmd) < BUFF_SIZE);
|
MBED_ASSERT(strlen(cmd) < MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE);
|
||||||
lock();
|
lock();
|
||||||
|
|
||||||
handle_start(cmd, cmd_chr);
|
handle_start(cmd, cmd_chr);
|
||||||
|
|
|
@ -12,6 +12,7 @@ target_compile_definitions(${TEST_NAME}
|
||||||
MBED_CONF_CELLULAR_USE_SMS=1
|
MBED_CONF_CELLULAR_USE_SMS=1
|
||||||
MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN=NULL
|
MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN=NULL
|
||||||
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${TEST_NAME}
|
target_sources(${TEST_NAME}
|
||||||
|
|
|
@ -18,6 +18,7 @@ target_compile_definitions(${TEST_NAME}
|
||||||
MDMRXD=NC
|
MDMRXD=NC
|
||||||
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
||||||
MBED_CONF_CELLULAR_USE_SMS=1
|
MBED_CONF_CELLULAR_USE_SMS=1
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${TEST_NAME}
|
target_sources(${TEST_NAME}
|
||||||
|
|
|
@ -10,6 +10,7 @@ target_compile_definitions(${TEST_NAME}
|
||||||
DEVICE_SERIAL=1
|
DEVICE_SERIAL=1
|
||||||
DEVICE_INTERRUPTIN=1
|
DEVICE_INTERRUPTIN=1
|
||||||
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${TEST_NAME}
|
target_sources(${TEST_NAME}
|
||||||
|
|
|
@ -10,6 +10,7 @@ target_compile_definitions(${TEST_NAME}
|
||||||
DEVICE_SERIAL=1
|
DEVICE_SERIAL=1
|
||||||
DEVICE_INTERRUPTIN=1
|
DEVICE_INTERRUPTIN=1
|
||||||
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${TEST_NAME}
|
target_sources(${TEST_NAME}
|
||||||
|
|
|
@ -11,6 +11,7 @@ target_compile_definitions(${TEST_NAME}
|
||||||
DEVICE_INTERRUPTIN=1
|
DEVICE_INTERRUPTIN=1
|
||||||
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
||||||
MBED_CONF_CELLULAR_USE_SMS=1
|
MBED_CONF_CELLULAR_USE_SMS=1
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${TEST_NAME}
|
target_sources(${TEST_NAME}
|
||||||
|
|
|
@ -10,6 +10,7 @@ target_compile_definitions(${TEST_NAME}
|
||||||
DEVICE_SERIAL=1
|
DEVICE_SERIAL=1
|
||||||
DEVICE_INTERRUPTIN=1
|
DEVICE_INTERRUPTIN=1
|
||||||
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${TEST_NAME}
|
target_sources(${TEST_NAME}
|
||||||
|
|
|
@ -12,6 +12,7 @@ target_compile_definitions(${TEST_NAME}
|
||||||
DEVICE_SERIAL=1
|
DEVICE_SERIAL=1
|
||||||
DEVICE_INTERRUPTIN=1
|
DEVICE_INTERRUPTIN=1
|
||||||
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${TEST_NAME}
|
target_sources(${TEST_NAME}
|
||||||
|
|
|
@ -18,6 +18,7 @@ target_compile_definitions(${TEST_NAME}
|
||||||
DEVICE_SERIAL=1
|
DEVICE_SERIAL=1
|
||||||
DEVICE_INTERRUPTIN=1
|
DEVICE_INTERRUPTIN=1
|
||||||
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${TEST_NAME}
|
target_sources(${TEST_NAME}
|
||||||
|
|
|
@ -16,6 +16,7 @@ target_compile_definitions(${TEST_NAME}
|
||||||
DEVICE_SERIAL=1
|
DEVICE_SERIAL=1
|
||||||
DEVICE_INTERRUPTIN=1
|
DEVICE_INTERRUPTIN=1
|
||||||
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${TEST_NAME}
|
target_sources(${TEST_NAME}
|
||||||
|
|
|
@ -17,6 +17,7 @@ target_compile_definitions(${TEST_NAME}
|
||||||
DEVICE_SERIAL=1
|
DEVICE_SERIAL=1
|
||||||
DEVICE_INTERRUPTIN=1
|
DEVICE_INTERRUPTIN=1
|
||||||
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${TEST_NAME}
|
target_sources(${TEST_NAME}
|
||||||
|
|
|
@ -11,7 +11,7 @@ target_compile_definitions(${TEST_NAME}
|
||||||
DEVICE_SERIAL=1
|
DEVICE_SERIAL=1
|
||||||
DEVICE_INTERRUPTIN=1
|
DEVICE_INTERRUPTIN=1
|
||||||
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
|
||||||
|
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${TEST_NAME}
|
target_sources(${TEST_NAME}
|
||||||
|
|
Loading…
Reference in New Issue