Skip to main content

Accessing SMS with Delphi: Read SMS Using Borland Delphi 7 Exploit Comport Component

Accessing SMS with Delphi: Read SMS Using Borland Delphi 7 Exploit Comport Component (The Basic Concept)
 
This writing will discuss about reading SMS from mobile phone to Personal Computer (PC). Basically, Reading SMS from mobile phone to computer happen in Format Protocol Data Unit( PDU), so that in reading the SMS have to be changed the PDU Form into text Form toward data SMS which is read by Delphi program through serial communication  so that the data can be read directly by people.
Step by step to create Application Accessing SMS with Delphi: Read SMS Using Borland Delphi 7 Exploit Comport Component

To make program for reading the SMS please enter the following component in to Form 1.


No
Component Name Properties Value
Button1 Caption Clear
Button2 Caption Convert PDU to text
Button3 Caption Send To HP
Button4 Caption DisConnect
Button5 Caption Connect
Button6 Caption Set Serial
Edit1 Text ATE1
Memo1 - -
Memo2 - -
Memo3 - -
Comport1 - -
ComLED1 - -

Arrange in such away so that the visualization of the program become as follows:

Picture 1. Reading SMS Application Design using Delphi used Comport Component

Then type source code as follows:

No Component Event Source Code
1 Button1 OnClick Memo1.Clear;
memo2.Clear;
memo3.Clear;
2 Button2 OnClick var smsc, tipe, pengirim, bentuk, skema, tanggal, batas,
isi, s : string;
begin
s := copy(memo2.Text,1,Length(Memo2.Text)-0);
ConvertMSG( s, smsc, tipe, pengirim, bentuk, skema,
tanggal, batas, isi);
Memo3.Lines.Add(tanggal+';dari '+pengirim +': '+#13#10+ isi);
3 Button3 OnClick var str : string;
begin
str := Edit1.Text+#13#10;
Comport1.WriteStr(str);
4 Button4 OnClick ComPort1.Close;
5 Button5 OnClick ComPort1.Open;
6 Button6 OnClick ComPort1.ShowSetupDialog;
IMPORTANT
Don’t forget to :
type the code below in under implementation
const sOK = #13#10'OK';
sERROR = #13#10'ERROR';
function PDU2Text(pdudata: string): string;
var pdu,isi,hasilteks,huruf: string;
i: integer;
m,n,vgeser,sisa,c,d,e,f,panjang: byte;
hasil,dbiner: array[1..9000] of byte;
begin
if length(pdudata)=0 then begin
Result := '';
exit;
end;
pdu := copy(pdudata,3,length(pdudata));
isi:= '';
panjang := length(pdu) div 2;
for i := 1 to panjang do begin
huruf := copy(pdu, i*2 - 1, 2);
dbiner[i] := StrToInt('$' + huruf);
end;
m := 1;
vgeser := 0;
sisa := 0;
n := 1;
while n <= panjang do begin
c := dbiner[n];
d := c shl vgeser;
e := d or sisa;
f := e and $7F;
hasil[m] := f;
Inc(vgeser);
c := dbiner[n];
d := c shr (8-vgeser);
sisa := d;
inc(m);
inc(n);
if vgeser >= 7 then begin
hasil[m] := sisa and $7F;
inc(m);
sisa := 0;
vgeser := 0;
end;
end;
hasilteks := '';
for i := 1 to m - 1 do
hasilteks := hasilteks + chr(hasil[i]);
Result := hasilteks;
end;
procedure ConvertMSG(var datasms,smsc,tipe,pengirim,bentuk,
skema,tanggal,batas,isi: string);
var pdu: string;
p,i: integer;
begin
pdu := datasms;
smsc := '';
p := StrToInt('$' + copy(pdu, 1, 2)) - 1;
pdu := copy(pdu,5,length(pdu)-4);
for i := 1 to p do begin
smsc := smsc + pdu[i*2];
smsc := smsc + pdu[i*2-1];
end;
if smsc[length(smsc)] = 'F' then
smsc := copy(smsc, 1, length(smsc) - 1);
pdu := copy(pdu, p*2+1,length(pdu)-p*2);
tipe := copy(pdu, 1, 2);
pdu := copy(pdu, 3, length(pdu)-2);
pengirim := '';
p := StrToInt('$'+copy(pdu,1,2));
if p mod 2 = 1 then inc(p);
pdu := copy(pdu,5,length(pdu)-4);
for i := 1 to p div 2 do begin
pengirim := pengirim + pdu[i*2];
pengirim := pengirim + pdu[i*2-1];
end;
if pengirim[length(pengirim)] = 'F' then
pengirim := copy(pengirim, 1, length(pengirim) - 1);
pdu := copy(pdu,p+1,length(pdu)-p);
bentuk := copy(pdu,1,2);
pdu := copy(pdu, 3, length(pdu)-2);
skema := copy(pdu,1,2);
pdu := copy(pdu, 3, length(pdu)-2);
tanggal := pdu[6]+pdu[5] + '-' + pdu[4]+pdu[3] + '-' +
pdu[2]+pdu[1] + ' ' +
pdu[8]+pdu[7] + ':' + pdu[10]+pdu[9] + ':' +
pdu[12]+pdu[11];
pdu := copy(pdu, 13, length(pdu)-12);
batas := copy(pdu,1,2);
pdu := copy(pdu, 3, length(pdu)-2);
isi := PDU2Text(pdu);
end;

This is the result of application execution:







Now, try to read all SMS saved in hand phone by type AT Command AT+CMGL=3 and then Click  

Send to HP button
To read the SMS by this Delphi Application, Click on the Translate to Text this button also can be change by type Convert to Text (in the caption properties)

Reference :
www.bengkelprogram.com
Septian Herlan Permana (Student in Electrical Engineering Department , Yogyakarta State University)

 I hope this article can give benefit to the visitors, readers, developer and me. Thanks for visiting and availability for sharing this article by pressing 
Share this on Facebook
or just press like button under this posting

Popular posts from this blog

Login Form Delphi by Connecting to Ms Access Database.

this the step by step  to making application :

Login Form Delphi by Connecting Ms Access Database.

In making/ building application in Delphi, login Form is an important to protect application so that cannot be open by irresponsible person. This login Form is connected with database so that able to keep a lot of username data and password. Before make the application, please create a database as the picture below:
Picture :Login  form Delphi database Microsoft Access
Save the database in the folder which use to save the application


Next step is create the application

Enter the component and the source code as follows.


No Component NameProperties Value1Label1CaptionUsername2Label2CaptionPassword3Edit1Text -4Edit2Text -5Button1CaptionLogin6Adoconnection1--7AdoQuery1ConnectionADOConnection1

Arrange the component as the picture below:


Figure. Login Form Delphi design form



 Create new form



Form properties can be check in the table below
No Component NameProperties Value1Form1CaptionSuccess…

Step by step Accessing SMS With Delphi: Sending SMS Using Borland Delphi 7 Exploit Comport Component (Siemens))

In this example, will present the way how making SMS delivery program with Delphi, basically, data in data communication series between Delphi and mobile phone happen in Format Protocol Data Unit (PDU). The destination number of sending Message and message that will be sent through Delphi program that is made have to be changed into PDU Form first, next is the data will be sent through serial port to mobile phone. To make the send SMS Application , please enter the following component to Form 1.

No Component NameProperties ValueButton1CaptionConnectButton2CaptionDisConnectButton3CaptionConvert to PDUButton4CaptionSend to HPButton5CaptionClearButton6CaptionStart Send SMSButton7CaptionSet PortEdit1Text-Edit2Text<Type The SMS here>Edit3Text-Label1Caption1) Destination Number :Label2Caption2Label3CaptionPDU lengthLabel4CaptionLabel lengthComLed1--Memo1--Memo2--Comport1--Arrange the Component  in such away so that the visualization program is as follows:


Then type the follow…

The Example Using Chart In Borland Delphi 7

The Example Using Chart In Borland Delphi 7




In this writing will discuss about how to use the chart in Delphi 7. In the example that is made by using Delphi 7, chart will appear 2 data in the form of incremental data number, the first data named data 1 and the second data named data 2. Data 1 is incremental data 1 that is begun from 0 until 10; while data 2 is same. Yet, in the beginning condition of data 1 start from 0 while data 2 start from 1.


To make application as the explanation above, please enter the components in the table below into design form.


NoComponentPropertiesValueNote1Form1CaptionThe Chart of Data on Delphi 72GroupBox1CaptionThe Chart of Data on Delphi 73Label1CaptionData 14Label2CaptionData 25Edit1Text06Edit2Text07Button1CaptionShow to Chart8Button2CaptionClose9Timer1EnabledFalse10Chart--Check the NoteNote:

Double click on chart component, set the property of chart as below:


Click on  Add.. Button

Then the following chart gallery will be shown:



Choose the…