As Of 13 06 2008

SMS reading and writing to database/ Testing

Task 10 - Completed

sms_tbl.jpg

The SMS received by the application has to written to a database so that it can be processed by other applications. The SMS will be written to the sms table and its status = 0. This can be used to identify who to process the SMS next.

status = 0 -> SMS Processor application
status = 1 -> Display application

Valid filed indicate the validity of the SMS. For example if the number of words in the SMS is less than what is required to generate poetry it is considered an invalid SMS.
Valid = 0 -> Invalid SMS
Valid = 1 -> Valid SMS

sms_log_tbl.jpg

The SMS will also be logged. The SMS will be logged in table “sms_log”. The information in the log file would be telephone number, data and time, the SMS received. Earlier system we logged the SMS in a file. This log file was created daily basis when the application started. This is a safe solution for the Singapore Science Centre since they close down the system daily basis. If the application never stops it may cause a problem. Therefore writing to a database seems the best solution. Following tool has been developed for this task. By pressing the “Delete SMS Logs” button it will delete all the contents of the “sms_log” table. It is advisable to backup contents of this table before performing the deletion if the data is valuable.

sms.jpg

SMS Reading

sms_reading.jpg

The methodology to read SMS from the modem is to issue AT command the go to sleep. This gives time for the modem to response. I have found out if we bombarded the modem with AT commands it would break the modem responses. What is happening is modem is receiving new AT commands before it can process current AT command. Making application sleep for short time, gives time for modem to response. The AT command to delete all the SMS should be issued at the very end of processing the received SMS. The reason for that is; if we issued it before processing we would get acknowledge response from the modem hindering the current process.

Generally I use separate project to communicate with the database. But in the case of SMS Reader I haven’t done that. Because the application only require two functions, writing to “sms” table and writing to “sms_log” table. Therefore I add 2 functions to SMSReader application. This helps to keep the application light weight.
AddSMSToLog – write sms, telephone, date/time to table “sms_log”
AddSMSToDB – write sms to table “sms”
Both functions simply open connection to database, write data, close connection.

Processing SMS from the database/ Testing

Task 12 –started

This may be the largest module. It takes the SMS written to the database by SMSReader and creates poetry. I have created command window base project called “DataProcessor”. I need to create many database related classes for this application since most of the processing would be done by this application. I decided to add new project called “db” for this purpose. Currently adding new functions to this db project.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.