Changeset 404 for PinConnection
- Timestamp:
- Aug 13, 2012, 10:03:31 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PinConnection/USerialPort.pas
r283 r404 7 7 uses 8 8 Classes, SysUtils, SynaSer, StdCtrls, Dialogs, UCommon, UThreading, 9 DateUtils ;9 DateUtils, FileUtil; 10 10 11 11 type … … 74 74 property BaudRateNumeric: Integer read GetBaudRateNumeric write SetBaudRateNumeric; 75 75 property OnReceiveData: TReceiveDataEvent read FOnReceiveData write FOnReceiveData; 76 procedure LoadAvailableToStrings(Strings: TStrings; Check: Boolean = False); 76 77 constructor Create; 77 78 destructor Destroy; override; … … 169 170 FreeAndNil(FReceiveThread); 170 171 CloseSocket; 172 end; 173 174 procedure TSerialPort.LoadAvailableToStrings(Strings: TStrings; Check: Boolean = False); 175 var 176 I: Integer; 177 TestPort: TSerialPort; 178 Files: TStringList; 179 begin 180 Strings.Clear; 181 {$IFDEF Windows} 182 if Check then 183 try 184 TestPort := TSerialPort.Create; 185 for I := 0 to Strings.Count - 1 do 186 with TestPort do begin 187 Name := Strings[I]; 188 Active := True; 189 if Active then begin 190 Strings.AddObject(Name, TObject(I)); 191 end; 192 Active := False; 193 end; 194 finally 195 TestPort.Free; 196 end else begin 197 for I := 1 to 255 do 198 Strings.AddObject('COM' + IntToStr(I), nil); 199 end; 200 {$ENDIF} 201 {$IFDEF Linux} 202 if Check then begin 203 Files := FindAllFiles('/dev', 'tty*', False); 204 Strings.Assign(Files); 205 Files.Free; 206 end else begin 207 for I := 1 to 63 do 208 Strings.AddObject('/dev/ttyS' + IntToStr(I), nil); 209 end; 210 {$ENDIF} 171 211 end; 172 212
Note:
See TracChangeset
for help on using the changeset viewer.