SDK_20001.VideoSource :=1表示1通道
SDK_20001.VideoSource :=1表示2通道
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, VaClasses, VaComm, OleCtrls, SDK_2000Lib_TLB;
type
TForm1 = class(TForm)
SDK_20001: TSDK_2000;
VaComm: TVaComm;
Image1: TImage;
Image2: TImage;
Timer1: TTimer;
Button1: TButton;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
Button2: TButton;
Button3: TButton;
SDK_20002: TSDK_2000;
procedure FormShow(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
private
{ Private declarations }
f_bDSR,
f_bCTS,
f_bRING,
f_bRLSD:boolean;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormShow(Sender: TObject);
begin
self.SDK_20001.Connect(false);
self.SDK_20001.VideoSource :=2;
self.SDK_20001.ShowLogo :=true;
self.SDK_20001.ShowTime:=true;
self.SDK_20001.ShowDate:=true;
self.SDK_20001.SetPreviewWHT(120,160,2);
self.SDK_20002.Connect(false);
self.SDK_20002.VideoSource :=1;
self.SDK_20002.ShowLogo :=true;
self.SDK_20002.ShowTime:=true;
self.SDK_20002.ShowDate:=true;
self.SDK_20002.SetPreviewWHT(120,160,2);
self.f_bDSR :=false;
self.f_bCTS :=false;
self.f_bRING :=false;
self.f_bRLSD :=false;
// self.VaComm.AutoOpen :=true;
self.VaComm.Open;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
//1
if self.VaComm.RLSD and not self.f_bRLSD then
begin
if self.SDK_20001.VideoSource =2 then
begin
self.SDK_20001.VideoSource :=1;
sleep(1500);
end;
self.SDK_20001.SaveImageToBmp('c:/1.bmp');
//图形捕捉
self.Image1.Picture.LoadFromFile('c:/1.bmp');
self.f_bRLSD :=true;
end;
if not self.VaComm.RLSD then
self.f_bRLSD :=false;
//6
if self.VaComm.DSR and not self.f_bDSR then
begin
if self.SDK_20001.VideoSource =1 then
begin
self.SDK_20001.VideoSource :=2;
sleep(1500);
end;
self.SDK_20001.SaveImageToBmp('c:/2.bmp');
//图形捕捉
self.Image2.Picture.LoadFromFile('c:/2.bmp');
self.f_bDSR :=true;
end;
if not self.VaComm.DSR then
self.f_bDSR :=false;
//8
if self.VaComm.CTS and not self.f_bCTS then
begin
if self.SDK_20001.VideoSource =1 then
begin
self.SDK_20001.VideoSource :=2;
sleep(1500);
end;
self.SDK_20001.SaveImageToBmp('c:/2.bmp');
//图形捕捉
self.Image2.Picture.LoadFromFile('c:/2.bmp');
self.f_bCTS :=true;
end;
if not self.VaComm.CTS then
self.f_bCTS :=false;
//9
if self.VaComm.RING and not self.f_bRING then
begin
if self.SDK_20001.VideoSource =1 then
begin
self.SDK_20001.VideoSource :=2;
sleep(1500);
end;
self.SDK_20001.SaveImageToBmp('c:/2.bmp');
//图形捕捉
self.Image2.Picture.LoadFromFile('c:/2.bmp');
self.f_bRING :=true;
end;
if not self.VaComm.RING then
self.f_bRING :=false;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if self.SDK_20001.VideoSource =2 then
begin
self.SDK_20001.VideoSource :=1;
sleep(1500);
end;
self.SDK_20001.SaveImageToJpg('c:/1.Jpg',100);
//图形捕捉
// self.Image1.Picture.Graphic.LoadFromFile('c:/1.Jpg');
if self.SDK_20001.VideoSource =1 then
begin
self.SDK_20001.VideoSource :=2;
sleep(1500);
end;
self.SDK_20001.SaveImageToJpg('c:/2.Jpg',100);
//图形捕捉
// self.Image2.Picture.Graphic.LoadFromFile('c:/2.Jpg');
self.RadioButton2.Checked:=true;
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
if self.RadioButton2.Checked then
self.SDK_20001.VideoSource :=2;
end;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
if self.RadioButton1.Checked then
self.SDK_20001.VideoSource :=1;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if self.SDK_20001.VideoSource =2 then
begin
self.SDK_20001.VideoSource :=1;
sleep(1500);
end;
self.SDK_20001.SaveImageToBmp('c:/1.bmp');
//图形捕捉
self.Image1.Picture.LoadFromFile('c:/1.bmp');
self.RadioButton1.Checked:=true;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if self.SDK_20001.VideoSource =1 then
begin
self.SDK_20001.VideoSource :=2;
sleep(1500);
end;
self.SDK_20001.SaveImageToBmp('c:/2.bmp');
//图形捕捉
self.Image2.Picture.LoadFromFile('c:/2.bmp');
self.RadioButton2.Checked:=true;
end;
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
self.SDK_20001.Disconnect;
self.SDK_20002.Disconnect;
end;
end.