16static constexpr int REGISTRATION_NOT_SEARCHING = 0;
17static constexpr int REGISTRATION_HOME = 1;
18static constexpr int REGISTRATION_SEARCHING = 2;
19static constexpr int REGISTRATION_DENIED = 3;
20static constexpr int REGISTRATION_REPORTED_UNKNOWN = 4;
21static constexpr int REGISTRATION_ROAMING = 5;
22static constexpr int REGISTRATION_SMS_ONLY_HOME = 6;
23static constexpr int REGISTRATION_SMS_ONLY_ROAMING = 7;
24static constexpr int REGISTRATION_EMERGENCY_ONLY = 8;
25static constexpr int REGISTRATION_CSFB_NOT_PREFERRED_HOME = 9;
26static constexpr int REGISTRATION_CSFB_NOT_PREFERRED_ROAMING = 10;
28static constexpr int REGISTRATION_UNKNOWN = -1;
29static constexpr int REGISTRATION_UNSUPPORTED = -2;
30static constexpr int REGISTRATION_NO_ANSWER = -3;
35 return registration == REGISTRATION_HOME || registration == REGISTRATION_ROAMING ||
36 (registration >= REGISTRATION_SMS_ONLY_HOME && registration <= REGISTRATION_SMS_ONLY_ROAMING) ||
37 (registration >= REGISTRATION_CSFB_NOT_PREFERRED_HOME &&
38 registration <= REGISTRATION_CSFB_NOT_PREFERRED_ROAMING);
44bool collect_reply(
char *buf,
size_t size,
size_t &
len,
const char *data,
size_t data_len,
bool whole);
bool is_registered(int registration)
Registered on a network, so the data attach can be requested.
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),...
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.
bool reply_names_unsupported(const char *reply)
Whether an error reply says the command is not supported (+CME ERROR: 4 or its verbose text)
int merge_registration(int lte, int legacy)
The state that tells most from the AT+CEREG? (LTE) and AT+CREG? (2G and 3G) results.
const char * sim_status(char *reply)
The SIM status in a flattened AT+CPIN? reply, cut before any following line, or nullptr.
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).