Changeset 119 for Comm/UCommPin.pas
- Timestamp:
- Jan 5, 2011, 1:16:30 PM (14 years ago)
- Location:
- Comm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Comm
-
Property svn:ignore
set to
lib
-
Property svn:ignore
set to
-
Comm/UCommPin.pas
r26 r119 9 9 10 10 type 11 TCommPin = class; 12 11 13 TDataDiretion = (ddReceive, ddSend); 12 14 TOnLogDataEvent = procedure (Stream: TStream; Direction: TDataDiretion) of object; 13 TOnStreamEvent = procedure (S tream: TStream) of object;15 TOnStreamEvent = procedure (Sender: TCommPin; Stream: TStream) of object; 14 16 15 17 { TCommPin } … … 19 21 FOnLogData: TOnLogDataEvent; 20 22 FOnReceive: TOnStreamEvent; 23 FDataTxCount: Integer; 24 FDataRxCount: Integer; 25 FFrameTxCount: Integer; 26 FFrameRxCount: Integer; 21 27 function GetConnected: Boolean; 22 28 public 23 29 RemotePin: TCommPin; 30 constructor Create; 24 31 destructor Destroy; override; 25 32 procedure Connect(Pin: TCommPin); … … 27 34 procedure Send(Stream: TStream); 28 35 procedure Receive(Stream: TStream); 36 procedure ResetCounters; 29 37 property OnReceive: TOnStreamEvent read FOnReceive write FOnReceive; 30 38 property Connected: Boolean read GetConnected; 31 39 property OnLogData: TOnLogDataEvent read FOnLogData write FOnLogData; 40 property DataTxCount: Integer read FDataTxCount; 41 property DataRxCount: Integer read FDataRxCount; 42 property FrameTxCount: Integer read FFrameTxCount; 43 property FrameRxCount: Integer read FFrameRxCount; 32 44 end; 33 45 … … 63 75 end; 64 76 77 constructor TCommPin.Create; 78 begin 79 RemotePin := nil; 80 end; 81 65 82 procedure TCommPin.Receive(Stream: TStream); 66 83 begin 84 Inc(FDataRxCount, Stream.Size); 85 Inc(FFrameRxCount); 67 86 if Assigned(FOnLogData) then FOnLogData(Stream, ddReceive); 68 87 Stream.Position := 0; 69 if Assigned(FOnReceive) then FOnReceive(Stream); 88 if Assigned(FOnReceive) then FOnReceive(Self, Stream); 89 end; 90 91 procedure TCommPin.ResetCounters; 92 begin 93 FDataTxCount := 0; 94 FDataRxCount := 0; 95 FFrameTxCount := 0; 96 FFrameRxCount := 0; 70 97 end; 71 98 72 99 procedure TCommPin.Send(Stream: TStream); 73 100 begin 101 Inc(FDataTxCount, Stream.Size); 102 Inc(FFrameTxCount); 74 103 if Assigned(FOnLogData) then FOnLogData(Stream, ddSend); 75 104 if Assigned(RemotePin) then RemotePin.Receive(Stream);
Note:
See TracChangeset
for help on using the changeset viewer.