Changeset 460 for PinConnection
- Timestamp:
- Nov 28, 2012, 8:11:43 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PinConnection/UCommSerialPort.pas
r416 r460 23 23 public 24 24 SerialPort: TSerialPort; 25 Lock: TCriticalSection;26 25 Pin: TCommPin; 27 26 destructor Destroy; override; … … 44 43 inherited; 45 44 SerialPort.Active := AValue; 45 FActive := SerialPort.Active; 46 46 end; 47 47 … … 56 56 begin 57 57 try 58 Lock.Acquire;58 SerialPort.Lock.Acquire; 59 59 if (AValue and 1) = 1 then SerialPort.Parity := paMark 60 60 else SerialPort.Parity := paSpace; 61 61 finally 62 Lock.Release;62 SerialPort.Lock.Release; 63 63 end; 64 64 end; … … 69 69 SerialPort := TSerialPort.Create; 70 70 SerialPort.OnReceiveData := ReceiveData; 71 Lock := TCriticalSection.Create;72 71 Pin := TCommPin.Create; 73 72 Pin.OnReceive := Receive; … … 79 78 begin 80 79 SerialPort.OnReceiveData := nil; 81 Pin.Free; 82 Lock.Free; 83 SerialPort.Free; 80 FreeAndNil(Pin); 81 FreeAndNil(SerialPort); 84 82 inherited; 85 83 end; … … 96 94 repeat 97 95 try 98 Lock.Acquire;96 SerialPort.Lock.Acquire; 99 97 if SerialPort.CanWrite(0) then 100 98 SerialPort.SendStreamRaw(S); 101 99 finally 102 Lock.Release;100 SerialPort.Lock.Release; 103 101 end; 104 102 if S.Position <> S.Size then
Note:
See TracChangeset
for help on using the changeset viewer.