希望对喜欢编程的朋友有帮助,最近在整理所有手机的编程,可能会出一书,交广州华莹出版。
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 DoSto