All the provided events functions are stored inside the file “GSM_Events.c”.
This permits the user to customize the response to each kind of asynchronous stimulus differently, for example if the event is an incoming call, or a network connection lost.
NOTE: GSM APIs cannot be used from GSM_Events.c file! All the GSM Functions must be called from the Flyport Task and events must be used to inform TaskFlyport() (and related external libs files...) of what happens with asyncronous events. For example, if you receive as SMS, the event OnSMSReceived is raised by GSMTask, but only Flyport Task can use the SMSRead API to start the reading of a specific SMS!
Following is a list of events provided by firmware, and their parameters:
- OnRing (char* phoneNumber) – executed when a RING is received (for example for an Incoming Call). It provides the phoneNumber (if any) that excited the RING.
- OnNoCarrier (char* phoneNumber) – executed when the NO CARRIER message is received. It could be excited from a hang up from the phone number who sent the call, or if a TCP connection was lost.
- OnBusy (char* phoneNumber) – excited if Flyport reaches BUSY signal on phone line.
- OnSMSReceived (char* memtype, int index) – this event is a notification form new SMS received. It provides related storage memory type, and position index.
- OnSMSSentReport (int msgreference, int msgreport) – if user sends a message with delivery report, this event will be executed when the delivery SMS from operator is received. It provides related message reference number, and delivery report value.
- OnError (int error, int errorNumber) – Every kind of ERROR messages received during the execution of AT-commands with GSM module are notified to user, providing two different error numbers:
int error: Type of the error. Following are handled errors:
1 - OP_TIMEOUT: no reply from GSM module
2 - OP_SYNTAX_ERR: “ERROR” message → some parameters are not allowed
3 - OP_CMS_ERR: “+CMS :...” message → error on SMS
4 - OP_CME_ERR: “+CME :...” message → generic GSM error
5 - OP_NO_CARR_ERR: “NO CARRIER” message → only if not expected as response
6 - OP_SMTP_ERR: “+KSMTP ERROR : ...” message → SMTP error not expected
7 - OP_FTP_ERR: “+KFTP ERROR : ...” message → FTP error not expected
int errorNumber: Number of the error (if provided)
- OnRegistration (BYTE Status) – event executed every time the connection to network (or registration) changes its status. It provides new value of connection status. Values can be:
0 - NO_REG → not registered
1 - REG_SUCCESS → registered correctly on network
2 - SEARCHING → searching for operator
3 - REG_DENIED → registration on network denied
4 - UNKOWN → unknown status
5 - ROAMING → registered in roaming mode
- void OnLowPowerDisabled() - event raised when modem quits from LowPowerMode due to some external events (such as an incoming call, an SMS received, etc...)