Changeset 460


Ignore:
Timestamp:
Nov 28, 2012, 8:11:43 AM (11 years ago)
Author:
chronos
Message:
Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • PinConnection/UCommSerialPort.pas

    r416 r460  
    2323  public
    2424    SerialPort: TSerialPort;
    25     Lock: TCriticalSection;
    2625    Pin: TCommPin;
    2726    destructor Destroy; override;
     
    4443  inherited;
    4544  SerialPort.Active := AValue;
     45  FActive := SerialPort.Active;
    4646end;
    4747
     
    5656begin
    5757  try
    58     Lock.Acquire;
     58    SerialPort.Lock.Acquire;
    5959    if (AValue and 1) = 1 then SerialPort.Parity := paMark
    6060      else SerialPort.Parity := paSpace;
    6161  finally
    62     Lock.Release;
     62    SerialPort.Lock.Release;
    6363  end;
    6464end;
     
    6969  SerialPort := TSerialPort.Create;
    7070  SerialPort.OnReceiveData := ReceiveData;
    71   Lock := TCriticalSection.Create;
    7271  Pin := TCommPin.Create;
    7372  Pin.OnReceive := Receive;
     
    7978begin
    8079  SerialPort.OnReceiveData := nil;
    81   Pin.Free;
    82   Lock.Free;
    83   SerialPort.Free;
     80  FreeAndNil(Pin);
     81  FreeAndNil(SerialPort);
    8482  inherited;
    8583end;
     
    9694      repeat
    9795        try
    98           Lock.Acquire;
     96          SerialPort.Lock.Acquire;
    9997          if SerialPort.CanWrite(0) then
    10098            SerialPort.SendStreamRaw(S);
    10199        finally
    102           Lock.Release;
     100          SerialPort.Lock.Release;
    103101        end;
    104102        if S.Position <> S.Size then
Note: See TracChangeset for help on using the changeset viewer.