Ignore:
Timestamp:
Aug 14, 2012, 10:31:30 AM (12 years ago)
Author:
chronos
Message:
  • Modified: PinConnection package now use for data parameters TListByte instead of TStream class contained in TemplateGenerics package. TStream have Position property which has no meaning for forwarding plain byte memory block. There is TBinarySerializer class used for serializing data instead of TStreamHelper class.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • PinConnection/UCommPin.pas

    r288 r407  
    66
    77uses
    8   Classes;
     8  Classes, SpecializedList;
    99
    1010type
     
    1212
    1313  TDataDiretion = (ddReceive, ddSend);
    14   TOnLogDataEvent = procedure (Stream: TStream; Direction: TDataDiretion) of object;
    15   TOnStreamEvent = procedure (Sender: TCommPin; Stream: TStream) of object;
     14  TOnLogDataEvent = procedure (Stream: TListByte; Direction: TDataDiretion) of object;
     15  TOnStreamEvent = procedure (Sender: TCommPin; Stream: TListByte) of object;
    1616  TOnSetStatus = procedure (Sender: TCommPin; Status: Integer) of object;
    1717
     
    3131    procedure SetStatus(AValue: Integer);
    3232  protected
    33     procedure Receive(Stream: TStream);
     33    procedure Receive(Stream: TListByte);
    3434    procedure ReceiveStatus(AValue: Integer);
    3535  public
     
    3939    procedure Connect(Pin: TCommPin);
    4040    procedure Disconnect;
    41     procedure Send(Stream: TStream);
     41    procedure Send(Stream: TListByte);
    4242    procedure ResetCounters;
    4343    property Connected: Boolean read GetConnected;
     
    100100end;
    101101
    102 procedure TCommPin.Receive(Stream: TStream);
     102procedure TCommPin.Receive(Stream: TListByte);
    103103begin
    104   Inc(FDataRxCount, Stream.Size);
     104  Inc(FDataRxCount, Stream.Count);
    105105  Inc(FFrameRxCount);
    106106  if Assigned(FOnLogData) then FOnLogData(Stream, ddReceive);
    107   Stream.Position := 0;
    108107  if Assigned(FOnReceive) then FOnReceive(Self, Stream);
    109108end;
     
    122121end;
    123122
    124 procedure TCommPin.Send(Stream: TStream);
     123procedure TCommPin.Send(Stream: TListByte);
    125124begin
    126   Inc(FDataTxCount, Stream.Size);
     125  Inc(FDataTxCount, Stream.Count);
    127126  Inc(FFrameTxCount);
    128127  if Assigned(FOnLogData) then FOnLogData(Stream, ddSend);
Note: See TracChangeset for help on using the changeset viewer.