100% found this document useful (1 vote)
81 views

Short Message Service (SMS) Using Visual C# 2005, Visual Basic Express

This document provides an overview of the Short Message Service (SMS) and describes how to send and receive SMS messages using Visual C# .NET. Key points include: - SMS allows sending and receiving text messages to/from mobile phones. The program was tested using a Nokia phone connected to the computer. - The Visual C# project contains an SMS component that handles connecting to the phone, sending, and receiving SMS messages. - To use the program, you must install the mobile phone's modem drivers, connect the phone to the computer, run the TestSMS executable, and select the correct COM port. Messages can then be sent and received.

Uploaded by

Dharma Lingam
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
81 views

Short Message Service (SMS) Using Visual C# 2005, Visual Basic Express

This document provides an overview of the Short Message Service (SMS) and describes how to send and receive SMS messages using Visual C# .NET. Key points include: - SMS allows sending and receiving text messages to/from mobile phones. The program was tested using a Nokia phone connected to the computer. - The Visual C# project contains an SMS component that handles connecting to the phone, sending, and receiving SMS messages. - To use the program, you must install the mobile phone's modem drivers, connect the phone to the computer, run the TestSMS executable, and select the correct COM port. Messages can then be sent and received.

Uploaded by

Dharma Lingam
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

Short Message Service (SMS) using Visual C# 2005, Visual Basic Express

This paper describes object-oriented access to the Short Message Service (SMS). SMS is one of the GSM Data Services provided by a Network Short Messages perator. !t enab"es yo# to send and receive

The progra$ was tested #sing the Nokia %& S#ite and the Nokia '()*. The '()* then f#nctions as a $ode$ for yo#r %& &o$$#nications +pp"ications, enab"ing yo# to send and receive SMS. The progra$ sho#"d work with any phones that co$e with $ode$ drivers. The "atest driver (asse$b"y ver -.*.(((-.(.'/* #pdated .* 0an (**1) has a"so been tested with the Sa$s#ng SG2-3/.*.

+"tho#gh the e4a$p"e is given in &5, with a "itt"e trans"ation, yo# sho#"d get it working with 6is#a" 7asic 34press or 6is#a" 7asic (**)

Down"oad SMS fo"der 3$antSMS(**).8ip ('k7. 34tract the entire fo"der to yo#r %&

Run the SMS

e!o "rogra!

Be#ore running the $e!o progra!, %ou !ust

&'

install the !o$e! $river so#t(are that co!es (ith %our !o)ile phone' Rea$ %our phone !anual or visit the phone !anu#acturer*s (e)site #or installation in#or!ation

2' 3.

connect %our phone to the co!puter +no( the co!! port nu!)er %our phone !o$e! is connecte$ to' ,oto the control panel an$ clic+ on Modem and Phone Options

Microsoft Visual C# .NET 2005 !ust alrea$% )e installe$' Cop% the entire Sms #ol$er to %our "C'

-ur screenshots are ta+en #ro! a .in$o(s /" co!puter'

Chec+ out %our s%ste!


1. 0ro! the SMS #ol$er, )ro(se to TestSMS\bin\Release' Run TestSMS.exe )% clic+ing on the progra!'

2.

Set the Co!! "ort 1o to the one that is in$icate$ #or %our phone !o$e!' Clic+ on the Connect to Phone chec+ )ox to connect to the phone' 2our phone shoul$ repl% (ith so!e status in the !essage )ox' Clic+ on Query )utton an$ %our phone shoul$ respon$ (ith its i$enti#ication'

3.

Sen$ a !essage to another phone )% +e%ing in %our !essage an$ phone nu!)er an$ then

clic+ the Send )utton' 3' 4o receive an SMS, 5ust sen$ a !essage to %our phone that is connecte$ to the co!puter'

4he !essage shoul$ appear in the !essage )ox' 3' 6# %ou have success#ull% sen$ an$ receive SMS, (e can no( anal%se the C# progra!'

7nal%se Source Co$e


,oto the TestSMS #ol$er an$ start the 6 E )% clic+ing on the TestSMS solution'

SMS Co!ponent
4he SMS co!ponent ena)les %ou to sen$ an$ receive Short Messages using a ,SM !o$e! or a phone that has !o$e! #unction'

Program 1.1 SMS Source Code


private void check ox!"CheckedChan#ed$ob%ect sender& System.'vent(r#s e) * i+ $check ox!.Checked) sms!.Open$text ox,.Text)else sms!.Close$).

private void button/"Click$ob%ect sender& System.'vent(r#s e) * sms!.Query$).

private void button!"Click$ob%ect sender& System.'vent(r#s e) * sms!.Send$text ox!.Text& text ox/.Text).

private void sms!"onReceived$ob%ect sender& 'vent(r#s e) * Control.Check0or1lle#alCrossThreadCalls 2 +alselabel!.Text 2 sms!.sresult.

Open method
sms!.Open$text ox,.Text)-

-pens the connection to the ,SM !o$e!'

bool Open(string Portnum Parameters "ortnu! 8 4he co!! port nu!)er the ,SM !o$e! is connecte$ to' !eturn Value true i# open is success#ul other(ise #alse

Close method
sms!.Close$)Close the ,SM !o$e! connection'

"oi# Close(

Query method
sms!.Query$)9se$ to i$enti#% the ,SM !o$e!' .hen the ,SM replies, the onReceived event occurs an$ the i$enti#ication string is assigne$ to the sresult propert%'

"oi# $uer%(

Send method
sms!.Send$text ox!.Text& text ox/.Text)4he Send !etho$ is use$ to sen$ an SMS to another phone' 4(o strings are passe$, one #or the !essage an$ the other #or the phone nu!)er'

"oi# &en#(string smsg' string sp(one Parameters

s!sg 8 !essage string that is sent to the $estination phone sphone 8 string o# the phone nu!)er o# the $estination phone

sresult Property
The $essage or stat#s fro$ the $ode$ is ret#rned as a string and assigned to the sres#"t property'
public string sresult )get*+ Propert% Value

string o# the !essage or status

onReceived Event
The event occ#rs when the $ode$ receives an SMS $essage or reports a stat#s or acknow"edge$ent. The infor$ation is stored in the sres#"t property. private void sms!"onReceived$ob%ect sender& 'vent(r#s e) * Control.Check0or1lle#alCrossThreadCalls 2 +alselabel!.Text 2 sms!.sresult.
4his Check0or1lle#alCrossThreadCalls propert% is ne( in the '1E4 0ra!e(or+ version 2'0' ,ets or sets a value in$icating (hether to catch calls on the (rong threa$ that access a control*s :an$le propert%' 6# le#t as $e#ault true, %ou (ill get the #ollo(ing runti!e error' ;Cross8threa$ operation not vali$< Control la)el& accesse$ #ro! a threa$ other than the threa$ it (as create$ on';

Control.Check0or1lle#alCrossThreadCalls 2 +alseSetting it #alse is a =uic+ #ix'

6nstall SMS Co!ponent


To integrate the SMS Component in 6is#a" St#dio .N3T9 -. (. .. ;. ). 1. Se"ect the General tab in the Toolbox :ight-c"ick on the Toolbox backgro#nd Se"ect Choose Items... n the Choose Toolbox Items Dialog, se"ect the NET Framework Components tab %ress the Browse 7#tton <ocate and se"ect the Emantsms.dll asse$b"y in the SMS fo"der &"ick O

7.

NOKIA GSM AT COMMAND SET


Call Control

(T( (T4 (T5 (T7 (TM (TO (TP (TT (T:CST( (T:CRC

(ns3er Command 4ial Command 5an# 6p Call Monitor Speaker 7oudness Monitor Speaker Mode 8o On97ine Set Pulse 4ial as 4e+ault Set Tone 4ial as 4e+ault Select Type o+ (ddress Cellular Result Codes

Data Card Control Commands


(T1 (TS (T; (T<0 (T<= (T<> (T<? (T:C7C@ (T:CO7P (T:8C(P (T:8M1 (T:8MM (T:8MR (T:8SB 1denti+ication Select an S9re#ister Recall Stored Pro+ile Restore 0actory Settin#s =ie3 (ctive Con+i#uration Store Parameters in 8iven Pro+ile Select Set as s Po3erup Option 0acility 7ock Command Connected 7ine 1denti+ication Presentation ReAuest Complete Capabilities 7ist ReAuest Manu+acturer 1denti+ication ReAuest Model 1denti+ication ReAuest Revision 1denti+ication ReAuest Product Serial Bumber 1denti+ication

Phone Control Commands


(T:C C (T:C8M1 (T:C8MM (T:C8MR (T:C8SB (T:CM'' (T:CP(S (T:CP 0 (T:CP R (T:CP S (T:CP > (T:CSCS (T:CSQ attery Char#e ReAuest Manu+acturer 1denti+ication ReAuest Model 1denti+ication ReAuest Revision 1denti+ication ReAuest Product Serial Bumber 1denti+ication Report Mobile 'Auipment 'rror Phone (ctivity Status 0ind Phone ook 'ntries Read Phone ook 'ntry Select Phone ook Memory Stora#e >rite Phone ook 'ntry Select T' Character Set Si#nal Quality

Computer Data Card Interface Commands


(T' (TQ (T= (TC (T<C (T<4 Command 'cho Result Code Suppression 4e+ine Response 0ormat Response Ran#e Selection 4e+ine 4C4 6sa#e 4e+ine 4TR 6sa#e

(T<@ (T<Q (T<S (T:1C0 (T:10C (T:1PR

Select 0lo3 Control 4e+ine Communications Mode Option 4e+ine 4SR Option 4T'94C' Character 0ramin# 4T'94C' 7ocal 0lo3 Control 0ixed 4T' Rate

Service
(T:C71P (T:CR (T:4R (T:17RR Callin# 7ine 1denti+ication Presentation Service Reportin# Control 4ata Compression Reportin# 4T'94C' 7ocal Rate Reportin#

Network Communication Parameter Commands


(T (T:C ST (T:C''R (T:CR7P (T:4S Communications Standard Option Select earer Service Type 'xtended 'rror Report Radio 7ink Protocol 4ata Compression

Miscellaneous Commands
(D Re9'xecute Command 7ine (TE Command 5elp (TFC Start SMS 1nterpreter (TFT 'nter SMS lock Mode Protocol (TF= (ctivate =./Gbis Mode (TFBO@1(T'ST Test Command (T:C'SP 'nter SMS lock Mode Protocol

SMS Commands SMS Text Mode


(T:CSMS (T:CPMS (T:CM80 (T:CSC( (T:CSMP (T:CS45 (T:CSC (T:CS(S (T:CR'S (T:CBM1 (T:CM87 (T:CM8R (T:CM8S (T:CMSS (T:CM8> (T:CM84 Select Messa#e Service Pre+erred Messa#e Stora#e Messa#e 0ormat Service Centre (ddress Set Text Mode Parameters Sho3 Text Mode Parameters Select Cell roadcast Messa#e Types Save Settin#s Restore Settin#s Be3 Messa#e 1ndications to T' 7ist Messa#es Read Messa#e Send Messa#e Send Messa#e +rom Stora#e >rite Messa#e to Memory 4elete Messa#e

SMS PDU Mode


(T:CM87 (T:CM8R (T:CM8S (T:CM8> 7ist Messa#es Read Messa#e Send Messa#e >rite Messa#e to Memory

You might also like