Skip to content

Bug(esp_modem): get_network_registration_state fails to parse state value from AT+CEREG? response (IDFGH-16683) #923

@JellevanKraaij

Description

@JellevanKraaij

Description

The function get_network_registration_state fails to correctly parse the network registration status from the AT+CEREG? command response (e.g., +CEREG: 2,1).

Steps to Reproduce

Call get_network_registration_state.

The underlying AT command returns a valid response like +CEREG: 2,1.

The function attempts to use std::from_chars to parse the state.

Expected Behavior

The function should correctly extract the integer state (e.g., 1) and return command_result::OK.

Actual Behavior

The function fails because it attempts to parse the state value starting at the preceding comma delimiter (e.g., attempting to parse ,1 instead of 1), leading to an std::errc::invalid_argument error from std::from_chars. The function incorrectly returns command_result::FAIL.

Proposed Solution

The parsing index needs to be adjusted by one (+ 1) to skip the comma delimiter, ensuring std::from_chars starts at the first digit of the state value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions