Ignore:
Timestamp:
Oct 24, 2011, 9:01:08 AM (13 years ago)
Author:
george
Message:
  • Added: TCommPin now support state number forwarding. State value is designed mainly for simulating parity bit and possibly other state bits.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • PinConnection/UCommHub.pas

    r272 r288  
    1818    function GetPin(Index: Integer): TCommPin;
    1919    procedure Receive(Sender: TCommPin; Stream: TStream);
     20    procedure SetStatus(Sender: TCommPin; Status: Integer);
    2021  public
    2122    constructor Create;
     
    5455end;
    5556
     57procedure TCommHub.SetStatus(Sender: TCommPin; Status: Integer);
     58var
     59  I: Integer;
     60begin
     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;
     67end;
     68
    5669constructor TCommHub.Create;
    5770begin
     
    6881begin
    6982  Pin.OnReceive := Receive;
     83  Pin.OnSetSatus := SetStatus;
    7084  Result := FPins.Add(Pin);
    7185end;
     
    7488begin
    7589  Pin.OnReceive := nil;
     90  Pin.OnSetSatus := nil;
    7691  Result := TCommPin(FPins.Extract(Pin));
    7792end;
     
    90105begin
    91106  Pin.OnReceive := Receive;
     107  Pin.OnSetSatus := SetStatus;
    92108  FPins.Insert(Index, Pin);
    93109end;
     
    107123  Result := TCommPin.Create;
    108124  Result.OnReceive := Receive;
     125  Result.OnSetSatus := SetStatus;
    109126  FPins.Add(Result);
    110127end;
Note: See TracChangeset for help on using the changeset viewer.