使用Delphi对手机通讯的编程
点击次数:63 次 发布日期:2008-11-09 08:41:36 作者:源代码网
|
源代码网推荐 unit PanasonicGD; 源代码网推荐 interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, RXClock, ExtCtrls, RXCtrls, Gauges, OoMisc, AdPort, DsFancyButton; 源代码网推荐 type TPanasonicGD92 = class(TForm) 源代码网推荐 SoftwareTitle: TRxLabel; 源代码网推荐 ComPortItem: TPanel; 源代码网推荐 PhoneInfo: TPanel; 源代码网推荐 ComPort1: TRadioButton; 源代码网推荐 ComPort2: TRadioButton; 源代码网推荐 ComPort3: TRadioButton; 源代码网推荐 ComPort4: TRadioButton; 源代码网推荐 Com1Port: TRxLabel; 源代码网推荐 Com2Port: TRxLabel; 源代码网推荐 Com3Port: TRxLabel; 源代码网推荐 Com4Port: TRxLabel; 源代码网推荐 RealClock: TRxClock; 源代码网推荐 Autohor: TRxLabel; 源代码网推荐 SoftwareVersion: TRxLabel; 源代码网推荐 PhoneIMEI: TRxLabel; 源代码网推荐 GD92SW: TEdit; 源代码网推荐 GD92IMEI: TEdit; 源代码网推荐 JobItem: TPanel; 源代码网推荐 ProcessInfo: TPanel; 源代码网推荐 PhoneLockCode: TRxLabel; 源代码网推荐 GD92CODE: TEdit; 源代码网推荐 ProcessBar: TGauge; 源代码网推荐 PromptInfo: TPanel; 源代码网推荐 UserInfo: TLabel; 源代码网推荐 ComPort: TApdComPort; 源代码网推荐 ExitProgram: TDsFancyButton; 源代码网推荐 TestMode: TDsFancyButton; 源代码网推荐 ReadInfo: TDsFancyButton; 源代码网推荐 Chinese: TDsFancyButton; 源代码网推荐 ExitTestMode: TDsFancyButton; 源代码网推荐 function GetCOMData(Count: integer): string; 源代码网推荐 procedure ExitProgramClick(Sender: TObject); 源代码网推荐 procedure TestModeClick(Sender: TObject); 源代码网推荐 procedure ComPortTriggerAvail(CP: TObject; Count: word); procedure ChineseClick(Sender: TObject); 源代码网推荐 procedure ExitTestModeClick(Sender: TObject); 源代码网推荐 procedure ReadInfoClick(Sender: TObject); 源代码网推荐 private { Private declarations } 源代码网推荐 public { Public declarations } 源代码网推荐 end; 源代码网推荐 var PanasonicGD92: TPanasonicGD92; 源代码网推荐 ResponseArray: array[1..300] of string; 源代码网推荐 Step: integer; 源代码网推荐 PanaGD9xIMEI: string; 源代码网推荐 PanaGD9xCode: string; 源代码网推荐 PanaGD9xSW: string; 源代码网推荐 DoStop: boolean; 源代码网推荐 implementation 源代码网推荐 {$R *.DFM} 源代码网推荐 function TPanasonicGD92.GetCOMData(Count: integer): string; 源代码网推荐 var I: integer;begin 源代码网推荐 Result := "; 源代码网推荐 for I := 1 to Count do 源代码网推荐 Result := Result IntToHex(byte(ComPort.GetChar), 02); 源代码网推荐 end; 源代码网推荐 procedure TPanasonicGD92.ExitProgramClick(Sender: TObject); 源代码网推荐 begin 源代码网推荐 Close; 源代码网推荐 end; 源代码网推荐 procedure TPanasonicGD92.TestModeClick(Sender: TObject); 源代码网推荐 begin 源代码网推荐 if TestMode.Caption = "Stop Jobs" then 源代码网推荐 DoStop := True else 源代码网推荐 begin 源代码网推荐 TestMode.Caption := "Stop Jobs"; 源代码网推荐 Step := 1; 源代码网推荐 if ComPort1.Checked then 源代码网推荐 ComPort.ComNumber := 1; 源代码网推荐 if ComPort2.Checked then 源代码网推荐 ComPort.ComNumber := 2; 源代码网推荐 if ComPort3.Checked then 源代码网推荐 ComPort.ComNumber := 3; 源代码网推荐 if ComPort4.Checked then 源代码网推荐 ComPort.ComNumber := 4; 源代码网推荐 UserInfo.Caption := "Press Phone Power On Key ..."; ResponseArray[Step] := "00"; 源代码网推荐 while Step = 1 do begin Application.ProcessMessages; 源代码网推荐 if DoStop then 源代码网推荐 begin 源代码网推荐 TestMode.Caption := "Test Mode"; 源代码网推荐 Exit; 源代码网推荐 end; 源代码网推荐 end; 源代码网推荐 ProcessBar.Progress := 0; 源代码网推荐 ReadInfo.Enabled := True; 源代码网推荐 Chinese.Enabled := True; 源代码网推荐 ExitTestMode.Enabled := True; 源代码网推荐 UserInfo.Caption := "Phone Test Mode OK !"; 源代码网推荐 end; 源代码网推荐 end; 源代码网推荐 procedure TPanasonicGD92.ChineseClick(Sender: TObject); 源代码网推荐 begin 源代码网推荐 Step := 5; 源代码网推荐 ProcessBar.ForeColor := clLime; 源代码网推荐 ResponseArray[Step] := "00800110"; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 4; 源代码网推荐 ComPort.PutChar(#$80); 源代码网推荐 ProcessBar.Progress := 8; 源代码网推荐 ComPort.PutChar(#$02); 源代码网推荐 ProcessBar.Progress := 12; 源代码网推荐 ComPort.PutChar(#$E2); 源代码网推荐 ProcessBar.Progress := 15; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 19; 源代码网推荐 while Step = 5 do begin Application.ProcessMessages; 源代码网推荐 if DoStop then Exit; 源代码网推荐 end; 源代码网推荐 Step := 6; 源代码网推荐 ResponseArray[Step] := "00800110"; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 23; 源代码网推荐 ComPort.PutChar(#$80); 源代码网推荐 ProcessBar.Progress := 27; 源代码网推荐 ComPort.PutChar(#$03); 源代码网推荐 ProcessBar.Progress := 31; 源代码网推荐 ComPort.PutChar(#$9A); 源代码网推荐 ProcessBar.Progress := 35; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 38; 源代码网推荐 ComPort.PutChar(#$FF); 源代码网推荐 ProcessBar.Progress := 42; 源代码网推荐 while Step = 6 do begin 源代码网推荐 Application.ProcessMessages; 源代码网推荐 if DoStop then Exit; 源代码网推荐 end; 源代码网推荐 Step := 7; 源代码网推荐 ResponseArray[Step] := "00800110"; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 46; 源代码网推荐 ComPort.PutChar(#$80); 源代码网推荐 ProcessBar.Progress := 50; 源代码网推荐 ComPort.PutChar(#$0B); 源代码网推荐 ProcessBar.Progress := 54; 源代码网推荐 ComPort.PutChar(#$CB); 源代码网推荐 ProcessBar.Progress := 58; 源代码网推荐 ComPort.PutChar(#$02); 源代码网推荐 ProcessBar.Progress := 62; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 65; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 69; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 73; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 77; 源代码网推荐 ComPort.PutChar(#$07); 源代码网推荐 ProcessBar.Progress := 81; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 85; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 88; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 92; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 96; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 100; 源代码网推荐 while Step = 7 do 源代码网推荐 begin 源代码网推荐 Application.ProcessMessages; 源代码网推荐 if DoStop then Exit; 源代码网推荐 end; 源代码网推荐 ProcessBar.Progress := 0; 源代码网推荐 UserInfo.Caption := "Chinese Language Active OK !"; 源代码网推荐 end; 源代码网推荐 procedure TPanasonicGD92.ExitTestModeClick(Sender: TObject); 源代码网推荐 begin 源代码网推荐 ExitTestMode.Enabled := False; 源代码网推荐 Step := 30; 源代码网推荐 ResponseArray[Step] := "0080015A"; 源代码网推荐 ProcessBar.ForeColor := clRed; 源代码网推荐 ProcessBar.Progress := 0; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 25; 源代码网推荐 ComPort.PutChar(#$80); 源代码网推荐 ProcessBar.Progress := 50; 源代码网推荐 ComPort.PutChar(#$01); 源代码网推荐 ProcessBar.Progress := 75; 源代码网推荐 ComPort.PutChar(#$23); 源代码网推荐 ProcessBar.Progress := 100; 源代码网推荐 while Step = 30 do begin 源代码网推荐 Application.ProcessMessages; 源代码网推荐 if DoStop then Exit; 源代码网推荐 end; 源代码网推荐 ProcessBar.Progress := 0; 源代码网推荐 ReadInfo.Enabled := False; 源代码网推荐 Chinese.Enabled := False; 源代码网推荐 TestMode.Enabled := True; 源代码网推荐 UserInfo.Caption := "Phone Exit Test Mode OK !"; TestMode.Caption := "Stop"; 源代码网推荐 end; 源代码网推荐 procedure TPanasonicGD92.ReadInfoClick(Sender: TObject); 源代码网推荐 var IMEI92: string; 源代码网推荐 Code92: string; 源代码网推荐 Soft92: string; 源代码网推荐 begin 源代码网推荐 Step := 20; 源代码网推荐 UserInfo.Caption := "Please Wait ..."; ProcessBar.ForeColor := clBlue; 源代码网推荐 ProcessBar.Progress := 0; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 8; 源代码网推荐 ComPort.PutChar(#$80); 源代码网推荐 ProcessBar.Progress := 15; 源代码网推荐 ComPort.PutChar(#$01); 源代码网推荐 ProcessBar.Progress := 23; 源代码网推荐 ComPort.PutChar(#$98); 源代码网推荐 ProcessBar.Progress := 31; 源代码网推荐 while Step = 20 do begin Application.ProcessMessages; 源代码网推荐 if DoStop then Exit; 源代码网推荐 end; 源代码网推荐 Code92 := Copy(PanaGD9xCode, 10, 1); 源代码网推荐 Code92 := Code92 Copy(PanaGD9xCode, 12, 1); 源代码网推荐 Code92 := Code92 Copy(PanaGD9xCode, 14, 1); 源代码网推荐 Code92 := Code92 Copy(PanaGD9xCode, 16, 1); 源代码网推荐 Code92 := Code92 Copy(PanaGD9xCode, 18, 1); GD92CODE.Text := Code92; 源代码网推荐 ProcessBar.Progress := 0; 源代码网推荐 UserInfo.Caption := "Read Phone Code OK !"; Step := 21; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 38; 源代码网推荐 ComPort.PutChar(#$80); 源代码网推荐 ProcessBar.Progress := 46; 源代码网推荐 ComPort.PutChar(#$01); 源代码网推荐 ProcessBar.Progress := 53; 源代码网推荐 ComPort.PutChar(#$90); 源代码网推荐 ProcessBar.Progress := 62; 源代码网推荐 while Step = 21 do 源代码网推荐 begin 源代码网推荐 Application.ProcessMessages; 源代码网推荐 if DoStop then Exit; 源代码网推荐 end; 源代码网推荐 IMEI92 := Copy(PanaGD9xIMEI, 10, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 12, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 14, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 16, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 18, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 20, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 22, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 24, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 26, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 28, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 30, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 32, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 34, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 36, 1); 源代码网推荐 IMEI92 := IMEI92 Copy(PanaGD9xIMEI, 38, 1); GD92IMEI.Text := IMEI92; 源代码网推荐 UserInfo.Caption := "Read Phone IMEI OK !"; 源代码网推荐 Step := 22; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 69; 源代码网推荐 ComPort.PutChar(#$80); 源代码网推荐 ProcessBar.Progress := 77; 源代码网推荐 ComPort.PutChar(#$02); 源代码网推荐 ProcessBar.Progress := 85; 源代码网推荐 ComPort.PutChar(#$94); 源代码网推荐 ProcessBar.Progress := 92; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 100; 源代码网推荐 while Step = 22 do 源代码网推荐 begin 源代码网推荐 Application.ProcessMessages; 源代码网推荐 if DoStop then Exit; 源代码网推荐 end; 源代码网推荐 Soft92 := "GAD" Copy(PanaGD9xSW, 16, 1); 源代码网推荐 Soft92 := Soft92 Copy(PanaGD9xSW, 18, 1); 源代码网推荐 Soft92 := Soft92 "A" Copy(PanaGD9xSW, 22, 1); Soft92 := Soft92 Copy(PanaGD9xSW, 24, 1); 源代码网推荐 GD92SW.Text := Soft92; 源代码网推荐 ProcessBar.Progress := 0; 源代码网推荐 UserInfo.Caption := "Read Phone Info OK !"; 源代码网推荐 end; 源代码网推荐 procedure TPanasonicGD92.ComPortTriggerAvail(CP: TObject; Count: word); 源代码网推荐 var ST: string; Rs: string; // I: Integer;begin if Step = 1 then 源代码网推荐 begin 源代码网推荐 ProcessBar.Progress := 0; 源代码网推荐 ComPort.PutChar(#$00); 源代码网推荐 ProcessBar.Progress := 25; 源代码网推荐 ComPort.PutChar(#$80); 源代码网推荐 ProcessBar.Progress := 50; 源代码网推荐 ComPort.PutChar(#$01); 源代码网推荐 ProcessBar.Progress := 75; 源代码网推荐 ComPort.PutChar(#$5C); 源代码网推荐 ProcessBar.Progress := 100; 源代码网推荐 end; St := GetCOMData(Count); 源代码网推荐 Rs := ResponseArray[Step]; 源代码网推荐 if Step = 20 then begin 源代码网推荐 PanaGD9xCode := St; 源代码网推荐 Rs := St; 源代码网推荐 end; 源代码网推荐 if Step = 21 then 源代码网推荐 begin 源代码网推荐 PanaGD9xIMEI := St; Rs := St; 源代码网推荐 end; 源代码网推荐 if Step = 22 then begin 源代码网推荐 PanaGD9xSW := St; 源代码网推荐 Rs := St; 源代码网推荐 end; 源代码网推荐 if Pos(Rs, St) > 0 then 源代码网推荐 Inc(Step); 源代码网推荐 end; 源代码网推荐 end. 源代码网推荐 源代码网供稿. |
