Ignore:
Timestamp:
Aug 30, 2011, 3:50:15 PM (13 years ago)
Author:
george
Message:
  • Fixed: Do not send or receive data for comm classes if not in active state.
  • Fixed: TCommProtocol now raise ENotActive exception on try to send data while in inactive state.
  • Fixed: Reseting event after data received in TCommThread class.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • PinConnection/UCommSerialPort.pas

    r258 r272  
    2929procedure TCommSerialPort.ReceiveData(Stream: TMemoryStream);
    3030begin
    31   Pin.Send(Stream);
     31  if Active then Pin.Send(Stream);
    3232end;
    3333
     
    5151procedure TCommSerialPort.Receive(Sender: TCommPin; Stream: TStream);
    5252begin
    53   Stream.Position := 0;
    54   repeat
    55     try
    56       Lock.Acquire;
    57       if CanWrite(0) then
    58         SendStreamRaw(Stream);
    59     finally
    60       Lock.Release;
    61     end;
    62     if Stream.Position <> Stream.Size then
    63       Sleep(1);
    64   until Stream.Position = Stream.Size;
     53  if Active then begin
     54    Stream.Position := 0;
     55    repeat
     56      try
     57        Lock.Acquire;
     58        if CanWrite(0) then
     59          SendStreamRaw(Stream);
     60      finally
     61        Lock.Release;
     62      end;
     63      if Stream.Position <> Stream.Size then
     64        Sleep(1);
     65    until Stream.Position = Stream.Size;
     66  end;
    6567end;
    6668
Note: See TracChangeset for help on using the changeset viewer.