|
|
@@ -49,15 +49,13 @@ namespace VehicleControlSystem.Managers
|
|
|
await ftp.ConnectAsync( token );
|
|
|
|
|
|
// upload a folder and all its files
|
|
|
- await ftp.UploadDirectoryAsync( @"C:\LOG\OHV\Vehicle\PhysicalCheckup\", @"/DriveInfo", FtpFolderSyncMode.Update );
|
|
|
+ await ftp.UploadDirectoryAsync( @"C:\LOG\FTP\", @"/DriveLog", FtpFolderSyncMode.Update );
|
|
|
|
|
|
// upload a folder and all its files, and delete extra files on the server
|
|
|
//ftp.UploadDirectory( @"C:\website\assets\", @"/public_html/assets", FtpFolderSyncMode.Mirror );
|
|
|
|
|
|
//ToDo: Delete Files
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public void DownloadPLCLog()
|
|
|
@@ -66,17 +64,24 @@ namespace VehicleControlSystem.Managers
|
|
|
{
|
|
|
ftp.Connect();
|
|
|
|
|
|
-
|
|
|
// download a folder and all its files
|
|
|
- ftp.DownloadDirectory( @"C:\website\logs\", @"/public_html/logs", FtpFolderSyncMode.Update );
|
|
|
+ ftp.DownloadDirectory( @"C:\LOG\FTP\", @"/0_CARD/log0/", FtpFolderSyncMode.Update );
|
|
|
|
|
|
// download a folder and all its files, and delete extra files on disk
|
|
|
//await ftp.DownloadDirectoryAsync( @"C:\website\dailybackup\", @"/public_html/", FtpFolderSyncMode.Mirror );
|
|
|
|
|
|
- ftp.DeleteFile( "/full/or/relative/path/to/file" );
|
|
|
+ //ftp.DeleteFile( "/full/or/relative/path/to/file" );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void FTPServerDeleteFile()
|
|
|
+ {
|
|
|
+ using ( var ftp = new FtpClient( "192.168.0.20", "KV", "1234" ) )
|
|
|
+ {
|
|
|
+ ftp.Connect();
|
|
|
+ ftp.DeleteDirectory( "/0_CARD/log0/" );
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 주행 시작 시 진단 PLC Bit On
|
|
|
@@ -84,22 +89,31 @@ namespace VehicleControlSystem.Managers
|
|
|
/// <returns></returns>
|
|
|
public bool SetPLCStartDrive()
|
|
|
{
|
|
|
- this.h.Connect( new TcpComm
|
|
|
+ try
|
|
|
{
|
|
|
- Active = true,
|
|
|
- Ip = this.PLCAddress,
|
|
|
- PortNo = this.PLCPort,
|
|
|
- } );
|
|
|
-
|
|
|
- if ( !h.Connected )
|
|
|
+ var h = new TcpConnector();
|
|
|
+ h.Connect( new TcpComm
|
|
|
+ {
|
|
|
+ Active = true,
|
|
|
+ Ip = this.PLCAddress,
|
|
|
+ PortNo = this.PLCPort,
|
|
|
+ } );
|
|
|
+
|
|
|
+ if ( !h.Connected )
|
|
|
+ return false;
|
|
|
+
|
|
|
+ var mb = new MemoryBuffer();
|
|
|
+ mb.AppendAscii( "WR MR100 1" );
|
|
|
+ mb.Append( CR );
|
|
|
+ this.h.WriteFlush( mb.ToBytes );
|
|
|
+
|
|
|
+ h.CloseSocket();
|
|
|
+ }
|
|
|
+ catch ( Exception e)
|
|
|
+ {
|
|
|
+ logger.E( $"[PLC] - Set Value Connection Error {e}" );
|
|
|
return false;
|
|
|
-
|
|
|
- var mb = new MemoryBuffer();
|
|
|
- mb.AppendAscii( "WR MR100 1" );
|
|
|
- mb.Append( CR );
|
|
|
- this.h.WriteFlush( mb.ToBytes );
|
|
|
-
|
|
|
- h.CloseSocket();
|
|
|
+ }
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -110,22 +124,32 @@ namespace VehicleControlSystem.Managers
|
|
|
/// <returns></returns>
|
|
|
public bool ResetPLCStartDrive()
|
|
|
{
|
|
|
- this.h.Connect( new TcpComm
|
|
|
+ try
|
|
|
{
|
|
|
- Active = true,
|
|
|
- Ip = this.PLCAddress,
|
|
|
- PortNo = this.PLCPort,
|
|
|
- } );
|
|
|
+ var h = new TcpConnector();
|
|
|
+ h.Connect( new TcpComm
|
|
|
+ {
|
|
|
+ Active = true,
|
|
|
+ Ip = this.PLCAddress,
|
|
|
+ PortNo = this.PLCPort,
|
|
|
+ } );
|
|
|
|
|
|
- if ( !h.Connected )
|
|
|
- return false;
|
|
|
+ if ( !h.Connected )
|
|
|
+ return false;
|
|
|
|
|
|
- var mb = new MemoryBuffer();
|
|
|
- mb.AppendAscii( "WR MR100 0" );
|
|
|
- mb.Append( CR );
|
|
|
- this.h.WriteFlush( mb.ToBytes );
|
|
|
+ var mb = new MemoryBuffer();
|
|
|
+ mb.AppendAscii( "WR MR100 0" );
|
|
|
+ mb.Append( CR );
|
|
|
+ this.h.WriteFlush( mb.ToBytes );
|
|
|
|
|
|
- h.CloseSocket();
|
|
|
+ h.CloseSocket();
|
|
|
+
|
|
|
+ }
|
|
|
+ catch ( Exception e )
|
|
|
+ {
|
|
|
+ logger.E( $"[PLC] - Reset Value Connection Error {e}" );
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
return true;
|
|
|
}
|