|
Zephyr API Documentation 4.5.0-rc1
A Scalable Open Source RTOS
|
Modem Chat. More...
Data Structures | |
| struct | modem_chat_match |
| Modem chat match. More... | |
| struct | modem_chat_script_chat |
| Modem chat script chat. More... | |
| struct | modem_chat_script_completion_info |
| Extra information about the script that completed. More... | |
| struct | modem_chat_script |
| Modem chat script. More... | |
| struct | modem_chat |
| Chat instance internal context. More... | |
| struct | modem_chat_config |
| Chat configuration. More... | |
Macros | |
| #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) |
| #define | MODEM_CHAT_MATCH_WILDCARD_DEFINE(_sym, _match, _separators, _callback) |
| #define | MODEM_CHAT_MATCHES_DEFINE(_sym, ...) |
| #define | MODEM_CHAT_SCRIPT_CMD_RESP(_request, _response_match) |
| Command that expects a single response. | |
| #define | MODEM_CHAT_SCRIPT_CMD_RESP_MULT(_request, _response_matches) |
| Command that can handle multiple responses. | |
| #define | MODEM_CHAT_SCRIPT_CMD_RESP_NONE(_request, _timeout_ms) |
| Command that does not expect any response. | |
| #define | MODEM_CHAT_SCRIPT_CMD_RESP_COND(_request, _response_match, _run_check) |
| Command that expects a single response, conditionally run. | |
| #define | MODEM_CHAT_SCRIPT_CMD_RESP_MULT_COND(_request, _response_matches, _run_check) |
| Command that can handle multiple responses, conditionally run. | |
| #define | MODEM_CHAT_SCRIPT_CMD_RESP_NONE_COND(_request, _timeout_ms, _run_check) |
| Command that does not expect any response, conditionally run. | |
| #define | MODEM_CHAT_SCRIPT_CMDS_DEFINE(_sym, ...) |
| Define a static const modem_chat_script_chat array. | |
| #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) |
Typedefs | |
| typedef bool(* | modem_chat_run_check) (void *user_data) |
| Callback called to determine if a chat command should be run. | |
| 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. | |
| typedef void(* | modem_chat_script_callback) (struct modem_chat *chat, enum modem_chat_script_result result, const struct modem_chat_script_completion_info *info, void *user_data) |
| Callback called when script execution completes. | |
Functions | |
| int | modem_chat_init (struct modem_chat *chat, const struct modem_chat_config *config) |
| Initialize modem pipe chat instance. | |
| int | modem_chat_attach (struct modem_chat *chat, struct modem_pipe *pipe) |
| Attach modem chat instance to pipe. | |
| bool | modem_chat_is_running (struct modem_chat *chat) |
| Check if a script is running. | |
| int | modem_chat_run_script_async (struct modem_chat *chat, const struct modem_chat_script *script) |
| Run script asynchronously. | |
| int | modem_chat_run_script (struct modem_chat *chat, const struct modem_chat_script *script) |
| Run script. | |
| static int | modem_chat_script_run (struct modem_chat *chat, const struct modem_chat_script *script) |
| Run script asynchronously. | |
| void | modem_chat_script_abort (struct modem_chat *chat) |
| Abort script. | |
| void | modem_chat_release (struct modem_chat *chat) |
| Release pipe from chat instance. | |
| void | modem_chat_match_init (struct modem_chat_match *chat_match) |
| Initialize modem chat match. | |
| int | modem_chat_match_set_match (struct modem_chat_match *chat_match, const char *match) |
| Set match of modem chat match instance. | |
| int | modem_chat_match_set_separators (struct modem_chat_match *chat_match, const char *separators) |
| Set separators of modem chat match instance. | |
| void | modem_chat_match_set_callback (struct modem_chat_match *chat_match, modem_chat_match_callback callback) |
| Set modem chat match callback. | |
| void | modem_chat_match_set_partial (struct modem_chat_match *chat_match, bool partial) |
| Set modem chat match partial flag. | |
| void | modem_chat_match_enable_wildcards (struct modem_chat_match *chat_match, bool enable) |
| Set modem chat match wildcards flag. | |
| void | modem_chat_script_chat_init (struct modem_chat_script_chat *script_chat) |
| Initialize modem chat script chat. | |
| int | modem_chat_script_chat_set_request (struct modem_chat_script_chat *script_chat, const char *request) |
| Set request of modem chat script chat instance. | |
| int | modem_chat_script_chat_set_response_matches (struct modem_chat_script_chat *script_chat, const struct modem_chat_match *response_matches, uint16_t response_matches_size) |
| Set modem chat script chat matches. | |
| void | modem_chat_script_chat_set_timeout (struct modem_chat_script_chat *script_chat, uint16_t timeout_ms) |
| Set modem chat script chat timeout. | |
| void | modem_chat_script_init (struct modem_chat_script *script) |
| Initialize modem chat script. | |
| void | modem_chat_script_set_name (struct modem_chat_script *script, const char *name) |
| Set modem chat script name. | |
| int | modem_chat_script_set_script_chats (struct modem_chat_script *script, const struct modem_chat_script_chat *script_chats, uint16_t script_chats_size) |
| Set modem chat script chats. | |
| int | modem_chat_script_set_abort_matches (struct modem_chat_script *script, const struct modem_chat_match *abort_matches, uint16_t abort_matches_size) |
| Set modem chat script abort matches. | |
| void | modem_chat_script_set_callback (struct modem_chat_script *script, modem_chat_script_callback callback) |
| Set modem chat script callback. | |
| void | modem_chat_script_set_timeout (struct modem_chat_script *script, uint32_t timeout_s) |
| Set modem chat script timeout. | |
Variables | |
| const struct modem_chat_match | modem_chat_any_match |
| const struct modem_chat_match | modem_chat_empty_matches [0] |
| const struct modem_chat_script_chat | modem_chat_empty_script_chats [0] |
Modem Chat.
| #define MODEM_CHAT_MATCH | ( | _match, | |
| _separators, | |||
| _callback ) |
#include <zephyr/modem/chat.h>
| #define MODEM_CHAT_MATCH_DEFINE | ( | _sym, | |
| _match, | |||
| _separators, | |||
| _callback ) |
#include <zephyr/modem/chat.h>
| #define MODEM_CHAT_MATCH_INITIALIZER | ( | _match, | |
| _separators, | |||
| _callback, | |||
| _wildcards, | |||
| _partial ) |
#include <zephyr/modem/chat.h>
| #define MODEM_CHAT_MATCH_WILDCARD | ( | _match, | |
| _separators, | |||
| _callback ) |
#include <zephyr/modem/chat.h>
| #define MODEM_CHAT_MATCH_WILDCARD_DEFINE | ( | _sym, | |
| _match, | |||
| _separators, | |||
| _callback ) |
#include <zephyr/modem/chat.h>
| #define MODEM_CHAT_MATCHES_DEFINE | ( | _sym, | |
| ... ) |
#include <zephyr/modem/chat.h>
| #define MODEM_CHAT_SCRIPT_CMD_RESP | ( | _request, | |
| _response_match ) |
#include <zephyr/modem/chat.h>
Command that expects a single response.
| _request | Command string to send |
| _response_match | Expected response, as created by MODEM_CHAT_MATCH or variant |
| #define MODEM_CHAT_SCRIPT_CMD_RESP_COND | ( | _request, | |
| _response_match, | |||
| _run_check ) |
#include <zephyr/modem/chat.h>
Command that expects a single response, conditionally run.
| _request | Command string to send |
| _response_match | Expected response, as created by MODEM_CHAT_MATCH or variant |
| _run_check | Callback that controls whether the command is run or not |
| #define MODEM_CHAT_SCRIPT_CMD_RESP_MULT | ( | _request, | |
| _response_matches ) |
#include <zephyr/modem/chat.h>
Command that can handle multiple responses.
| _request | Command string to send |
| _response_matches | Accepted responses, as created by MODEM_CHAT_MATCHES_DEFINE |
| #define MODEM_CHAT_SCRIPT_CMD_RESP_MULT_COND | ( | _request, | |
| _response_matches, | |||
| _run_check ) |
#include <zephyr/modem/chat.h>
Command that can handle multiple responses, conditionally run.
| _request | Command string to send |
| _response_matches | Accepted responses, as created by MODEM_CHAT_MATCHES_DEFINE |
| _run_check | Callback that controls whether the command is run or not |
| #define MODEM_CHAT_SCRIPT_CMD_RESP_NONE | ( | _request, | |
| _timeout_ms ) |
#include <zephyr/modem/chat.h>
Command that does not expect any response.
| _request | Command string to send |
| _timeout_ms | Duration to wait in milliseconds before continuing the script |
| #define MODEM_CHAT_SCRIPT_CMD_RESP_NONE_COND | ( | _request, | |
| _timeout_ms, | |||
| _run_check ) |
#include <zephyr/modem/chat.h>
Command that does not expect any response, conditionally run.
| _request | Command string to send |
| _timeout_ms | Duration to wait in milliseconds before continuing the script |
| _run_check | Callback that controls whether the command is run or not |
| #define MODEM_CHAT_SCRIPT_CMDS_DEFINE | ( | _sym, | |
| ... ) |
#include <zephyr/modem/chat.h>
Define a static const modem_chat_script_chat array.
| _sym | Name of the created array |
| ... | Arbitrary number of MODEM_CHAT_SCRIPT_CMD_RESP and variant macros |
| #define MODEM_CHAT_SCRIPT_DEFINE | ( | _sym, | |
| _script_chats, | |||
| _abort_matches, | |||
| _callback, | |||
| _timeout_s ) |
#include <zephyr/modem/chat.h>
| #define MODEM_CHAT_SCRIPT_EMPTY_DEFINE | ( | _sym | ) |
#include <zephyr/modem/chat.h>
| #define MODEM_CHAT_SCRIPT_NO_ABORT_DEFINE | ( | _sym, | |
| _script_chats, | |||
| _callback, | |||
| _timeout_s ) |
#include <zephyr/modem/chat.h>
| typedef void(* modem_chat_match_callback) (struct modem_chat *chat, char **argv, uint16_t argc, void *user_data) |
#include <zephyr/modem/chat.h>
Callback called when matching chat is received.
| 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() |
| typedef bool(* modem_chat_run_check) (void *user_data) |
#include <zephyr/modem/chat.h>
Callback called to determine if a chat command should be run.
| user_data | Free to use user data set during modem_chat_init() |
| typedef void(* modem_chat_script_callback) (struct modem_chat *chat, enum modem_chat_script_result result, const struct modem_chat_script_completion_info *info, void *user_data) |
#include <zephyr/modem/chat.h>
Callback called when script execution completes.
chat context has already been reset at the callback point. Additional asynchronous scripts can be queued directly from the callback, but the internal object state cannot be usefully inspected. Access all information through info .| chat | Pointer to chat instance |
| result | Result of script execution |
| info | Extra information about the script that was running |
| user_data | Free to use user data set during modem_chat_init() |
#include <zephyr/modem/chat.h>
| Enumerator | |
|---|---|
| MODEM_CHAT_SCRIPT_RESULT_SUCCESS | |
| MODEM_CHAT_SCRIPT_RESULT_ABORT | |
| MODEM_CHAT_SCRIPT_RESULT_TIMEOUT | |
#include <zephyr/modem/chat.h>
| Enumerator | |
|---|---|
| MODEM_CHAT_SCRIPT_SEND_STATE_IDLE | |
| MODEM_CHAT_SCRIPT_SEND_STATE_REQUEST | |
| int modem_chat_attach | ( | struct modem_chat * | chat, |
| struct modem_pipe * | pipe ) |
#include <zephyr/modem/chat.h>
Attach modem chat instance to pipe.
| chat | Chat instance |
| pipe | Pipe instance to attach Chat instance to |
| int modem_chat_init | ( | struct modem_chat * | chat, |
| const struct modem_chat_config * | config ) |
#include <zephyr/modem/chat.h>
Initialize modem pipe chat instance.
| chat | Chat instance |
| config | Configuration which shall be applied to Chat instance |
| bool modem_chat_is_running | ( | struct modem_chat * | chat | ) |
#include <zephyr/modem/chat.h>
Check if a script is running.
| chat | Chat instance |
| void modem_chat_match_enable_wildcards | ( | struct modem_chat_match * | chat_match, |
| bool | enable ) |
#include <zephyr/modem/chat.h>
Set modem chat match wildcards flag.
| chat_match | Modem chat match instance |
| enable | Enable/disable Wildcards |
| void modem_chat_match_init | ( | struct modem_chat_match * | chat_match | ) |
#include <zephyr/modem/chat.h>
Initialize modem chat match.
| chat_match | Modem chat match instance |
| void modem_chat_match_set_callback | ( | struct modem_chat_match * | chat_match, |
| modem_chat_match_callback | callback ) |
#include <zephyr/modem/chat.h>
Set modem chat match callback.
| chat_match | Modem chat match instance |
| callback | Callback to set |
| int modem_chat_match_set_match | ( | struct modem_chat_match * | chat_match, |
| const char * | match ) |
#include <zephyr/modem/chat.h>
Set match of modem chat match instance.
| chat_match | Modem chat match instance |
| match | Match to set |
| 0 | if successful, negative errno code otherwise |
| void modem_chat_match_set_partial | ( | struct modem_chat_match * | chat_match, |
| bool | partial ) |
#include <zephyr/modem/chat.h>
Set modem chat match partial flag.
| chat_match | Modem chat match instance |
| partial | Partial flag to set |
| int modem_chat_match_set_separators | ( | struct modem_chat_match * | chat_match, |
| const char * | separators ) |
#include <zephyr/modem/chat.h>
Set separators of modem chat match instance.
| chat_match | Modem chat match instance |
| separators | Separators to set |
| 0 | if successful, negative errno code otherwise |
| void modem_chat_release | ( | struct modem_chat * | chat | ) |
| int modem_chat_run_script | ( | struct modem_chat * | chat, |
| const struct modem_chat_script * | script ) |
#include <zephyr/modem/chat.h>
Run script.
| chat | Chat instance |
| script | Script to run |
| int modem_chat_run_script_async | ( | struct modem_chat * | chat, |
| const struct modem_chat_script * | script ) |
#include <zephyr/modem/chat.h>
Run script asynchronously.
| chat | Chat instance |
| script | Script to run |
| void modem_chat_script_abort | ( | struct modem_chat * | chat | ) |
| void modem_chat_script_chat_init | ( | struct modem_chat_script_chat * | script_chat | ) |
#include <zephyr/modem/chat.h>
Initialize modem chat script chat.
| script_chat | Modem chat script chat instance |
| int modem_chat_script_chat_set_request | ( | struct modem_chat_script_chat * | script_chat, |
| const char * | request ) |
#include <zephyr/modem/chat.h>
Set request of modem chat script chat instance.
| script_chat | Modem chat script chat instance |
| request | Request to set |
| 0 | if successful, negative errno code otherwise |
| int modem_chat_script_chat_set_response_matches | ( | struct modem_chat_script_chat * | script_chat, |
| const struct modem_chat_match * | response_matches, | ||
| uint16_t | response_matches_size ) |
#include <zephyr/modem/chat.h>
Set modem chat script chat matches.
| script_chat | Modem chat script chat instance |
| response_matches | Response match array to set |
| response_matches_size | Size of response match array |
| 0 | if successful, negative errno code otherwise |
| void modem_chat_script_chat_set_timeout | ( | struct modem_chat_script_chat * | script_chat, |
| uint16_t | timeout_ms ) |
#include <zephyr/modem/chat.h>
Set modem chat script chat timeout.
| script_chat | Modem chat script chat instance |
| timeout_ms | Timeout in milliseconds |
| void modem_chat_script_init | ( | struct modem_chat_script * | script | ) |
#include <zephyr/modem/chat.h>
Initialize modem chat script.
| script | Modem chat script instance |
|
inlinestatic |
#include <zephyr/modem/chat.h>
Run script asynchronously.
| chat | Chat instance |
| script | Script to run |
| int modem_chat_script_set_abort_matches | ( | struct modem_chat_script * | script, |
| const struct modem_chat_match * | abort_matches, | ||
| uint16_t | abort_matches_size ) |
#include <zephyr/modem/chat.h>
Set modem chat script abort matches.
| script | Modem chat script instance |
| abort_matches | Abort match array to set |
| abort_matches_size | Size of abort match array |
| 0 | if successful, negative errno code otherwise |
| void modem_chat_script_set_callback | ( | struct modem_chat_script * | script, |
| modem_chat_script_callback | callback ) |
#include <zephyr/modem/chat.h>
Set modem chat script callback.
| script | Modem chat script instance |
| callback | Callback to set |
| void modem_chat_script_set_name | ( | struct modem_chat_script * | script, |
| const char * | name ) |
#include <zephyr/modem/chat.h>
Set modem chat script name.
| script | Modem chat script instance |
| name | Name to set |
| int modem_chat_script_set_script_chats | ( | struct modem_chat_script * | script, |
| const struct modem_chat_script_chat * | script_chats, | ||
| uint16_t | script_chats_size ) |
#include <zephyr/modem/chat.h>
Set modem chat script chats.
| script | Modem chat script instance |
| script_chats | Chat script array to set |
| script_chats_size | Size of chat script array |
| 0 | if successful, negative errno code otherwise |
| void modem_chat_script_set_timeout | ( | struct modem_chat_script * | script, |
| uint32_t | timeout_s ) |
#include <zephyr/modem/chat.h>
Set modem chat script timeout.
| script | Modem chat script instance |
| timeout_s | Timeout in seconds |
|
extern |
#include <zephyr/modem/chat.h>
|
extern |
#include <zephyr/modem/chat.h>
|
extern |
#include <zephyr/modem/chat.h>