using PdfSharp.Drawing; using System; namespace GenesisZeroFlow { #region Labels and logging static class DataLogging { public const String DefaultPath = @"..\"; } public static class ZeroOffsetTestConstants { public const Int32 StabilizationTime = 10; [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Tof")] public static readonly Double DeltaTofAverageFactor =((Math.Pow(10, 12)) / (Math.Pow(2, 38)));// /3.6379788; public const Int32 BadDataLimit = 3; } static class Debugmessages { public const Boolean MessagesEnabled = false; public const String Line = "----------------------------------------------------------------------------------------------------------------------------------------------------------\n"; } static class DataError { public const Int32 NoError = 0; public const Int32 Pulsewidth = 0x0F0D; public const Int32 Amplitude = 0x0F0E; public const Int32 TofOutOfRange = 0x0F0F; public const Int32 DeltaTimeOfFlight = 0x0F10; public const Int32 TofTimeout = 0x0F11; public const Int32 Unknown = 0xFFFF; } static class SerialSettings { public const String Path = @"..\SerialSettings.txt"; } static class PreparationValues { public const Int32 CalFactor1 = 15625; public const Int32 CalFactor2 = 15625; public const Int32 CalFactor3 = 15625; public const Int32 ZeroOffset1 = 0; public const Int32 ZeroOffset2 = 0; public const Int32 ZeroOffset3 = 0; public const Int32 Samplerate = 10; public const Int32 MeterSize = 1; public const Int32 LedMode = 3; } static class StatusPanelItems { public const Int32 None = 0; public const Int32 Detect = 1; public const Int32 Prepare = 2; public const Int32 Amplitude = 3; public const Int32 Offset = 4; public const Int32 Completion = 5; public const Int32 TempCal = 6; } static class Settingsfile { // for position of items in file public const Int32 CmdMeter1Baudrate = 0; public const Int32 CmdMeter1Databits = 1; public const Int32 CmdMeter1Comselect = 2; public const Int32 CmdMeter1Stopbits = 3; public const Int32 CmdMeter1Parity = 4; public const Int32 CmdMeter1Handshake = 5; public const Int32 DataMeter1Baudrate = 6; public const Int32 DataMeter1Databits = 7; public const Int32 DataMeter1Comselect = 8; public const Int32 DataMeter1Stopbits = 9; public const Int32 DataMeter1Parity = 10; public const Int32 DataMeter1Handshake = 11; public const Int32 RawLogEnable = 12; public const Int32 CsvLogEnable = 13; public const Int32 CsvLogPath0 = 14; public const Int32 CsvLogPath1 = 15; public const Int32 CsvLogPath2 = 16; public const Int32 ListBoxOption = 17; public const Int32 MaingraphXval = 18; public const Int32 MaingraphPath0 = 19; public const Int32 MaingraphPath1 = 20; public const Int32 MaingraphPath2 = 21; public const Int32 MaingraphFlowVal = 22; public const Int32 Password1 = 23; public const Int32 JsonPath = 24; public const Int32 StdDeviationXval = 25; public const Int32 StdDeviationValues = 26; public const Int32 StdDeviationEnHit0Path0 = 27; public const Int32 StdDeviationEnHit1Path0 = 28; public const Int32 StdDeviationEnHit2Path0 = 29; public const Int32 StdDeviationEnHit3Path0 = 30; public const Int32 StdDeviationEnHit4Path0 = 31; public const Int32 StdDeviationEnHit5Path0 = 32; public const Int32 StdDeviationEnHit6Path0 = 33; public const Int32 StdDeviationEnHit7Path0 = 34; public const Int32 StdDeviationEn3HitsPath0 = 35; public const Int32 StdDeviationEn8HitsPath0 = 36; public const Int32 StdDeviationEnHit0Path1 = 37; public const Int32 StdDeviationEnHit1Path1 = 38; public const Int32 StdDeviationEnHit2Path1 = 39; public const Int32 StdDeviationEnHit3Path1 = 40; public const Int32 StdDeviationEnHit4Path1 = 41; public const Int32 StdDeviationEnHit5Path1 = 42; public const Int32 StdDeviationEnHit6Path1 = 43; public const Int32 StdDeviationEnHit7Path1 = 44; public const Int32 StdDeviationEn3HitsPath1 = 45; public const Int32 StdDeviationEn8HitsPath1 = 46; public const Int32 StdDeviationEnHit0Path2 = 47; public const Int32 StdDeviationEnHit1Path2 = 48; public const Int32 StdDeviationEnHit2Path2 = 49; public const Int32 StdDeviationEnHit3Path2 = 50; public const Int32 StdDeviationEnHit4Path2 = 51; public const Int32 StdDeviationEnHit5Path2 = 52; public const Int32 StdDeviationEnHit6Path2 = 53; public const Int32 StdDeviationEnHit7Path2 = 54; public const Int32 StdDeviationEn3HitsPath2 = 55; public const Int32 StdDeviationEn8HitsPath2 = 56; public const Int32 LogDirectory = 57; public const Int32 ReportDirectory = 58; public const Int32 ImagesDirectory = 59; public const Int32 CsvDirectory = 60; public const Int32 MassLogging = 61; public const Int32 CmdMeter2Baudrate = 62; public const Int32 CmdMeter2Databits = 63; public const Int32 CmdMeter2Comselect = 64; public const Int32 CmdMeter2Stopbits = 65; public const Int32 CmdMeter2Parity = 66; public const Int32 CmdMeter2Handshake = 67; public const Int32 DataMeter2Baudrate = 68; public const Int32 DataMeter2Databits = 69; public const Int32 DataMeter2Comselect = 70; public const Int32 DataMeter2Stopbits = 71; public const Int32 DataMeter2Parity = 72; public const Int32 DataMeter2Handshake = 73; public const Int32 CmdMeter3Baudrate = 74; public const Int32 CmdMeter3Databits = 75; public const Int32 CmdMeter3Comselect = 76; public const Int32 CmdMeter3Stopbits = 77; public const Int32 CmdMeter3Parity = 78; public const Int32 CmdMeter3Handshake = 79; public const Int32 DataMeter3Baudrate = 80; public const Int32 DataMeter3Databits = 81; public const Int32 DataMeter3Comselect = 82; public const Int32 DataMeter3Stopbits = 83; public const Int32 DataMeter3Parity = 84; public const Int32 DataMeter3Handshake = 85; public const Int32 Password2 = 86; public const Int32 Password3 = 87; } static class ReportParams { public const Int32 LogoXPos = 500; public const Int32 LogoYPos = 10; public const Int32 LogoXSize = 50; public const Int32 LogoYSize = 25; public const Int32 HeadlineXPos = 0; public const Int32 HeadlineYPos = 50; public const Int32 Headline2XPos = 128; public const Int32 Headline2YPos = 113; public const Int32 PageNumberXPosition = 220; public const Int32 PageNumberYPosition = -20; public const Int32 StandardTextXPos = 128; public const Int32 StandardTextYPos = 150; public const Int32 ImageXSize = 400; public const Int32 ImageYSize = 240; public const Int32 ImageXPos = 125; public const Int32 ImageYPos = 135; public const Int32 IntroductionXPos = 100; public const Int32 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 static readonly XFont fontVerySmall = new XFont("Calibri", 8, XFontStyle.Regular); public const Int32 Column1 = 0; public const Int32 Column2 = 1; public const Int32 Column3 = 2; public const Int32 Column4 = 3; public const Int32 Column5 = 4; } static class TempCalMode { public const Int32 Adjustment = 0; public const Int32 Measurement = 1; } static class ScrRes { public const UInt16 Low = 0; public const UInt16 High = 1; public const Double Scale = 0.53; } static class Constants { public const String Meter = "METER"; public const String Thermo = "THERMOMETER"; public const String TwentySpaces = " "; public const Double Vcal = 350; // For amplitude measurement. See TDC-GP30, vol.3, 2-6 public const UInt16 NumberOfMeters = 10; public const UInt16 NumberOfThermometers = 2; 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 Thermo1 = 0; public const UInt16 Thermo2 = 1; public const UInt16 Thermo3 = 2; public const UInt16 Slot1 = 1; public const UInt16 Slot2 = 2; public const UInt16 Slot3 = 3; public const UInt16 Slot4 = 4; public const UInt16 Slot5 = 5; public const UInt16 Slot6 = 6; public const UInt16 Slot7 = 7; public const UInt16 Slot8 = 8; public const UInt16 Slot9 = 9; public const UInt16 Slot10 = 10; public const UInt16 Slot11 = 11; public const UInt16 Slot12 = 12; 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 CmdThermo1 = 0; // tbc public const UInt16 CmdThermo2 = 1; // tbc 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 DataThermo1 = CmdThermo1 + Constants.NumberOfThermometers; // tbc public const UInt16 DataThermo2 = CmdThermo2 + Constants.NumberOfThermometers; // tbc 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 static 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"; public const String StatusDateTimeString = "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 Int32 OK = 0x00; public const Int32 Length = 0x01; public const Int32 Format = 0x02; public const Int32 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 Int32 ProtocolIdentPosition = 24; [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Messagetype")] public const Int32 MessagetypePosition = 26; [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ident")] public const Int32 PathIdentPosition = 28; [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ident")] public const Int32 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 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; public const Byte MultipleReaddata = 0x0D; public const Byte MultipleReaddataReply = 0x0E; public const Byte MultipleWritedata = 0x0F; 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 Int32 NoError = 0; public const Int32 SerialPortClosed = -2; public const Int32 SerialPortWriteFailure = -3; public const Int32 SerialPortReadFailure = -4; public const Int32 MaxDataLength = -5; public const Int32 Exception = -6; public const Int32 CrcCalcError = -7; public const Int32 Unknown = -8; public const Int32 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 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 }