Skip to main content

Serial Communication Delphi-Comport>Delphi Access SMS :Getting information on mobile phone: Brand, Type, IMEI, Operator Network, Service Center using Delphi

Serial Communication Delphi-Comport>Delphi Access SMS  :Getting information on mobile phone: Brand, Type, IMEI, Operator Network, Service Center using Delphi (Part1 : basic concept and design form)
The main component that is used in making the application is Comport. This component is used to get Brand, Type, IMEI, Operator Network, and Service Center through Serial Communication. Then the data that is gained through serial communication is processed to be visualized in MEMO components.

The component below is needed in making application to get information on Mobile Phone: Brand, Type, IMEI, Operator Network, and Service Center using Delphi.

Insert this following component to the design form area



No
Component Name Properties Value
1 Label1 Caption Merk
2 Label2 Caption Type
3 Label3 Caption IMEI
4 Label4 Caption Network Operator
5 Label5 Caption Service Center
6 Label6 Caption Access Hand Phone Information :

Merk, Type, IMEI, Networ Operator, Service Center

With Delphi
7 Memo1 Lines Memo1
8 Memo2 Lines Memo2
9 Memo3 Lines Memo3
10 Memo4 Lines Memo4
11 Memo5 Lines Memo5
12 Button1 Caption Get Mobile Phone Information
13 Button2 Caption Set Serial Port



Arrange the components into this picture below:



Serial Communication Delphi-Comport>Delphi Access SMS  :Getting information on mobile phone: Brand, Type, IMEI, Operator Network, Service Center using Delphi (Part 2 : Variable, Function and the Procedure)

Before writing the source code to connect Personal Computer and Mobile Phone, and also source code to get mobile phone information, declare the global variable as follows:

tanda_receive,BatasStr,tanda_thistime,tanda_motion: string;

item: Tstrings;

ReceiveText: WideString;

ReadyState,koneksi,tanda_info,sms_sign: Boolean;



add a Constantan:

const

sOK = #13#10'OK';



After that make some Private Function and Procedure to access mobile phone information, Before make it, function and procedure have to be declared first as follows:



Then type function and procedure as follows:



No
Name Source code
 1 function TForm1.SendGetData(Teks, Batas: String): String; function TForm1.SendGetData(Teks, Batas: String): String;
var
waktu: TDateTime;
begin
ReadyState := False;
BatasStr := Batas;
ReceiveText := '';
waktu := now;
comport1.WriteStr(Teks);
while (Not ReadyState) and (SecondsBetween(waktu, Now) < 10)
do Application.ProcessMessages;
Result := ReceiveText;
end;
 2 function Tform1.Cek_koneksi; function Tform1.Cek_koneksi;
var s:string;
begin
s:=SendGetData('ATE1'+#13, sOK);
if pos(sOK,s)>0 then koneksi:=true
else koneksi:=false;
Result := pos(sOK, s) > 0;
end;
 3 procedure TForm1.getInfo; procedure TForm1.getInfo;
var
c: string;
begin
if Pos('AT+CGMI', ReceiveText) > 0 then
begin
c:=copy(Receivetext,pos('AT+
CGMI',ReceiveText)+10,length(ReceiveText));
memo1.Text:=c;
end;
if Pos('AT+GMM', ReceiveText) > 0 then begin
c:=copy(Receivetext,pos('AT+GMM',
ReceiveText)+9,length(ReceiveText));
memo2.Text:=c;
end;
if Pos('AT+CGSN', ReceiveText) > 0 then begin
c:=copy(Receivetext,pos('AT+CGSN',
ReceiveText)+10,length(ReceiveText));
memo3.Text:=c;
end;
if Pos('+COPS:', ReceiveText) > 0 then begin
c := copy(ReceiveText, pos('+COPS:',
ReceiveText) + 7, length(ReceiveText));
memo4.Text:=c;
end;
if Pos('+CSCA:', ReceiveText) > 0 then begin
c := copy(ReceiveText, pos('+CSCA:', ReceiveText) + 7, length(ReceiveText));
memo5.Text:=c;
tanda_receive:='OK';
end;
end;

Serial Communication Delphi-Comport>Delphi Access SMS  :Getting information on mobile phone: Brand, Type, IMEI, Operator Network, Service Center using Delphi(Part 4: the source code)

Check all source code so that become as follows:
unit Unit1;
interface
uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, CPortCtl, ComCtrls, ExtCtrls, Buttons, CPort,DateUtils,StrUtils;

type

TForm1 = class(TForm)

Button1: TButton;

Button2: TButton;

ComPort1: TComPort;

Memo1: TMemo;

Memo2: TMemo;

Memo3: TMemo;

Memo4: TMemo;

Memo5: TMemo;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Label8: TLabel;

Label9: TLabel;

Label10: TLabel;

Label11: TLabel;

Label12: TLabel;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure ComPort1RxChar(Sender: TObject; Count: Integer);
  private
    function SendGetData(Teks, Batas: String): String;
    function Cek_koneksi: Boolean;
    procedure getInfo(buffer: string);

    { Private declarations }

public

{ Public declarations }

end;
  const

sOK = #13#10'OK';

var

Form1: TForm1;
  tanda_receive,BatasStr,tanda_thistime,tanda_motion: string;

item: Tstrings;

ReceiveText: WideString;

ReadyState,koneksi,tanda_info,sms_sign: Boolean;
implementation
{$R *.dfm}
function TrimAll(t: string): string;

var s: string;

begin

s := trim(t);

s := copy(s, 2, length(s) - 2);

result := s;

end;
function TForm1.SendGetData(Teks, Batas: String): String;

var

waktu: TDateTime;

begin

ReadyState := False;

BatasStr := Batas;

ReceiveText := '';

waktu := now;

comport1.WriteStr(Teks);

while (Not ReadyState) and (SecondsBetween(waktu, Now) < 10)

do Application.ProcessMessages;

Result := ReceiveText;

end;
function Tform1.Cek_koneksi;

var s:string;

begin

s:=SendGetData('ATE1'+#13, sOK);

if pos(sOK,s)>0 then koneksi:=true

else koneksi:=false;

Result := pos(sOK, s) > 0;

end;
procedure TForm1.getInfo;

var

c: string;

begin

if Pos('AT+CGMI', ReceiveText) > 0 then

begin

c:=copy(Receivetext,pos('AT+CGMI',ReceiveText)+10,length(ReceiveText));

memo1.Text:=c;

end;

if Pos('AT+GMM', ReceiveText) > 0 then begin

c:=copy(Receivetext,pos('AT+GMM',ReceiveText)+9,length(ReceiveText));

memo2.Text:=c;

end;

if Pos('AT+CGSN', ReceiveText) > 0 then begin

c:=copy(Receivetext,pos('AT+CGSN',ReceiveText)+10,length(ReceiveText));

memo3.Text:=c;

end;

if Pos('+COPS:', ReceiveText) > 0 then begin

c := copy(ReceiveText, pos('+COPS:', ReceiveText) + 7, length(ReceiveText));

memo4.Text:=c;

end;

if Pos('+CSCA:', ReceiveText) > 0 then begin

c := copy(ReceiveText, pos('+CSCA:', ReceiveText) + 7, length(ReceiveText));

memo5.Text:=c;

tanda_receive:='OK';

end;

end;

procedure TForm1.ComPort1RxChar(Sender: TObject; Count: Integer);

var Str: String;

begin

comport1.ReadStr(Str, Count);

ReceiveText := ReceiveText + Str;

If (Not ReadyState) And (Pos(BatasStr, ReceiveText) > 0) Then Begin

ReadyState := True;

End;

end;

procedure TForm1.Button1Click(Sender: TObject);
begin

if comport1.Connected then

begin

if cek_koneksi then

begin

//listview1.Clear;

getinfo(SendGetData('AT+CGMI'+#13, sOK));

getinfo(SendGetData('AT+GMM'+#13, sOK));

getinfo(SendGetData('AT+CGSN'+#13, sOK));

getinfo(SendGetData('AT+COPS?'+#13, sOK));

getinfo(SendGetData('AT+CSCA?'+#13, sOK));

SendGetData('AT+CMGf=0'+#13, sOK);

SendGetData('AT+CSMS=0'+#13, sOK);

tanda_info:=true;

end

else

begin

ShowMessage('Failed to Connect');

tanda_info:=false;

end;

end

else

begin

MessageDlg('Setting Serial First !!!',mtinformation, [mbYes],0);

end;

end;
procedure TForm1.Button2Click(Sender: TObject);

begin

if comport1.Connected then

comport1.Connected:=false;

comport1.ShowSetupDialog;

comport1.Connected:=true;

end;

end.

Execute the application that is made then manage the port connection by pressing set serial button, connect the mobile phone and PC through serial port or USB port, connect by Get Mobile Phone Information button so that the program visualization will be as follows:



 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…