MaJerle / GSM_AT_commands_parser

Platform independent, ANSI C AT commands parser for SIMcom GSM modules
171 stars 95 forks source link

Return cause of GPRS attach failure #3

Closed zzattack closed 7 years ago

zzattack commented 7 years ago

Currently we have no information about the cause when GPRS attaching fails. From the AT command description:

AT+CREG AT command gives information about the registration status and access technology of the serving cell.

Possible values of registration status are, 0 not registered, MT is not currently searching a new operator to register to 1 registered, home network 2 not registered, but MT is currently searching a new operator to register to 3 registration denied 4 unknown (e.g. out of GERAN/UTRAN/E-UTRAN coverage) 5 registered, roaming 6 registered for "SMS only", home network (applicable only when indicates E-UTRAN) 7 registered for "SMS only", roaming (applicable only when indicates E-UTRAN) 8 attached for emergency bearer services only (see NOTE 2) (not applicable) 9 registered for "CSFB not preferred", home network (applicable only when indicates E-UTRAN) 10 registered for "CSFB not preferred", roaming (applicable only when indicates E-UTRAN)

For return code '2' no immediate action is required, registration may succeed later on. But when return value is different, the user should be able to determine the next action according to the failure cause. If return code is '3', there is probably permanent error so it is useless to try again. If return code is '0', maybe there is bad reception and user can restart the GSM module?

MaJerle commented 7 years ago

Here is added for 0, 2 and 3 modes.

https://github.com/MaJerle/GSM_AT_commands_parser/commit/1a83a0de04c4fd831724f9daacca891984ed1616