656 lines
29 KiB
C#
656 lines
29 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using System.Drawing.Printing;
|
|
using PdfSharp;
|
|
using PdfSharp.Drawing;
|
|
using PdfSharp.Pdf.IO;
|
|
using PdfSharp.Pdf;
|
|
using PdfSharp.Drawing.Layout;
|
|
|
|
namespace Ui.GenesisZeroFlow.Constants
|
|
{
|
|
|
|
#region Labels and logging
|
|
|
|
static class DataLogging
|
|
{
|
|
public const string DefaultPath = @"..\";
|
|
}
|
|
|
|
public static class ZeroOffsetTestConstants
|
|
{
|
|
public const int StabilizationTime = 10;
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Tof")]
|
|
public const double DeltaTofAverageFactor = 3.6379788;
|
|
public const int BadDataLimit = 3;
|
|
}
|
|
|
|
static class Debugmessages
|
|
{
|
|
public const bool MessagesEnabled = false;
|
|
public const string Line = "------------------------------------------------------------------------------------------------------------------------------------------------\n";
|
|
}
|
|
|
|
|
|
static class DataError
|
|
{
|
|
public const int NoError = 0;
|
|
public const int Pulsewidth = 0x0F0D;
|
|
public const int Amplitude = 0x0F0E;
|
|
public const int TofOutOfRange = 0x0F0F;
|
|
public const int DeltaTimeOfFlight = 0x0F10;
|
|
public const int TofTimeout = 0x0F11;
|
|
public const int Unknown = 0xFFFF;
|
|
}
|
|
|
|
static class SerialSettings
|
|
{
|
|
public const string Path = @"..\SerialSettings.txt";
|
|
}
|
|
static class PreparationValues
|
|
{
|
|
public const int CalFactor1 = 62500;
|
|
public const int CalFactor2 = 62500;
|
|
public const int CalFactor3 = 62500;
|
|
public const int ZeroOffset1 = 0;
|
|
public const int ZeroOffset2 = 0;
|
|
public const int ZeroOffset3 = 0;
|
|
public const int Samplerate = 10;
|
|
public const int MeterSize = 1;
|
|
public const int LedMode = 3;
|
|
public const int FirstHitLevelProportion = 0;
|
|
|
|
}
|
|
static class StatusPanelItems
|
|
{
|
|
public const int None = 0;
|
|
public const int Detect = 1;
|
|
public const int Prepare = 2;
|
|
public const int Amplitude = 3;
|
|
public const int Offset = 4;
|
|
public const int Completion = 5;
|
|
public const int TempCal = 6;
|
|
}
|
|
static class Settingsfile
|
|
{
|
|
// for position of items in file
|
|
public const int CmdMeter1Baudrate = 0;
|
|
public const int CmdMeter1Databits = 1;
|
|
public const int CmdMeter1Comselect = 2;
|
|
public const int CmdMeter1Stopbits = 3;
|
|
public const int CmdMeter1Parity = 4;
|
|
public const int CmdMeter1Handshake = 5;
|
|
public const int DataMeter1Baudrate = 6;
|
|
public const int DataMeter1Databits = 7;
|
|
public const int DataMeter1Comselect = 8;
|
|
public const int DataMeter1Stopbits = 9;
|
|
public const int DataMeter1Parity = 10;
|
|
public const int DataMeter1Handshake = 11;
|
|
public const int RawLogEnable = 12;
|
|
public const int CsvLogEnable = 13;
|
|
public const int CsvLogPath0 = 14;
|
|
public const int CsvLogPath1 = 15;
|
|
public const int CsvLogPath2 = 16;
|
|
public const int ListBoxOption = 17;
|
|
public const int MaingraphXval = 18;
|
|
public const int MaingraphPath0 = 19;
|
|
public const int MaingraphPath1 = 20;
|
|
public const int MaingraphPath2 = 21;
|
|
public const int MaingraphFlowVal = 22;
|
|
public const int Password1 = 23;
|
|
public const int JsonPath = 24;
|
|
public const int StdDeviationXval = 25;
|
|
public const int StdDeviationValues = 26;
|
|
public const int StdDeviationEnHit0Path0 = 27;
|
|
public const int StdDeviationEnHit1Path0 = 28;
|
|
public const int StdDeviationEnHit2Path0 = 29;
|
|
public const int StdDeviationEnHit3Path0 = 30;
|
|
public const int StdDeviationEnHit4Path0 = 31;
|
|
public const int StdDeviationEnHit5Path0 = 32;
|
|
public const int StdDeviationEnHit6Path0 = 33;
|
|
public const int StdDeviationEnHit7Path0 = 34;
|
|
public const int StdDeviationEn3HitsPath0 = 35;
|
|
public const int StdDeviationEn8HitsPath0 = 36;
|
|
public const int StdDeviationEnHit0Path1 = 37;
|
|
public const int StdDeviationEnHit1Path1 = 38;
|
|
public const int StdDeviationEnHit2Path1 = 39;
|
|
public const int StdDeviationEnHit3Path1 = 40;
|
|
public const int StdDeviationEnHit4Path1 = 41;
|
|
public const int StdDeviationEnHit5Path1 = 42;
|
|
public const int StdDeviationEnHit6Path1 = 43;
|
|
public const int StdDeviationEnHit7Path1 = 44;
|
|
public const int StdDeviationEn3HitsPath1 = 45;
|
|
public const int StdDeviationEn8HitsPath1 = 46;
|
|
public const int StdDeviationEnHit0Path2 = 47;
|
|
public const int StdDeviationEnHit1Path2 = 48;
|
|
public const int StdDeviationEnHit2Path2 = 49;
|
|
public const int StdDeviationEnHit3Path2 = 50;
|
|
public const int StdDeviationEnHit4Path2 = 51;
|
|
public const int StdDeviationEnHit5Path2 = 52;
|
|
public const int StdDeviationEnHit6Path2 = 53;
|
|
public const int StdDeviationEnHit7Path2 = 54;
|
|
public const int StdDeviationEn3HitsPath2 = 55;
|
|
public const int StdDeviationEn8HitsPath2 = 56;
|
|
public const int LogDirectory = 57;
|
|
public const int ReportDirectory = 58;
|
|
public const int ImagesDirectory = 59;
|
|
public const int CsvDirectory = 60;
|
|
public const int MassLogging = 61;
|
|
public const int CmdMeter2Baudrate = 62;
|
|
public const int CmdMeter2Databits = 63;
|
|
public const int CmdMeter2Comselect = 64;
|
|
public const int CmdMeter2Stopbits = 65;
|
|
public const int CmdMeter2Parity = 66;
|
|
public const int CmdMeter2Handshake = 67;
|
|
public const int DataMeter2Baudrate = 68;
|
|
public const int DataMeter2Databits = 69;
|
|
public const int DataMeter2Comselect = 70;
|
|
public const int DataMeter2Stopbits = 71;
|
|
public const int DataMeter2Parity = 72;
|
|
public const int DataMeter2Handshake = 73;
|
|
public const int CmdMeter3Baudrate = 74;
|
|
public const int CmdMeter3Databits = 75;
|
|
public const int CmdMeter3Comselect = 76;
|
|
public const int CmdMeter3Stopbits = 77;
|
|
public const int CmdMeter3Parity = 78;
|
|
public const int CmdMeter3Handshake = 79;
|
|
public const int DataMeter3Baudrate = 80;
|
|
public const int DataMeter3Databits = 81;
|
|
public const int DataMeter3Comselect = 82;
|
|
public const int DataMeter3Stopbits = 83;
|
|
public const int DataMeter3Parity = 84;
|
|
public const int DataMeter3Handshake = 85;
|
|
public const int Password2 = 86;
|
|
public const int Password3 = 87;
|
|
|
|
}
|
|
static class ReportParams
|
|
{
|
|
public const int LogoXPos = 500;
|
|
public const int LogoYPos = 10;
|
|
public const int LogoXSize = 50;
|
|
public const int LogoYSize = 25;
|
|
public const int HeadlineXPos = 0;
|
|
public const int HeadlineYPos = 50;
|
|
public const int Headline2XPos = 128;
|
|
public const int Headline2YPos = 113;
|
|
public const int PageNumberXPosition = 220;
|
|
public const int PageNumberYPosition = -20;
|
|
public const int StandardTextXPos = 128;
|
|
public const int StandardTextYPos = 150;
|
|
public const int ImageXSize = 400;
|
|
public const int ImageYSize = 240;
|
|
public const int ImageXPos = 125;
|
|
public const int ImageYPos = 135;
|
|
public const int IntroductionXPos = 100;
|
|
public const int IntroductionYPos = 600;
|
|
public static readonly XFont font20 = new XFont("Eras Bold ITC ", 20, XFontStyle.Bold);
|
|
public static readonly XFont font14 = new XFont("Calibri", 14, XFontStyle.Bold);
|
|
public static readonly XFont font12 = new XFont("Calibri", 12, XFontStyle.BoldItalic);
|
|
public static readonly XFont fontStandard = new XFont("Calibri", 10, XFontStyle.Regular);
|
|
public static readonly XFont fontSmall = new XFont("Calibri", 9, XFontStyle.Regular);
|
|
public const int Column1 = 0;
|
|
public const int Column2 = 1;
|
|
public const int Column3 = 2;
|
|
public const int Column4 = 3;
|
|
public const int Column5 = 4;
|
|
}
|
|
static class Core
|
|
{
|
|
public const double Vcal = 350; // For amplitude measurement. See TDC-GP30, vol.3, 2-6
|
|
public const UInt16 NumberOfMeters = 10;
|
|
public const UInt16 Meter1 = 0;
|
|
public const UInt16 Meter2 = 1;
|
|
public const UInt16 Meter3 = 2;
|
|
public const UInt16 Meter4 = 3;
|
|
public const UInt16 Meter5 = 4;
|
|
public const UInt16 Meter6 = 5;
|
|
public const UInt16 Meter7 = 6;
|
|
public const UInt16 Meter8 = 7;
|
|
public const UInt16 Meter9 = 8;
|
|
public const UInt16 Meter10 = 9;
|
|
|
|
public const UInt16 CmdMeter1 = 0;
|
|
public const UInt16 CmdMeter2 = 1;
|
|
public const UInt16 CmdMeter3 = 2;
|
|
public const UInt16 CmdMeter4 = 3;
|
|
public const UInt16 CmdMeter5 = 4;
|
|
public const UInt16 CmdMeter6 = 5;
|
|
public const UInt16 CmdMeter7 = 6;
|
|
public const UInt16 CmdMeter8 = 7;
|
|
public const UInt16 CmdMeter9 = 8;
|
|
public const UInt16 CmdMeter10 = 9;
|
|
public const UInt16 DataMeter1 = 10;
|
|
public const UInt16 DataMeter2 = 11;
|
|
public const UInt16 DataMeter3 = 12;
|
|
public const UInt16 DataMeter4 = 13;
|
|
public const UInt16 DataMeter5 = 14;
|
|
public const UInt16 DataMeter6 = 15;
|
|
public const UInt16 DataMeter7 = 16;
|
|
public const UInt16 DataMeter8 = 17;
|
|
public const UInt16 DataMeter9 = 18;
|
|
public const UInt16 DataMeter10 = 19;
|
|
public const UInt16 MainGraphDefaultXValues = 200;
|
|
public const UInt16 MainGraphDefaultFlowValue = 10;
|
|
public const UInt16 MainGraphListMaxElements = 20000;
|
|
public const UInt16 StdDevGraphDefaultXValues = 200;
|
|
public const UInt16 StdDevGraphDefaultElements = 20;
|
|
public const UInt16 StdDevGraphListMaxElements = 20000;
|
|
public const UInt16 NumberOfPaths = 3;
|
|
public const UInt16 PATH0 = 0;
|
|
public const UInt16 PATH1 = 1;
|
|
public const UInt16 PATH2 = 2;
|
|
public const UInt16 NOPATH = 4;
|
|
public const UInt16 HIT0 = 0;
|
|
public const UInt16 HIT1 = 1;
|
|
public const UInt16 HIT2 = 2;
|
|
public const UInt16 HIT3 = 3;
|
|
public const UInt16 HIT4 = 4;
|
|
public const UInt16 HIT5 = 5;
|
|
public const UInt16 HIT6 = 6;
|
|
public const UInt16 HIT7 = 7;
|
|
public const UInt16 ListItem0 = 0;
|
|
public const UInt16 ListItem1 = 1;
|
|
public const UInt16 ListItem2 = 2;
|
|
public const UInt16 ListItem3 = 3;
|
|
public const UInt16 ListItem4 = 4;
|
|
public const UInt16 ListItem5 = 5;
|
|
public const UInt16 ListItem6 = 6;
|
|
public const string CsvDefaultModeString = "0x1C";
|
|
public const double DefaultScrollGrace = (double)0.05;
|
|
public const double FirstHitLevelFactor = (double)0.88;
|
|
public const double DefaultHccCorrectionFactor = 1.0;
|
|
public const UInt16 Gp30WriteMultipleMaxLength = 20; // tbc
|
|
public const double NominalFrequency = 4.0;
|
|
public const double FlowFactor = 0.0036379788;
|
|
|
|
|
|
|
|
}
|
|
static class Formats
|
|
{
|
|
#region Format strings for display
|
|
#region Format strings for "Decoded Data"-display
|
|
public const string TofDispString = "000000.00000000";
|
|
public const string HccCorrectionValue = "0.00000";
|
|
public const string PwDispString = "0.00";
|
|
public const string AmpDispUpString = "000.0";
|
|
public const string AmpDispDownString = "-000.0";
|
|
public const string TempDispString = "0.00";
|
|
public const string Flow = "0.00";
|
|
#endregion
|
|
#region Format strings for "Mean"-Display
|
|
public const string MeanDispString = "0.00";
|
|
#endregion
|
|
#region Format strings for "Std-Deviation"-Display
|
|
public const string StdDevDispString = "0.00";
|
|
#endregion
|
|
#endregion
|
|
#region Format strings for CSV-Logging
|
|
public const string TofLogString = "000000.00000000";
|
|
public const string PwLogString = "0.00";
|
|
public const string AmpLogString = "000.0";
|
|
public const string TempLogString = "0.00";
|
|
public const string CsvDateTimeLogString = "HH:mm:ss:fff;yyyy.MM.dd;";
|
|
public const string ErrorLogString = "HH:mm:ss:fff;yyyy.MM.dd;";
|
|
public const string RawDataDateTimeLogString = "yyyy-MM-dd HH:mm:ss:ff ";
|
|
public const string CsvIndexLogString = "{0:D8}";
|
|
public const string CsvFileDateTimeString = "yyyyMMdd_HHmmss_";
|
|
public const string TxtFileDateTimeString = "yyyyMMdd_HHmmss_";
|
|
public const string LogFileDateTimeString = "yyyyMMdd_HHmmss";
|
|
public const string HeaderFileDateTimeString = "yyyy-MM-dd HH:mm:ss";
|
|
#endregion
|
|
#region Date/ Time for raw file naming
|
|
public const string RawFileDateTimeString = "yyyyMMdd_HHmmss_";
|
|
#endregion
|
|
#region Date/ Time for image files naming
|
|
public const string ImageFileDateTimeString = "yyyyMMdd_HHmmss_";
|
|
#endregion
|
|
#region Date/ Time for reports
|
|
public const string ReportDateTimeTitleString = "yyyy-MM-dd";
|
|
public const string PdfDateTimeString = "yyyyMMdd_HHmmss_";
|
|
#endregion
|
|
#region Format for GP30 first hit level adjustments
|
|
public const string FirstHitLevelVoltage = "000.00";
|
|
#endregion
|
|
|
|
|
|
|
|
}
|
|
static class Units
|
|
{
|
|
#region Unit strings for Display
|
|
public const string TofDispString = " ns";
|
|
public const string DifTofDispString = " ps";
|
|
public const string StdDevDispString = " ps";
|
|
public const string AmpDispString = " mV";
|
|
public const string TempDispString = " °C";
|
|
public const string Flow = " m³/h";
|
|
#endregion
|
|
#region Unit Strings for CSV-Logging
|
|
public const string TofCsvLogString = "E-9;";
|
|
#endregion
|
|
#region First hit level voltage
|
|
public const string FirstHitLevelVoltage = " mV";
|
|
#endregion
|
|
}
|
|
#endregion
|
|
#region Serial stuff
|
|
/*
|
|
public static class SettingsFileError
|
|
{
|
|
public const int OK = 0x00;
|
|
public const int Length = 0x01;
|
|
public const int Format = 0x02;
|
|
public const int Unknown = 0x03;
|
|
}
|
|
*/
|
|
public static class Message
|
|
{
|
|
public const string Data = "V";
|
|
public const string Temperature = "T";
|
|
public const string Comment = "C";
|
|
public const string Hcc = "H";
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ident")]
|
|
public const int ProtocolIdentPosition = 24;
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Messagetype")]
|
|
public const int MessagetypePosition = 26;
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ident")]
|
|
public const int PathIdentPosition = 28;
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ident")]
|
|
public const int ValidIdentPosition = 30;
|
|
}
|
|
#endregion
|
|
#region GP30 stuff
|
|
|
|
|
|
public static class GP30Registers
|
|
{
|
|
|
|
public static byte[] TriggerUpgrade() { return new byte[] { 0x00, 0x00 }; }
|
|
|
|
public static byte[] CheckPresence() { return new byte[] { 0x00, 0x01 }; }
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Pcb")]
|
|
public static byte[] PcbSerialNumber() { return new byte[] { 0x00, 0x02 }; }
|
|
public static byte[] CustomerSerialNumber0() { return new byte[] { 0x00, 0x03 }; }
|
|
public static byte[] CustomerSerialNumber1() { return new byte[] { 0x00, 0x04 }; }
|
|
public static byte[] CustomerSerialNumber2() { return new byte[] { 0x00, 0x05 }; }
|
|
public static byte[] CustomerSerialNumber3() { return new byte[] { 0x00, 0x06 }; }
|
|
public static byte[] MonotonicSeconds() { return new byte[] { 0x00, 0x07 }; }
|
|
public static byte[] CalendarSeconds() { return new byte[] { 0x00, 0x08 }; }
|
|
public static byte[] CoreRevision() { return new byte[] { 0x00, 0x09 }; }
|
|
public static byte[] DriveCapacity() { return new byte[] { 0x00, 0x0A }; }
|
|
public static byte[] ExitReason() { return new byte[] { 0x00, 0x0B }; }
|
|
public static byte[] CorePlatform() { return new byte[] { 0x00, 0x0C }; }
|
|
public static byte[] Quota() { return new byte[] { 0x08, 0x00 }; }
|
|
public static byte[] Drive() { return new byte[] { 0x08, 0x01 }; }
|
|
public static byte[] TriggerLogFlush() { return new byte[] { 0x08, 0x02 }; }
|
|
public static byte[] AlarmStatus0() { return new byte[] { 0x09, 0x00 }; }
|
|
public static byte[] AlarmStatus1() { return new byte[] { 0x09, 0x01 }; }
|
|
public static byte[] TriggerAlarmCancel() { return new byte[] { 0x09, 0x02 }; }
|
|
public static byte[] AlarmStatus2() { return new byte[] { 0x09, 0x03 }; }
|
|
public static byte[] AlarmStatus3() { return new byte[] { 0x09, 0x04 }; }
|
|
public static byte[] AlarmStatus4() { return new byte[] { 0x09, 0x05 }; }
|
|
public static byte[] AlarmStatus5() { return new byte[] { 0x09, 0x06 }; }
|
|
public static byte[] AlarmStatus6() { return new byte[] { 0x09, 0x07 }; }
|
|
public static byte[] AlarmStatus7() { return new byte[] { 0x09, 0x08 }; }
|
|
public static byte[] AlarmEnableMask() { return new byte[] { 0x09, 0x09 }; }
|
|
public static byte[] AlarmVisualAutoClearMask() { return new byte[] { 0x09, 0x0A }; }
|
|
public static byte[] BatteryVoltage() { return new byte[] { 0x01, 0x00 }; }
|
|
public static byte[] BatteryManufacturer() { return new byte[] { 0x01, 0x01 }; }
|
|
public static byte[] Privilege() { return new byte[] { 0x04, 0x00 }; }
|
|
public static byte[] Password() { return new byte[] { 0x04, 0x01 }; }
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Samplerate")]
|
|
public static byte[] Samplerate() { return new byte[] { 0x0F, 0x00 }; }
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
|
public static byte[] FirstHitLvlUp1() { return new byte[] { 0x0F, 0x01 }; }
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
|
public static byte[] FirstHitLvlUp2() { return new byte[] { 0x0F, 0x02 }; }
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
|
public static byte[] FirstHitLvlUp3() { return new byte[] { 0x0F, 0x03 }; }
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
|
public static byte[] FirstHitLvlDown1() { return new byte[] { 0x0F, 0x04 }; }
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
|
public static byte[] FirstHitLvlDown2() { return new byte[] { 0x0F, 0x05 }; }
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Lvl")]
|
|
public static byte[] FirstHitLvlDown3() { return new byte[] { 0x0F, 0x06 }; }
|
|
public static byte[] StartHit() { return new byte[] { 0x0F, 0x07 }; }
|
|
public static byte[] AmplitudePeakDetectEnd() { return new byte[] { 0x0F, 0x08 }; }
|
|
public static byte[] NumberOfTXBursts() { return new byte[] { 0x0F, 0x09 }; }
|
|
public static byte[] MeterSize() { return new byte[] { 0x0F, 0x0C }; }
|
|
public static byte[] CalFactor1() { return new byte[] { 0x0F, 0x0D }; }
|
|
public static byte[] CalFactor2() { return new byte[] { 0x0F, 0x0E }; }
|
|
public static byte[] CalFactor3() { return new byte[] { 0x0F, 0x0F }; }
|
|
public static byte[] ZeroOffset1() { return new byte[] { 0x0F, 0x10 }; }
|
|
public static byte[] ZeroOffset2() { return new byte[] { 0x0F, 0x11 }; }
|
|
public static byte[] ZeroOffset3() { return new byte[] { 0x0F, 0x12 }; }
|
|
public static byte[] ResetAccu() { return new byte[] { 0x0F, 0x14 }; }
|
|
public static byte[] Arrow() { return new byte[] { 0x0F, 0x15 }; }
|
|
public static byte[] LedMode() { return new byte[] { 0x0F, 0x16 }; }
|
|
public static byte[] StoreCalibration() { return new byte[] { 0x0F, 0x17 }; }
|
|
public static byte[] FirstHitLevelPercentagePath0() { return new byte[] { 0x0F, 0x26 }; }
|
|
public static byte[] FirstHitLevelPercentagePath1() { return new byte[] { 0x0F, 0x27 }; }
|
|
public static byte[] FirstHitLevelPercentagePath2() { return new byte[] { 0x0F, 0x28 }; }
|
|
public static byte[] FirstHitShift() { return new byte[] { 0x0F, 0x29 }; }
|
|
public static byte[] FirstHitMinimum() { return new byte[] { 0x0F, 0x2A }; }
|
|
public static byte[] TofErrorLimit() { return new byte[] { 0x0F, 0x2B }; }
|
|
public static byte[] FirstHitUpdatePeriod() { return new byte[] { 0x0F, 0x2C }; }
|
|
public static byte[] ToFTempOffset1() { return new byte[] { 0x0F, 0x2E }; }
|
|
public static byte[] ToFTempOffset2() { return new byte[] { 0x0F, 0x2F }; }
|
|
public static byte[] ToFTempOffset3() { return new byte[] { 0x0F, 0x30 }; }
|
|
public static byte[] ToFTempCalibrate() { return new byte[] { 0x0F, 0x31 }; }
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
public class GP30Payloads
|
|
{
|
|
public const byte Base = 0x05;
|
|
public const byte SupportedBauddrates = 0x00;
|
|
public const byte SupportedPacketSizes = 0x01;
|
|
public const byte SupportedProtocolVersion = 0x02;
|
|
public const byte SetBaudrate = 0x03;
|
|
public const byte SetPacketsize = 0x04;
|
|
public const byte TrainingByte = 0x05;
|
|
public const byte TrainingTime = 0x06;
|
|
public const byte AttemptedBaudrate = 0x07;
|
|
public const byte ResetInternalState = 0x08;
|
|
public const byte AutosetLow = 0x09;
|
|
public const byte AutosetHigh = 0x09;
|
|
}*/
|
|
|
|
public static class GP30RequestType
|
|
{
|
|
public const byte ReadRegister = 0x00;
|
|
public const byte WriteRegister = 0x01;
|
|
public const byte QueryCaps = 0x02;
|
|
public const byte MultipleWrite = 0x03;
|
|
}
|
|
|
|
public static class GP30Commands
|
|
{
|
|
public const byte Startbyte = 0x5B;
|
|
public const byte Nop = 0x00;
|
|
public const byte QueryCaps = 0x01;
|
|
public const byte QueryCapsreply = 0x02;
|
|
public const byte SetCaps = 0x03;
|
|
public const byte SetCapsreply = 0x04;
|
|
public const byte Train = 0x05;
|
|
public const byte Trainreply = 0x06;
|
|
public const byte RepeatLast = 0x07;
|
|
public const byte RepeatLastreply = 0x08;
|
|
public const byte ReadData = 0x09;
|
|
public const byte ReadDatareply = 0x0A;
|
|
public const byte WriteData = 0x0B;
|
|
public const byte WriteDatareply = 0x0C;
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Readdata")]
|
|
public const byte MultipleReaddata = 0x0D;
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Readdatareply")]
|
|
public const byte MultipleReaddatareply = 0x0E;
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Writedata")]
|
|
public const byte MultipleWritedata = 0x0F;
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Writedatareply")]
|
|
public const byte MultipleWritedatareply = 0x10;
|
|
public const byte SetLevel = 0x11;
|
|
public const byte SetLevelreply = 0x12;
|
|
public const byte SetBitratelsb = 0x03;
|
|
public const byte SetBitratemsb = 0x05;
|
|
public const byte SetPacketSizesLsb = 0x04;
|
|
public const byte SetPacketSizesMsb = 0x05;
|
|
public const byte SetProtocolLsb = 0x02;
|
|
public const byte SetProtocolMsb = 0x05;
|
|
|
|
}
|
|
|
|
public static class GP30Payload
|
|
{
|
|
public const byte GetBitrateLsb = 0x00;
|
|
public const byte GetBitrateMsb = 0x05;
|
|
public const byte GetPacketSizesLsb = 0x01;
|
|
public const byte GetPacketSizesMsb = 0x05;
|
|
public const byte GetProtocolLsb = 0x02;
|
|
public const byte GetProtocolMsb = 0x05;
|
|
}
|
|
|
|
public static class GP30BytePosition
|
|
{
|
|
public const byte ErrCodeBase = 7;
|
|
public const byte ErrCodeSubreason = 6;
|
|
public const byte CrcLsb = 5;
|
|
public const byte CrcMsb = 6;
|
|
public const byte Cmd = 2;
|
|
public const byte Reply = 8;
|
|
public const byte ReplyMsb = 9;
|
|
public const byte CmdBitrateLsb = 12;
|
|
public const byte CmdBitrateMsb = 13;
|
|
public const byte BitrateLsb = 14;
|
|
public const byte BitrateMsb = 15;
|
|
public const byte CmdPacketSizeLsb = 18;
|
|
public const byte CmdPacketSizeMsb = 19;
|
|
public const byte PacketSizeLsb = 20;
|
|
public const byte PacketSizeMsb = 21;
|
|
public const byte CmdProtocolLsb = 24;
|
|
public const byte CmdProtocolMsb = 25;
|
|
public const byte ProtocolLsb = 26;
|
|
public const byte ProtocolMsb = 27;
|
|
|
|
}
|
|
|
|
public static class GP30ConfigExErrors
|
|
{
|
|
public const byte BaseOk = 0x00;
|
|
public const byte Base = 0x04;
|
|
public const byte LockedOut = 0x00;
|
|
public const byte AuthenticationFail = 0x01;
|
|
public const byte AccessDenied = 0x02;
|
|
public const byte UnknownParameter = 0x03;
|
|
public const byte InUse = 0x04;
|
|
public const byte SizesDoNotMatch = 0x05;
|
|
public const byte CannotReadConfigfile = 0x06;
|
|
public const byte UserNotKnown = 0x07;
|
|
public const byte CannotCreateConfigfile = 0x08;
|
|
public const byte StoreDidnotStore = 0x09;
|
|
public const byte StoreCorrupt = 0x0A;
|
|
public const byte ExpectedWrite = 0x0B;
|
|
public const byte ExpectedRead = 0x0C;
|
|
public const byte StopCycling = 0x0D;
|
|
public const byte TooManyOpen = 0x0E;
|
|
public const byte NeverOpened = 0x0F;
|
|
public const byte FileProtected = 0x1F;
|
|
public const byte PartialRecall = 0x2F;
|
|
public const byte DefaultPasswordUsed = 0x3F;
|
|
|
|
}
|
|
|
|
public static class GP30HighLevelErrors
|
|
{
|
|
public const byte BaseOk = 0x00;
|
|
public const byte Base = 0x05;
|
|
public const byte PayloadCount = 0x00;
|
|
public const byte InvalidSubreason = 0x01;
|
|
public const byte InvalidBaudrate = 0x02;
|
|
public const byte InvalidBuffersize = 0x03;
|
|
public const byte CrcFailure = 0x04;
|
|
public const byte UnrecognizedCmd = 0x05;
|
|
public const byte Framing = 0x06;
|
|
public const byte Overflow = 0x07;
|
|
public const byte PacketTimeout = 0x08;
|
|
public const byte InvalidEscape = 0x09;
|
|
public const byte UnknownParameter = 0x0A;
|
|
public const byte TrainingFailed = 0x0B;
|
|
public const byte NoBreak = 0x0C;
|
|
public const byte NoSubreason = 0xFF;
|
|
|
|
}
|
|
|
|
public static class GP30LowLevelErrors
|
|
{
|
|
public const int NoError = 0;
|
|
public const int SerialPortClosed = -2;
|
|
public const int SerialPortWriteFailure = -3;
|
|
public const int SerialPortReadFailure = -4;
|
|
public const int MaxDataLength = -5;
|
|
public const int Exception = -6;
|
|
public const int CrcCalcError = -7;
|
|
public const int Unknown = -8;
|
|
public const int Timeout = -9;
|
|
}
|
|
|
|
public static class GP30PrivilegeLevel
|
|
{
|
|
public const byte Level1 = 0x01;
|
|
public const byte Level2 = 0x02;
|
|
public const byte Level3 = 0x03;
|
|
public const byte Level4 = 0x04;
|
|
public const byte Level5 = 0x05;
|
|
public const byte Level6 = 0x06;
|
|
public const byte Level7 = 0x07;
|
|
public const byte Level8 = 0x08;
|
|
public const byte LevelDefault = 0xFF;
|
|
|
|
}
|
|
|
|
/*
|
|
public class GP30ConfigRegister
|
|
{
|
|
public const byte BASE = 0x05;
|
|
public const byte BAUDRATECAPABILITIES = 0x00;
|
|
public const byte PACKETSIZECAPABILITIES = 0x01;
|
|
public const byte PROTOCOLVERSION = 0x02;
|
|
public const byte BAUDRATESELECTED = 0x03;
|
|
public const byte PACKETSIZESELECTED = 0x04;
|
|
public const byte TESTPULSECONTROL = 0x05;
|
|
}*/
|
|
|
|
public static class GP30Parameters
|
|
{
|
|
public const double FirstHitVoltageMin = 200; // [TBC]
|
|
public const double FirstHitVoltageMax = 1000; // [TBC]
|
|
public const UInt16 Timeout = 5;
|
|
public const UInt16 PasswordMaxlength = 12;
|
|
public const UInt16 TXDataMaxlength = 8;
|
|
}
|
|
|
|
#endregion
|
|
#region Error logging
|
|
public static class LogErrReason
|
|
{
|
|
public const string Exeption = "exception";
|
|
public const string Function = "function";
|
|
public const string Unknown = "unknown";
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
|
|
|