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/UCommSerialPort.pas

    r272 r288  
    1010
    1111type
     12
     13  { TCommSerialPort }
     14
    1215  TCommSerialPort = class(TSerialPort)
    1316  private
    1417    procedure Receive(Sender: TCommPin; Stream: TStream);
     18    procedure SetStatus(Sender: TCommPin; AValue: Integer);
    1519    procedure ReceiveData(Stream: TMemoryStream);
    1620  public
     
    3236end;
    3337
     38procedure TCommSerialPort.SetStatus(Sender: TCommPin; AValue: Integer);
     39begin
     40  try
     41    Lock.Acquire;
     42    if (AValue and 1) = 1 then Parity := paMark else Parity := paSpace;
     43  finally
     44    Lock.Release;
     45  end;
     46end;
     47
    3448constructor TCommSerialPort.Create;
    3549begin
     
    3852  Pin := TCommPin.Create;
    3953  Pin.OnReceive := Receive;
     54  Pin.OnSetSatus := SetStatus;
    4055  OnReceiveData := ReceiveData;
    4156end;
Note: See TracChangeset for help on using the changeset viewer.