请教gsm modem(wavecom)状态报告功能的开发 ( 积分: 100 )

  • 主题发起人 主题发起人 he_xin_
  • 开始时间 开始时间
H

he_xin_

Unregistered / Unconfirmed
GUEST, unregistred user!
gsm modem(wavecom)具有状态报告功能,如何通过程序能实现这种功能,哪位在这方面有开发经验的请给与指导
 
gsm modem(wavecom)具有状态报告功能,如何通过程序能实现这种功能,哪位在这方面有开发经验的请给与指导
 
呵呵,我们有利用GSM MODEM发送手机短信的控件和短信群发例子,纯DELPHI源码的,用的设备就是WAVECOM的。可以有偿提供源码和资料,需要的话可以与我联系。
QQ:57151728 WWW.STARTOR.CN
 
这是我们短信控件的Demo, http://www.sms2008.net

unit uMain;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, KoSMSXControl_TLB, StdCtrls;

type
TfrmMain = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
cbModemType: TComboBox;
Label2: TLabel;
edtCenterNo: TEdit;
Label3: TLabel;
cbAvailPorts: TComboBox;
btnOpenComm: TButton;
btnCloseComm: TButton;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
GroupBox4: TGroupBox;
Label4: TLabel;
edtPhoneNo: TEdit;
Label5: TLabel;
mmoContent: TMemo;
btnSend: TButton;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
mmoLogs: TMemo;
Label6: TLabel;
KoSMSX1: TKoSMSX;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure btnSendClick(Sender: TObject);
procedure btnOpenCommClick(Sender: TObject);
procedure KoSMSX1MsgReceived(ASender: TObject; const PhoneNo,
Content: WideString; TimeStamp: TDateTime);
procedure KoSMSX1StatusReport(ASender: TObject; StatusCode: Integer;
const PhoneNo, Content: WideString; MessageID: Integer);
procedure KoSMSX1IncomingCall(ASender: TObject;
const IncomePhoneNo: WideString; IncomeTime: TDateTime);
procedure KoSMSX1Connected(Sender: TObject);
procedure KoSMSX1Disconnected(Sender: TObject);
procedure btnCloseCommClick(Sender: TObject);
private
{ Private declarations }
procedure ConnectDevice(Active: Boolean);
public
{ Public declarations }
end;

var
frmMain: TfrmMain;

implementation

{$R *.dfm}

procedure TfrmMain.FormCreate(Sender: TObject);
var
sPorts: WideString;
begin
Caption := Application.Title;

ConnectDevice(False);
KoSMSX1.EnumComPorts(sPorts);
cbAvailPorts.Items.CommaText := sPorts;
if cbAvailPorts.Items.Count > 0 then
cbAvailPorts.ItemIndex := 0;
end;

procedure TfrmMain.FormDestroy(Sender: TObject);
begin
KoSMSX1.Close;
end;

procedure TfrmMain.btnSendClick(Sender: TObject);
var
sPhoneNo, sContent, sOptions: string;
begin
sOptions := '';
btnSend.Enabled := False;
try
sPhoneNo := edtPhoneNo.Text;
sContent := mmoContent.Text;

if CheckBox1.Checked then // 免提短信
sOptions := sOptions + 'F';

if CheckBox2.Checked then // 状态报告
sOptions := sOptions + 'R';

if KoSMSX1.SendMsg(edtPhoneNo.Text, sContent, 0, sOptions) then
ShowMessage('发送成功!')
else
ShowMessage('发送失败!');
finally
btnSend.Enabled := True;
end;
end;

procedure TfrmMain.btnOpenCommClick(Sender: TObject);
var
s: string;
begin
mmoLogs.Clear;
KoSMSX1.CommName := cbAvailPorts.Text;
KoSMSX1.CenterNo := edtCenterNo.Text;
KoSMSX1.ModemType := cbModemType.ItemIndex;
case KoSMSX1.Open of
0: begin
s := '连接成功';
KoSMSX1.ReadAllMsg;
end;
1: s := '端口无效';
2: s := '端口已被占用';
3: s := '设备没有上电';
4: s := '初始化失败';
5: s := '不支持协议';
end;

ShowMessage(s);
end;

procedure TfrmMain.btnCloseCommClick(Sender: TObject);
begin
KoSMSX1.Close;
end;

procedure TfrmMain.KoSMSX1MsgReceived(ASender: TObject; const PhoneNo,
Content: WideString; TimeStamp: TDateTime);
begin
mmoLogs.Lines.Add('时间:' + DateTimeToStr(TimeStamp));
mmoLogs.Lines.Add('来自:' + PhoneNo);
mmoLogs.Lines.Add('内容:' + Content);
mmoLogs.Lines.Add('=================================');
end;

//状态报告事件
procedure TfrmMain.KoSMSX1StatusReport(ASender: TObject;
StatusCode: Integer; const PhoneNo, Content: WideString;
MessageID: Integer);
var
s: string;
begin
mmoLogs.Lines.Add('接收号码:' + PhoneNo);
mmoLogs.Lines.Add('短信编号:' + IntToStr(MessageID));
mmoLogs.Lines.Add('短信内容:' + Content);
if StatusCode = 0 then
s := '成功'
else
s := '失败';

mmoLogs.Lines.Add('发送结果:' + s);
mmoLogs.Lines.Add('=================================');
end;

procedure TfrmMain.KoSMSX1IncomingCall(ASender: TObject;
const IncomePhoneNo: WideString; IncomeTime: TDateTime);
begin
mmoLogs.Lines.Add('来电时间:' + DateTimeToStr(IncomeTime));
mmoLogs.Lines.Add('来电号码:' + IncomePhoneNo);
mmoLogs.Lines.Add('=================================');
end;

procedure TfrmMain.KoSMSX1Connected(Sender: TObject);
begin
ShowMessage('Connected');
ConnectDevice(True);
end;

procedure TfrmMain.KoSMSX1Disconnected(Sender: TObject);
begin
ShowMessage('Disconnected');
ConnectDevice(False);
end;

procedure TfrmMain.ConnectDevice(Active: Boolean);
begin
btnOpenComm.Enabled := not Active;
btnCloseComm.Enabled := Active;
btnSend.Enabled := Active;
end;

end.


参见: http://www.sms2008.net 有一堆。
下载: http://www.sms2008.net/files/KoSMSGateWay_V2006.rar
通过Outlook收发短信演示: http://www.sms2008.net/files/Outlook_Demo.rar
通过Foxmail收发短信演示: http://www.sms2008.net/files/Foxmail_Demo.rar

现成产品,无需自已再花精力做了。
 
to seaboy:
到www.sms2008.net下载不了KoSMSX控件呀
 
如果需求符合,您可以直接使用我们的软件产品,如:短信网关服务器。
 
我想试用一下你们的控件,行吗
 
你如果要对方返回短信状态报告给你的话,需要你在发送短信的时候就设置好需要对方返回状态报告就可以了,这样对方接收成功后你就可以收到一条单独的状态报告的回复的。呵呵。邮箱,我发个Demo给你。我个人开发过不少wavecom gsm modem的程序了,你如果有需要的话请联系 QQ : 185597150
 
像个样的应用,不算特别难。 自己找找Modem的AT命令,慢慢调试一下就好了
 
后退
顶部