Sms Based Info System
description
Transcript of Sms Based Info System
23
2008SMS Based Information System
Dharmsinh Desai University, earlier known as D. D. I. T., was established in June 1968 by Late Dharmsinh Desai (Member of Parliament), with the view to provide quality education in Engineering and Technology to the youth of Gujarat and was affil iated to Gujarat University, Started with Diploma and Degree course in Chemical Engineering it has grow as a best Insti tute of Gujarat offering Graduates and Post-Graduates level courses in various disciplines and ultimately has become a State University in the year 2005. The insti tute became autonomous in 1999 with approval from UGC and Government of Gujarat and became a Deemed University accredited by N. B. A. in the year 2000. This University offers Graduates and Post-Graduates level courses in various disciplines and Master of Computer Applications (MCA) is being run under Facility of Technology. The University has also received ISO 9001:2000 Certification from ISOQAR.
Dharmsinh Desai University believes not only in providing quality education, but also in overall development of its students in the form of, to be disciplined, socially accountable to the society and responsible cit izen of our country. Dharmsinh Desai University is being guided by the vision of its founding Chairman Late Shri Dharmsinh Desai, the present Chairman Dr. Narendra Desai Under the strong and dynamic leadership of Vice-Chancellor Dr. H.M. Desai.
DDU Profile
23
2008SMS Based Information System
Project Name : SMS Based Information System
Project Description: This System is the knowledge based Remote Application which includes Database of information, The User can get the Information on their mobile handsets by a single SMS.e.g. User sends SMS to find the meaning of “Culture” word then Our System will Response by sending the meaning of that word.
Development Team: Jaldip G. Vala (MCA-60)Chintan G. Kanabar (MCA-23)Nishant P. Shah (MCA-47)
Internal Guide : Mr. J. J. ShahLecturer,MCA Department,DDU – Nadiad.
Platform : 1. Visual Studio .NET 2005 (Enterprise Architecture / Enterprise Developer / Professional) VB.NET.
2. Microsoft Windows XP Professional (SP2)3. mCore Messaging Tools4. MS Access
Methodology : OOSD
Tools Used : 1) Microsoft Visio 20032) Nokia AT commands
Project Profile
23
2008SMS Based Information System
Project Definition:
This system is the knowledge based Remote Application which includes database of information. The user can get the information on their mobile handsets by a single SMS. e.g.” User sends SMS as ‘’Dignity’’ to our System then System will Response by sending the meaning of that word.
. Preliminary Investigation:
Project Feasibility:
Technical Feasibility:-
This project requires one computer connected through Mobile phone which has connecting facil ity.
Economic Feasibility:-
This project is economically feasible as no new computers or hardware has to be installed in the computer.
Operational Feasibility:-
As we are using VB.NET 2005 which provides a very good look and feel to the user and SMS Based Information System is used by all the peoples who wants to get information via SMS from their mobile phones
Planning
23
2008SMS Based Information System
Requirement Specification:
Hardware Requirement:
Main Memory: 256 MB RAM or More.
Secondary Memory: 40 GB Hard drive.
Processor : above 1.0 GHz Intel or AMD processor
Any Nokia Connectivi ty enabled Mobile
Connecting Cable like FSBUS cable
Software Requirement:
Visual Studio 2005
MS Access
mCore Messaging Library and Tools
Nokia PC Suite
.NET Framework to execute Applicat ion
23
2008SMS Based Information System
Visual Basic.NET:
Microsoft Visual Basic (called VB) is a new programming language designed for building a wide range of enterprise applications that run on the .NET Framework. An evolution of Microsoft Visual Basic, Visual Basic .NET is simple, modern, type safe, and object oriented. Visual Basic .NET code is compiled as managed code, which means it benefits from the services of the common language runtime. These services include language interoperability, garbage collection, enhanced security, and improved versioning support. Visual Basic .NET leverages the Microsoft .NET Framework to provide a rich set of built-in types that you can use when building your own classes. A subset of these types can be used for interacting with other .NET languages. The .NET Framework also provides an extensive class library that you can use and extend with Visual Basic .NET.As with all object-oriented languages, Visual Basic .NET promotes reuse through classes. A class defines a type as well as the methods and properties that are used to interact with instances of the type. For example, a class that represents an animal might include methods that represent the animal’s activities (such as eating and sleeping) and properties that represent i ts characterist ics (such as color or size). The main design goal of Visual Basic .NET is simplicity rather than pure power. You do give up a li ttle processing power, but you get cool stuff like type safety and automatic garbage collection in return. Visual Basic .NET can make your code more stable and productive overall, meaning that you can more than make up that lost power in the long run. Visual Basic .NET offers several key benefits for programmers:
o Simplicityo Consistencyo Modernityo Object-orientationo Type-safetyo Scalabili tyo Version supporto Compatibil ityo Flexibility
Features of Tools being used
23
2008SMS Based Information System
mCore Messaging Tools:
mCore™ .NET SMS Library is a powerful and easy to use class library that can be used to build powerful .NET applications for mobile messaging using GSM mobile phones or GSM modems connected to serial port or infrared port. Using mCore™ .NET SMS Library in your applications allows you to:
Send text messages Read incoming text messages Send WAP Push over SMS Send vCard over SMS Send vCalendar over SMS Set various messaging and network parameters (PIN, SMSC, Message Memory etc) Read modem and network information (Manufacturer, IMEI, Model, Signal Strength etc)
Rich set of properties, methods and its compatibility with wide range of GSM mobile phones and GSM modems makes mCore™ .NET SMS Library the best choice for any type of mobile messaging application.
Key Features:
1. Send Text Messages Send text messages by simply specifying the destination mobile number and the text
message. Send text messages with delivery report request. Can send 160 character messages with default 7-bit character encoding (as per ETSI
GSM 03.38) and 140 character messages with 8-bit encoding. Can send 70 character messages in international languages using 16-bit Unicode (UCS2)
encoding. Allows delivery format selection for long messages (e.g. Truncate, Split, Concatenate and
Formatted Split). Can send flash (alert) messages that are immediately displayed on destination phone
screen. Specify validity period of the text message. Allows changing of SMSC stored in modem or phone. Supports destination numbers and SMSC number in international as well as national
format. Allows setting of minimum time delay interval two consecutive messages to avoid
delivery failure during a network busy period. Specify maximum number of retries in case of delivery failure when sending text
message.
2. Send WAP Push
23
2008SMS Based Information System
Send WAP Push (Service Indication) over SMS through GSM Modem or Phone by specifying URL and text message as per WAP-167-ServiceInd-20010731-a specification.
Option to specify action type (e.g. signal-low, signal-medium, signal-high etc). Option to specify content created or last modified date and time. Option to specify si-expires attribute i.e. a date and time when the WAP Push link will
expire.
3. Send vCard
Send vCard over SMS through GSM Modem or Phone by specifying Name, Home Contact Details, Business Contact Details etc as vCard version 2.1 specification.
Option to specify Home Phone, Business Phone & Mobile Phone numbers separately. Option to specify Home Street Address and Business Street Address separately. Option to specify other vCard details viz. Email, Website, Comment etc.
4. Send vCalendar
Send vCalendar over SMS through GSM Modem or Phone by specifying Event Description & Summary, Event Location, Start Date & Time, End Date & Time etc as per vCalendar version 1.0 specification.
Option to specify Event Date & Time or Event Duration. Option to specify Event description and/or Event summary. Automatically picks up GMT Time-Zone settings of the sending computer to ensure that
the vCalendar is saved in recipient's mobile device as per its Time-Zone settings.
5. General Features
All members (properties & methods) that require serial communication are completely thread safe and are queued inside the library for sequential execution.
Extensive use of enumerators to simplify programming. Well categorized and structured exceptions. Connect to GSM Modem or Phone through physical serial port or virtual serial port (e.g.
Infrared, USB to Serial Converter, Bluetooth etc). Specify serial communication parameters like COM Port, Baud Rate, Stop Bits, Parity,
Flow Control etc. Specify PIN for connecting to network using PIN protected SIM card. Read various network information (e.g. GSM Signal Strength, Network Identification
etc) Extensive error handling with error codes and descriptions to easily identify error cause. Option to selectively display error message box with customization of message box title. Log option with option to log only error messages or logging of errors as well as status. Automatically checks if modem can send messages in PDU mode. Send modem initialization AT commands
23
2008SMS Based Information System
2) Database Design
Table Name: Dictionary
Field Name Data Type Size Constrains
Word Char 25 Primary Key
Description Char 300 Not Null
23
2008SMS Based Information System
Coding:
Public Class frmMain Private WithEvents objSMS As New mCore.SMS Private strMyAppName As String = "mCore™ (VB.NET Demo)" Private blnFormLoaded As Boolean = False
Private Sub frmMain_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed objSMS.Dispose() objSMS = Nothing End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim i As Integer
cboPort.Items.Add("Select Port") For i = 1 To 256 cboPort.Items.Add("COM" & i.ToString) Next cboPort.SelectedIndex = 0 With cboBaudRate .Items.Add("110") .Items.Add("300") .Items.Add("1200") .Items.Add("2400") .Items.Add("4800") .Items.Add("9600") .Items.Add("14400")
Implementation
23
2008SMS Based Information System
.Items.Add("19200") .Items.Add("38400") .Items.Add("57600") .Items.Add("115200") .Items.Add("230400") .Items.Add("460800") .Items.Add("921600") End With cboBaudRate.SelectedIndex = cboBaudRate.FindString(CType(objSMS.BaudRate, Integer).ToString)
With cboDataBits .Items.Add("4") .Items.Add("5") .Items.Add("6") .Items.Add("7") .Items.Add("8") End With cboDataBits.SelectedIndex = cboDataBits.FindString(CType(objSMS.DataBits, Integer).ToString)
With cboParity .Items.Add("None") .Items.Add("Odd") .Items.Add("Even") .Items.Add("Mark") .Items.Add("Space") End With cboParity.SelectedIndex = CType(objSMS.Parity, Integer) With cboStopBits .Items.Add("1") .Items.Add("2") .Items.Add("1.5") End With cboStopBits.SelectedIndex = CType(objSMS.StopBits, Integer) - 1 With cboFlowControl .Items.Add("None") .Items.Add("Hardware") .Items.Add("Xon/Xoff") End With
23
2008SMS Based Information System
cboFlowControl.SelectedIndex = CType(objSMS.FlowControl, Integer) txtSendDelay.Text = (objSMS.SendDelay / 1000).ToString txtSendRetry.Text = objSMS.SendRetry.ToString txtTimeout.Text = (objSMS.Timeout / 1000).ToString
chkDisableCheckPIN.Checked = objSMS.DisableCheckPIN
objSMS.ReadIntervalTimeout = 100 objSMS.DelayAfterPIN = 20000
chkIncomingCall.Checked = objSMS.IncomingCallIndication objSMS.Queue.Enabled = True chkQueue.Checked = objSMS.Queue.Enabled With cboMsgMemory .Items.Add("SIM") .Items.Add("Phone") .Items.Add("SIM+Phone") End With cboMsgMemory.SelectedIndex = 0
With cboLongMsg .Items.Add("Truncate") .Items.Add("Simple Split") .Items.Add("Formatted Split") .Items.Add("Concatenate") End With cboLongMsg.SelectedIndex = CType(objSMS.LongMessage, Integer) With cboEncoding .Items.Add("Default Alphabet") .Items.Add("ANSI (8-Bit)") .Items.Add("Unicode (16-Bit)") End With cboencoding.SelectedIndex=CType(objSMS.Encoding, Integer)
lblNoteSMS.Text = "NOTE: For non-english language messages you must select encoding type as Unicode (16-Bit)." & vbCrLf & "Use a suitable keyboard/IME to type non-english messages."
txtValidity.Text = "24" With cboValidity
23
2008SMS Based Information System
.Items.Add("Min") .Items.Add("Hour") .Items.Add("Day") .Items.Add("Week") End With cboValidity.SelectedIndex = 1
With cboSMSQPriority .Items.Add("High") .Items.Add("Normal") .Items.Add("Low") End With cboSMSQPriority.SelectedIndex = 1
chkSMSQueue.Checked = False cboSMSQPriority.Enabled = False lblSMSQPriority.Enabled = False
End Sub
Private Sub cmdConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click
Try If cboPort.SelectedIndex = 0 Then MsgBox("Select a serial port", MsgBoxStyle.Critical, strMyAppName) Exit Sub End If
cmdConnect.Text = "Please Wait..." cmdConnect.Enabled = False cmdDisconnect.Enabled = False
SetCommParameters()
If objSMS.Connect() Then cmdConnect.Enabled = False cmdDisconnect.Enabled = True
txtSMSC.Text = objSMS.SMSC
23
2008SMS Based Information System
Select Case objSMS.MessageMemory Case mCore.SMS.EnumMessageMemory.SM : cboMsgMemory.SelectedIndex = 0 Case mCore.SMS.EnumMessageMemory.ME : cboMsgMemory.SelectedIndex = 1 Case mCore.SMS.EnumMessageMemory.MT : cboMsgMemory.SelectedIndex = 2 End Select
MsgBox("Connection successful", MsgBoxStyle.Information, strMyAppName)
Else MsgBox("Connection error", MsgBoxStyle.Critical, strMyAppName)
cmdConnect.Enabled = True cmdDisconnect.Enabled = False End If
MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
End Try
Try cmdConnect.Text = "Connect" If objSMS.IsConnected Then cmdConnect.Enabled = False cmdDisconnect.Enabled = True Else cmdConnect.Enabled = True cmdDisconnect.Enabled = False End If Catch ex As Exception
End Try End Sub
23
2008SMS Based Information System
Private Sub cmdDisconnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDisconnect.Click
cmdDisconnect.Text = "Please Wait..." cmdDisconnect.Enabled = False cmdConnect.Enabled = False
Try objSMS.Disconnect() cmdConnect.Enabled = True cmdDisconnect.Enabled = False
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
End Try
cmdDisconnect.Text = "Disconnect" End Sub
Private Sub cmdRefreshSettings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRefreshSettings.Click
Try If cboPort.SelectedIndex = 0 Then MsgBox("Select a serial port", MsgBoxStyle.Critical, strMyAppName) Exit Sub End If
cmdRefreshSettings.Text = "Please Wait..." cmdRefreshSettings.Enabled = False cmdApplySettings.Enabled = False
objSMS.PIN = txtPIN.Text.Trim chkDisableCheckPIN.Checked = objSMS.DisableCheckPIN txtSendRetry.Text = objSMS.SendRetry.ToString
23
2008SMS Based Information System
txtSendDelay.Text = (objSMS.SendDelay / 1000).ToString txtTimeout.Text = (objSMS.Timeout / 1000).ToString System.Windows.Forms.Application.DoEvents()
SetCommParameters()
txtSMSC.Text = objSMS.SMSC
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
End Try
cmdRefreshSettings.Text = "Refresh" cmdRefreshSettings.Enabled = True cmdApplySettings.Enabled = True
End Sub
Private Sub cmdApplySettings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdApplySettings.Click
Try If cboPort.SelectedIndex = 0 Then MsgBox("Select a serial port", MsgBoxStyle.Critical, strMyAppName) Exit Sub End If
cmdApplySettings.Text = "Please Wait..." cmdApplySettings.Enabled = False cmdRefreshSettings.Enabled = False
objSMS.PIN = txtPIN.Text.Trim
objSMS.SendDelay = CInt(CDbl(txtSendDelay.Text) * 1000) objSMS.SendRetry = CInt(txtSendRetry.Text)
23
2008SMS Based Information System
objSMS.Timeout = CLng(CDbl(txtTimeout.Text) * 1000)
SetCommParameters() objSMS.SMSC = txtSMSC.Text
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
End Try
cmdApplySettings.Text = "Apply" cmdApplySettings.Enabled = True cmdRefreshSettings.Enabled = True
End Sub
Private Sub cboMsgMemory_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboMsgMemory.SelectedIndexChanged
If cboPort.SelectedIndex = 0 Then tabMessaging.SelectedIndex = 0 Exit Sub End If
Try cboMsgMemory.Enabled = False
lblMsgCount.Text = "Setting message memory... Please wait..." System.Windows.Forms.Application.DoEvents()
SetCommParameters()
Select Case cboMsgMemory.SelectedIndex Case 0 : objSMS.MessageMemory = mCore.SMS.EnumMessageMemory.SM
23
2008SMS Based Information System
Case 1 : objSMS.MessageMemory = mCore.SMS.EnumMessageMemory.ME Case 2 : objSMS.MessageMemory = mCore.SMS.EnumMessageMemory.MT End Select
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
End Try
lblMsgCount.Text = vbNullString cboMsgMemory.Enabled = True
End Sub
Private Sub cmdInboxRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdInboxRefresh.Click RefreshInbox() End Sub
Private Sub lstInbox_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstInbox.DoubleClick Dim i As Integer, objInbox As mCore.Inbox = objSMS.Inbox Dim Msg As mCore.Message
Try For i = 1 To lstInbox.Items.Count Msg = objInbox.Message(i) If lstInbox.Items.Item(i - 1).Selected Then MsgBox(Msg.TimeStampRFC & vbCrLf & vbCrLf & Msg.Text, , "From: " & Msg.Phone) Exit For End If Next
If lstInbox.Items.Item(i - 1).Checked Then lstInbox.Items.Item(i - 1).Checked = False
23
2008SMS Based Information System
End If
Catch ex As mCore.SMSReadException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
End Try
End Sub
Private Sub cmdMsgDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdMsgDelete.Click Dim i As Integer
Try cmdMsgDelete.Enabled = False
If MsgBox("Delete selected message(s)?", MsgBoxStyle.YesNo, strMyAppName) = MsgBoxResult.Yes Then lblMsgCount.Text = "Deleting selected messages..." For i = lstInbox.Items.Count To 1 Step -1 If lstInbox.Items.Item(i - 1).Checked Then objSMS.Inbox.Message(i).Delete() End If Next lstInbox.Items.Clear() FillInboxList() End If
lblMsgCount.Text = "Total Messages: " & objSMS.Inbox.Count If objSMS.Inbox.Count > 0 Then lblMsgCount.Text = lblMsgCount.Text & vbCrLf & "(double click on a message to view)"
23
2008SMS Based Information System
Catch ex As mCore.SMSDeleteException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
End Try
cmdMsgDelete.Enabled = True
End Sub
Private Sub RefreshInbox() Dim objInbox As mCore.Inbox = objSMS.Inbox()
SetCommParameters()
lblMsgCount.Text = "Reading messages... Please wait..." System.Windows.Forms.Application.DoEvents()
Try cmdInboxRefresh.Enabled = False cmdMsgDelete.Enabled = False cboMsgMemory.Enabled = False objInbox.Refresh(mCore.Inbox.EnumMessageType.ReceivedUnreadMessages) objInbox.Refresh(mCore.Inbox.EnumMessageType.ReceivedReadMessages)
Catch ex As mCore.SMSReadException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
23
2008SMS Based Information System
Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
End Try
lblMsgCount.Text = "Total Messages: " & objSMS.Inbox.Count If objSMS.Inbox.Count > 0 Then lblMsgCount.Text = lblMsgCount.Text & vbCrLf & "(double click on a message to view)" End If
cmdMsgDelete.Enabled = True cmdInboxRefresh.Enabled = True cboMsgMemory.Enabled = True End Sub
Private Sub FillInboxList() Dim i As Integer Dim Msg As mCore.Message, objInbox As mCore.Inbox = objSMS.Inbox
Try i = 0 For Each Msg In objInbox With lstInbox .Items.Add(Msg.Phone) .Items.Item(i).SubItems.Add(Msg.Text) .Items.Item(i).SubItems.Add(Msg.TimeStamp.ToString) i += 1 End With Next
Catch ex As mCore.SMSReadException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
23
2008SMS Based Information System
Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
End Try
End Sub
Private Sub objSMS_NewDeliveryReport(ByVal sender As Object, ByVal e As mCore.NewDeliveryReportEventArgs) Handles objSMS.NewDeliveryReport If e.Status Then MsgBox("MESSAGE DELIVERED" & vbCrLf & vbCrLf & "TO: " & e.Phone & vbCrLf & vbCrLf & "SENT DATE/TIME: " & e.SentTimeStamp.ToString & vbCrLf & vbCrLf & "DELIVERY DATE/TIME: " & e.DeliveryTimeStamp & vbCrLf & vbCrLf & "[Message Ref.: " & e.MessageReference.ToString & "]", MsgBoxStyle.Information, "DELIVERY REPORT...") Else MsgBox("MESSAGE DELIVERY FAILED" & vbCrLf & vbCrLf & "TO: " & e.Phone & vbCrLf & vbCrLf & "SENT DATE/TIME: " & e.SentTimeStamp.ToString & vbCrLf & vbCrLf & "REPORT DATE/TIME: " & e.DeliveryTimeStamp & vbCrLf & vbCrLf & "[Message Ref.: " & e.MessageReference.ToString & "]", MsgBoxStyle.Critical, "DELIVERY REPORT...") End If End Sub
Private Sub objSMS_NewIncomingCall(ByVal sender As Object, ByVal e As mCore.NewIncomingCallEventArgs) Handles objSMS.NewIncomingCall MsgBox("Incoming call from: " & e.CallerID, MsgBoxStyle.Information, "INCOMING CALL...")
End Sub
Private Sub chkDeliveryReport_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkDeliveryReport.CheckedChanged
Try chkDeliveryReport.Enabled = False
SetCommParameters()
23
2008SMS Based Information System
objSMS.DeliveryReport = chkDeliveryReport.Checked
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) chkDeliveryReport.Checked = objSMS.DeliveryReport
End Try
chkDeliveryReport.Enabled = True
End Sub
Private Sub cboLongMsg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboLongMsg.SelectedIndexChanged
Try objSMS.LongMessage = CType(cboLongMsg.SelectedIndex, mCore.SMS.EnumLongMessage)
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName)
Catch ex As Exception
End Try
End Sub
Private Sub cboEncoding_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboEncoding.SelectedIndexChanged
Try objSMS.Encoding = CType(cboEncoding.SelectedIndex, mCore.SMS.EnumEncoding)
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName)
End Try
End Sub
23
2008SMS Based Information System
Private Sub cmdSendMsg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSendMsg.Click Dim strSendResult As String, strKey As String
If txtPhone.Text.Trim.Length = 0 Then MsgBox("Destination phone number is required!", vbExclamation, strMyAppName) Exit Sub End If
cmdSendMsg.Text = "Sending SMS...Please Wait..." cmdSendMsg.Enabled = False
System.Windows.Forms.Application.DoEvents()
Try SetCommParameters()
objSMS.Validity = txtValidity.Text & cboValidity.Text.Substring(0, 1)
If chkSMSQueue.Checked Then strKey = objSMS.SendSMSToQueue(txtPhone.Text, txtMessage.Text, CType(cboSMSQPriority.SelectedIndex + 1, mCore.SMS.EnumQueuePriority), chkAlert.Checked) lblQueueCount.Text = "Messages in queue: " & objSMS.Queue.Count.ToString MsgBox("Message sent to queue!" & vbCrLf & vbCrLf & "[Message Queue Key: " & strKey & "]", MsgBoxStyle.Information, strMyAppName) Else strSendResult = objSMS.SendSMS(txtPhone.Text, txtMessage.Text, chkAlert.Checked) MsgBox("Message sent!" & vbCrLf & vbCrLf & "[Message Ref.: " & strSendResult & "]", MsgBoxStyle.Information, strMyAppName) End If Catch ex As mCore.SMSSendException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
Catch ex As Exception
23
2008SMS Based Information System
MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName) Exit Try
End Try
cmdSendMsg.Text = "Send Message" cmdSendMsg.Enabled = True
End Sub
Public Sub SetCommParameters()
Try If Not objSMS.IsConnected And cboPort.SelectedIndex > 0 Then objSMS.Port = cboPort.Text objSMS.BaudRate = CType(CInt(cboBaudRate.Text), mCore.SMS.EnumBaudRate) objSMS.DataBits = CType(CInt(cboDataBits.Text), mCore.SMS.EnumDataBits) objSMS.Parity = CType(cboParity.SelectedIndex, mCore.SMS.EnumParity) objSMS.StopBits = CType(cboStopBits.SelectedIndex + 1, mCore.SMS.EnumStopBits) objSMS.FlowControl = CType(cboFlowControl.SelectedIndex, mCore.SMS.EnumFlowControl) objSMS.PIN = txtPIN.Text objSMS.DisableCheckPIN = chkDisableCheckPIN.Checked End If
Catch ex As mCore.GeneralException MsgBox(ex.Message, MsgBoxStyle.Critical, strMyAppName)
End Try End Sub
Private Sub chkIncomingCall_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkIncomingCall.CheckedChanged chkIncomingCall.Enabled = False Try objSMS.IncomingCallIndication = chkIncomingCall.Checked Catch ex As Exception Exit Try
23
2008SMS Based Information System
End Try chkIncomingCall.Checked = objSMS.IncomingCallIndication chkIncomingCall.Enabled = True End Sub
Private Sub chkSMSQueue_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkSMSQueue.CheckedChanged If chkSMSQueue.Checked Then cboSMSQPriority.Enabled = True lblSMSQPriority.Enabled = True Else cboSMSQPriority.Enabled = False lblSMSQPriority.Enabled = False End If End Sub
Private Sub objSMS_QueueSMSSent(ByVal sender As Object, ByVal e As mCore.QueueSMSSentEventArgs) Handles objSMS.QueueSMSSent Control.CheckForIllegalCrossThreadCalls = False lblQueueStatus.Text = "" lblQueueCount.Text = "Messages in queue: " & objSMS.Queue.Count.ToString Control.CheckForIllegalCrossThreadCalls = True Windows.Forms.Application.DoEvents() If e.ErrorCode > 0 Then MsgBox("Message sending from queue failed to " & e.DestinationNumber & vbCrLf & "[Queue Message Key: " & e.QueueMessageKey & "]" & vbCrLf & "ERROR " & e.ErrorCode.ToString & ": " & e.ErrorDescription, MsgBoxStyle.Critical, "Message Sending FAILED") Else MsgBox("Message from queue sent to: " & e.DestinationNumber & vbCrLf & "[Queue Message Key: " & e.QueueMessageKey & "]", MsgBoxStyle.Information, "Message SENT") End If End Sub
Private Sub objSMS_QueueSMSSending(ByVal sender As Object, ByVal e As mCore.QueueSMSSendingEventArgs) Handles objSMS.QueueSMSSending Control.CheckForIllegalCrossThreadCalls = False lblQueueStatus.Text = "Sending to:" & e.DestinationNumber & vbCrLf & "[Key:" & e.QueueMessageKey & "]" Control.CheckForIllegalCrossThreadCalls = True
23
2008SMS Based Information System
Windows.Forms.Application.DoEvents() End Sub
Private Sub cmdClearQueue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClearQueue.Click objSMS.Queue.Clear() Control.CheckForIllegalCrossThreadCalls = False lblQueueCount.Text = "Messages in queue: " & objSMS.Queue.Count.ToString Control.CheckForIllegalCrossThreadCalls = True Windows.Forms.Application.DoEvents() End Sub
Private Sub chkDisableCheckPIN_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkDisableCheckPIN.CheckedChanged objSMS.DisableCheckPIN = chkDisableCheckPIN.Checked End Sub
Private Sub grpPortSettings_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grpPortSettings.Enter
End SubEnd Class
23
2008SMS Based Information System
This SMS Based Information System is help in many areas if we take it to at Enterprise world, This System simply serve the user to getting information at a single SMS, Like, If User want to find the meaning of any word from dictionary then He / She has to type Simple Message from their mobile phone that DIC WORD and send that message to our given number and then this system replying you with the meaning of the word.
This system’s options are shown in the following figure and also explain the all the field of that form.
User Manual
23
2008SMS Based Information System
Port: When we connect the mobile it shows the connected portBaud Rate: It is selecting the baud rate of mobile modemData bit: It is used to show the how the packets of the bits default value is 8.Parity: it is used here for the checking the Parity technique for error handlingStop Bits: it is for the last bit which shows the last bitFlow Control: This is the flow control techniques like hardware or controlled by some otherPIN: It automatically takes the PIN of the mobile phoneSMSC: It shows SMS Centre number Send Delay: It shows the how many minutes u want to delay the messageSend Retry: If the sending is fail then how many times u retryTimeout: If the message is time out then message is not sends Buttons:
Connects: when all fields has been filled and we apply the settings then press this button Program simply connects the computer with the mobile phones
Refresh: Refresh will simply Refreshing all the settings
Disconnect: when user want to disconnect this button is used.
Apply: When user set all settings by this button user can apply the settings.
Tabs:
Settings: This tab is used for settings the mobile and computer connections
Incoming SMS: This tab is give the information related to Incoming SMS
Send SMS: This Tab shows the control regarding sending the SMS
23
2008SMS Based Information System
Phone number: For Entering the Phone Number
Text Message: For typing the text message
Message Delivery Report: If admin wants the delivery report then check this check button
Long Message: Here this combo box having different types of messaging Schemes like Short
Message, Long Message or Concatenate message
Encoding: This shows the different Encoding Schemes like Unicode-16 bits, 8-bits
Validity Period: This is used to set the Validity period of the message
Message Queuing: if admin want to Message Queuing facility then it must be checked
23
2008SMS Based Information System
Message Memory: This Combo Box is used to select the Storage Device to store the Received messages, it has three values that are SIM, Memory Card, and SIM+Memory card both.
Incoming Message Data Grid:
It’s having 3 fields that are from which number we receive the message, and the content of the message, and the date and time of the Receiving messages
23
2008SMS Based Information System
1) The system should be connected to the Internet and can transmit the messages FREE.
2) With proper use of indexes in the Database design the searching process can be made faster.
3) In the Application mCore is the demo version. It can be upgraded & buy the full Version to get the full services for the lifetime
Future Enhancements
23
2008SMS Based Information System
Reference of the books
VB.net:
Microsoft Visual Basic.NET
Mickey Williams
- Microsoft Press
Reference of websites
www.msdn.microsoft.com www.mcorelib.com www.getacoder.com www.nokia.asia.com
Other resources
MSDN Library - 2005
Bibliography