unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, nrclasses, nrdataproc, StdCtrls, nrcomm, nrcommbox;

type
  TForm1 = class(TForm)
    nrDeviceBox1: TnrDeviceBox;
    nrComm1: TnrComm;
    CheckBox1: TCheckBox;
    Button1: TButton;
    Memo1: TMemo;
    Memo2: TMemo;
    Label1: TLabel;
    Label2: TLabel;
    nrDataProcessor1: TnrDataProcessor;
    procedure Button1Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure nrDataProcessor1DataPacket(Sender: TObject;
      Packet: TnrDataPacket);
    procedure nrDataProcessor1Timeout(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  nrComm1.ConfigDialog;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  try
    nrComm1.Active := CheckBox1.Checked;
  except
    CheckBox1.Checked := nrComm1.Active;
    raise;
  end;
end;

procedure TForm1.nrDataProcessor1DataPacket(Sender: TObject;
  Packet: TnrDataPacket);
begin
  Memo1.Lines.Add(Packet.Caption + ':' + Packet.Data );
end;

procedure TForm1.nrDataProcessor1Timeout(Sender: TObject);
begin
  Memo1.Lines.Add(' TIMEOUT!!!!!!!!' );
end;

end.
