Werde ich mir noch ansehen!
Zur Zeit habe ich es so gelöst:
Delphi-Quellcode:
function TForm1.SplitBuffer(Value: String; var Data : TStringList): String;
var
i : Integer;
begin
Result := Value;
while Pos(#$D#$A, Result) <> 0 do
begin
i := Pos(#$D#$A, Result);
Data.Add(LeftStr(Result, i - 1));
Result := RightStr(Result, Length(Result) - i - 5);
end;
end;
Delphi-Quellcode:
procedure TForm1.OnRxChar(Sender: TObject; Count: Integer);
var
ReceivedData : AnsiString;
i, count : Integer;
begin
ComPort_Connection.ReadStr(ReceivedData, count);
TextBuffer := TextBuffer + ReceivedData;
NewLines.Clear;
TextBuffer := SplitBuffer(TextBuffer, NewLines);
// Analyse NewLines here...
end;