mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-18 13:02:21 +02:00
feat(esp_modem): Add CMUX mode to C-API
Closes https://github.com/espressif/esp-protocols/issues/41
This commit is contained in:
@ -39,6 +39,7 @@ typedef enum esp_modem_dce_mode
|
||||
{
|
||||
ESP_MODEM_MODE_COMMAND, /**< Default mode after modem startup, used for sending AT commands */
|
||||
ESP_MODEM_MODE_DATA, /**< Used for switching to PPP mode for the modem to connect to a network */
|
||||
ESP_MODEM_MODE_CMUX, /**< Multiplexed terminal mode */
|
||||
} esp_modem_dce_mode_t;
|
||||
|
||||
/**
|
||||
|
@ -125,6 +125,13 @@ extern "C" esp_err_t esp_modem_set_mode(esp_modem_dce_t *dce_wrap, esp_modem_dce
|
||||
dce_wrap->dce->set_data();
|
||||
} else if (mode == ESP_MODEM_MODE_COMMAND) {
|
||||
dce_wrap->dce->exit_data();
|
||||
} else if (mode == ESP_MODEM_MODE_CMUX) {
|
||||
if (dce_wrap->dce->set_mode(modem_mode::CMUX_MODE) &&
|
||||
// automatically switch to data mode for the primary terminal
|
||||
dce_wrap->dce->set_mode(modem_mode::DATA_MODE)) {
|
||||
return ESP_OK;
|
||||
}
|
||||
return ESP_FAIL;
|
||||
} else {
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
Reference in New Issue
Block a user