|
ESPHome 2026.11.0
|
Data Structures | |
| class | ModemComponent |
Typedefs | |
| using | DceFactory |
Functions | |
| bool | collect_reply (char *buf, size_t size, size_t &len, const char *data, size_t data_len, bool whole) |
| Add data to the reply in buf (size includes the terminator, len is the current length). | |
| ReplyEnd | reply_end (const char *data, size_t len, bool skip_first) |
| How the reply ends. | |
| size_t | flatten_reply (char *reply, size_t len) |
| Puts a raw reply on one line for the log and drops the final OK; returns the new length. | |
| int | registration_from_reply (const char *reply, const char *prefix) |
| The <stat> after the first comma of the "<n>,<stat>" line starting with prefix (+CREG: and friends), or REGISTRATION_UNKNOWN; a one-field line is an unsolicited notification and is skipped. | |
| int | merge_registration (int lte, int legacy) |
| The state that tells most from the AT+CEREG? (LTE) and AT+CREG? (2G and 3G) results. | |
| bool | reply_names_unsupported (const char *reply) |
| Whether an error reply says the command is not supported (+CME ERROR: 4 or its verbose text) | |
| const char * | sim_status (char *reply) |
| The SIM status in a flattened AT+CPIN? reply, cut before any following line, or nullptr. | |
| bool | is_registered (int registration) |
| Registered on a network, so the data attach can be requested. | |
| ESPHOME_LOG_TAG (TAG, "modem") | |
| PROGMEM_STRING_TABLE (ModemStateStrings, "DISABLED", "ENABLING", "SYNCED", "CONNECTING", "WAIT_IP", "CONNECTED", "DISCONNECTING", "UNKNOWN") | |
| PROGMEM_STRING_TABLE (ModemFaultStrings, "", "Modem not responding", "Configured baud rate failed", "init_at command failed", "SIM not ready", "SIM locked", "SIM PIN not sent; check pin_code", "PIN record not saved", "APN or radio setup failed", "No network attachment", "Network registration denied", "PPP link failed", "Modem teardown failed") | |
| PROGMEM_STRING_TABLE (RegistrationStrings, "not searching", "registered", "searching", "denied", "unknown", "roaming", "registered for SMS only", "roaming for SMS only", "emergency only", "registered, CSFB not preferred", "roaming, CSFB not preferred", "other") | |
| PROGMEM_STRING_TABLE (CommandResultStrings, "OK", "FAIL", "TIMEOUT") | |
| PROGMEM_STRING_TABLE (NetworkModeStrings, "No service", "GSM", "GPRS", "EDGE", "WCDMA", "HSDPA", "HSUPA", "HSPA", "LTE", "Unknown") | |
Variables | |
| ModemComponent * | global_modem_component = nullptr |
Definition at line 86 of file modem_component.h.
|
strong |
| Enumerator | |
|---|---|
| CONNECT_STEP_START | |
| CONNECT_STEP_RADIO_ON | |
| CONNECT_STEP_ATTACH_REQUESTED | |
Definition at line 40 of file modem_component.h.
|
strong |
Definition at line 54 of file modem_component.h.
|
strong |
| Enumerator | |
|---|---|
| MODEM_STATE_DISABLED | |
| MODEM_STATE_ENABLING | |
| MODEM_STATE_SYNCED | |
| MODEM_STATE_CONNECTING | |
| MODEM_STATE_WAIT_IP | |
| MODEM_STATE_CONNECTED | |
| MODEM_STATE_DISCONNECTING | |
Definition at line 29 of file modem_component.h.
|
strong |
| Enumerator | |
|---|---|
| PIN_SAVE_DONE | |
| PIN_SAVE_PENDING | |
| PIN_SAVE_FAILED | |
Definition at line 78 of file modem_component.h.
|
strong |
| Enumerator | |
|---|---|
| PIN_STEP_IDLE | |
| PIN_STEP_SAVING | |
| PIN_STEP_SENT | |
Definition at line 71 of file modem_component.h.
|
strong |
| Enumerator | |
|---|---|
| REPLY_END_NONE | |
| REPLY_END_OK | |
| REPLY_END_ERROR | |
Definition at line 9 of file at_reply.h.
|
strong |
| Enumerator | |
|---|---|
| SIM_RESULT_READY | |
| SIM_RESULT_RETRY | |
| SIM_RESULT_LOCKED | |
| SIM_RESULT_HALT | |
Definition at line 46 of file modem_component.h.
| bool esphome::modem::collect_reply | ( | char * | buf, |
| size_t | size, | ||
| size_t & | len, | ||
| const char * | data, | ||
| size_t | data_len, | ||
| bool | whole ) |
Add data to the reply in buf (size includes the terminator, len is the current length).
With whole, data is everything received so far (UART) and replaces the reply; otherwise it is one new CMUX frame and is appended. A reply longer than the buffer keeps its newest bytes, where the final line is. Returns true when bytes were dropped.
Definition at line 10 of file at_reply.cpp.
| esphome::modem::ESPHOME_LOG_TAG | ( | TAG | , |
| "modem" | ) |
| size_t esphome::modem::flatten_reply | ( | char * | reply, |
| size_t | len ) |
Puts a raw reply on one line for the log and drops the final OK; returns the new length.
Definition at line 63 of file at_reply.cpp.
|
inline |
Registered on a network, so the data attach can be requested.
SMS only and "CSFB not preferred" limit the circuit switched side, not the packet data attach; emergency only (8) is not a registration.
Definition at line 34 of file at_reply.h.
| int esphome::modem::merge_registration | ( | int | lte, |
| int | legacy ) |
The state that tells most from the AT+CEREG? (LTE) and AT+CREG? (2G and 3G) results.
Definition at line 106 of file at_reply.cpp.
| esphome::modem::PROGMEM_STRING_TABLE | ( | CommandResultStrings | , |
| "OK" | , | ||
| "FAIL" | , | ||
| "TIMEOUT" | ) |
| esphome::modem::PROGMEM_STRING_TABLE | ( | ModemFaultStrings | , |
| "" | , | ||
| "Modem not responding" | , | ||
| "Configured baud rate failed" | , | ||
| "init_at command failed" | , | ||
| "SIM not ready" | , | ||
| "SIM locked" | , | ||
| "SIM PIN not sent; check pin_code" | , | ||
| "PIN record not saved" | , | ||
| "APN or radio setup failed" | , | ||
| "No network attachment" | , | ||
| "Network registration denied" | , | ||
| "PPP link failed" | , | ||
| "Modem teardown failed" | ) |
| esphome::modem::PROGMEM_STRING_TABLE | ( | ModemStateStrings | , |
| "DISABLED" | , | ||
| "ENABLING" | , | ||
| "SYNCED" | , | ||
| "CONNECTING" | , | ||
| "WAIT_IP" | , | ||
| "CONNECTED" | , | ||
| "DISCONNECTING" | , | ||
| "UNKNOWN" | ) |
| esphome::modem::PROGMEM_STRING_TABLE | ( | NetworkModeStrings | , |
| "No service" | , | ||
| "GSM" | , | ||
| "GPRS" | , | ||
| "EDGE" | , | ||
| "WCDMA" | , | ||
| "HSDPA" | , | ||
| "HSUPA" | , | ||
| "HSPA" | , | ||
| "LTE" | , | ||
| "Unknown" | ) |
| esphome::modem::PROGMEM_STRING_TABLE | ( | RegistrationStrings | , |
| "not searching" | , | ||
| "registered" | , | ||
| "searching" | , | ||
| "denied" | , | ||
| "unknown" | , | ||
| "roaming" | , | ||
| "registered for SMS only" | , | ||
| "roaming for SMS only" | , | ||
| "emergency only" | , | ||
| " | registered, | ||
| CSFB not preferred" | , | ||
| " | roaming, | ||
| CSFB not preferred" | , | ||
| "other" | ) |
| int esphome::modem::registration_from_reply | ( | const char * | reply, |
| const char * | prefix ) |
The <stat> after the first comma of the "<n>,<stat>" line starting with prefix (+CREG: and friends), or REGISTRATION_UNKNOWN; a one-field line is an unsolicited notification and is skipped.
Definition at line 88 of file at_reply.cpp.
| ReplyEnd esphome::modem::reply_end | ( | const char * | data, |
| size_t | len, | ||
| bool | skip_first ) |
How the reply ends.
Only a complete final result line counts, so ERROR inside a payload line does not; a +CME ERROR line counts even without its reason, which a dropped CMUX frame can take away. With skip_first, the first line is a cut-off fragment and is ignored.
Definition at line 34 of file at_reply.cpp.
| bool esphome::modem::reply_names_unsupported | ( | const char * | reply | ) |
Whether an error reply says the command is not supported (+CME ERROR: 4 or its verbose text)
Definition at line 133 of file at_reply.cpp.
| const char * esphome::modem::sim_status | ( | char * | reply | ) |
The SIM status in a flattened AT+CPIN? reply, cut before any following line, or nullptr.
Definition at line 147 of file at_reply.cpp.
| ModemComponent * esphome::modem::global_modem_component = nullptr |
Definition at line 39 of file modem_component.cpp.