Translate Blog

EnglishFrenchGermanSpainItalianDutchRussianPortugueseJapaneseKoreanArabicChinese Simplified

May 6, 2011

SMS Gateway Dengan ZylGSM

sedikit oleh-oleh dari proses pengerjaan skripsi..... di dalam program skripsi q ada aplikasi untuk sms nya... pertama bingung juga.... nyari di mbah google... wah susah2 program nya.... instal komponennya di delphi 7 juga pada ribet-ribet.... eh pas pusing-pusingnya akhirnya datang juga.. eh salah akhirnya nemu juga ni komponen ZylGSM... programnya simpel... instal komponennya juga mudah... support Cbuider n delphi. mulai delphi 4 smp delphi 2010.. program masih bisa diedit2 sendiri bisa di kembangkan gitu... download aja dulu ni komponennya disini
 kayak kini ni contoh program sms standartnya. bisa buat telpon juga, tampilan dulu aja deh.... baru programnya:

dahkan... baru ni dia source code nya:



unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ZylGSM;

type
  TForm1 = class(TForm)
    Memo: TMemo;
    btnOpen: TButton;
    txtNo: TEdit;
    btnSendStr: TButton;
    btnClose: TButton;
    lstPort: TListBox;
    lstBaudRate: TListBox;
    ZylGSM: TZylGSM;
    btnDial: TButton;
    btnAnswer: TButton;
    btnSendSMSText: TButton;
    txtMessage: TMemo;
    btnTerminate: TButton;
    btnSendSMSPDU: TButton;
    btnDetect: TButton;
    lblDetect: TLabel;
    btnCancel: TButton;
    rgMessageFormat: TRadioGroup;
    procedure ZylGSMReceive(Sender: TObject; Buffer: String);
    procedure btnOpenClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure btnSendStrClick(Sender: TObject);
    procedure btnCloseClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ZylGSMDisconnect(Sender: TObject; Port: TCommPort);
    procedure ZylGSMConnect(Sender: TObject; Port: TCommPort);
    procedure btnDialClick(Sender: TObject);
    procedure btnAnswerClick(Sender: TObject);
    procedure btnSendSMSTextClick(Sender: TObject);
    procedure btnTerminateClick(Sender: TObject);
    procedure btnSendSMSPDUClick(Sender: TObject);
    procedure ZylGSMRing(Sender: TObject; CallerNumber: String);
    procedure ZylGSMNewMessage(Sender: TObject; Storage: String;
      Index: Integer);
    procedure ZylGSMReadMessage(Sender: TObject; MessageText: WideString; PhoneNumber,
      CenterNumber: String; Status: Integer);
    procedure btnDetectClick(Sender: TObject);
    procedure ZylGSMDetect(Sender: TObject; const Port: TCommPort;
      const BaudRate: TBaudRate; var Cancel: Boolean);
    procedure btnCancelClick(Sender: TObject);
    procedure rgMessageFormatClick(Sender: TObject);
  private
    { Private declarations }
    FCancelDetect: Boolean;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ZylGSMReceive(Sender: TObject; Buffer: String);
begin
  Memo.Lines.Add(Buffer)
end;

procedure TForm1.btnOpenClick(Sender: TObject);
begin
  ZylGSM.Port := TCommPort(lstPort.ItemIndex + 1);
  ZylGSM.BaudRate := ZylGSM.IntToBaudRate(
  StrToInt(lstBaudRate.Items[lstBaudRate.ItemIndex]));
  ZylGSM.MessageFormat := TMessageFormat(rgMessageFormat.ItemIndex);
  ZylGSM.Open;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  ZylGSM.Close();
end;

procedure TForm1.btnSendStrClick(Sender: TObject);
begin
  ZylGSM.SendString(txtMessage.Text + #13);
end;

procedure TForm1.btnCloseClick(Sender: TObject);
begin
  ZylGSM.Close;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  comPorts: TCommPortSet;
  i: TCommPort;
begin
  comPorts := ZylGSM.GetExistingCommPorts();
  Memo.Lines.Add('Installed COMM Ports:');
  for i := spCOM1 to spCOM99 do
  begin
    if i in comPorts then
      Memo.Lines.Add(ZylGSM.CommPortToString(i));
  end;
 
  lstBaudRate.ItemIndex := 9;
end;

procedure TForm1.ZylGSMDisconnect(Sender: TObject; Port: TCommPort);
begin
  Memo.Lines.Add('Disconnected from ' + ZylGSM.CommPortToString(Port));
end;

procedure TForm1.ZylGSMConnect(Sender: TObject; Port: TCommPort);
begin
  Memo.Lines.Add('Connected to ' + ZylGSM.CommPortToString(Port));
end;

procedure TForm1.btnDialClick(Sender: TObject);
begin
  ZylGSM.DialVoice(txtNo.Text);
end;

procedure TForm1.btnAnswerClick(Sender: TObject);
begin
  ZylGSM.AnswerCall;
end;

procedure TForm1.btnSendSMSTextClick(Sender: TObject);
begin
  ZylGSM.SendSmsAsText(txtNo.Text, '', txtMessage.Text);
end;

procedure TForm1.btnTerminateClick(Sender: TObject);
begin
  ZylGSM.TerminateCall;
end;

procedure TForm1.btnSendSMSPDUClick(Sender: TObject);
begin
  ZylGSM.SendSmsAsPDU(txtNo.Text, '', txtMessage.Text);
end;

procedure TForm1.ZylGSMRing(Sender: TObject; CallerNumber: String);
begin
  Memo.Lines.Add('RING EVENT: ' + CallerNumber);
end;

procedure TForm1.ZylGSMNewMessage(Sender: TObject; Storage: String;
  Index: Integer);
begin
  Memo.Lines.Add('New SMS');
end;

procedure TForm1.ZylGSMReadMessage(Sender: TObject; MessageText: WideString;
  PhoneNumber, CenterNumber: String; Status: Integer);
begin
  Memo.Lines.Add('SMS: ' + MessageText);
  Memo.Lines.Add('Caller: ' + PhoneNumber);
  Memo.Lines.Add('Center: ' + CenterNumber);
  Memo.Lines.Add('Status: ' + IntToStr(Status));
end;

procedure TForm1.btnDetectClick(Sender: TObject);
var
  pPort: TCommPort;
  pBaudRate: TBaudRate;
begin
  FCancelDetect := False;
  if ZylGSM.DetectGSM(pPort, pBaudRate) then
  begin
    ShowMessage('Detected: ' + ZylGSM.CommPortToString(pPort) +
      ' BaudRate = ' + IntToStr(ZylGSM.BaudRateToInt(pBaudRate)));
    lstPort.ItemIndex := lstPort.Items.IndexOf(ZylGSM.CommPortToString(pPort));
    lstBaudRate.ItemIndex := lstBaudRate.Items.IndexOf(IntToStr(ZylGSM.BaudRateToInt(pBaudRate)));
  end
  else
  begin
    ShowMessage('No GSM detected.');
  end;
  lblDetect.Caption := ''
end;

procedure TForm1.ZylGSMDetect(Sender: TObject; const Port: TCommPort;
  const BaudRate: TBaudRate; var Cancel: Boolean);
begin
  lblDetect.Caption := 'Detecting - Port: ' + ZylGSM.CommPortToString(Port) +
      ' BaudRate: ' + IntToStr(ZylGSM.BaudRateToInt(BaudRate));
  Cancel := FCancelDetect;
end;

procedure TForm1.btnCancelClick(Sender: TObject);
begin
  FCancelDetect := True;
end;

procedure TForm1.rgMessageFormatClick(Sender: TObject);
begin
  ZylGSM.MessageFormat := TMessageFormat(rgMessageFormat.ItemIndex);
end;

end.

7 comments:

  1. Everything is very open with a very clear explanation of the iѕsues.
    It was definitely informatіve. Your site іѕ very helpful.
    Thаnks fοr sharing!

    Feel free to surf tо mу web blog; payday loan if
    Also see my page - online payday loan,payday loan lenders,payday loans online,payday loans no faxing,instant payday loans,direct payday loan lenders,fast payday loans,online payday loans,best payday loans,payday loan lender,1 hour payday loans,instant payday loan,advance payday loans,payday loan online,fast payday loan,same day payday loans,payday loans,instant approval payday loans,one hour payday loans,direct payday loans,no credit check payday loan,bad credit payday loans,easy payday loans,no faxing payday loans,cheap payday loans,instant payday loans online,quick payday loan,no credit check payday loans,payday loan yes,long term payday loans,same day payday loan,cash payday loans,payday loans direct lender,direct lender payday loans,payday loan direct lenders,online payday loan lenders,free payday loan,no teletrack payday loans,quick payday loans,direct lenders for payday loans,payday loan store,payday loan no credit check,payday loans online direct lenders,payday loans no credit check,payday loans direct lenders only,payday loan lenders only,payday loans for bad credit,savings account payday loans,my payday loan,get a payday loan,a payday loan for,a payday loan,the payday loan,payday loan for,payday loan if,payday loan when,your payday loan,if payday loan,payday loan can help,payday loan will often,payday loan might,payday loan has

    ReplyDelete
  2. I loved as muсh as yοu'll receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get bought an shakiness over that you wish be delivering the following. unwell unquestionably come more formerly again since exactly the same nearly a lot often inside case you shield this increase.

    Feel free to visit my page bad credit long term loans

    ReplyDelete
  3. Terrifіc poѕt howeѵeг , I ωas ωаnting to knοw if уou could
    write a lіtte mοre on this subjeсt?
    Ι'd be very grateful if you could elaborate a little bit further. Many thanks!

    My blog :: Lloyd Irvin

    ReplyDelete
  4. I might get aгound to ԁοing somethіng sіmilаr myself ѕοmetime, іf I cаn finԁ
    thе finance.

    Have а loоk аt my ωeb ѕіte long term Loan lenders

    ReplyDelete
  5. this is a demo from ZylGSMNewMessage

    ReplyDelete
  6. Works nicely! Thanks dude
    http://imgur.com/JN51mek

    ReplyDelete