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

    r268 r272  
    1414  ECommTimeout = class(Exception);
    1515  ECommError = class(Exception);
     16  ENotActive = class(Exception);
    1617
    1718  TResponseError = (rcNone, rcCommandNotSupported, rcSequenceOutOfRange,
     
    118119  SDeviceProtocol = 'Device protocol';
    119120  SProtocolDecodeError = 'Data decode error';
     121  SProtocolNotActive = 'Device protocol not active';
    120122
    121123procedure TCommProtocol.DataReceive(Sender: TCommPin; Stream: TStream);
     
    133135    with Request do
    134136    try
     137      Stream.Position := 0;
    135138      ReadFromStream(Stream);
    136139      if TestIndex(0) then
     
    273276  NewRequest: TVarBlockIndexed;
    274277begin
     278  if FActive then begin
    275279  try
    276280    Session := TDeviceProtocolSession.Create;
     
    337341    NewRequest.Free;
    338342  end;
     343  end else raise ENotActive.Create(SProtocolNotActive);
    339344end;
    340345
Note: See TracChangeset for help on using the changeset viewer.