• Tidak ada hasil yang ditemukan

POOLING SHORT MESSAGE SERVICE (SMS) TANPA OPERATOR, UNTUK TOP 10 LAGU INDONESIA TERBAIK PADA RADIO SUPRA - Unika Repository

N/A
N/A
Protected

Academic year: 2019

Membagikan "POOLING SHORT MESSAGE SERVICE (SMS) TANPA OPERATOR, UNTUK TOP 10 LAGU INDONESIA TERBAIK PADA RADIO SUPRA - Unika Repository"

Copied!
40
0
0

Teks penuh

(1)

unit Unit1;

interface

uses

{UnitIO, }Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, SerialNG, ComCtrls, Buttons, ExtCtrls, DB, DBTables, DBCtrls, Mask, Grids, DBGrids, MPlayer;

type

TForm1 = class(TForm)

SerialPortNG1: TSerialPortNG; Timer1: TTimer;

Timer2: TTimer;

StatusBar1: TStatusBar; DataSource1: TDataSource; Table1: TTable;

Table1TANGGAL: TStringField; Table1JAM: TStringField;

Table1NO_PENGIRIM: TStringField; Table1SMS: TMemoField;

TimerJam: TTimer; Panel6: TPanel;

Table2: TTable;

StringField1: TStringField;

StringField2: TStringField; StringField3: TStringField;

MemoField1: TMemoField; DataSource2: TDataSource;

Timer3: TTimer; TimerAwal: TTimer;

Panel3: TPanel; Memo2: TMemo;

(2)

Label7: TLabel; Label6: TLabel;

Label3: TLabel; Label9: TLabel;

SBGetMCTR: TSpeedButton; SBSetHP: TSpeedButton;

Label20: TLabel; CBCom: TComboBox;

CBBoud: TComboBox; ESetHP: TEdit;

EMCTR: TEdit; E_SMS: TEdit; POUTBOX: TPanel;

Label10: TLabel;

Label16: TLabel; Label17: TLabel; Label18: TLabel;

Label19: TLabel; DBEdit4: TDBEdit;

DBEdit5: TDBEdit; DBEdit6: TDBEdit;

DBMemo2: TDBMemo; DBNavigator2: TDBNavigator;

Panel1: TPanel; Label1: TLabel;

SpeedButton2: TSpeedButton; Label5: TLabel;

Label2: TLabel; Label4: TLabel;

SBSetup: TSpeedButton; SBINBOX: TSpeedButton;

SBOUTBOX: TSpeedButton; EHPNomor: TEdit;

(3)

PINBOX: TPanel; Label11: TLabel;

Label12: TLabel; Label13: TLabel;

Label14: TLabel; Label8: TLabel;

DBEdit1: TDBEdit; DBEdit2: TDBEdit;

DBEdit3: TDBEdit; DBMemo1: TDBMemo;

DBNavigator1: TDBNavigator; Panel4: TPanel;

PageControl1: TPageControl;

TabSheet1: TTabSheet;

Label15: TLabel; EKTKUNCI: TEdit; ESMS: TEdit;

EDURASI: TEdit; ETGL2: TEdit;

EKATEGORI: TEdit; MKirimBalik: TMemo;

EKirimBalik: TEdit; MSimulasi: TMemo;

Button1: TButton; Button3: TButton;

TabSheet4: TTabSheet; PHide: TPanel;

SBConvSMS: TSpeedButton; SBConvMCtr: TSpeedButton;

SBConvHP: TSpeedButton; SBGetNoHP: TSpeedButton;

SpeedButton1: TSpeedButton; Label22: TLabel;

(4)

ECMC: TEdit; EKode: TEdit;

Edit6: TEdit; EAT: TEdit;

SMDR: TMemo; Button2: TButton;

Memo1: TMemo; BBDEL: TBitBtn;

BSMSIN: TButton; BCek_n_Del1: TButton;

BCek_n_Del: TButton; Edit1: TEdit;

PageControl2: TPageControl;

TabSheet5: TTabSheet;

BB_AddLagu: TBitBtn; DBNavigator3: TDBNavigator; OpenDialog1: TOpenDialog;

BB_PollBaru: TBitBtn; Label21: TLabel;

DBE_No: TDBEdit; DSPoll: TDataSource;

Label24: TLabel;

DBE_Judul_Lagu: TDBEdit;

Label25: TLabel;

DBE_Group_Penyanyi: TDBEdit;

Label26: TLabel;

DBE_File_Name: TDBEdit;

Label27: TLabel; DBE_Dir: TDBEdit;

Label28: TLabel; DBE_Count: TDBEdit;

Label29: TLabel; DBE_Diputar: TDBEdit;

(5)

BB_Post: TBitBtn; BB_Del: TBitBtn;

BB_Edit: TBitBtn; E_Judul_Lagu: TEdit;

E_Group_Penyanyi: TEdit; TPoll: TTable;

MP1: TMediaPlayer; TimerPlay: TTimer;

Panel2: TPanel; DBGrid1: TDBGrid;

SBClose: TSpeedButton; Label31: TLabel;

TabSheet2: TTabSheet;

TimerDurasi: TTimer;

TabSheet6: TTabSheet; Label30: TLabel; PB1: TProgressBar;

TBDurasi: TTrackBar; Label32: TLabel;

LDurasi: TLabel; Label35: TLabel;

Label36: TLabel; BitBtn1: TBitBtn;

BB_STOP_N_PLAY: TBitBtn; Shape1: TShape;

TabSheet7: TTabSheet; Button4: TButton;

BB_Sort: TBitBtn; Edit2: TEdit;

Shape3: TShape; TimerDetik: TTimer;

SpeedButton3: TSpeedButton; SpeedButton4: TSpeedButton;

(6)

Label37: TLabel; Label34: TLabel;

Shape2: TShape; Label33: TLabel;

Label38: TLabel; Label39: TLabel;

TBLamaPoll: TTrackBar; BB_Matic: TBitBtn;

Shape4: TShape;

procedure FormCreate(Sender: TObject);

procedure FormDestroy(Sender: TObject);

procedure SerialPortNG1RxClusterEvent(Sender: TObject); procedure SBGetMCTRClick(Sender: TObject);

procedure MemoTextChange(Sender: TObject);

procedure SBConvSMSClick(Sender: TObject); procedure SpeedButton2Click(Sender: TObject); procedure SBConvMCtrClick(Sender: TObject);

procedure SBConvHPClick(Sender: TObject); procedure CBComClick(Sender: TObject);

procedure SBSetupClick(Sender: TObject); procedure CBBoudClick(Sender: TObject);

procedure SBCloseClick(Sender: TObject); procedure MemoTextClick(Sender: TObject);

procedure Button2Click(Sender: TObject); procedure SBGetNoHPClick(Sender: TObject);

procedure Timer1Timer(Sender: TObject); procedure Timer2Timer(Sender: TObject);

procedure TimerJamTimer(Sender: TObject); procedure SBINBOXClick(Sender: TObject);

procedure HidePanel;

procedure SBOUTBOXClick(Sender: TObject);

procedure SBSetHPClick(Sender: TObject); procedure EHPNomorChange(Sender: TObject);

(7)

procedure Timer3Timer(Sender: TObject); procedure BSMSINClick(Sender: TObject);

procedure SMDRChange(Sender: TObject); procedure BCek_n_Del1Click(Sender: TObject);

procedure BCek_n_DelClick(Sender: TObject); procedure TimerAwalTimer(Sender: TObject);

procedure Button1Click(Sender: TObject); procedure Button3Click(Sender: TObject);

procedure BB_AddLaguClick(Sender: TObject); procedure BB_CancelClick(Sender: TObject);

procedure BB_PostClick(Sender: TObject); procedure BB_DelClick(Sender: TObject); procedure BB_EditClick(Sender: TObject);

procedure DBE_Judul_LaguChange(Sender: TObject);

procedure DBE_Group_PenyanyiChange(Sender: TObject); procedure E_SMSChange(Sender: TObject);

procedure DBE_NoKeyPress(Sender: TObject; var Key: Char);

procedure Edit2KeyPress(Sender: TObject; var Key: Char); procedure Button4Click(Sender: TObject);

procedure BB_SortClick(Sender: TObject);

procedure BB_STOP_N_PLAYClick(Sender: TObject);

procedure TimerPlayTimer(Sender: TObject); procedure BB_PollBaruClick(Sender: TObject);

procedure TBDurasiChange(Sender: TObject); procedure BitBtn1Click(Sender: TObject);

procedure BB_MaticClick(Sender: TObject); procedure TimerDurasiTimer(Sender: TObject);

procedure TBLamaPollChange(Sender: TObject); procedure CBComChange(Sender: TObject);

procedure TimerDetikTimer(Sender: TObject); procedure SpeedButton3Click(Sender: TObject);

procedure SpeedButton4Click(Sender: TObject); private

(8)

public

{ Public declarations }

end;

var

Form1: TForm1;

i: word;

SS, GabPDU, balik, CodHP, PDUSMS, TerimaBaru: string;

testing, Terima, CodHP1, Tgl1, Jam1, PDUSMS1, SMS1, codeTGL, codeJAM {punya procedure Conv SMS In}: string;

pjh1, pjm1, panjang, SMSCount: integer; lpt0, dtout, countdel: byte;

lpt1: array [0..7] of byte;

adaOK, adaCMGL, adatitik2, adaCMGD, idx, pjlagu, Dur: integer;

passok: byte; nolagu: byte;

START_POLL: BOOLEAN;

implementation

//uses mainform, UnitIDPass;

{$R *.dfm}

procedure AddHexString(S : String; Lines : TStrings ); const SLen = 30;

begin SS:=S;

end;

procedure ConvMsg(InText: string; var E6, E2, E3, E4 :String; pjm: integer); var pj, pj2, x, y, a, b, c, ind, ind1,

(9)

buff1, buff2, BUFF3, cod: byte; cods, cods1, cods2,

ED1, ED2, ED3, ED4, ED6, sx0, sx1: string; msg1: array [0..160] of Char; // character

msg2: array [0..160] of byte; // asci

msg3: array [0..160] of string; // biner string

msg4: array [0..160] of string; // bantuan biner string per bit msg5: array [0..160] of byte; // data char dlm byte

msg6: array [0..160] of string; // data char Hex String

begin ED2:=''; ED3:='';

ED1:=InText;

pj:=length(ED1); //pjm:=pj;

case (pj and $0F) of

$00: sx0:='0'; $01: sx0:='1';

$02: sx0:='2'; $03: sx0:='3';

$04: sx0:='4'; $05: sx0:='5';

$06: sx0:='6'; $07: sx0:='7';

$08: sx0:='8'; $09: sx0:='9';

$0A: sx0:='A'; $0B: sx0:='B';

$0C: sx0:='C'; $0D: sx0:='D';

$0E: sx0:='E'; $0F: sx0:='F';

(10)

case (pj and $F0) of $00: sx1:='0';

$10: sx1:='1'; $20: sx1:='2';

$30: sx1:='3'; $40: sx1:='4';

$50: sx1:='5'; $60: sx1:='6';

$70: sx1:='7'; $80: sx1:='8';

$90: sx1:='9'; $A0: sx1:='A'; $B0: sx1:='B';

$C0: sx1:='C';

$D0: sx1:='D'; $E0: sx1:='E'; $F0: sx1:='F';

end;

x:=0;

StrLCopy(Msg1, PChar(ED1), pj);

repeat

Msg2[x]:=ord(Msg1[x]);

ED2:=ED2+intTOstr(Msg2[x]); y:=0;

Msg3[x]:=''; buff1:=Msg2[x];

repeat inc(y);

buff3:=Buff1 div 2; Buff2:=Buff1 mod 2;

if buff2=0 then

Msg3[x]:='0'+Msg3[x]

(11)

buff1:=buff3; until y=7;

ED3:=Msg3[x]+ED3; x:=x+1;

until x=pj; a:=7*pj;

b:=a mod 8; c:=8-b;

case c of

1: ED3:='0'+ED3;

2: ED3:='00'+ED3; 3: ED3:='000'+ED3; 4: ED3:='0000'+ED3;

5: ED3:='00000'+ED3;

6: ED3:='000000'+ED3; 7: ED3:='0000000'+ED3; 8: ED3:=ED3;

end; xx:=0;

pj2:=length(ED3); ED4:='';

ED6:=''; IND:=pj2+1;

repeat ind:=ind-8;

Msg4[xx]:=copy(ED3,ind,8); y:=1;

cod:=0; ind1:=1;

Msg6[xx]:=''; repeat

cods1:=copy(Msg4[xx],ind1,4); ind1:=5;

(12)

if cods1='0000' then cods2:='0'; if cods1='0001' then cods2:='1';

if cods1='0010' then cods2:='2'; if cods1='0011' then cods2:='3';

if cods1='0100' then cods2:='4'; if cods1='0101' then cods2:='5';

if cods1='0110' then cods2:='6'; if cods1='0111' then cods2:='7';

if cods1='1000' then cods2:='8'; if cods1='1001' then cods2:='9';

if cods1='1010' then cods2:='A'; if cods1='1011' then cods2:='B'; if cods1='1100' then cods2:='C';

if cods1='1101' then cods2:='D';

if cods1='1110' then cods2:='E'; if cods1='1111' then cods2:='F'; Msg6[xx]:=Msg6[xx]+Cods2;

until y>2; y:=1;

Msg5[xx]:=0; REPEAT

cods:=copy(Msg4[xx],y,1); case y of

1: if cods='0' then cod:=0 else cod:=$80; 2: if cods='0' then cod:=0 else cod:=$40;

3: if cods='0' then cod:=0 else cod:=$20; 4: if cods='0' then cod:=0 else cod:=$10;

5: if cods='0' then cod:=0 else cod:=$08; 6: if cods='0' then cod:=0 else cod:=$04;

7: if cods='0' then cod:=0 else cod:=$02; 8: if cods='0' then cod:=0 else cod:=$01;

end; inc(y);

(13)

UNTIL y>8;

ED4:=ED4+Msg4[xx];

ED6:=ED6+Msg6[xx]; until ind=1;

E6:=sx1+sx0+ED6; E2:=ED2;

E3:=ED3; E4:=ED4;

end;

procedure TForm1.FormCreate(Sender: TObject); var xx: integer;

begin

START_POLL:=FALSE; passok:=0;

Table1.Open;

Table2.Open;

Timer2.Enabled:=True;

HidePanel; SBSetup.Click;

SELF.WindowState:=WSMAXIMIZED;

LDurasi.Caption:=intTOstr(TBDurasi.Position); LLamaPoll.Caption:=intTOstr(TBLamaPoll.Position);

SerialPortNG1.Active := True;

TPoll.Open;

BB_Cancel.Enabled:=False;

BB_Post.Enabled:=False;

{ if FileExists('.\hp.dat') = false then begin

(14)

'Isikan No. Validasi HP dan Klik Tombol Validasi HP'); end

else begin

xx:=1;

Memo1.Lines.LoadFromFile('.\hp.dat');

ESetHP.Text:=''; repeat

ESetHP.Text:=ESetHP.Text+copy(Memo1.Text,xx,1); xx:=xx+1;

until copy(Memo1.Text,xx,1)=chr(13); end; }

end;

procedure TForm1.FormDestroy(Sender: TObject); begin

SerialPortNG1.Active := False; if TPoll.Active=true then TPoll.Close;

end;

procedure TForm1.SerialPortNG1RxClusterEvent(Sender: TObject); var MCtr, Mctr1, AA, ax: string;

pj, AAA: integer; begin

smdr.Clear;

if SerialPortNG1.NextClusterSize >= 0 then

begin

AddHexString(SerialPortNG1.ReadNextClusterAsString,SMDR.Lines);

end;

SMDR.Lines.Add(ss);

idx:=1;

(15)

case Form1.Tag of 0: begin

MCtr:=SMDR.Lines.Text; pj:=length(MCtr);

repeat

AA:=copy(Mctr,idx,1);

inc(idx);

until (AA='"') or (idx>pj);

AA:=''; MCtr1:='';

repeat

Mctr1:=MCtr1+AA; AA:=copy(Mctr,idx,1);

inc(idx);

until (AA='"') or (idx>pj); Form1.Tag:=1;

EMCTR.Text:=MCtr1;

end;

3: begin // 3.. 5 Send SMS

if (AnsiPos('>', Balik))> 0 then begin

SerialPortNG1.SendString(GabPDU); Form1.Tag:=4;

end; end;

4: begin

Form1.Tag:=5;

end; 5: begin

aaa:=AnsiPos('OK', Balik); if aaa>0 then

begin

//ShowMessage('Pesan terkirim');

(16)

else ShowMessage('Pesan tidak terkirim...'+chr(13)+ 'Ada ERROR'+chr(13)+

'Cek No HP dan Pesan'); Form1.Tag:=1;

Timer1.Enabled:=True; end;

6: begin // Test AT Command

AA:=SMDR.Text; AA:=Testing;

AA:=''; end; 7: begin

AA:=SMDR.Text;

pj:=length(AA); Terima:=''; idx:=1;

repeat

ax:=copy(AA,idx,2);

inc(idx);

until (ax='OK') or (idx>pj);

Form1.Tag:=1; end;

10: begin

Timer1.Enabled:=False;

BSMSIN.Click; end;

20: begin

adaOK:=pos('OK',Testing);

adaCMGL:=pos('+CMGL:',Testing);

if ((adaOK>0) and (adaCMGL>0)) then begin

(17)

Form1.Tag:=1; end;

if (adaOK>0) and (adaCMGL=0) and (adaCMGD=0) then begin

TimerAwal.Enabled:=False; Timer1.Enabled:=True;

end; end;

end;

end;

procedure Convert(InText: string; Pilih: Boolean; var OutText: String; pjh: integer);

var pjhp, ul1, count1, idx, Kon: integer;

code1, NoHP, KodePj: string;

HP1: array [0..20] of string; // biner string begin

count1:=0; repeat

HP1[count1]:=''; inc(Count1);

until Count1>20;

pjHP:=Length(InText); code1:=copy(InText,1,1);

if (code1='0') or (code1='+') then NoHP:=copy(InText,2,pjHP-1) else NoHP:=InText;

code1:=copy(NoHP,1,2);

if (code1<>'62') then NoHP:='62'+NoHP;

pjHP:=Length(NoHP);

if (pjHP mod 2)<>0 then NoHP:=NoHP+'F' else

(18)

if pilih=False then begin

pjHP:=Length(NoHP); Kon:=(pjHP div 2) + 1;

end else

begin

Kon:=pjHP;

end; case Kon of

$00: KodePj:='00'; $01: KodePj:='01'; $02: KodePj:='02';

$03: KodePj:='03';

$04: KodePj:='04'; $05: KodePj:='05'; $06: KodePj:='06';

$07: KodePj:='07'; $08: KodePj:='08';

$09: KodePj:='09'; $0A: KodePj:='0A';

$0B: KodePj:='0B'; $0C: KodePj:='0C';

$0D: KodePj:='0D'; $0E: KodePj:='0E';

$0F: KodePj:='0F'; end;

if ((pjHP mod 2)<>0) and (pilih=True) then ul1:=(pjHP+1) div 2 else

ul1:=pjHP div 2; count1:=0;

idx:=1; repeat

(19)

HP1[count1]:=copy(HP1[count1],2,1)+copy(HP1[count1],1,1); idx:=idx+2;

inc(Count1); until Count1=ul1;

count1:=0; NoHP:='';

repeat

NoHP:=NoHP+HP1[count1];

inc(Count1); until Count1=ul1;

OutText:=KodePj+'91'+NoHP; end;

procedure TForm1.SBGetMCTRClick(Sender: TObject);

begin

Form1.Tag:=0;

if SerialPortNG1.CommPort=CBCom.Text then

begin

SerialPortNG1.SendString('AT+CSCA?'+#$0D);

end;

if SerialPortNG1.CommPort<>CBCom.Text then

begin

Timer2.Enabled:=True;

end; end;

procedure TForm1.MemoTextChange(Sender: TObject);

begin

Label5.Caption:=intTOstr(length(MemoText.Lines.Text));

if (EHPNomor.Text<>'') and (MemoText.Text<>'') then SpeedButton2.Enabled:=True

else

SpeedButton2.Enabled:=False;

(20)

procedure TForm1.SBConvSMSClick(Sender: TObject);

VAR EE6,EE2,EE3,EE4: STRING; pjss: integer;

begin

if MemoText.Lines.Text='' then MemoText.Lines.Text:=' ';

ConvMsg((MemoText.Lines.Text),EE6,EE2,EE3,EE4,pjss); pjm1:=pjss;

PDUSMS:=EE6; end;

procedure TForm1.SpeedButton2Click(Sender: TObject); begin

Timer1.Enabled:=False;

SBConvMCtr.Click; SBConvHP.Click; SBConvSMS.Click;

panjang:=(length('0100'+CodHP+'0000'+PDUSMS)) div 2;

GabPDU:=ECMC.Text+'0100'+CodHP+'0000'+PDUSMS+chr(26);

EAT.Text:='';

EAT.Text:='AT+CMGS='+intTOstr(panjang);

Form1.Tag:=3;

SerialPortNG1.SendString(EAT.Text+#$0D);

Table2.Append;

Table2.Fields[0].AsString:=dateTOstr(date); Table2.Fields[1].AsString:=timeTOstr(time);

Table2.Fields[2].AsString:=EHPNomor.Text; Table2.Fields[3].AsString:=MemoText.Text;

Table2.Post; end;

procedure TForm1.SBConvMCtrClick(Sender: TObject);

(21)

pjk: integer; begin

Convert(EMCTR.Text, False,SSS,pjk); ECMC.Text:=SSS;

end;

procedure TForm1.SBConvHPClick(Sender: TObject); var SSS: String; pjs: integer;

begin

if EHPNomor.Text='' then ShowMessage('Inputkan No HP !')

else begin

Convert(EHPNomor.Text, True,SSS,pjs);

pjh1:=pjs;

CodHP:=SSS;

EKode.Text:=CodHP;//+' '+intTOstr(pjh1)+' '+CodHP; end;

end;

procedure TForm1.CBComClick(Sender: TObject); begin

SerialPortNG1.CommPort:=CBCom.Text; end;

procedure TForm1.SBSetupClick(Sender: TObject);

begin

HidePanel;

PSETUP.Visible:=True; end;

procedure TForm1.CBBoudClick(Sender: TObject);

begin

SerialPortNG1.BaudRate := StrToIntDef(CBBoud.Text,57600);

(22)

end;

procedure TForm1.SBCloseClick(Sender: TObject); begin

Close; end;

procedure TForm1.MemoTextClick(Sender: TObject);

begin

SBSetup.Tag:=0;

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

Form1.Tag:=6; Testing:='';

SerialPortNG1.SendString(EAT.Text+#$0D);

end;

procedure TForm1.SBGetNoHPClick(Sender: TObject); var codes, codehps, xs,xxxs, codeSMS, codeSMSb,

codepj, codeSMSc: string;

codei, codehpi, codeSMSi, x, y, pj, pjb: integer;

begin

codes:=copy(Terima,1,2);

if codes='01' then codei:=1; if codes='02' then codei:=2; if codes='03' then codei:=3; if codes='04' then codei:=4;

if codes='05' then codei:=5; if codes='06' then codei:=6; if codes='07' then codei:=7; if codes='08' then codei:=8;

if codes='09' then codei:=9; if codes='0A' then codei:=10; if codes='0B' then codei:=11; if codes='0C' then codei:=12;

if codes='0D' then codei:=13; if codes='0E' then codei:=14; if codes='0F' then codei:=15; if codes='00' then codei:=0;

(23)

codei:=((codei+2)*2)+1;

CodeHPs:=copy(Terima,codei,2); // panjang no hp

if codeHPs='01' then codeHPi:=1; if codeHPs='02' then codeHPi:=2;

if codeHPs='03' then codeHPi:=3; if codeHPs='04' then codeHPi:=4; if codeHPs='05' then codeHPi:=5; if codeHPs='06' then codeHPi:=6;

if codeHPs='07' then codeHPi:=7; if codeHPs='08' then codeHPi:=8; if codeHPs='09' then codeHPi:=9; if codeHPs='0A' then codeHPi:=10;

if codeHPs='0B' then codeHPi:=11; if codeHPs='0C' then codeHPi:=12; if codeHPs='0D' then codeHPi:=13; if codeHPs='0E' then codeHPi:=14;

if codeHPs='0F' then codeHPi:=15; if codeHPs='00' then codeHPi:=0; //codeHPi:=strTOint(codeHPs);

Xs:=copy(Terima,codei+2,2);// 19 PAKE KODE INTERNASIONAL

if ((codeHPi mod 2)<>0) then

CodHP1:=copy(Terima,codei+2+2,codeHPi+1) else

CodHP1:=copy(Terima,codei+2+2,codeHPi);

x:=1; xxxs:='';

repeat

xxxs:=xxxs+copy(codHP1,x+1,1);

xxxs:=xxxs+copy(codHP1,x,1); x:=x+2;

until x>codeHPi;

if (codeHPi mod 2)<>0 then

begin

xxxs:=copy(xxxs,1,codeHPi);

codeHPi:=codeHPi+1; end;

xxxs:='+'+xxxs; codHP1:=xxxs;

codeTGL:=copy(Terima,codei+2+2+codeHPi+4,6);

(24)

codeTGL:=copy(xxxs,6,1)+copy(xxxs,5,1)+'/'+ copy(xxxs,4,1)+copy(xxxs,3,1)+'/'+

copy(xxxs,2,1)+copy(xxxs,1,1);

codeJAM:=copy(Terima,codei+2+2+codeHPi+4+6,6); xxxs:=codeJAM;

codeJam:=copy(xxxs,2,1)+copy(xxxs,1,1)+':'+ copy(xxxs,4,1)+copy(xxxs,3,1);

codePJ:=copy(Terima,codei+2+2+codeHPi+4+6+6+2,2);//+2 karena validasi sms tdk

dipakai

pj:=strTOint('$'+codePJ);

codeSMS:=copy(Terima,codei+2+2+codeHPi+4+6+6+2+2,1+(length(Terima)-(codei+2+2+codeHPi+4+6+6+2+2)));

x:=length(codeSMS); y:=1;

codeSMSb:='';

repeat // membalik hex

codeSMSb:=copy(codeSMS,y,2)+codeSMSb;

y:=y+2; until y>x;

codeSMS:=codeSMSb; codeSMSb:='';

y:=1;

repeat // hec to bin

case strTOint('$'+copy(codeSMS,y,1)) of $0: codeSMSb:=codeSMSb+'0000';

$1: codeSMSb:=codeSMSb+'0001'; $2: codeSMSb:=codeSMSb+'0010';

$3: codeSMSb:=codeSMSb+'0011'; $4: codeSMSb:=codeSMSb+'0100';

$5: codeSMSb:=codeSMSb+'0101'; $6: codeSMSb:=codeSMSb+'0110';

(25)

$8: codeSMSb:=codeSMSb+'1000'; $9: codeSMSb:=codeSMSb+'1001';

$A: codeSMSb:=codeSMSb+'1010'; $B: codeSMSb:=codeSMSb+'1011';

$C: codeSMSb:=codeSMSb+'1100'; $D: codeSMSb:=codeSMSb+'1101';

$E: codeSMSb:=codeSMSb+'1110'; $F: codeSMSb:=codeSMSb+'1111';

end; inc(y);

until y>x;

pjb:=length(codeSMSb);

codeSMSb:=copy(codeSMSb,pjb-(pj*7)+1,pjb-(pjb-(pj*7)));

pjb:=length(codeSMSb);

y:=1;

codeSMS:='';

repeat // bin to sms

codeSMSc:=copy(codeSMSb,y,7);

codeSMSi:=(strTOint(copy(codeSMSc,1,1))*$40)+

(strTOint(copy(codeSMSc,2,1))*$20)+ (strTOint(copy(codeSMSc,3,1))*$10)+

(strTOint(copy(codeSMSc,4,1))*$08)+ (strTOint(copy(codeSMSc,5,1))*$04)+

(strTOint(copy(codeSMSc,6,1))*$02)+ (strTOint(copy(codeSMSc,7,1))*$01);

codeSMS:=chr(codeSMSi)+codeSMS; y:=y+7

until y>pjb; Table1.Append;

Table1.Fields[0].AsString:=codeTGL; Table1.Fields[1].AsString:=codeJAM;

Table1.Fields[2].AsString:=codHP1; Table1.Fields[3].AsString:=codeSMS;

(26)

MemoText.Clear;

MemoText.Lines.Add(codeTGL);

MemoText.Lines.Add(codeJAM); MemoText.Lines.Add(codeSMS);

EHPNomor.Text:=codHP1;

E_SMS.Text:=codeSMS; end;

procedure TForm1.Timer1Timer(Sender: TObject); begin

Label23.Caption:=intTOstr(Timer1.Tag);

Timer1.Tag:=Timer1.Tag+1; if Timer1.Tag<=25 then

begin

BBDel.Click;

Timer1.Enabled:=False;

end;

if Timer1.Tag>25 then

begin

Timer2.Enabled:=True;

Timer1.Enabled:=False; Timer1.Tag:=0;

Timer2.Tag:=0; end;

end;

procedure TForm1.Timer2Timer(Sender: TObject); begin

Label22.Caption:=intTOstr(Timer2.Tag); Timer2.Tag:=Timer2.Tag+1;

(27)

begin

SBGetMCTR.Click;

StatusBar1.Panels[2].Text:='SEARCHING CONNECTION'; end;

if (Timer2.Tag=7) and (EMCTR.Text='') then begin

Timer2.Tag:=0;

StatusBar1.Panels[2].Text:='UNCONNECTED';

end;

if Timer2.Tag=9then

begin

Timer2.Enabled:=False;

StatusBar1.Panels[2].Text:='CONNECTED';

BCek_n_Del1.Click;

end; end;

procedure TForm1.TimerJamTimer(Sender: TObject); var adasp, pj, xx: integer;

begin

if StatusBar1.Panels[0].Text<> dateTOstr(date) then

StatusBar1.Panels[0].Text:=dateTOstr(date); if StatusBar1.Panels[1].Text<> timeTOstr(time) then

StatusBar1.Panels[1].Text:=timeTOstr(time);

procedure TForm1.SBINBOXClick(Sender: TObject); begin

HidePanel;

PINBOX.Visible:=True;

end;

procedure TForm1.HidePanel; begin

(28)

POUTBOX.Visible:=False; PSETUP.Visible :=False;

end;

procedure TForm1.SBOUTBOXClick(Sender: TObject); begin

HidePanel;

POUTBOX.Visible:=True;

end;

procedure TForm1.EHPNomorChange(Sender: TObject); begin

if (EHPNomor.Text<>'') and (MemoText.Text<>'') then

SpeedButton2.Enabled:=True

else

SpeedButton2.Enabled:=False; end;

procedure TForm1.BBDELClick(Sender: TObject);

begin // terima + del

Form1.Tag:=10;

TerimaBaru:=''; Testing:='';

SerialPortNG1.SendString('AT+CMGL=4'+#$0D); end;

procedure TForm1.Timer3Timer(Sender: TObject);

begin

Timer3.Tag:=Timer3.Tag+1;

if timer3.Tag=10 then begin

SpeedButton2.Click; Timer3.Enabled:=False;

(29)

end;

procedure TForm1.BSMSINClick(Sender: TObject); var aa, ax: string;

pj: integer; begin

Timer1.Enabled:=True; TerimaBaru:=Testing;

Edit1.Text:=Testing; AA:=Testing;

pj:=length(AA); Terima:=''; idx:=1;

repeat

ax:=copy(AA,idx,2); inc(idx);

until (ax='OK') or (idx>pj);

if ax='OK' then begin

idx:=1; repeat

ax:=copy(AA,idx,6); inc(idx);

until (ax='+CMGL:') or (idx>pj); if ax='+CMGL:' then

begin repeat

ax:=copy(AA,idx,1); inc(idx);

until (ax=chr($A)) or (idx>pj); terima:='';

repeat

ax:=copy(AA,idx,1);

(30)

inc(idx);

until (copy(AA,idx,1)=chr($D)) or (idx>pj);

SBGetNoHP.Click;

SerialPortNG1.SendString('AT+CMGD=1'+#$0D);

Form1.Tag:=7; SMDR.Clear;

end; end

else begin

// end; //idx:=1;

Timer1.Enabled:=True;

end;

procedure TForm1.SMDRChange(Sender: TObject);

begin

Testing:=Testing+SMDR.Text; // ambil data sms format text

end;

procedure TForm1.BCek_n_Del1Click(Sender: TObject); begin

TerimaBaru:=''; Testing:='';

SerialPortNG1.SendString('AT+CMGL=4'+#$0D); Form1.Tag:=20;

TimerAwal.Enabled:=True; end;

procedure TForm1.BCek_n_DelClick(Sender: TObject);

var aa, ax, call1 : string; pj, indx: integer;

(31)

// jika ada sms awal di del dulu TerimaBaru:=Testing;

Edit1.Text:=Testing; AA:=Testing;

pj:=length(AA); Terima:='';

idx:=1; //...cari ok

adaOK:=pos('OK',Testing);

if adaOK>1 then begin

adaCMGL:=pos('+CMGL:',Testing);

if adaCMGL>0 then

begin

adatitik2:=pos(':',Testing); indx:=adatitik2+1;

call1:=''; // mencari sms ke repeat

ax:=copy(Testing,indx,1);

if (ax='0') or (ax='1') or (ax='2') or (ax='3') or (ax='4') or

(ax='5') or (ax='6') or (ax='7') or (ax='8') or (ax='9') then call1:=call1+ax;

inc(indx);

until copy(Testing,indx,1)=',';

TerimaBaru:=''; Testing:='';

SMDR.Clear;

SerialPortNG1.SendString('AT+CMGD='+call1+#$0D);

end; end;

end;

(32)

begin

Memo2.Text:=Testing;

adaOK:=pos('OK',Testing);

adaCMGD:=pos('CMGD',Testing);

if ((adaOK>0) and (adaCMGD>0)) then begin

BCek_n_Del1.Click; Form1.Tag:=20;

end; end;

procedure TForm1.Button1Click(Sender: TObject); begin

MSimulasi.Lines.SaveToFile('.\kirim.txt');

end;

procedure TForm1.Button3Click(Sender: TObject);

begin

codHP1:='+6285640341643';

codeTGL:=dateTOstr(date); codeJAM:=timeTOstr(time);

end;

procedure TForm1.BB_AddLaguClick(Sender: TObject); var m3path, chks: string;

pj, poss: integer; begin

TPoll.Last;

OpenDialog1.Execute;

if OpenDialog1.FileName<>'' then begin

TPoll.Append;

m3path:=OpenDialog1.FileName;

(33)

chks:=copy(ExtractFileName(m3path),1,pj-4); E_Judul_Lagu.Text:=chks;

DBE_File_Name.Text:=ExtractFileName(m3path);

DBE_Dir.Text:=ExtractFileDir(m3path); chks:=DBE_Dir.Text;

poss:=pos('\',chks); pj:=length(chks);

if poss<>0 then chks:=copy(chks,poss+1,pj); poss:=pos('\',chks);

pj:=length(chks);

if poss<>0 then E_Group_Penyanyi.Text:=copy(chks,poss+1,pj);

ShowMessage('KOREKSI KEMBALI ISIAN TANGGA LAGU'+chr(13)+

'ISIKAN NO LAGU, DAN JIKA PERLU EDIT JUDUL DAN PE NYANYI');

BB_Cancel.Enabled:=True; BB_Post.Enabled:=True; BB_AddLagu.Enabled:=False;

end; end;

procedure TForm1.BB_CancelClick(Sender: TObject);

begin

TPoll.Cancel;

E_Judul_Lagu.Text:=DBE_Judul_Lagu.Text;

E_Group_Penyanyi.Text:=DBE_Group_Penyanyi.Text;

BB_Cancel.Enabled:=False; BB_Post.Enabled:=False;

BB_AddLagu.Enabled:=True; end;

procedure TForm1.BB_PostClick(Sender: TObject);

begin

if DBE_No.Text<>'' then

(34)

DBE_Judul_Lagu.Text:=E_Judul_Lagu.Text;

DBE_Group_Penyanyi.Text:=E_Group_Penyanyi.Text;

DBE_Count.Text:='0';

DBE_Diputar.Text:='BELUM';

TPoll.Post;

BB_Cancel.Enabled:=False;

BB_Post.Enabled:=False; BB_AddLagu.Enabled:=True;

end else

ShowMessage('ISIKAN NO LAGU'); end;

procedure TForm1.BB_DelClick(Sender: TObject);

begin

if not TPoll.Eof then TPoll.Delete; end;

procedure TForm1.BB_EditClick(Sender: TObject);

begin TPoll.Edit;

BB_Post.Enabled:=True; BB_Cancel.Enabled:=True;

end;

procedure TForm1.DBE_Judul_LaguChange(Sender: TObject); begin

E_Judul_Lagu.Text:=DBE_Judul_Lagu.Text;

end;

procedure TForm1.DBE_Group_PenyanyiChange(Sender: TObject);

(35)

E_Group_Penyanyi.Text:=DBE_Group_Penyanyi.Text; end;

procedure TForm1.E_SMSChange(Sender: TObject);

var panjang, posi: integer; sds: string;

adasps: boolean; begin

TPoll.Refresh;

panjang:=length(E_SMS.Text);

if (pos('TGLG ',E_SMS.Text)>0) AND (START_POLL=TRUE) then begin

posi:=pos(' ',E_SMS.Text);

sds:=copy(E_SMS.Text,posi+1,panjang);

nolagu:=strTOint(sds); TPoll.First;

while not TPoll.Eof do

begin

if DBE_No.Text=sds then

begin TPoll.Edit;

DBE_Count.Text:=intTOstr(strTOint(DBE_Count.Text)+1); TPoll.Post;

E_SMS.Text:=''; end;

TPoll.Next; end;

TPoll.Refresh; end;

end;

procedure TForm1.DBE_NoKeyPress(Sender: TObject; var Key: Char); begin

(36)

end;

procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char); begin

if not((key>=#48) and (key<=#57)) then key:=#0; end;

procedure TForm1.Button4Click(Sender: TObject);

begin

E_SMS.Text:='TGLG '+Edit2.Text;

end;

procedure TForm1.BB_SortClick(Sender: TObject);

begin

TPoll.IndexName:='by_count'; end;

procedure TForm1.BB_STOP_N_PLAYClick(Sender: TObject);

begin

TIMERDURASI.Enabled:=False;

START_POLL:=FALSE; BB_Sort.Click;

TPoll.First; MP1.Close;

MP1.FileName:=DBE_Dir.Text+'\'+DBE_File_Name.Text; MP1.Open;

MP1.TimeFormat:=tfMilliseconds; pjlagu:=MP1.Length;

PB1.Max:=pjlagu; MP1.Play;

TimerPlay.Enabled:=True; end;

procedure TForm1.TimerPlayTimer(Sender: TObject);

(37)

Dur:=(pjLagu*TBDurasi.Position) div 100;

Label30.Caption:=intTOstr(MP1.Position div 1000)+' / '+intTOstr(pjlagu div 1000)+

' | Dimainkan selama '+intTOstr(Dur div 1000) + ' detik '; PB1.Position:=MP1.Position;

if MP1.Position>(Dur) then begin

MP1.Stop; TPoll.Edit;

DBE_Diputar.Text:='SUDAH'; TPoll.Post;

if not TPoll.Eof then begin

TPoll.Next;

MP1.FileName:=DBE_Dir.Text+'\'+DBE_File_Name.Text;

MP1.Open;

MP1.TimeFormat:=tfMilliseconds; pjlagu:=MP1.Length;

PB1.Max:=pjlagu; MP1.Play;

end;

if TPoll.Eof then

begin MP1.Stop;

TPoll.Edit;

DBE_Diputar.Text:='SUDAH';

TPoll.Post;

TimerPlay.Enabled:=False;

end; end;

end;

procedure TForm1.BB_PollBaruClick(Sender: TObject); begin

(38)

while not TPoll.Eof do TPoll.Delete; START_POLL:=FALSE;

end;

procedure TForm1.TBDurasiChange(Sender: TObject); begin

LDurasi.Caption:=intTOstr(TBDurasi.Position); end;

procedure TForm1.BitBtn1Click(Sender: TObject);

begin

START_POLL:=TRUE; end;

procedure TForm1.BB_MaticClick(Sender: TObject); var

menit,detik : integer;

begin

START_POLL:=TRUE;

TIMERDURASI.Enabled:=TRUE; TIMERDURASI.Tag:=0;

TimerDetik.Enabled:=TRUE; TimerDetik.Tag:=0;

end;

procedure TForm1.TimerDurasiTimer(Sender: TObject); var

detik, menit : integer; begin

TIMERDURASI.Tag:=TIMERDURASI.Tag+1;

menit:=(TBLamaPoll.Position*60)-(TIMERDURASI.Tag);

menit:=(menit div 60);

Label38.Caption:=intTOstr(menit)+ ' menit';

(39)

begin

TIMERDURASI.Enabled:=False;

TimerDetik.Enabled:=False; detik:=0;

Label39.Caption:=intTOstr(detik)+ ' detik '; BB_STOP_N_PLAY.Click;

end; end;

procedure TForm1.TBLamaPollChange(Sender: TObject);

begin

LLamaPoll.Caption:=intTOstr(TBLamaPoll.Position); end;

procedure TForm1.CBComChange(Sender: TObject); begin

SerialPortNG1.CommPort:=CBCom.Text;

end;

procedure TForm1.TimerDetikTimer(Sender: TObject); var

detik : integer; begin

detik:=60;

TimerDetik.Tag:=TimerDetik.Tag+1;

detik:=detik-TimerDetik.Tag;

Label39.Caption:=intTOstr(detik)+ ' detik ';

IF TimerDetik.Tag=60 then begin

TimerDetik.Enabled:=TRUE; TimerDetik.Tag:=0;

end; end;

(40)

begin

PageControl2.Visible:=True;

end;

procedure TForm1.SpeedButton4Click(Sender: TObject); begin

PageControl2.Visible:=False; end;

Referensi

Dokumen terkait

Munculnya medan listrik radial ini sangat boleh jadi disebabkan tat kala pembawa-pembawa muatan (arus listrik) tertarik oleh gaya magnetik ke arah pusat konduktor

Berdasarkan kriteria yang telah ditetapkan maka aspek ini telah memenuhi kriteria “Baik” (digunakan). Hasil kuesioner para ahli setelah menjadi produk menunjukkan bahwa ahli

Kalau diartikan secara dangkal, rekam medis seakan-akan hanya merupakan catatan dan dokumen tentang keadaan pasien, namun kalau dikaji lebih dalam rekam medis mempunyai makna yang

Kasus kegagalan dalam penggunaan alat kontrasepsi IUD seperti yang dialami oleh Luluah, secara otomatis bidan sebagai pelaksana pemberian pelayanan terkait

Tujuan penelitian ini yaitu untuk mengetahui efektifitas ekstrak daun patikan kebo (E. hirta) untuk pengobatan ikan nila (O. niloticus) yang diinfeksi bakteri

Cara yang digunakan oleh guru untuk memotivasi siswa agar mereka mau mempelajari matematika tampaknya bergantung pada karakteristik guru yang diantaranya adalah hubungan

Secara umum bayi yang dilahirkan dengan berat badan rendah, mayoritas terjadi pada ibu berusia 20-38 tahun, status pekerjaan tidak bekerja, pendidikan terakhir

2 Keluarga Bapak Nurati merupakan salah satu dari sekian keluarga miskin atau rumah tangga miskin (RTM) yang berada di Desa Manduang. Ia tinggal bersama istri dan satu anak