Specifications
7.4. SOFTWARE DESIGN
Email
In order to initiate an email send, the module must have successfully attached
to the GPRS APN and obtained an IP address. Originally, it was proposed
that the module’s on-board email client would be used for sending emails.
This client works by buffering the entire email locally and then attempts the
connection to the server to upload the mail. Unfortunately, the GM862 has
limited buffering capacity and is not able to buffer more than a few hundred
characters locally. The size of the email is thus limited and unsuitable for
this application which requires delivery of many records (where each record
requires approximately 50 characters).
Our solution is to implement a custom SMTP client. Once initiated, the
GSM module looks up the email hostname as specified by the user in the
EEPROM backup and opens a TCP socket on port 25 using the module’s
on-board TCP/IP stack. An extended time-out of 60 seconds is allowed to
establish this connection. This value was determined experimentally and is
required to cater for congested network conditions. Also, if the connection
fails, it is retried “retry counter” number of times. If it fails, the GSM state
changes to the “email send fail” state and awaits further instruction from the
requesting application.
Once a connection has been established to the email server, the FSM
performs a handshaking and begins a new email. This is a standard SMTP
client-server interaction which will not be discussed here. Once the mail is
opened and ready for contents, the GSM state changes to “sending email
body”. The application which requested the email transmission must now
pipe its contents across the same data channel (RS232 USART) as the GSM
module uses for commands. When the email has been composed, the host
application changes the GSM state to “deliver email”. The GSM FSM now
completes the email and awaits confirmation of successf ul delivery. In this
case, the GSM state changes to “email se nt”. If an error occurred, however,
the GSM FSM retries the transmission by disconnecting from the email serve r
and re-establishing the connection. Should this fail “retry
counter” number
of times, the state changes to “email send fail”. In either case, the GSM
FSM will remain in either of these states (success or fail) indefinitely and
83