Ignore:
Timestamp:
Aug 16, 2012, 12:59:53 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Classes using TCommPin class now inherits from TCommNode which inherits from TComponent. All TCommNodes are now registred as components in PinConnection group on component palette.
  • Modified: TCommPin now have reference to parent TCommNode.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ISPProgrammer/Dallas/UDallasProgrammer.pas

    r410 r413  
    88  Classes, SysUtils, USerialPort, UCommSerialPort, UCommPin, UCommMark,
    99  UJobProgressView, SyncObjs, DateUtils, Dialogs, URegistry,
    10   Forms, UISPProgrammer, Registry, UBinarySerializer, SpecializedList;
     10  Forms, UISPProgrammer, Registry, UBinarySerializer, SpecializedList,
     11  UCommTelnet;
    1112
    1213const
     
    135136
    136137procedure TDallasProgrammer.SetActive(AValue: Boolean);
     138var
     139  SerialPort: TCommSerialPort;
     140  Telnet: TCommTelnet;
    137141begin
    138142  if Active = AValue then Exit;
     
    144148    HexData := TStringList.Create;
    145149
    146     SerialPort.Active := False;
    147     SerialPortBackup.Assign(SerialPort);
    148     SerialPortBackupPin := SerialPort.Pin.RemotePin;
    149     SerialPort.Pin.Disconnect;
    150 
    151     //SerialPort.Name := SerialPort.Name;
    152     SerialPort.FlowControl := fcNone;
    153     SerialPort.BaudRate := BaudRate;
    154     SerialPort.DTR := True;
    155     SerialPort.Pin.Connect(CommMark.PinRaw);
    156     SerialPort.Flush;
    157     SerialPort.Purge;
    158     SerialPort.Active := True;
    159     if Assigned(FOnLogData) then
    160       Pin.OnLogData := FOnLogData;
     150    if ExtPin.Connected and (ExtPin.RemotePin.Node is TCommSerialPort) then begin
     151      SerialPort := TCommSerialPort(ExtPin.RemotePin.Node);
     152      SerialPort.Active := False;
     153      SerialPortBackup.Assign(SerialPort);
     154      SerialPortBackupPin := SerialPort.Pin.RemotePin;
     155      SerialPort.Pin.Disconnect;
     156
     157      //SerialPort.Name := SerialPort.Name;
     158      SerialPort.SerialPort.FlowControl := fcNone;
     159      SerialPort.SerialPort.BaudRate := BaudRate;
     160      SerialPort.SerialPort.DTR := True;
     161      SerialPort.Pin.Connect(CommMark.PinRaw);
     162      SerialPort.SerialPort.Flush;
     163      SerialPort.SerialPort.Purge;
     164      SerialPort.Active := True;
     165      if Assigned(FOnLogData) then
     166        Pin.OnLogData := FOnLogData;
     167    end;
     168    if ExtPin.Connected and (ExtPin.RemotePin.Node is TCommTelnet) then begin
     169      Telnet := TCommTelnet(ExtPin.RemotePin.Node);
     170    end;
    161171    ResponseClear;
    162172    CommMark.Active := True;
    163 
    164173    ReadIdentification;
    165174  end else begin
    166175    CommMark.Active := False;
    167     SerialPort.Active := False;
    168     SerialPort.Assign(SerialPortBackup);
    169     SerialPort.Pin.Connect(SerialPortBackupPin);
    170     SerialPort.Active := True;
     176    if ExtPin.Connected and (ExtPin.RemotePin.Node is TCommSerialPort) then begin
     177      SerialPort := TCommSerialPort(ExtPin.Node);
     178      SerialPort.Active := False;
     179      SerialPort.Assign(SerialPortBackup);
     180      SerialPort.Pin.Connect(SerialPortBackupPin);
     181      SerialPort.Active := True;
     182    end;
     183    if ExtPin.Connected and (ExtPin.RemotePin.Node is TCommTelnet) then begin
     184      Telnet := TCommTelnet(ExtPin.RemotePin.Node);
     185    end;
    171186    HexData.Free;
    172187    Request.Free;
     
    359374  Mark := TListByte.Create;
    360375  Mark.SetArray([13, 10]);
    361   CommMark := TCommMark.Create;
     376  CommMark := TCommMark.Create(nil);
    362377  CommMark.Mark.Assign(Mark);
    363378  CommMark.PinFrame.Connect(Pin);
    364379  BaudRate := 9600;
    365   SerialPortBackup := TCommSerialPort.Create;
     380  SerialPortBackup := TCommSerialPort.Create(nil);
    366381end;
    367382
Note: See TracChangeset for help on using the changeset viewer.