anchor.diff:    );
   
   
  -  TParseMsgEvent = procedure(Sender: TObject; msg: TBuffer; var Handled: boolean) of object;
  -
  -  TXpressNETHistoryPacket = record
  -   cmd: Tcmd;
  -   params:array [0..2] of Integer;
  -   time:TDateTime;
  -   sent:Integer;
  -   callback_err:TCommandCallback;
  -   callback_ok:TCommandCallback;
  +  TParseMsgEvent = procedure(Sender: TObject; msg: TBuffer;
  +                              var Handled: boolean) of object;
  +
  +  TXpressNETHistoryPacket = record                                              // prvek vystupniho bufferu
  +   cmd: Tcmd;                                                                     // prikaz
  +   params:array [0..2] of Integer;                                                // parametry prikazu
  +   time:TDateTime;                                                                // cas odeslani
  +   sent:Integer;                                                                  // kolikrat odeslan
  +   callback_err:TCommandCallback;                                                 // chybovy callback
  +   callback_ok:TCommandCallback;                                                  // ok callback
     end;
   
     TXpressNET = class(TTrakce)
  
positive.code:                                                                                 //  tzn. jedna zprava je pred prohlasenim za neodeslatelnou odeslana prave trikrat (poprve a pote 2x opakovane)
  
     private
      Fbuf_in: TBuffer;                                                           // vstupni buffer
  
      FOnParseMsg: TParseMsgEvent;
      loading_addr:Word;                  //aktualni adresa lokomotivy, ktera se nacita
  
      send_history: TList<TXpressNETHistoryPacket>;
      timer_history:TTimer;
      buf:TBuffer;
  
      function LokAddrEncode(addr: Integer): Word;
      function LokAddrDecode(ah, al: byte): Integer;
      function LokAddrToBuf(addr: Integer):ShortString;
  
      procedure DataReceive(Sender: TObject; Count: Integer);
      procedure ParseMsg(msg: TBuffer);
      procedure ParseMsgTry(msg: TBuffer);
  
      procedure Send(buf: TBuffer);
      procedure SendCommand(cmd: Tcmd; p1:Integer = 0; p2:Integer = 0; p3: Integer = 0; sent_times:Integer = 0);
  
      function CreateBuf(str:ShortString):TBuffer;
  
      procedure CheckLoading();
  
      procedure OnTimer_history(Sender:TObject);
      procedure hist_send(index:Integer);
      procedure hist_ok();
      procedure hist_err();
     public
  
       constructor Create();
       destructor Destroy(); override;
  
       procedure SetTrackStatus(NewtrackStatus:Ttrk_status); override;
  
       procedure LokEmergencyStop(addr:Integer); override;
       procedure LokSetSpeed(Address:Integer; speed:Integer; dir:Integer); override;
       procedure LokSetFunc(Address:Integer; sada:Byte; stav:Byte); override;
       procedure LokGetInfo(Address:Integer); override;
       procedure Lok2MyControl(Address:Integer); override;
       procedure LokFromMyControl(Address:Integer); override;
       procedure LokGetFunctions(Address:Integer; startFunc:Integer); override;
  
       procedure GetTrackStatus(); override;
       procedure GetCSVersion(callback:TCSVersionEvent); override;
       procedure GetLIVersion(callback:TLIVersionEvent); override;
       procedure POMWriteCV(Address:Integer; cv:Word; data:byte); override;
  
  
       procedure EmergencyStop(); override;
  
       procedure AfterOpen(); override;
       procedure BeforeClose(); override;
  
       //events
       property OnParseMsg: TParseMsgEvent read FOnParseMsg write FOnParseMsg;
  
negative.code:   ExtCtrls, Forms;
  
  type
    // zprava
    //  maximalni delka pro rychlost omezena na astronomickou hodnotu 256 bytu
    TBuffer = record
     data:array [0..255] of Byte;
     Count:Integer;
    end;
  
    // mozne prikazy z PC do centraly:
    Tcmd = (
      XB_TRK_OFF = 10,
      XB_TRK_ON  = 11,
  