Go to the source code of this file.
|
#define | MODEM_CHAT_MATCH(_match, _separators, _callback) |
|
#define | MODEM_CHAT_MATCH_WILDCARD(_match, _separators, _callback) |
|
#define | MODEM_CHAT_MATCH_INITIALIZER(_match, _separators, _callback, _wildcards, _partial) |
|
#define | MODEM_CHAT_MATCH_DEFINE(_sym, _match, _separators, _callback) const static struct modem_chat_match _sym = MODEM_CHAT_MATCH(_match, _separators, _callback) |
|
#define | MODEM_CHAT_MATCHES_DEFINE(_sym, ...) const static struct modem_chat_match _sym[] = {__VA_ARGS__} |
|
#define | MODEM_CHAT_SCRIPT_CMD_RESP(_request, _response_match) |
|
#define | MODEM_CHAT_SCRIPT_CMD_RESP_MULT(_request, _response_matches) |
|
#define | MODEM_CHAT_SCRIPT_CMD_RESP_NONE(_request, _timeout_ms) |
|
#define | MODEM_CHAT_SCRIPT_CMDS_DEFINE(_sym, ...) const struct modem_chat_script_chat _sym[] = {__VA_ARGS__} |
|
#define | MODEM_CHAT_SCRIPT_DEFINE(_sym, _script_chats, _abort_matches, _callback, _timeout_s) |
|
#define | MODEM_CHAT_SCRIPT_NO_ABORT_DEFINE(_sym, _script_chats, _callback, _timeout_s) |
|
#define | MODEM_CHAT_SCRIPT_EMPTY_DEFINE(_sym) MODEM_CHAT_SCRIPT_NO_ABORT_DEFINE(_sym, modem_chat_empty_script_chats, NULL, 0) |
|
◆ MODEM_CHAT_MATCH
#define MODEM_CHAT_MATCH |
( |
|
_match, |
|
|
|
_separators, |
|
|
|
_callback |
|
) |
| |
Value: { \
.match = (
uint8_t *)(_match), .match_size = (
uint8_t)(
sizeof(_match) - 1), \
.separators = (
uint8_t *)(_separators), \
.separators_size = (
uint8_t)(
sizeof(_separators) - 1), .wildcards =
false, \
.callback = _callback, \
}
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
◆ MODEM_CHAT_MATCH_DEFINE
#define MODEM_CHAT_MATCH_DEFINE |
( |
|
_sym, |
|
|
|
_match, |
|
|
|
_separators, |
|
|
|
_callback |
|
) |
| const static struct modem_chat_match _sym = MODEM_CHAT_MATCH(_match, _separators, _callback) |
◆ MODEM_CHAT_MATCH_INITIALIZER
#define MODEM_CHAT_MATCH_INITIALIZER |
( |
|
_match, |
|
|
|
_separators, |
|
|
|
_callback, |
|
|
|
_wildcards, |
|
|
|
_partial |
|
) |
| |
Value: { \
.match_size = (
uint8_t)(
sizeof(_match) - 1), \
.separators = (
uint8_t *)(_separators), \
.separators_size = (
uint8_t)(
sizeof(_separators) - 1), \
.wildcards = _wildcards, \
.partial = _partial, \
.callback = _callback, \
}
◆ MODEM_CHAT_MATCH_WILDCARD
#define MODEM_CHAT_MATCH_WILDCARD |
( |
|
_match, |
|
|
|
_separators, |
|
|
|
_callback |
|
) |
| |
Value: { \
.match = (
uint8_t *)(_match), .match_size = (
uint8_t)(
sizeof(_match) - 1), \
.separators = (
uint8_t *)(_separators), \
.separators_size = (
uint8_t)(
sizeof(_separators) - 1), .wildcards =
true, \
.callback = _callback, \
}
◆ MODEM_CHAT_MATCHES_DEFINE
#define MODEM_CHAT_MATCHES_DEFINE |
( |
|
_sym, |
|
|
|
... |
|
) |
| const static struct modem_chat_match _sym[] = {__VA_ARGS__} |
◆ MODEM_CHAT_SCRIPT_CMD_RESP
#define MODEM_CHAT_SCRIPT_CMD_RESP |
( |
|
_request, |
|
|
|
_response_match |
|
) |
| |
Value: { \
.request = (
uint8_t *)(_request), \
.request_size = (
uint16_t)(
sizeof(_request) - 1), \
.response_matches = &_response_match, \
.response_matches_size = 1, \
.timeout = 0, \
}
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
◆ MODEM_CHAT_SCRIPT_CMD_RESP_MULT
#define MODEM_CHAT_SCRIPT_CMD_RESP_MULT |
( |
|
_request, |
|
|
|
_response_matches |
|
) |
| |
Value: { \
.request = (
uint8_t *)(_request), \
.request_size = (
uint16_t)(
sizeof(_request) - 1), \
.response_matches = _response_matches, \
.response_matches_size =
ARRAY_SIZE(_response_matches), \
.timeout = 0, \
}
#define ARRAY_SIZE(array)
Number of elements in the given array.
Definition: util.h:127
◆ MODEM_CHAT_SCRIPT_CMD_RESP_NONE
#define MODEM_CHAT_SCRIPT_CMD_RESP_NONE |
( |
|
_request, |
|
|
|
_timeout_ms |
|
) |
| |
Value: { \
.request = (
uint8_t *)(_request), \
.request_size = (
uint16_t)(
sizeof(_request) - 1), \
.response_matches = NULL, \
.response_matches_size = 0, \
.timeout = _timeout_ms, \
}
◆ MODEM_CHAT_SCRIPT_CMDS_DEFINE
#define MODEM_CHAT_SCRIPT_CMDS_DEFINE |
( |
|
_sym, |
|
|
|
... |
|
) |
| const struct modem_chat_script_chat _sym[] = {__VA_ARGS__} |
◆ MODEM_CHAT_SCRIPT_DEFINE
#define MODEM_CHAT_SCRIPT_DEFINE |
( |
|
_sym, |
|
|
|
_script_chats, |
|
|
|
_abort_matches, |
|
|
|
_callback, |
|
|
|
_timeout_s |
|
) |
| |
Value:
.abort_matches = _abort_matches, \
.abort_matches_size =
ARRAY_SIZE(_abort_matches), \
.callback = _callback, \
.timeout = _timeout_s, \
}
Modem chat script.
Definition: chat.h:162
const struct modem_chat_script_chat * script_chats
Array of script chats.
Definition: chat.h:166
const char * name
Name of script.
Definition: chat.h:164
◆ MODEM_CHAT_SCRIPT_EMPTY_DEFINE
◆ MODEM_CHAT_SCRIPT_NO_ABORT_DEFINE
#define MODEM_CHAT_SCRIPT_NO_ABORT_DEFINE |
( |
|
_sym, |
|
|
|
_script_chats, |
|
|
|
_callback, |
|
|
|
_timeout_s |
|
) |
| |
Value:
_callback, _timeout_s)
const struct modem_chat_match modem_chat_empty_matches[0]
#define MODEM_CHAT_SCRIPT_DEFINE(_sym, _script_chats, _abort_matches, _callback, _timeout_s)
Definition: chat.h:179
◆ modem_chat_match_callback
typedef void(* modem_chat_match_callback) (struct modem_chat *chat, char **argv, uint16_t argc, void *user_data) |
Callback called when matching chat is received.
- Parameters
-
chat | Pointer to chat instance instance |
argv | Pointer to array of parsed arguments |
argc | Number of parsed arguments, arg 0 holds the exact match |
user_data | Free to use user data set during modem_chat_init() |
◆ modem_chat_script_callback
Callback called when script chat is received.
- Parameters
-
chat | Pointer to chat instance instance |
result | Result of script execution |
user_data | Free to use user data set during modem_chat_init() |
◆ modem_chat_script_result
Enumerator |
---|
MODEM_CHAT_SCRIPT_RESULT_SUCCESS | |
MODEM_CHAT_SCRIPT_RESULT_ABORT | |
MODEM_CHAT_SCRIPT_RESULT_TIMEOUT | |
◆ modem_chat_script_send_state
Enumerator |
---|
MODEM_CHAT_SCRIPT_SEND_STATE_IDLE | |
MODEM_CHAT_SCRIPT_SEND_STATE_REQUEST | |
MODEM_CHAT_SCRIPT_SEND_STATE_DELIMITER | |
◆ modem_chat_attach()
int modem_chat_attach |
( |
struct modem_chat * |
chat, |
|
|
struct modem_pipe * |
pipe |
|
) |
| |
Attach modem chat instance to pipe.
- Parameters
-
chat | Chat instance |
pipe | Pipe instance to attach Chat instance to |
- Returns
- 0 if successful
-
negative errno code if failure
- Note
- Chat instance is enabled if successful
◆ modem_chat_init()
Initialize modem pipe chat instance.
- Parameters
-
chat | Chat instance |
config | Configuration which shall be applied to Chat instance |
- Note
- Chat instance must be attached to pipe
◆ modem_chat_release()
void modem_chat_release |
( |
struct modem_chat * |
chat | ) |
|
Release pipe from chat instance.
- Parameters
-
◆ modem_chat_run_script()
Run script.
- Parameters
-
chat | Chat instance |
script | Script to run |
- Returns
- 0 if successful
-
-EBUSY if a script is currently running
-
-EPERM if modem pipe is not attached
-
-EINVAL if arguments or script is invalid
- Note
- Script runs until complete or aborted.
◆ modem_chat_run_script_async()
Run script asynchronously.
- Parameters
-
chat | Chat instance |
script | Script to run |
- Returns
- 0 if script successfully started
-
-EBUSY if a script is currently running
-
-EPERM if modem pipe is not attached
-
-EINVAL if arguments or script is invalid
- Note
- Script runs asynchronously until complete or aborted.
◆ modem_chat_script_abort()
void modem_chat_script_abort |
( |
struct modem_chat * |
chat | ) |
|
◆ modem_chat_script_run()
Run script asynchronously.
- Note
- Function exists for backwards compatibility and should be deprecated
- Parameters
-
chat | Chat instance |
script | Script to run |
- Returns
- 0 if script successfully started
-
-EBUSY if a script is currently running
-
-EPERM if modem pipe is not attached
-
-EINVAL if arguments or script is invalid
◆ modem_chat_any_match
◆ modem_chat_empty_matches
◆ modem_chat_empty_script_chats