📄 unitparam.pas
字号:
ComboBox5.SetFocus;
exit;
end;
if ComboBox4.ItemIndex = -1 then
begin
MessageBox(Handle, PChar('校验位不能为空'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 3;
ComboBox4.SetFocus;
exit;
end;
if ComboBox2.ItemIndex = -1 then
begin
MessageBox(Handle, PChar('停止位不能为空'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 3;
ComboBox2.SetFocus;
exit;
end;
if ComboBox3.ItemIndex = -1 then
begin
MessageBox(Handle, PChar('流控制不能为空'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 3;
ComboBox3.SetFocus;
exit;
end;
end;
if CheckBox29.Checked then begin
paramcount := paramcount + 1;
tmpstr := Trim(Edit23.Text);
if (tmpstr = '') or (strtoint(tmpstr) > 9) then
begin
MessageBox(Handle, PChar('终端类型不能为空,取值范围从0到9'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 4;
Edit23.SetFocus;
exit;
end;
end;
if CheckBox30.Checked then begin
paramcount := paramcount + 1;
tmpstr := Trim(Edit24.Text);
if (tmpstr = '') or (strtoint(tmpstr) > 3) then
begin
MessageBox(Handle, PChar('呼叫类型不能为空,取值范围从0到3'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 4;
Edit24.SetFocus;
exit;
end;
end;
if CheckBox31.Checked then begin
paramcount := paramcount + 1;
tmpstr := Trim(Edit25.Text);
tmpint := strtoint(tmpstr);
if (tmpstr = '') or ((tmpint > 0) and (tmpint < 10))
or (tmpint > 65535) then
begin
MessageBox(Handle, PChar('呼叫间隔不能为空,取值范围0或10到65535'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 4;
Edit25.SetFocus;
exit;
end;
end;
if CheckBox32.Checked then begin
paramcount := paramcount + 1;
tmpstr := Trim(Edit26.Text);
tmpint := strtoint(tmpstr);
if (tmpstr = '') or ((tmpint > 0) and (tmpint < 10))
or (tmpint > 65535) then
begin
MessageBox(Handle, PChar('下线间隔不能为空,取值范围0或10到65535'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 4;
Edit26.SetFocus;
exit;
end;
end;
if CheckBox29.Checked and (Trim(Edit23.Text) = '2') then begin
tmpstr := Trim(Edit24.Text);
if CheckBox30.Checked and ((tmpstr = '0') or (tmpstr = '1')) then
if CheckBox33.Checked then begin
paramcount := paramcount + 1;
if Trim(Edit27.Text) = '' then
begin
MessageBox(Handle, PChar('终端类型为2,呼叫类型为0或1时,DSC身份识别码不能为空'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 4;
Edit27.SetFocus;
exit;
end;
end
else begin
MessageBox(Handle, PChar('终端类型为2,呼叫类型为0或1时,必须勾上DSC身份识别码'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 4;
CheckBox33.SetFocus;
exit;
end;
end;
if CheckBox2.Visible and CheckBox2.Checked then begin
paramcount := paramcount + 1;
if ComboBox6.ItemIndex = -1 then
begin
MessageBox(Handle, PChar('传输方式不能为空'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 4;
ComboBox6.SetFocus;
exit;
end;
end;
if CheckBox3.Visible and CheckBox3.Checked then begin
paramcount := paramcount + 1;
if ComboBox7.ItemIndex = -1 then
begin
MessageBox(Handle, PChar('与DSC连接方式不能为空'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 4;
ComboBox7.SetFocus;
exit;
end;
end;
if CheckBox34.Checked then begin
paramcount := paramcount + 1;
tmpstr := Trim(Edit29.Text);
if (tmpstr = '') or (strtoint(tmpstr) > 120) then
begin
MessageBox(Handle, PChar('TCP保活间隔不能为空,取值范围从0到120'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 4;
Edit29.SetFocus;
exit;
end;
end;
if CheckBox23.Checked then begin
paramcount := paramcount + 1;
tmpstr := Trim(Edit22.Text);
if (tmpstr = '') or (strtoint(tmpstr) > 255) then
begin
MessageBox(Handle, PChar('制造商类型不能为空,取值范围从0到255'), PChar('参数错误'), MB_OK or MB_ICONEXCLAMATION);
PageControl1.ActivePageIndex := 5;
Edit22.SetFocus;
exit;
end;
end;
if paramcount = 0 then
begin
MessageBox(Handle, PChar('请选择需要更改的参数,再进行设置'), PChar('提示'), MB_OK or MB_ICONEXCLAMATION);
exit;
end;
result := true;
end;
procedure TFParam.BitBtn2Click(Sender: TObject);
var
//destip: Longword;
//destport: word;
i: Integer;
dtu: string;
tmpip: Longword;
param: array[0..299] of char;
nParamLenth: Integer;
iErrorCode: Integer;
two_byte: word;
mess: array[0..255] of char;
// Parity: Byte;
// StopBit: Byte;
begin
if ComboBox1.ItemIndex = -1 then
exit;
if not checkparam() then
exit;
//destip := 0;
//destport := 0;
dtu := ComboBox1.Items[ComboBox1.ItemIndex];
for i := 0 to form1.ListView1.Items.Count - 1 do
{if dtu = form1.ListView1.Items[i].Caption then
begin
destip := inet_addr(PChar(form1.ListView1.Items[i].SubItems[3]));
destip := ntohl(destip);
destport := StrToInt(form1.ListView1.Items[i].SubItems[4]);
break;
end;}
// destip := 1;
//if destip <> 0 then
//begin
ClearParam();
//设置移动服务参数
if CheckBox7.Checked then begin
strcopy(param, PChar(Edit1.Text));
nParamLenth := Length(Edit1.Text);
SetParam($01, param, nParamLenth, iErrorCode);
end;
if CheckBox8.Checked then begin
strcopy(param, PChar(Edit2.Text));
nParamLenth := Length(Edit2.Text);
SetParam($02, param, nParamLenth, iErrorCode);
end;
if CheckBox9.Checked then begin
strcopy(param, PChar(Edit3.Text));
nParamLenth := Length(Edit3.Text);
SetParam($03, param, nParamLenth, iErrorCode);
end;
if CheckBox10.Checked then begin
strcopy(param, PChar(Edit4.Text));
nParamLenth := Length(Edit4.Text);
SetParam($04, param, nParamLenth, iErrorCode);
end;
if CheckBox11.Checked then begin
strcopy(param, PChar(Edit5.Text));
nParamLenth := Length(Edit5.Text);
SetParam($05, param, nParamLenth, iErrorCode);
end;
//设置DTU参数
if CheckBox12.Checked then begin
strcopy(param, PChar(Edit6.Text));
nParamLenth := Length(Edit6.Text);
SetParam($06, param, nParamLenth, iErrorCode);
end;
if CheckBox13.Checked then begin
two_byte := strtoint(Edit7.Text);
param[0] := char(two_byte shr 8);
param[1] := char(two_byte);
nParamLenth := 2;
SetParam($07, param, nParamLenth, iErrorCode);
end;
if CheckBox14.Checked then begin
two_byte := strtoint(Edit8.Text);
param[0] := char(two_byte shr 8);
param[1] := char(two_byte);
nParamLenth := 2;
SetParam($08, param, nParamLenth, iErrorCode);
end;
if CheckBox15.Checked then begin
two_byte := strtoint(Edit9.Text);
param[0] := char(two_byte shr 8);
param[1] := char(two_byte);
nParamLenth := 2;
SetParam($09, param, nParamLenth, iErrorCode);
end;
if CheckBox16.Checked then begin
two_byte := strtoint(Edit10.Text);
param[0] := char(two_byte shr 8);
param[1] := char(two_byte);
nParamLenth := 2;
SetParam($0a, param, nParamLenth, iErrorCode);
end;
if CheckBox17.Checked then begin
two_byte := strtoint(Edit12.Text);
param[0] := char(two_byte);
nParamLenth := 1;
SetParam($0b, param, nParamLenth, iErrorCode);
end;
if CheckBox18.Checked then begin
two_byte := strtoint(Edit11.Text);
param[0] := char(two_byte shr 8);
param[1] := char(two_byte);
nParamLenth := 2;
SetParam($0c, param, nParamLenth, iErrorCode);
end;
if CheckBox35.Checked then begin
two_byte := strtoint(Edit30.Text);
param[0] := char(two_byte);
nParamLenth := 1;
SetParam($23, param, nParamLenth, iErrorCode);
end;
//设置数据中心参数 .
if CheckBox24.Checked then begin
tmpip := ntohl(inet_addr(PChar(Edit13.Text)));
param[0] := char(HIBYTE(HIWORD(tmpip)));
param[1] := char(LOBYTE(HIWORD(tmpip)));
param[2] := char(HIBYTE(LOWORD(tmpip)));
param[3] := char(LOBYTE(LOWORD(tmpip)));
nParamLenth := 4;
SetParam($0d, param, nParamLenth, iErrorCode);
end;
if CheckBox25.Checked then begin
strcopy(param, PChar(Edit14.Text));
nParamLenth := Length(Edit14.Text);
SetParam($0e, param, nParamLenth, iErrorCode);
end;
if CheckBox26.Checked then begin
two_byte := strtoint(Edit15.Text);
param[0] := char(two_byte shr 8);
param[1] := char(two_byte);
nParamLenth := 2;
SetParam($0f, param, nParamLenth, iErrorCode);
end;
if CheckBox27.Checked then begin
two_byte := strtoint(Edit16.Text);
param[0] := char(two_byte shr 8);
param[1] := char(two_byte);
nParamLenth := 2;
SetParam($10, param, nParamLenth, iErrorCode);
end;
if CheckBox28.Checked then begin
tmpip := ntohl(inet_addr(PChar(ComboBox9.Text)));
param[0] := char(HIBYTE(HIWORD(tmpip)));
param[1] := char(LOBYTE(HIWORD(tmpip)));
param[2] := char(HIBYTE(LOWORD(tmpip)));
param[3] := char(LOBYTE(LOWORD(tmpip)));
nParamLenth := 4;
SetParam($11, param, nParamLenth, iErrorCode);
end;
if CheckBox21.Checked then begin
tmpip := ntohl(inet_addr(PChar(Edit20.Text)));
param[0] := char(HIBYTE(HIWORD(tmpip)));
param[1] := char(LOBYTE(HIWORD(tmpip)));
param[2] := char(HIBYTE(LOWORD(tmpip)));
param[3] := char(LOBYTE(LOWORD(tmpip)));
nParamLenth := 4;
SetParam($20, param, nParamLenth, iErrorCode);
end;
if CheckBox22.Checked then begin
two_byte := strtoint(Edit21.Text);
param[0] := char(two_byte shr 8);
param[1] := char(two_byte);
nParamLenth := 2;
SetParam($21, param, nParamLenth, iErrorCode);
end;
//设置串口参数
if CheckBox19.Checked then begin
fillmemory(@param[0], sizeof(param), 0);
strcopy(param, pchar(ComboBox8.Text + '-'));
strcat(param, pchar(IntToStr(ComboBox5.ItemIndex + 5) + '-'));
strcat(param, pchar(IntToStr(ComboBox4.ItemIndex + 1) + '-'));
strcat(param, pchar(IntToStr(ComboBox2.ItemIndex) + '-'));
strcat(param, pchar(IntToStr(ComboBox3.ItemIndex + 1)));
{if ComboBox4.ItemIndex = 0 then
StopBit := 0
else
StopBit := $04;
if ComboBox2.ItemIndex = 0 then
Parity := 0
else if ComboBox2.ItemIndex = 1 then
Parity := $08
else
Parity := $18;
CombinSerialParam(
param,
7,
StrToInt(ComboBox8.Text),
ComboBox5.ItemIndex,
StopBit,
Parity,
ComboBox3.ItemIndex + 1);}
SetParam($12, param, strlen(param), iErrorCode);
end;
//设置特殊参数
if CheckBox29.Checked then begin
two_byte := strtoint(Edit23.Text);
param[0] := char(two_byte);
nParamLenth := 1;
SetParam($13, param, nParamLenth, iErrorCode);
end;
if CheckBox30.Checked then begin
two_byte := strtoint(Edit24.Text);
param[0] := char(two_byte);
nParamLenth := 1;
SetParam($14, param, nParamLenth, iErrorCode);
end;
if CheckBox31.Checked then begin
two_byte := strtoint(Edit25.Text);
param[0] := char(two_byte shr 8);
param[1] := char(two_byte);
nParamLenth := 2;
SetParam($15, param, nParamLenth, iErrorCode);
end;
if CheckBox32.Checked then begin
two_byte := strtoint(Edit26.Text);
param[0] := char(two_byte shr 8);
param[1] := char(two_byte);
nParamLenth := 2;
SetParam($16, param, nParamLenth, iErrorCode);
end;
if CheckBox33.Checked then begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -