Add project files.

This commit is contained in:
Tyrel Souza 2022-11-17 13:41:38 -05:00
parent bccf058588
commit 6d04f48019
21 changed files with 4923 additions and 0 deletions

36
2022-03-5--05-25.txt Normal file
View File

@ -0,0 +1,36 @@
Calibrating DAC1
Enter Voltage
Calibrating DAC1
Enter Voltage
= 0.38
Enter Voltage
= 1.29
Enter Voltage
= 3.06
Enter Voltage
= 6.62
Enter Voltage
= 10.21
Enter Voltage
= 12.07
SEE=7.96412 COD=0.99997196
Coefs 278.901123 144.999618
250. 0.384 252.
500. 1.290 505.
1000. 3.059 998.
2000. 6.620 1991.
3000. 10.213 2993.
3500. 12.066 3510.
VTable:
0.0 = 145.
0.5 = 284.
1.0 = 424.
1.5 = 563.
2.0 = 703.
2.5 = 842.
3.0 = 982.
3.5 = 1121.
4.0 = 1261.
4.5 = 1400.
Save this Calibration (y/n) ?

146
8082_Waymo_PC.csproj Normal file
View File

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1206B49C-9DCD-49A9-A135-42135532C2CB}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>_8082_Waymo_PC</RootNamespace>
<AssemblyName>DMD-III Sequence Manager</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>C:\Users\Tony\OneDrive\_Projects\_Active\8082_Waymo\Software Stuff\Publish\V1-T\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>30</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>450CB89F602E75887DB2DAC9C38E2B0F225D3AAE</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>DMD-III Sequence Manager_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FlexFlowXML.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="GetUnitInfo.cs" />
<Compile Include="I28FlexStatus.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SaveResult.cs" />
<Compile Include="T_Func.cs" />
<Compile Include="XMLParser.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="DMD-III Sequence Manager_TemporaryKey.pfx" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="BTD barcode.gif" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

23
8082_Waymo_PC.sln Normal file
View File

@ -0,0 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "8082_Waymo_PC", "8082_Waymo_PC.csproj", "{1206B49C-9DCD-49A9-A135-42135532C2CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1206B49C-9DCD-49A9-A135-42135532C2CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1206B49C-9DCD-49A9-A135-42135532C2CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1206B49C-9DCD-49A9-A135-42135532C2CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1206B49C-9DCD-49A9-A135-42135532C2CB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal

67
App.config Normal file
View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="_8082_Waymo_PC.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="_8082_Waymo_PC.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<userSettings>
<_8082_Waymo_PC.Properties.Settings>
<setting name="ReadyCom" serializeAs="String">
<value>COM7</value>
</setting>
<setting name="Default_File" serializeAs="String">
<value>"c:\\BTD\\DMD-III Seq\\"</value>
</setting>
<setting name="I28" serializeAs="String">
<value>COM6</value>
</setting>
<setting name="Zebra" serializeAs="String">
<value>COM8</value>
</setting>
<setting name="Fix_1_Prog" serializeAs="String">
<value>1</value>
</setting>
<setting name="Fix_2_Prog" serializeAs="String">
<value>2</value>
</setting>
<setting name="DebugPort" serializeAs="String">
<value>COM29</value>
</setting>
<setting name="HR_ID" serializeAs="String">
<value>40</value>
</setting>
<setting name="SV_ID" serializeAs="String">
<value>30</value>
</setting>
<setting name="FlexURL" serializeAs="String">
<value>http://10.0.0.1/Burgundy/fftester20.asmx</value>
</setting>
<setting name="EnableFlexFlow" serializeAs="String">
<value>True</value>
</setting>
<setting name="StationName" serializeAs="String">
<value>FLEX-M4-CR2-LEAK TEST</value>
</setting>
<setting name="DebugLogs" serializeAs="String">
<value>True</value>
</setting>
<setting name="LogDirectory" serializeAs="String">
<value>c:\\benchtoplogs</value>
</setting>
</_8082_Waymo_PC.Properties.Settings>
</userSettings>
<applicationSettings>
<_8082_Waymo_PC.Properties.Settings>
<setting name="Version" serializeAs="String">
<value>V1-T</value>
</setting>
</_8082_Waymo_PC.Properties.Settings>
</applicationSettings>
</configuration>

BIN
BTD barcode.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

84
FlexFlowXML.cs Normal file
View File

@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.IO;
using System.Threading.Tasks;
using System.Net.Http;
namespace _8082_Waymo_PC
{
class FlexFlow
{
public static string Send(string className, string body, string action)
{
string response;
response = Task.Run(async () => await EnvelopeAndSend(className, body, action)).Result;
Directory.CreateDirectory("C:\\benchtoplogs");
File.WriteAllText($"C:\\benchtoplogs\\response_{DateTime.Now:h_mm_ss}.txt", response);
return response;
}
public static async Task<string> EnvelopeAndSend(string className, string body, string action)
{
HttpResponseMessage response;
// should serialized properly, but the CData jank makes it hard.
var envelope = String.Join(
Environment.NewLine,
"<?xml version=\"1.0\" encoding=\"utf-8\"?>",
"<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">",
"<soap12:Body>",
$"<{className} xmlns=\"http://www.flextronics.com/FFTester20\">",
body,
$"</{className}>",
"</soap12:Body>",
"</soap12:Envelope>"
);
// Debugging logs
Directory.CreateDirectory("C:\\benchtoplogs");
File.WriteAllText($"C:\\benchtoplogs\\envelope_{DateTime.Now:h_mm_ss}.txt", envelope);
response = await PostXmlRequest(envelope, action);
var x = await response.Content.ReadAsStringAsync();
LogText("got xml string");
return x;
}
public static async Task<HttpResponseMessage> PostXmlRequest(string envelope, string action)
{
string FlexFlowURL = Properties.Settings.Default.FlexURL; //URL for Flex Flow Stuff
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add("Accept-Encoding", "gzip,deflate");
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/soap+xml;charset=UTF-8");
var httpContent = new StringContent(envelope, Encoding.UTF8, "text/xml");
httpContent.Headers.Add("SOAPAction", action);
var x = await httpClient.PostAsync(FlexFlowURL, httpContent);
LogText("Got Post data back.");
return x;
}
}
public static void LogText(string message)
{
if (Properties.Settings.Default.DebugLogs)
{
if (!Directory.Exists(Properties.Settings.Default.LogDirectory))
{
Directory.CreateDirectory(Properties.Settings.Default.LogDirectory);
}
using (StreamWriter w = File.AppendText($"{Properties.Settings.Default.LogDirectory}\\log_form1.txt"))
{
w.Write("\r\nLog Entry : ");
w.WriteLine($"{DateTime.Now.ToLongTimeString()} {DateTime.Now.ToLongDateString()}");
w.WriteLine($" :{message}");
w.WriteLine("-------------------------------");
}
}
}
}
}

1536
Form1.Designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

1725
Form1.cs Normal file

File diff suppressed because it is too large Load Diff

147
Form1.resx Normal file
View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="serialPort1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>218, 17</value>
</metadata>
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>433, 17</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>702, 17</value>
</metadata>
<metadata name="tmrScanIn.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>991, 15</value>
</metadata>
<metadata name="tmrDelay.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1186, 15</value>
</metadata>
<metadata name="serialPort2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1367, 15</value>
</metadata>
<metadata name="serialPort3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1568, 15</value>
</metadata>
<metadata name="serialPort4.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1769, 15</value>
</metadata>
</root>

79
GetUnitInfo.cs Normal file
View File

@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
namespace _8082_Waymo_PC
{
public class GetUnitInfo
{
public string ACTION = "http://www.flextronics.com/FFTester20/GetUnitInfo";
public string strStationName { get; set; }
public string strSerialNumber { get; set; }
public string strUserID { get; set; }
public string Body()
{
return String.Join(
Environment.NewLine,
$"<strRequest>{strSerialNumber}</strRequest>",
$"<strStationName>{strStationName}</strStationName>",
"<strUnitInfo></strUnitInfo>",
$"<strUserID>{strUserID}</strUserID>" // See if needs to be set
);
}
}
public class GetUnitInfoResponse
{
[XmlElement]
public string GetUnitInfoResult { get; set; }
public string Message { get; set; }
public GetUnitInfoResponse(GetUnitInfo gi)
{
// If Flex Flow is not enabled, don't make an API call, and set the messages appropriately.
if (!Properties.Settings.Default.EnableFlexFlow)
{
GetUnitInfoResult = "0";
Message = "Skipping FlexFlow because Disabled";
return;
}
var response = FlexFlow.Send(gi.GetType().Name, gi.Body(), gi.ACTION);
// local variables because cant use class variable with TryGetResult
var dict = XMLParser.ToDict(response);
if (dict == null)
{
GetUnitInfoResult = "-100";
Message = $"Error reading XML, please check your FlexFlow URL Setting ({Properties.Settings.Default.FlexURL}) is correct, or check the FlexFlow logs.";
return;
}
dict.TryGetValue("GetUnitInfoResult", out string lGUI);
GetUnitInfoResult = lGUI;
Message = response;
}
public Boolean IsOkay()
{
/// If not okay, Message is error message NEED TO Display to screen.
if (GetUnitInfoResult == "0")
{
return true;
}
return false;
}
}
}

98
I28FlexStatus.cs Normal file
View File

@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _8082_Waymo_PC
{
public class I28FlexStatus
{
/// <summary>
/// The status to send to FlexFlow SaveResult
/// </summary>
public string flexStatus { get; set; }
/// <summary>
/// The status to send to Waymo as a single test parameter status
/// </summary>
public string parameterStatus { get; set; }
/// <summary>
/// The overall test status to send to Waymo
/// </summary>
public string outcome { get; set; }
/// <summary>
/// Whether there was an error, or the test finished to completion
/// </summary>
public bool error { get; set; }
/// <summary>
/// A human readable failure code to send as a Failure to Waymo
/// </summary>
public string failureCode { get; set; }
/// <summary>
/// A full details of the failure to send to Waymo, (explains failureCode in length)
/// </summary>
public string failureDetails { get; set; }
public I28FlexStatus (string code)
{
switch (code.ToUpper())
{
/* NON ERRORS */
case "A": // Accept
flexStatus = "Passed";
parameterStatus = "PASS";
outcome = "TEST_PASS";
error = false;
break;
case "R": // Reject
flexStatus = "Failed";
parameterStatus = "FAIL";
outcome = "TEST_FAIL";
error = false;
break;
/* ERRORS */
case "PL": // Below Pressure
flexStatus = "Failed";
parameterStatus = "FAIL";
outcome = "TEST_FAIL";
error = true;
failureCode = "pressure_low";
failureDetails = "Equipment reported error code PL, Pressure Low. Unable to run leak test.";
break;
case "SL": // Severe Leak
flexStatus = "Failed";
parameterStatus = "FAIL";
outcome = "TEST_FAIL";
error = true;
failureCode = "severe_leak";
failureDetails = "Equipment reported error code SL, Severe Leak. Unable to run leak test.";
break;
case "PH": // Above Pressure
flexStatus = "Failed";
parameterStatus = "FAIL";
outcome = "TEST_FAIL";
error = true;
failureCode = "pressure_high";
failureDetails = "Equipment reported error code PH, Pressure High. Unable to run leak test.";
break;
case "SI": // Stop Button
flexStatus = "Failed";
parameterStatus = "FAIL";
outcome = "TEST_FAIL";
error = true;
failureCode = "test_stopped";
failureDetails = "Operator pressed stop button, test aborted.";
break;
/* FALLBACK - Error */
default: // No idea, just log it and fail.
flexStatus = "Failed";
parameterStatus = "FAIL";
outcome = "TEST_FAIL";
error = true;
failureCode = "unknown_error";
failureDetails = $"Encountered error code {code}, an unknown error has occurred.";
break;
}
}
}
}

22
Program.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _8082_Waymo_PC
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("_8082_Waymo_PC")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("_8082_Waymo_PC")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("695a8d3a-096e-42ea-aefb-632d6f9d9948")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

73
Properties/Resources.Designer.cs generated Normal file
View File

@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace _8082_Waymo_PC.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_8082_Waymo_PC.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap BTD_barcode {
get {
object obj = ResourceManager.GetObject("BTD barcode", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

124
Properties/Resources.resx Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="BTD barcode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\BTD barcode.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

203
Properties/Settings.Designer.cs generated Normal file
View File

@ -0,0 +1,203 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace _8082_Waymo_PC.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("COM7")]
public string ReadyCom {
get {
return ((string)(this["ReadyCom"]));
}
set {
this["ReadyCom"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("\"c:\\\\BTD\\\\DMD-III Seq\\\\\"")]
public string Default_File {
get {
return ((string)(this["Default_File"]));
}
set {
this["Default_File"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("COM6")]
public string I28 {
get {
return ((string)(this["I28"]));
}
set {
this["I28"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("COM8")]
public string Zebra {
get {
return ((string)(this["Zebra"]));
}
set {
this["Zebra"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("1")]
public string Fix_1_Prog {
get {
return ((string)(this["Fix_1_Prog"]));
}
set {
this["Fix_1_Prog"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("2")]
public string Fix_2_Prog {
get {
return ((string)(this["Fix_2_Prog"]));
}
set {
this["Fix_2_Prog"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("COM29")]
public string DebugPort {
get {
return ((string)(this["DebugPort"]));
}
set {
this["DebugPort"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("40")]
public string HR_ID {
get {
return ((string)(this["HR_ID"]));
}
set {
this["HR_ID"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("30")]
public string SV_ID {
get {
return ((string)(this["SV_ID"]));
}
set {
this["SV_ID"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("http://10.0.0.1/Burgundy/fftester20.asmx")]
public string FlexURL {
get {
return ((string)(this["FlexURL"]));
}
set {
this["FlexURL"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool EnableFlexFlow {
get {
return ((bool)(this["EnableFlexFlow"]));
}
set {
this["EnableFlexFlow"] = value;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("V1-U")]
public string Version {
get {
return ((string)(this["Version"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("FLEX-M4-CR2-LEAK TEST")]
public string StationName {
get {
return ((string)(this["StationName"]));
}
set {
this["StationName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool DebugLogs {
get {
return ((bool)(this["DebugLogs"]));
}
set {
this["DebugLogs"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("c:\\\\benchtoplogs")]
public string LogDirectory {
get {
return ((string)(this["LogDirectory"]));
}
set {
this["LogDirectory"] = value;
}
}
}
}

View File

@ -0,0 +1,51 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="ReadyCom" Type="System.String" Scope="User">
<Value Profile="(Default)">COM7</Value>
</Setting>
<Setting Name="Default_File" Type="System.String" Scope="User">
<Value Profile="(Default)">"c:\\BTD\\DMD-III Seq\\"</Value>
</Setting>
<Setting Name="I28" Type="System.String" Scope="User">
<Value Profile="(Default)">COM6</Value>
</Setting>
<Setting Name="Zebra" Type="System.String" Scope="User">
<Value Profile="(Default)">COM8</Value>
</Setting>
<Setting Name="Fix_1_Prog" Type="System.String" Scope="User">
<Value Profile="(Default)">1</Value>
</Setting>
<Setting Name="Fix_2_Prog" Type="System.String" Scope="User">
<Value Profile="(Default)">2</Value>
</Setting>
<Setting Name="DebugPort" Type="System.String" Scope="User">
<Value Profile="(Default)">COM29</Value>
</Setting>
<Setting Name="HR_ID" Type="System.String" Scope="User">
<Value Profile="(Default)">40</Value>
</Setting>
<Setting Name="SV_ID" Type="System.String" Scope="User">
<Value Profile="(Default)">30</Value>
</Setting>
<Setting Name="FlexURL" Type="System.String" Scope="User">
<Value Profile="(Default)">http://10.0.0.1/Burgundy/fftester20.asmx</Value>
</Setting>
<Setting Name="EnableFlexFlow" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Version" Type="System.String" Scope="Application">
<Value Profile="(Default)">V1-U</Value>
</Setting>
<Setting Name="StationName" Type="System.String" Scope="User">
<Value Profile="(Default)">FLEX-M4-CR2-LEAK TEST</Value>
</Setting>
<Setting Name="DebugLogs" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="LogDirectory" Type="System.String" Scope="User">
<Value Profile="(Default)">c:\\benchtoplogs</Value>
</Setting>
</Settings>
</SettingsFile>

205
SaveResult.cs Normal file
View File

@ -0,0 +1,205 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
namespace _8082_Waymo_PC
{
public class SaveResult
{
public string ACTION = "http://www.flextronics.com/FFTester20/SaveResult";
public string strSerialNumber { get; set; }
public string strStationName { get; set; }
public string strStationType { get; set; }
public DateTime dtStartBatchTimestamp { get; set; }
public DateTime dtEndBatchTimestamp { get; set; }
public string strOperator { get; set; }
public string strTestResults { get; set; }
public string strBenchtopRefNumber { get; set; }
public string strParameters { get; set; } // test parameters from serial
public I28FlexStatus i28FlexStatus { get; set; }
public string strDeltaValue {get; set; }
public string strDeltaMinimum {get; set; }
public string strDeltaMaximum {get; set; }
public string strPTValue {get; set; }
public string strPTMinimum {get; set; }
public string strPTMaximum {get; set; }
public string Body()
{
return String.Join(
Environment.NewLine,
"<strXMLResultText>",
"<![CDATA[",
"<BATCH>",
$"<FACTORY TESTER=\"{strStationName}\" />",
" <PANEL>",
$" <DUT ID=\"{strSerialNumber}\" TIMESTAMP=\"{dtEndBatchTimestamp.ToString("o")}\" STATUS=\"{i28FlexStatus.flexStatus}\">",
" <GROUP>",
$" <TEST NAME=\"OPERATOR\" STATUS=\"Passed\" VALUE=\"{strOperator}\" />",
$" <TEST NAME=\"TestResult\" STATUS=\"{i28FlexStatus.flexStatus}\" VALUE=\"{strTestResults}\" />",
" </GROUP>",
" </DUT>",
" </PANEL>",
"</BATCH>",
"]]>",
"</strXMLResultText>",
$"<strTestRefNo>{strBenchtopRefNumber}</strTestRefNo>"
);
}
public void Dumpy()
{
//Directory.CreateDirectory("C:\\dumpy"); // force make the dumpy directory
//Directory.CreateDirectory("C:\\dumpy\\inbox"); // force make the dumpy directory
LogText("to dumpy: " + strStationType + " " + strDeltaValue + " " + strDeltaMinimum + " " + strDeltaMaximum);
var dump = String.Join(
Environment.NewLine,
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>",
"<Event xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"dumptruck.xsd\">",
$" <start_time>{dtStartBatchTimestamp.ToUniversalTime().ToString("o")}</start_time>",
$" <end_time>{dtEndBatchTimestamp.ToUniversalTime().ToString("o")}</end_time>",
$" <unit_serial>{strSerialNumber}</unit_serial>",
$" <station_name>{Properties.Settings.Default.StationName}</station_name>",
$" <station_type>{strStationType.ToLower()}_leakdecay</station_type>", // e.g.: sv_leakdecay
$" <outcome>{i28FlexStatus.outcome}</outcome>",
$" <operator_name>{strOperator}</operator_name>",
i28FlexStatus.error ? ErrorElement() : SuccessElement(),
"</Event>"
);
var filename = $"C:\\dumpy\\inbox\\benchtop_8082_{dtStartBatchTimestamp.ToString("h_mm_ss")}.xml";
File.WriteAllText(filename, dump);
}
private string SuccessElement()
{
return String.Join(
Environment.NewLine,
" <TestParameter>",
$" <name>Delta Pa</name>",
$" <parameter_status>{i28FlexStatus.parameterStatus}</parameter_status>",
$" <numeric_value>{strDeltaValue}</numeric_value>",
$" <numeric_minimum>{strDeltaMinimum}</numeric_minimum>",
$" <numeric_maximum>{strDeltaMaximum}</numeric_maximum>",
" </TestParameter>",
" <TestParameter>",
" <name>Volumetric Pressure (mbar)</name>",
$" <parameter_status>{i28FlexStatus.parameterStatus}</parameter_status>",
$" <numeric_value>{strPTValue}</numeric_value>",
$" <numeric_minimum>{strPTMinimum}</numeric_minimum>",
$" <numeric_maximum>{strPTMaximum}</numeric_maximum>",
" </TestParameter>",
" <MediaParameter>",
" <filename>TEST_PARAMETERS.txt</filename>",
" <filetype>TXT</filetype>",
$" <encoded_file>{base64(strParameters)}</encoded_file>",
" </MediaParameter>");
}
private string ErrorElement()
{
return String.Join(
Environment.NewLine,
"<FailureCode>",
$"<code>{i28FlexStatus.failureCode}</code> ",
$"<details>{i28FlexStatus.failureDetails}</details>",
"</FailureCode>"
);
}
public string base64(string plainText)
{
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
return System.Convert.ToBase64String(plainTextBytes);
}
public static void LogText(string message)
{
if (Properties.Settings.Default.DebugLogs)
{
if (!Directory.Exists(Properties.Settings.Default.LogDirectory))
{
Directory.CreateDirectory(Properties.Settings.Default.LogDirectory);
}
using (StreamWriter w = File.AppendText($"{Properties.Settings.Default.LogDirectory}\\log_form1.txt"))
{
w.Write("\r\nLog Entry : ");
w.WriteLine($"{DateTime.Now.ToLongTimeString()} {DateTime.Now.ToLongDateString()}");
w.WriteLine($" :{message}");
w.WriteLine("-------------------------------");
}
}
}
}
public class SaveResultResponse
{
[XmlElement]
public string SaveResultResult { get; set; }
public string Message { get; set; }
public string strTestRefNo { get; set; }
public SaveResultResponse(SaveResult sr)
{
// If Flex Flow is not enabled, don't make an API call, and set the messages appropriately.
if (!Properties.Settings.Default.EnableFlexFlow)
{
SaveResultResult = "0";
Message = "Skipping FlexFlow because Disabled";
strTestRefNo = sr.strBenchtopRefNumber;
return;
}
var response = FlexFlow.Send(sr.GetType().Name, sr.Body(), sr.ACTION);
var dict = XMLParser.ToDict(response);
if (dict == null)
{
SaveResultResult = "-100";
Message = $"Error reading XML, please check your FlexFlow URL Setting ({Properties.Settings.Default.FlexURL}) is correct, or check the FlexFlow logs.";
return;
}
dict.TryGetValue("SaveResultResult", out string lSRR);
dict.TryGetValue("strTestRefNo", out string lTRN);
SaveResultResult = lSRR;
strTestRefNo = lTRN;
Message = response; // Just set message as response.
}
public Boolean IsOkay()
{
/// If not okay, Message is error message NEED TO Display to screen.
if (SaveResultResult == "0")
{
return true;
}
return false;
}
public static void LogText(string message)
{
if (Properties.Settings.Default.DebugLogs)
{
if (!Directory.Exists(Properties.Settings.Default.LogDirectory))
{
Directory.CreateDirectory(Properties.Settings.Default.LogDirectory);
}
using (StreamWriter w = File.AppendText($"{Properties.Settings.Default.LogDirectory}\\log_form1.txt"))
{
w.Write("\r\nLog Entry : ");
w.WriteLine($"{DateTime.Now.ToLongTimeString()} {DateTime.Now.ToLongDateString()}");
w.WriteLine($" :{message}");
w.WriteLine("-------------------------------");
}
}
}
}
}

184
T_Func.cs Normal file
View File

@ -0,0 +1,184 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Text;
namespace TonyFunctions
{
public class T_Func
{
public static double caniseeit;
#region Conversions
/// <summary>
/// Converts to mm (inch)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static double in_to_mm(double toConvert)
{
double dblConverted = (toConvert / .03937007);
return dblConverted;
}
/// <summary>
/// Converts to mm (inch)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static decimal in_to_mm(decimal toConvert)
{
decimal decConverted = (toConvert / (decimal).03937007);
return decConverted;
}
/// <summary>
/// Converts to Inches (mm)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static double mm_to_in(double toConvert)
{
double dblConverted = (toConvert * .03937007);
return dblConverted;
}
/// <summary>
/// Converts to Inches (mm)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static decimal mm_to_in(decimal toConvert)
{
decimal decConverted = (toConvert * (decimal).03937007);
return decConverted;
}
#endregion Conversions
#region Area and Volume
/// <summary>
/// Calculates Area of circle (Rad in inches)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static double Area_Circle_Rad_in(double dblRad)
{
double dblArea = (dblRad * 2) * Math.PI;
return dblArea;
}
/// <summary>
/// Calculates Area of circle (Rad in inches)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static decimal Area_Circle_Rad_in(decimal decRad)
{
decimal decArea = (decRad * 2) * (decimal)Math.PI;
return decArea;
}
/// <summary>
/// Calculates Volume of Cyl (Rad in inches,Height)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static double Vol_Cyl_Rad_in(double dblRad, double dblHgt)
{
double dblVolume = ((dblRad * 2) * Math.PI) * dblHgt;
return dblVolume;
}
/// <summary>
/// Calculates Volume of Cyl (Rad in inches,Height)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static decimal Vol_Cyl_Rad_in(decimal decRad, decimal decHgt)
{
decimal decVolume = ((decRad * 2) * (decimal)Math.PI) * decHgt;
return decVolume;
}
/////////
/// <summary>
/// Calculates Area of circle (Dia in inches)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static double Area_Circle_Dia_in(double dblDia)
{
double dblArea = dblDia * Math.PI;
return dblArea;
}
/// <summary>
/// Calculates Area of circle (Dia in inches)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static decimal Area_Circle_Dia_in(decimal decDia)
{
decimal decArea = decDia * (decimal)Math.PI;
return decArea;
}
/// <summary>
/// Calculates Volume of Cyl (Dia in inches,Height)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static double Vol_Cyl_Dia_in(double dblDia, double dblHgt)
{
double dblVolume = (dblDia * Math.PI) * dblHgt;
return dblVolume;
}
/// <summary>
/// Calculates Volume of Cyl (Dia in inches,Height)
/// </summary>
/// <param name="toConvert"></param>
/// <returns></returns>
public static decimal Vol_Cyl_Dia_in(decimal decDia, decimal decHgt)
{
decimal decVolume = (decDia * (decimal)Math.PI) * decHgt;
return decVolume;
}
#endregion Area and Volume
#region String Stuff
/// <summary>
/// Takes string and returns SPLIT string array (string to split, split char)
/// </summary>
/// <param name="strToSplit"></param>
/// <param name="chrSplitter"></param>
/// <returns></returns>
public static string[] saSplit (string strToSplit, char chrSplitter)
{
string[] saToReturn = strToSplit.Split(new Char[] { chrSplitter });//splits string
return saToReturn;
}
#endregion String Stuff
}
}

59
XMLParser.cs Normal file
View File

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Xml;
using System.Text;
using System.IO;
using System.Threading.Tasks;
namespace _8082_Waymo_PC
{
class XMLParser
{
public static Dictionary<string, string> ToDict(string xmlToParse)
{
XDocument doc;
try
{
doc = XDocument.Parse(xmlToParse);
} catch ( XmlException e)
{
LogText("exception:" + e.Message);
return null;
}
Dictionary<string, string> dataDictionary = new Dictionary<string, string>();
foreach (XElement element in doc.Descendants().Where(p => p.HasElements == false))
{
int keyInt = 0;
string keyName = element.Name.LocalName;
while (dataDictionary.ContainsKey(keyName))
{
keyName = element.Name.LocalName + "_" + keyInt++;
}
dataDictionary.Add(keyName, element.Value);
}
return dataDictionary;
}
public static void LogText(string message)
{
if (Properties.Settings.Default.DebugLogs)
{
if (!Directory.Exists(Properties.Settings.Default.LogDirectory))
{
Directory.CreateDirectory(Properties.Settings.Default.LogDirectory);
}
using (StreamWriter w = File.AppendText($"{Properties.Settings.Default.LogDirectory}\\log_xmlparser.txt"))
{
w.Write("\r\nLog Entry : ");
w.WriteLine($"{DateTime.Now.ToLongTimeString()} {DateTime.Now.ToLongDateString()}");
w.WriteLine($" :{message}");
w.WriteLine("-------------------------------");
}
}
}
}
}

25
example_dumptruck_xml.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<Event xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="dumptruck.xsd">
<start_time>2022-06-16T16:42:06.7007641Z</start_time>
<end_time>2022-06-16T16:42:45.7435212Z</end_time>
<unit_serial>DYN072135100664</unit_serial>
<station_name>{Waymo designated station name for the tester}</station_name>
<station_type>{Waymo designated test type name for the kind of test}</station_type>
<outcome>TEST_PASS</outcome>
<operator_name>{Optional operator name input}</operator_name>
<TestParameter>
<name>Initial Pressure</name>
<parameter_status>PASS</parameter_status>
<numeric_value>30.123</numeric_value>
<numeric_minimum>27.0</numeric_minimum>
<numeric_maximum>33.0</numeric_maximum>
</TestParameter>
<TestParameter>
<name>Delta Pa</name>
<parameter_status>PASS</parameter_status>
<numeric_value>4.340760</numeric_value>
<numeric_minimum>-30.013</numeric_minimum>
<numeric_maximum>30.006</numeric_maximum>
</TestParameter>
...
</Event>