diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-01-27 09:18:58 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-01-27 09:18:58 +0200 |
| commit | 1d4d327571d4c0c9f4e17411551bd4dae1e2aed0 (patch) | |
| tree | 54cfe3cb1d789c05b7270b07904d0ead44aa236a /Software/Stubs Collection/stubs/embParamDownload.cs | |
| parent | 31096fb03e434d52738b07acd881b87516c3c3d5 (diff) | |
| download | Tango-1d4d327571d4c0c9f4e17411551bd4dae1e2aed0.tar.gz Tango-1d4d327571d4c0c9f4e17411551bd4dae1e2aed0.zip | |
STUBS
Diffstat (limited to 'Software/Stubs Collection/stubs/embParamDownload.cs')
| -rw-r--r-- | Software/Stubs Collection/stubs/embParamDownload.cs | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Software/Stubs Collection/stubs/embParamDownload.cs b/Software/Stubs Collection/stubs/embParamDownload.cs new file mode 100644 index 000000000..afdc14c92 --- /dev/null +++ b/Software/Stubs Collection/stubs/embParamDownload.cs @@ -0,0 +1,74 @@ +using System; +using System.Text; +using System.Linq; +using System.Drawing; +using System.Diagnostics; +using System.Windows.Forms; +using System.Threading; +using System.Threading.Tasks; +using System.Collections.Generic; +using Tango.PMR.Stubs; +using Tango.Stubs; +using Google.Protobuf; +using Tango.PMR.EmbeddedParameters; +using System.IO; +using Tango.PMR.IO; + + +public void OnExecute(StubManager stubManager) +{ + + +ConfigurationParameters configurationParameters = new ConfigurationParameters(); + +File.WriteAllBytes("C:/temp/EmbParam.cfg",configurationParameters.ToBytes()); + +byte[] fileBytes = File.ReadAllBytes("C:/temp/EmbParam.cfg"); + + +var config = ConfigurationParameters.Parser.ParseFrom(fileBytes); + + stubManager.Write( config); + Thread.Sleep(1000); + +//1. read +stubManager.Write("\n\n Deleting old file"); + +stubManager.Write("\n\n Loading new file file"); + + +FileDownloadRequest fileDownloadRequest = new FileDownloadRequest(); +fileDownloadRequest.FileName = "SYSINFO//EmbParam.cfg";; + +FileDownloadResponse response = stubManager.Run<FileDownloadResponse>(fileDownloadRequest); + + +FileChunkDownloadRequest fileChunkDownloadRequest = new FileChunkDownloadRequest(); +fileChunkDownloadRequest.DownloadID = response. +fileChunkDownloadRequest.FileName = null; +fileChunkDownloadRequest.Position = 0; + +Thread.Sleep(1000); +long chunk_size = response2.MaxChunkLength; + +FileStream fs = new FileStream("C:/temp/EmbParam.cfg",FileMode.Open); + +while (fs.Position < fs.Length) +{ + stubManager.Write("Position "+ fs.Position+ " Length "+ fs.Length +"\n\n"); + FileChunkUploadRequest fileChunkUploadRequest = new FileChunkUploadRequest(); + fileChunkUploadRequest.UploadID = response2.UploadID; + byte[] chunk = new byte[Math.Min(chunk_size,fs.Length - fs.Position)]; + fs.Read(chunk,0,chunk.Length); + fileChunkUploadRequest.Buffer = ByteString.CopyFrom(chunk); + var response3 = stubManager.Run<FileChunkUploadResponse>(fileChunkUploadRequest); + Thread.Sleep(2000); + +} + +/* +13:46:42.38: Executing script 'embeddedparametersbuild.cs'... +{ "BreakSensorLimit": 10, "DiagnosticCollectionLimit": 1, "OverHeatCountLimit": 3, "UnderHeatCountLimit": 3, "CloseValveTimeout": 255, "OpenValveTimeout": 255, "InitialDispenserPressure": 1.5, "InitialDispenserTimeout": 60000, "InitialDispenserTimeLag": 100, "DispenserBuildPressureSpeed": 800, "DispenserBuildPressureLimit": 0.9, "DispenserBuildPressureTimeout": 80000, "DispenserBuildPressureLag": 50, "ACHeatersLowerOperationLimit": 995, "ACHeatersUpperOperationLimit": 1005, "DCHeatersLowerOperationLimit": 978, "DCHeatersUpperOperationLimit": 1005, "DispenserPresegmentWFCF": 80, "StartHeatingOnInitSequence": true, "GeneralParameters": [ 1, 1, 1, 1, 800, 1000 ], "CurrentAlarmLowLimit": 0.8, "CurrentAlarmHighLimit": 1.07, "IDSSegmentRefillTimeout": 5000, "IDSPreSegmentBuildupTime": 5000, "IDSCleaningSpeed": 50, "IDSCleaningStopBeforeSegmentTime": 3000, "IDSCleaningStartSprayPreSegmentTime": 1000, "IDSLeftCleaningMotorSpeed": 30, "IDSRightCleaningMotorSpeed": 23, "SwitchToIdleTimeinSeconds": 3600, "IdleDrierTemperature": 80, "IdleHeadTemperature": 80, "PowerOffTemperatureLimit": 50, "IDSPreSegmentWFCFTimeBeforeSegment": 1500 } */ + + +}
\ No newline at end of file |
