unit DataMain;
interface
uses
SysUtils, Classes, AdWnPort, OoMisc, AdPort, Dialogs;
type
TDataModMain =
class(TDataModule)
ApdComPort: TApdComPort;
ApdWinsockPort: TApdWinsockPort;
procedure ApdComPortTriggerAvail(CP: TObject; Count: Word);
procedure ApdComPortTriggerData(CP: TObject; TriggerHandle: Word);
procedure DataModuleCreate(Sender: TObject);
private
{ Private-Deklarationen }
Zeile :
string;
CRTrig : word;
public
{ Public-Deklarationen }
function DoCommand(CMD :
string): boolean;
end;
var
DataModMain: TDataModMain;
implementation
uses Types, Controls, FrmMain;
{$R *.dfm}
procedure TDataModMain.DataModuleCreate(Sender: TObject);
begin
ApdComPort.Open := true;
CRTrig := ApdComPort.AddDataTrigger(#13, False);
end;
procedure TDataModMain.ApdComPortTriggerData(CP: TObject; TriggerHandle: Word);
begin
if TriggerHandle = CRTrig
then begin
FormMain.Memo.Lines.Add(Zeile);
Zeile := '
';
// ApdComPort.RemoveTrigger(TriggerHandle);
end;
end;
procedure TDataModMain.ApdComPortTriggerAvail(CP: TObject; Count: Word);
var i : Integer;
c : Char;
begin
for i := 1
to Count
do begin
c := ApdComPort.GetChar;
case c
of
#10 :;
#13 :;
else Zeile := Zeile + c;
end;
end;
end;
function TDataModMain.DoCommand(CMD:
string): boolean;
begin
//
ApdComPort.PutString(CMD);
end;
end.