Changeset 288 for PinConnection/UCommHub.pas
- Timestamp:
- Oct 24, 2011, 9:01:08 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PinConnection/UCommHub.pas
r272 r288 18 18 function GetPin(Index: Integer): TCommPin; 19 19 procedure Receive(Sender: TCommPin; Stream: TStream); 20 procedure SetStatus(Sender: TCommPin; Status: Integer); 20 21 public 21 22 constructor Create; … … 54 55 end; 55 56 57 procedure TCommHub.SetStatus(Sender: TCommPin; Status: Integer); 58 var 59 I: Integer; 60 begin 61 if FActive then begin 62 // Broadcast received packet to all other pins 63 for I := 0 to FPins.Count - 1 do 64 if Sender <> FPins[I] then 65 TCommPin(FPins[I]).Status := Status; 66 end; 67 end; 68 56 69 constructor TCommHub.Create; 57 70 begin … … 68 81 begin 69 82 Pin.OnReceive := Receive; 83 Pin.OnSetSatus := SetStatus; 70 84 Result := FPins.Add(Pin); 71 85 end; … … 74 88 begin 75 89 Pin.OnReceive := nil; 90 Pin.OnSetSatus := nil; 76 91 Result := TCommPin(FPins.Extract(Pin)); 77 92 end; … … 90 105 begin 91 106 Pin.OnReceive := Receive; 107 Pin.OnSetSatus := SetStatus; 92 108 FPins.Insert(Index, Pin); 93 109 end; … … 107 123 Result := TCommPin.Create; 108 124 Result.OnReceive := Receive; 125 Result.OnSetSatus := SetStatus; 109 126 FPins.Add(Result); 110 127 end;
Note:
See TracChangeset
for help on using the changeset viewer.