Changeset 288 for PinConnection/UCommPin.pas
- Timestamp:
- Oct 24, 2011, 9:01:08 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PinConnection/UCommPin.pas
r247 r288 14 14 TOnLogDataEvent = procedure (Stream: TStream; Direction: TDataDiretion) of object; 15 15 TOnStreamEvent = procedure (Sender: TCommPin; Stream: TStream) of object; 16 TOnSetStatus = procedure (Sender: TCommPin; Status: Integer) of object; 16 17 17 18 { TCommPin } … … 25 26 FFrameTxCount: Integer; 26 27 FFrameRxCount: Integer; 28 FOnSetStatus: TOnSetStatus; 29 FStatus: Integer; 27 30 function GetConnected: Boolean; 31 procedure SetStatus(AValue: Integer); 32 protected 33 procedure Receive(Stream: TStream); 34 procedure ReceiveStatus(AValue: Integer); 28 35 public 29 36 RemotePin: TCommPin; … … 33 40 procedure Disconnect; 34 41 procedure Send(Stream: TStream); 35 procedure Receive(Stream: TStream);36 42 procedure ResetCounters; 37 property OnReceive: TOnStreamEvent read FOnReceive write FOnReceive;38 43 property Connected: Boolean read GetConnected; 39 44 property OnLogData: TOnLogDataEvent read FOnLogData write FOnLogData; … … 42 47 property FrameTxCount: Integer read FFrameTxCount; 43 48 property FrameRxCount: Integer read FFrameRxCount; 49 property Status: Integer read FStatus write SetStatus; // Used for general status bits such as parity bit 50 property OnReceive: TOnStreamEvent read FOnReceive write FOnReceive; 51 property OnSetSatus: TOnSetStatus read FOnSetStatus write FOnSetStatus; 44 52 end; 45 53 … … 55 63 Disconnect; 56 64 Self.RemotePin := Pin; 57 Pin.RemotePin := Self; 65 if Assigned(Pin) then begin 66 Pin.RemotePin := Self; 67 RemotePin.ReceiveStatus(FStatus); 68 end; 58 69 end; 59 70 end; … … 78 89 end; 79 90 91 procedure TCommPin.SetStatus(AValue: Integer); 92 begin 93 FStatus := AValue; 94 if Assigned(RemotePin) then RemotePin.ReceiveStatus(AValue); 95 end; 96 80 97 constructor TCommPin.Create; 81 98 begin … … 90 107 Stream.Position := 0; 91 108 if Assigned(FOnReceive) then FOnReceive(Self, Stream); 109 end; 110 111 procedure TCommPin.ReceiveStatus(AValue: Integer); 112 begin 113 if Assigned(FOnSetStatus) then FOnSetStatus(Self, AValue); 92 114 end; 93 115
Note:
See TracChangeset
for help on using the changeset viewer.