Update sim7600ce.c

if (!str) 
    {
        return -1;
    }
This commit is contained in:
David Lin
2020-08-10 18:07:51 +08:00
committed by GitHub
parent ad5f75d4a3
commit 3e11773cc5

View File

@@ -47,6 +47,10 @@ static int sim7600ce_signal_quality_check(void)
}
str = strstr(echo.buffer, "+CSQ:");
if (!str)
{
return -1;
}
sscanf(str, "+CSQ:%d,%d", &rssi, &ber);
if (rssi == 99 || ber == 99) {
return -1;
@@ -300,6 +304,10 @@ static int sim7600ce_parse_domain(const char *host_name, char *host_ip, size_t h
int seg1, seg2, seg3, seg4;
str = strstr(echo.buffer, "+CDNSGIP: 1,");
if (!str)
{
return -1;
}
str += strlen("+CDNSGIP: 1,\"") + strlen(host_name) + 3;
sscanf(str, "%d.%d.%d.%d", &seg1, &seg2, &seg3, &seg4);
snprintf(host_ip, host_ip_len, "%d.%d.%d.%d", seg1, seg2, seg3, seg4);