<?
xml version="1.0" encoding="utf-8" ?>
<codetemplate xmlns="http://schemas.borland.com/Delphi/2005/codetemplates"
version="1.0.0">
<template name="asyncr" invoke="manual">
<point name="form"><text>TForm1</text><hint>TForm</hint></point>
<point name="kp"><text>Comm1</text><hint>TComm</hint></point>
<point name="start"><text>[</text><hint>Startzeichen</hint></point>
<point name="end"><text>]</text><hint>Endzeichen</hint></point>
<point name="internbuffer"><text>buffer</text><hint>Interner Puffer</hint></point>
<point name="externbuffer"><text>inputbuffer</text><hint>Externer Puffer</hint></point>
<point name="workvar"><text>OnWork</text><hint>Variable Aktive Übertragung</hint></point>
<point name="procedure"><text>CommandInputReady</text><hint>Prozedur bei beendeter Übertragung...</hint></point>
<point name="log"><text>Memo1</text><hint>Logwindow</hint></point>
<description>
RS232 über Async lesen...
</description>
<author>
Tobias Hocke
</author>
<code language="Delphi" delimiter="|"><![CDATA[
procedure |form|.|kp|RxChar(Sender: TObject; Count: Integer);
var
|internbuffer| : Array[0..1024] of Char;
i : Integer;
c : Char;
begin
Fillchar(|internbuffer|, SizeOf(buffer), 0);
count := |kp|.Read(|internbuffer|, Count);
if count > 0 then
begin
for i := 1 to Count do
begin
c := |internbuffer|[i-1];
if |workvar| = true then
begin
if (c =
#13) or (c = #10) then c := #0;
if c = |end| then
begin
|log|.Lines.Add(' -> ' + |externbuffer|);
|procedure|;
|workvar| := false;
|externbuffer| := '';
end
else
begin
|externbuffer| := |externbuffer| + c;
end;
end
else
begin
if c = |start| then
begin
|externbuffer| := '';
|workvar| := true;
end;
end;
end;
end;
end;
]]>
</code>
</template>
</codetemplate>