using System; using System.Collections.Generic; using System.Text; using DTS.Common.Utilities; using System.Net.NetworkInformation; using DTS.Common.ICommunication; using DTS.Common.Enums.DASFactory; using DTS.Common.Utilities.Logging; using DTS.Common.Interface.DASFactory; namespace DTS.DASLib.Command.SLICE { public class Switches { public enum BaseSwitches : byte { PowerLedBlue = 0x01, // 1 PowerLedGreen, // 2 PowerLedRed, // 3 PowerLedBlink, // 4 StatusLedBlue, // 5 StatusLedGreen, // 6 StatusLedRed, // 7 StatusLedBlink, // 8 SLICEBusPower, // 9 TriggerOut, // 10 StartRecordOut, // 11 SDPowerEnable, // 12 : Now mapped to NAND device. ForceStatus, // 13 StatusMonitor, // 14 ChargePower, // 15 BackupPower, // 16 obsolete for SLICE 2.0. Connection being repurposed for I2C smart battery. ChargeStatus, // 17 OnOverride, // 18 PowerLedAll, // 19 StatusLedAll, // 20 SquibCh1Green, // 21 SquibCh1Yellow, // 22 SquibCh1Red, // 23 SquibCh2Green, // 24 SquibCh2Yellow, // 25 SquibCh2Red, // 26 SquibCh3Green, // 27 SquibCh3Yellow, // 28 SquibCh3Red, // 29 SquibCh4Green, // 30 SquibCh4Yellow, // 31 SquibCh4Red, // 32 SquibKillPower, // 33 SquibSelect_1, // 34 belong to squib PE address 0x27 SquibSelect_2, // 35 SquibSelect_3, // 36 SquibSelect_4, // 37 SquibSensorID_Mux0, // 38 SquibSensorID_Mux1, // 39 SquibAlarmEnable, // 40 SquibSafeArmSwitch, // 41 RO status from arm switch //39259 "Quick" software trigger doesn't work with TSR AIR TSRAIR_TriggerOut = 0xFD // 253 TSR AIR value for "quick" Trigger Check }; public enum S6Switches : byte { PowerLedBlue = 0x01, // 1 PowerLedGreen, // 2 PowerLedRed, // 3 PowerLedBlink, // 4 StatusLedBlue, // 5 StatusLedGreen, // 6 StatusLedRed, // 7 StatusLedBlink, // 8 SLICEBusPower, // 9 TriggerOut, // 10 StartRecordOut, // 11 SDPowerEnable, // 12 : Now mapped to NAND device. ForceStatus, // 13 StatusMonitor, // 14 ChargePower, // 15 BackupPower, // 16 obsolete for SLICE 2.0. Connection being repurposed for I2C smart battery. ChargeStatus, // 17 OnOverride, // 18 PowerLedAll, // 19 StatusLedAll, // 20 SquibCh1Green, // 21 SquibCh1Yellow, // 22 SquibCh1Red, // 23 SquibCh2Green, // 24 SquibCh2Yellow, // 25 SquibCh2Red, // 26 SquibCh3Green, // 27 SquibCh3Yellow, // 28 SquibCh3Red, // 29 SquibCh4Green, // 30 SquibCh4Yellow, // 31 SquibCh4Red, // 32 SquibKillPower, // 33 SquibSelect_1, // 34 belong to squib PE address 0x27 SquibSelect_2, // 35 SquibSelect_3, // 36 SquibSelect_4, // 37 SquibSensorID_Mux0, // 38 SquibSensorID_Mux1, // 39 SquibAlarmEnable, // 40 SquibSafeArmSwitch // 41 RO status from arm switch }; public enum S6DBSwitches : byte { PowerLedBlue = 0x01, // 1 PowerLedGreen = 2, // 2 PowerLedRed = 3, // 3 PowerLedBlink = 4, // 4 StatusLedBlue = 5, // 5 StatusLedGreen = 6, // 6 StatusLedRed = 7, // 7 StatusLedBlink = 8, // 8 AllPortPower = 9, // 9 = enable/disable all ports. TriggerOut = 10, // 10 = event out StartRecordOut = 11, // 11 = start out SDPowerEnable = 12, // 12 xxxxxxxxxxxxxxx N/A ForceStatus = 13, // 13 Force Ports Status StatusMonitor = 14, // 14 led_up_status ChargePower = 15, // 15 charger enable BackupPower = 16, // 16 xxxxxxxxxxxxxxx N/A ChargeStatus = 17, // 17 charger status OnOverride = 18, // 18 /ON override PowerLedAll = 19, // 19 StatusLedAll = 20, // 20 /* SquibCh1Green = 21, // 21 xxxxxxxxxxxxxxx N/A SquibCh1Yellow = 22, // 22 xxxxxxxxxxxxxxx N/A SquibCh1Red = 23, // 23 xxxxxxxxxxxxxxx N/A SquibCh2Green = 24, // 24 xxxxxxxxxxxxxxx N/A SquibCh2Yellow = 25, // 25 xxxxxxxxxxxxxxx N/A SquibCh2Red = 26, // 26 xxxxxxxxxxxxxxx N/A SquibCh3Green = 27, // 27 xxxxxxxxxxxxxxx N/A SquibCh3Yellow = 28, // 28 xxxxxxxxxxxxxxx N/A SquibCh3Red = 29, // 29 xxxxxxxxxxxxxxx N/A SquibCh4Green = 30, // 30 xxxxxxxxxxxxxxx N/A SquibCh4Yellow = 31, // 31 xxxxxxxxxxxxxxx N/A SquibCh4Red = 32, // 32 xxxxxxxxxxxxxxx N/A SquibKillPower = 33, // 33 xxxxxxxxxxxxxxx N/A SquibSelect_1 = 35, // 34 xxxxxxxxxxxxxxx N/A SquibSelect_2 = 35, // 35 xxxxxxxxxxxxxxx N/A SquibSelect_3 = 36, // 36 xxxxxxxxxxxxxxx N/A SquibSelect_4 = 37, // 37 xxxxxxxxxxxxxxx N/A SquibSensorID_Mux0 = 38, // 38 xxxxxxxxxxxxxxx N/A SquibSensorID_Mux1 = 39, // 39 xxxxxxxxxxxxxxx N/A SquibAlarmEnable = 40, // 40 xxxxxxxxxxxxxxx N/A SquibSafeArmSwitch = 41, // 41 xxxxxxxxxxxxxxx N/A */ Port1_nON_Enable = 42, // 42 S6DB downport 1 /ON enabe. Port2_nON_Enable = 43, // 43 S6DB downport 1 /ON enabe. Port3_nON_Enable = 44, // 44 S6DB downport 1 /ON enabe. Port4_nON_Enable = 45, // 45 S6DB downport 1 /ON enabe. Port1_Status_Line = 46, // 46 S6DB port 1 status line Port2_Status_Line = 47, // 47 S6DB port 2 status line Port3_Status_Line = 48, // 48 S6DB port 3 status line Port4_Status_Line = 49, // 49 S6DB port 4 status line Power_Hub_Status_Line = 50, // 50 S6DB HUB status line Up_Event_Line = 51, // 51 S6DB HUB status line Up_Start_Line = 52, // 52 S6DB HUB status line Up_Status_Line = 53, // 53 S6DB HUB status line Port1_PowerGood = 54, // S6DB Port1_PowerEnable = 55, // S6DB Port2_PowerGood = 56, // S6DB Port2_PowerEnable = 57, // S6DB Port3_PowerGood = 58, // S6DB Port3_PowerEnable = 59, // S6DB Port4_PowerGood = 60, // S6DB Port4_PowerEnable = 61, // S6DB Battery1_Enable = 62, // S6DB Battery2_Enable = 63, // S6DB Default_DasChain_Status = 64, // S6DB Battery_Detect = 65, // S6DB Event_Self = 66, // S6DB ON_Hold = 67, // S6DB Eth_Event_En = 68, // S6DB Eth_Event_En_Sw = 69, // S6DB Default_Hub_Status_Enable = 70, // S6DB revB only. DAS_1_Trigger_Status = 71, // S6DB revB only. DAS_2_Trigger_Status = 72, // S6DB revB only. DAS_3_Trigger_Status = 73, // S6DB revB only. DAS_4_Trigger_Status = 74, // S6DB revB only. PE5_DAS_Trigger2MCU = 75, // S6DB revB only. PE6_DAS_Trigger_UpStream = 76, // S6DB revB only. PE7_EXT_Trigger_Polarity = 77, // S6DB revB only. }; public enum PowerProSwitches : byte { PowerLedBlue = 1, PowerLedGreen = 2, PowerLedRed = 3, PowerLedBlink = 4, StatusLedBlue = 5, StatusLedGreen = 6, StatusLedRed = 7, StatusLedBlink = 8, //add back slice6 switch. SLICEBusPower = 0x09, // 9 MCUSelfTrigger = 10, // 10 SelfStartRecord = 11, // 11 SDPower = 12, // 12 : Now mapped to NAND device. ForceStatus = 13, // 13 StatusMonitor = 14, // 14 ChargePower = 15, // 15 BackupPower = 16, // 16 // obsolete for SLICE 2.0. Connection being repurposed for I2C smart battery. ChargeStatus = 17, // 17 OnOverride = 18, // 18 PowerLedAll = 19, // 19 StatusLedAll = 20, // 20 //Power switch AmpLedBlue = 21,//9, AmpLedGreen = 22,//10, AmpLedRed = 23,//11, AmpLedBlink = 24,//12, LemoLedBlue = 25,//13, LemoLedGreen = 26,//14, LemoLedRed = 27,//15, LemoLedBlink = 28,//16, WetLedBlue = 29,//17, WetLedGreen = 30,//18, WetLedRed = 31,//19, WetLedBlink = 32,//20, AmpLedAll = 33,//23, LemoLedAll = 34,//24, WetLedAll = 35,//25, AmpInProt = 36,//26, AmpInPS = 37,//27, AmpOutDSBL = 38,//28, AmpInFault = 39,//29, AmpGoodPower = 40,//30, AmpOutFault = 41,//31, LemoInProt = 42,//32, LemoInPS = 43,//33, LemoOutDSBL = 44,//34, LemoInFault = 45,//35, LemoGoodPower = 46,//36, LemoOutFault = 47,//37, WetInProt = 48,//38, WetInPS = 49,//39, WetOutDSBL = 50,//40, ChargerInFault = 51,//41, ChargerGoodPower = 52,//42, WetOutFault = 53,//43, BatteryInProt = 54,//44, BatteryInPS = 55,//45, BatteryOutDSBL = 56,//46, Battery_Enable = 57,//47, Battery_Detect = 58,//48, BatteryOutFault = 59,//49, StartRecordOut = 63,//53, TriggerOut = 64,//54, OnMonitor = 65,//55, StartMonitor = 67,//57, EventMonitor = 68,//58, Eth_Event_En = 69,//59, Eth_Event_En_Sw = 70,//60, Button_Enable = 71,//61, nRST_PE = 72,//62, nWR_EEPROM = 73,//63, PG_3V3 = 74,//64, PG_5V = 75,//65, IN_PS_PRES = 76,//66, nINT_FROM_PE = 77,//67, }; public enum BridgeSwitches : byte { EnableEmulation = 0, EmulationA, EmulationB, EmulationC, EnableExcitation, EnableAnalogPowerSupply, EnableAmps, EnableHalfBridgeCompletionA, EnableHalfBridgeCompletionB, EnableHalfBridgeCompletionC, }; public enum BridgeSwitchesSlice6 : byte { S6A_A2_GSWC____S6_G_SW_A = 0, // bit 0 S6A_EN_AC_C____S6_G_SW_D = 1, // bit 1 S6A_EnDAC_N_C__S6_IA_EN = 2, // bit 2 S6A_EnDAC_P_C__S6_EXCITE_EN = 3, // bit 3 S6A_EN_HALF_C__S6_ANALOG_EN = 4, // bit 4 S6A_EN_IEPE_C__S6_SW_MUX_2 = 5, // bit 5 S6A_A1_GSWB____S6_SW_MUX_1 = 6, // bit 6 S6A_EN_AC_B____S6_SW_MUX_0 = 7, // bit 7 S6A_nCS_IA_A___S6_G_SW_E = 8, // bit 0/1 S6A_nCS_IA_B___S6_A2_G_SW_C = 9, // bit 1/1 S6A_nCS_IA_C___S6_A1_G_SW_F = 10, // bit 2/1 S6A_nCS_IA_D___S6_A0_G_SW_B = 11, // bit 3/1 S6A_nCS_IA_E___S6_nCS_IA_D = 12, // bit 4/1 S6A_nCS_IA_F___S6_nCS_IA_A = 13, // bit 5/1 S6A_EN_IEPE_A__S6_nCS_IA_E = 14, // bit 6/1 S6A_EN_HALF_A__S6_nCS_IA_C = 15, // bit 7/1 S6A_EnDAC_P_A__S6_nCS_IA_F = 16, // bit 0/1 S6A_EnDAC_N_A__S6_nCS_IA_B = 17, // bit 1/1 S6A_EN_AC_A____S6_HALF_BRIDGE_B = 18, // bit 2/1 S6A_A0_GSWA____S6_HALF_BRIDGE_F = 19, // bit 3/1 S6A_EN_IEPE_B__S6_HALF_BRIDGE_C = 20, // bit 4/1 S6A_EN_HALF_B__S6_HALF_BRIDGE_E = 21, // bit 5/1 S6A_EnDAC_P_B__S6_HALF_BRIDGE_A = 22, // bit 6/1 S6A_EnDAC_N_B__S6_HALF_BRIDGE_D = 23, // bit 7/1 // 2nd PE switches S6A_PE2_TP504 = 0 + 24, // bit 0 S6A_PE2_EN_EXCITATION = 1 + 24, // bit 1 S6A_PE2_nSHDN_AD8231 = 2 + 24, // bit 2 S6A_PE2_MUX_A = 3 + 24, // bit 3 S6A_PE2_MUX_B = 4 + 24, // bit 4 S6A_PE2_MUX_C = 5 + 24, // bit 5 S6A_PE2_GSWF = 6 + 24, // bit 6 S6A_PE2_EN_AC_F = 7 + 24, // bit 7 S6A_PE2_EN_IEPE_D = 8 + 24, // bit 0/1 S6A_PE2_EN_HALF_D = 9 + 24, // bit 1/1 S6A_PE2_EnDAC_P_D = 10 + 24, // bit 2/1 S6A_PE2_EnDAC_N_D = 11 + 24, // bit 3/1 S6A_PE2_EN_AC_D = 12 + 24, // bit 4/1 S6A_PE2_GSWD = 13 + 24, // bit 5/1 S6A_PE2_EN_IEPE_E = 14 + 24, // bit 6/1 S6A_PE2_EN_HALF_E = 15 + 24, // bit 7/1 S6A_PE2_EnDAC_P_E = 16 + 24, // bit 0/1 S6A_PE2_EnDAC_N_E = 17 + 24, // bit 1/1 S6A_PE2_EN_AC_E = 18 + 24, // bit 2/1 S6A_PE2_GSWE = 19 + 24, // bit 3/1 S6A_PE2_EN_IEPE_F = 20 + 24, // bit 4/1 S6A_PE2_EN_HALF_F = 21 + 24, // bit 5/1 S6A_PE2_EnDAC_P_F = 22 + 24, // bit 6/1 S6A_PE2_EnDAC_N_F = 23 + 24, // bit 7/1 // Base 368 switches. S6A_BASE_UART_TX_EN = 0 + 48, // bit 0 S6A_BASE_UART_RX_nEN = 1 + 48, // bit 1 S6A_BASE_IRIG_B_EN = 9 + 48, // bit 9 S6A_BASE_nRST_ETH = 10 + 48, // bit 10 S6A_BASE_nRST_FPGA = 11 + 48, // bit 11 S6A_BASE_EN_24P5VA = 12 + 48, // bit 12 S6A_BASE_EN_AN_PWR = 13 + 48, // bit 13 S6A_BASE_FILT_SHDN = 14 + 48, // bit 14 S6A_BASE_EN_AN = 15 + 48, // bit 15 analog 5.1V and 3.3V on analog board. S6A_BASE_EN_CLASS1 = 16 + 48, // bit 16 S6A_BASE_nEN_MUX = 17 + 48, // bit 17 /* S6_P0_G_SW_A = 0, // SW_MUX_0 GPIO0 mux address 0 S6_P1_G_SW_D = 1, // SW_MUX_1 GPIO1 mux address 1 S6_P2_IA_EN = 2, // SW_MUX_2 2 mux address 1 S6_P3_EXCITE_EN = 3, // 3 ANALOG_EN enable excitation. S6_P4_ANALOG_EN = 4, // 4 EXCITE_EN enable analog on bridges. S6_P5_SW_MUX_2 = 5, // 5 IA_EN enable the amplifier AD8231ACPZ S6_P6_SW_MUX_1 = 6, // 6 G_SW_F gain switch for channel F S6_P7_SW_MUX_0 = 7, // 7 G_SW_E gain switch for channel E S6_P8_G_SW_E = 8, // 8 gain switch for channel D S6_P9_A2_G_SW_C = 9, // 9 gain switch for channel C and A2 multiplex S6_P10_A1_G_SW_F = 10, // 10 gain switch for channel B and A1 multiplex S6_P11_A0_G_SW_B = 11, // 11 gain switch for channel A and A0 multiplex S6_P12_nCS_IA_D = 12, // 12 cs to program gain for channel F S6_P13_nCS_IA_A = 13, // 13 cs to program gain for channel E S6_P14_nCS_IA_E = 14, // 14 cs to program gain for channel D S6_P15_nCS_IA_C = 15, // 15 cs to program gain for channel C S6_P16_nCS_IA_F = 16, // 16 cs to program gain for channel B S6_P17_nCS_IA_B = 17, // 17 cs to program gain for channel A // Continue from analog switches. S6_S1_HALF_BRIDGE_B = 18, // 0 S6_S2_HALF_BRIDGE_F = 19, // 1 S6_S3_HALF_BRIDGE_C = 20, // 2 S6_S4_HALF_BRIDGE_E = 21, // 3 S6_S5_HALF_BRIDGE_A = 22, // 4 S6_S6_HALF_BRIDGE_D = 23, // 5 */ }; public enum BridgeSwitches_SLICE2 : byte { swEnableEmulation = 0, // 0 : High active. 1 = enabled. 0 = disabled. swEmulationA, // 1 : Low active. 0 = enabled. 1 = disabled. swEmulationB, // 2 : Low active. 0 = enabled. 1 = disabled. swEmulationC, // 3 : Low active. 0 = enabled. 1 = disabled. swExcitation, // 4 : High active. 1 = enabled. 0 = disabled. swAnalogPowerSupply_MSP, // 5 : High active. 1 = enabled. 0 = disabled. swEnIAA, // 6 : High active. 1 = enabled IEPE type. 0 = disabled. swEnHalfA, // 7 : High active. 1 = enabled. 0 = disabled. swEnHalfB, // 8 : High active. 1 = enabled. 0 = disabled. swEnHalfC, // 9 : High active. 1 = enabled. 0 = disabled. swFilterSelHBW_MSP, // 10 : High active. 1 = enabled. 0 = disabled. swFilterSelLBW_MSP, // 11 : High active. 1 = enabled. 0 = disabled. swEnIAB, // 12 : High active. 1 = enabled IEPE type. 0 = disabled == BRIDGE. swEnClass, // 13 : High active. 1 = enabled. 0 = disabled. swEnIAC, // 14 : High active. 1 = enabled IEPE type. 0 = disabled. // these belongs to PE1 swVoltageInsertionA, // 15 : High active. 1 = enabled. 0 = disabled. swVoltageInsertionB, // 16 : High active. 1 = enabled. 0 = disabled. swVoltageInsertionC, // 17 : High active. 1 = enabled. 0 = disabled. swVoltageInsertionMode, // 18 : High active. 1 = enabled. 0 = disabled. swVoltageInsertionAmp, // 19 : Low active. 0 = enabled. 1 = disabled. // IEPE switches swIS_CalibrationA, // 20 : High active. 1 = enabled. 0 = disabled. EN_CALA, swIS_CalibrationB, // 21 : High active. 1 = enabled. 0 = disabled. EN_CALB, swIS_CalibrationC, // 22 : High active. 1 = enabled. 0 = disabled. EN_CALC, swIS_EnableAnalogPowerSupply_MSP, // 23 : High active. 1 = enabled. 0 = disabled.EN_ANALOG_PWR swIS_Enable24Volt, // 24 : High active. 1 = enabled. 0 = disabled.EN_24V swIS_EnableACcouplerA, // 25 : High active. 1 = enabled. 0 = disabled.BS_EnableHalfBridgeA, swIS_EnableACcouplerB, // 26 : High active. 1 = enabled. 0 = disabled.BS_EnableHalfBridgeB, swIS_EnableACcouplerC, // 27 : High active. 1 = enabled. 0 = disabled.BS_EnableHalfBridgeC // IEPE: Mapping VInsert in same order with bridge. swIS_EnGainAmpAll, // 28 N/A 2nd stage gain amplifier. swIS_EnIAA, // 29 : Low active. 0 = enabled. 1 = disabled. input A buffer enabled. swIS_FilterSelHBW_MSP, // 30 : High active. 1 = enabled. 0 = disabled.(not used in IEPE, but for debug purpose.) swIS_FilterSelLBW_MSP, // 31 : High active. 1 = enabled. 0 = disabled.new in v2.0 swIS_EnIAB, // 32 : Low active. 0 = enabled. 1 = disabled. input B buffer enabled. swIS_EnClass, // 33 : High active. 1 = enabled. 0 = disabled.Class Enable (for TEDS ID detect) swIS_EnIAC, // 34 : Low active. 0 = enabled. 1 = disabled. input C buffer enabled. // these belongs to PE1 swIS_VoltageInsertionA, // 35 : High active. 1 = enabled. 0 = disabled. swIS_VoltageInsertionB, // 36 : High active. 1 = enabled. 0 = disabled. swIS_VoltageInsertionC, // 37 : High active. 1 = enabled. 0 = disabled. swIS_VoltageInsertionMode, // 38 : High active. 1 = enabled. 0 = disabled. swIS_VoltageInsertionAmp, // 39 : Low active. 0 = enabled. 1 = disabled // added to support IEPE/ swIS_EnGainIAmp_A, // 40 : High active. 1 = enabled IEPE Input. 0 = disabled. swIS_EnGainIAmp_B, // 41 : High active. 1 = enabled IEPE Input. 0 = disabled. swIS_EnGainIAmp_C, // 42 : High active. 1 = enabled IEPE Input. 0 = disabled. // add for RevC bridge type. swEnPosExcite_A, // 43 only for 2V and 5V swEnPosExcite_B, // 44 swEnPosExcite_C, // 45 swEnQB_A, // 46 swEnQB_B, // 47 swEnQB_C, // 48 swAll_SignalsShorted, // 49 common to both IEPE/Bridge swAll_ReferenceShorted, // 50 connect signal to reference 2.5V. swEn10VoltExcite_A, // 51 separate 10V excitation because it needs swEn10VoltExcite_B, // 52 to follow a strict timing sequence to turn on swEn10VoltExcite_C, // 53 EX+ and EX- PE0_P00, // 0- 15 PE0_P01, // 1- 16 PE0_P02, // 2- 17 PE0_P03, // 3- 18 PE0_P04, // 4- 19 PE0_P05, // 5- 20 PE0_P06, // 6- 21 PE0_P07, // 7- 22 PE0_P10, // 8- 23 PE0_P11, // 9- 24 PE0_P12, // 10- 25 PE0_P13, // 11- 26 PE0_P14, // 12- 27 PE0_P15, // 13- 28 PE0_P16, // 14- 29 PE0_P17, // 15- 30 PE0_P20, // 16- 31 PE0_P21, // 17- 32 PE0_P22, // 18- 33 PE0_P23, // 19- 34 PE0_P24, // 20- 35 PE0_P25, // 21- 36 PE0_P26, // 22- 37 PE0_P27, // 23- 38 PE1_P00, // 0- 39 PE1_P01, // 1- 40 PE1_P02, // 2- 41 PE1_P03, // 3- 42 PE1_P04, // 4- 43 PE1_P05, // 5- 44 PE1_P06, // 6- 45 PE1_P07, // 7- 46 PE1_P10, // 8- 47 PE1_P11, // 9- 48 PE1_P12, // 10- 49 PE1_P13, // 11- 50 PE1_P14, // 12- 51 PE1_P15, // 13- 52 PE1_P16, // 14- 53 PE1_P17, // 15- 54 PE1_P20, // 16- 55 =>>>>>>>>>>>>>>>>>>>>>>>>>> PE1_P21, // 17- 56 =>> Only available in RevC PE1_P22, // 18- 57 =>> Only available in RevC PE1_P23, // 19- 58 =>> Only available in RevC PE1_P24, // 20- 59 =>> Only available in RevC PE1_P25, // 21- 60 =>> Only available in RevC PE1_P26, // 22- 61 =>> Only available in RevC PE1_P27, // 23- 62 =>>>>>>>>>>>>>>>>>>>>>>>>>> DBG_swMax }; public enum BridgeSwitchesSlice6ABR : byte { S6BR_SIGN_ALL = 0, // bit 0 S6BR_GAINF = 1, // bit 1 S6BR_SIGPF_DAC = 2, // bit 2 S6BR_GAINE = 3, // bit 3 S6BR_SIGPE_DAC = 4, // bit 4 S6BR_GAIND = 5, // bit 5 S6BR_SIGPD_DAC = 6, // bit 6 S6BR_GAINC = 7, // bit 7 S6BR_EN_EX = 8, // bit 0/1 S6BR_A0_GC = 9, // bit 1/1 S6BR_A1_GC = 10, // bit 2/1 S6BR_A2_GC = 11, // bit 3/1 S6BR_nCS_IA_A = 12, // bit 4/1 S6BR_nCS_IA_B = 13, // bit 5/1 S6BR_nCS_IA_C = 14, // bit 6/1 S6BR_nCS_IA_D = 15, // bit 7/1 S6BR_nCS_IA_E = 16, // bit 0/1 S6BR_nCS_IA_F = 17, // bit 1/1 S6BR_nSHDN = 18, // bit 2/1 S6BR_SIGPA_DAC = 19, // bit 3/1 S6BR_GAINA = 20, // bit 4/1 S6BR_SIGPB_DAC = 21, // bit 5/1 S6BR_GAINB = 22, // bit 6/1 S6BR_SIGPC_DAC = 23, // bit 7/1 }; public enum BridgeSwitches_TOM : byte { DS_Squib_Arm1 = 0, // 0 : High active. 1 = enabled. 0 = disabled. DS_Squib_Arm2, // 1 : High active. 1 = enabled. 0 = disabled. DS_Squib_Arm3, // 2 : High active. 1 = enabled. 0 = disabled. DS_Squib_Arm4, // 3 : High active. 1 = enabled. 0 = disabled. DS_Squib1_ConstCur, // 4 : 1 = select constant current mode. 0 = cap discharge. DS_Squib2_ConstCur, // 5 : 1 = select constant current mode. 0 = cap discharge. DS_Squib3_ConstCur, // 6 : 1 = select constant current mode. 0 = cap discharge. DS_Squib4_ConstCur, // 7 : 1 = select constant current mode. 0 = cap discharge. DS_RecordFire1, // 8 : High active. 1 = enabled. 0 = disabled. DS_RecordFire2, // 9 : High active. 1 = enabled. 0 = disabled. DS_RecordFire3, // 10 : High active. 1 = enabled. 0 = disabled. DS_RecordFire4, // 11 : High active. 1 = enabled. 0 = disabled. DS_EnableHwFilter, // 12 : High active. 1 = enabled UseSCF. 0 = disable. // =============================================== // from second PE addr 0x21: 5 reserve [10.11.12.13.14] DS_D1_OCPU_Mode, // 13 : 1 = Contact closure. 0=Logic 5V/0V digital output 1 DS_D2_OCPU_Mode, // 14 : 1 = Contact closure. 0=Logic 5V/0V digital output 1 DS_D3_OCPU_Mode, // 15 : 1 = Contact closure. 0=Logic 5V/0V digital output 1 DS_D4_OCPU_Mode, // 16 : 1 = Contact closure. 0=Logic 5V/0V digital output 1 DS_D5_OCPU_Mode, // 17 : 1 = Contact closure. 0=Logic 5V/0V digital output 1 DS_D6_OCPU_Mode, // 18 : 1 = Contact closure. 0=Logic 5V/0V digital output 1 DS_D7_OCPU_Mode, // 19 : 1 = Contact closure. 0=Logic 5V/0V digital output 1 DS_D8_OCPU_Mode, // 20 : 1 = Contact closure. 0=Logic 5V/0V digital output 1 DS_Digital_PwrEn1234, // 21 DS_Digital_PwrEn5678, // 22 DS_SquibCharge_17p_Enable, // 23 // here is the add-on to switch the port extender pin. PE0_P00, // 0- 24 PE0_P01, // 1- 25 PE0_P02, // 2- 26 PE0_P03, // 3- 27 PE0_P04, // 4- 28 PE0_P05, // 5- 29 PE0_P06, // 6- 30 PE0_P07, // 7- 31 PE0_P10, // 8- 32 PE0_P11, // 9- 33 PE0_P12, // 10- 34 PE0_P13, // 11- 35 PE0_P14, // 12- 36 PE0_P15, // 13- 37 PE0_P16, // 14- 38 PE0_P17, // 15- 39 PE1_P00, // 0- 40 PE1_P01, // 1- 41 PE1_P02, // 2- 42 PE1_P03, // 3- 43 PE1_P04, // 4- 44 PE1_P05, // 5- 45 PE1_P06, // 6- 46 PE1_P07, // 7- 47 PE1_P10, // 8- 48 PE1_P11, // 9- 49 PE1_P12, // 10- 50 PE1_P13, // 11- 51 PE1_P14, // 12- 52 PE1_P15, // 13- 53 PE1_P16, // 14- 54 PE1_P17, // 15- 55 DBG_swMax }; public enum EIPESwitches : byte { IS_CalibrationA = 0, // EN_CALA, IS_CalibrationB, // EN_CALB, IS_CalibrationC, // EN_CALC, IS_EnableAnalogPowerSupply, // EN_ANALOG_PWR IS_Enable24Volt, // EN_24V IS_EnableACcouplerA, // BS_EnableHalfBridgeA, IS_EnableACcouplerB, // BS_EnableHalfBridgeB, IS_EnableACcouplerC // BS_EnableHalfBridgeC } public enum EIPEDACs : byte { IS_DACOffsetA = 0, IS_DACOffsetB, IS_DACOffsetC, IS_DACCalibrationCoarse } public enum SystemSwitches_425B //TSR AIR { GPIO__3P3VD_ENABLE, GPIO__50_MHZ_OSC_ENABLE, GPIO__FPGA_POWER, GPIO__FPGA_RESET, GPIO__GPS_POWER, GPIO__MCU_EVENT, //For doing Quick Trigger GPIO__MCU_START, GPIO__MCU_STATUS, GPIO__MEM_POWER, GPIO__PE_RESET, GPIO__SENSOR_POWER, GPIO__KILL_POWER, GPIO__TP400, PE_8__PWR_LED_BLUE, PE_8__PWR_LED_GREEN, PE_8__PWR_LED_RED, PE_8__STS_LED_BLUE, PE_8__STS_LED_GREEN, PE_8__STS_LED_RED, PE_8__ETH_RESET, PE_8__HEATER_POWER, FPGA_PPS_DIR, } } public class DACs { public enum BridgeDACs : byte { OffsetA = 0x00, OffsetB = 0x01, OffsetC = 0x02, CoarseShunt = 0x03, FineShunt = 0x04, NotUseDAC = 5, VInsertA = 6, // for slice6A VInsertB = 7, VInsertC = 8, VInsertD = 9, VInsertE = 10, VInsertF = 11, } public enum IEPEDACs : byte { OffsetA = 0x00, OffsetB = 0x01, OffsetC = 0x02, CoarseShunt = 0x03 } public enum BridgeDACS_SLICE2 : byte { OffsetA = 0x00, OffsetB = 0x01, OffsetC = 0x02, CoarseShunt = 0x03, FineShunt = 0x04, ExcitationA = 0x05, ExcitationB = 0x06, ExcitationC = 0x07, } } public abstract class QAandUtilityCommands : CommandBase { protected enum Commands { Reserved = 0x00, QuerySwitchImmediate = 0x01, SetSwitchImmediate = 0x02, QueryDACImmediate = 0x03, SetDACImmediate = 0x04, QueryGainImmediate = 0x05, SetGainImmediate = 0x06, QueryAAFilterImmediate = 0x07, SetAAFilterImmediate = 0x08, ReadArbitraryFlash = 0x09, WriteArbitraryFlash = 0x0A, SelfTestFlash = 0x0B, QueryTime = 0x0C, SetTime = 0x0D, RestartSDCard = 0x0E, QueryEventPhysicalStartAddress = 0x0F, SetEventPhysicalStartAddress = 0x10, TestCommunication = 0x11, QueryLastError = 0x12, SetSmartBatteryConfig = 0x13, QuerySmartBatteryConfig = 0x14, SetStackLowPowerMode = 0x15, SetTiltSensorRange = 0x16, QueryTiltSensorRange = 0x17, QueryTiltSensorData = 0x18, QueryTiltSensorSensitivity = 0x19, QueryEthernetMacTable = 0x1A, TestEthernetCable = 0x1B, MeasureEventDelay = 0x1C, MeasureStartDelay = 0x1D, SetSwitchTestMode = 0x1E, QuerySwitchTestMode = 0x1F, QueryMacIpTable = 0x20, TiltSensorSet = 0x21, TiltSensorGet = 0x22, }; protected abstract Commands _Command { get; } protected QAandUtilityCommands(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Type = CommandPacket.CommandType.QAandUtility; command.SetCommand((byte)_Command, _Command.ToString()); } protected QAandUtilityCommands(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Type = CommandPacket.CommandType.QAandUtility; command.SetCommand((byte)_Command, _Command.ToString()); } } public class QuerySwitchImmediate : QAandUtilityCommands { protected override Commands _Command => Commands.QuerySwitchImmediate; private byte _setting = 0; private byte _Switch = 0; public byte Switch { get => _Switch; set { _Switch = value; command.SetParameter(0, value); } } public byte Setting => _setting; public string SwitchText { private get; set; } public QuerySwitchImmediate(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[1]; } public QuerySwitchImmediate(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[1]; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _setting); } else { _setting = 0; } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Switch: {_Switch}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); string s = SwitchText; if (string.IsNullOrWhiteSpace(s)) { s = _Switch.ToString(); } lines.Add(new List() { $"DeviceID: {DeviceID}, Switch{s}, Setting: {Setting}" }); } } public class SetSwitchImmediate : QAandUtilityCommands { protected override Commands _Command => Commands.SetSwitchImmediate; private byte _Switch; private byte _Setting; private byte _Port; private byte _Pin; public byte Switch { get => _Switch; set { _Switch = value; command.SetParameter(0, value); } } public string SwitchText { private get; set; } public byte Setting { set { _Setting = value; command.SetParameter(1, value); } } public byte Port { get => _Port; set { _Port = value; command.SetParameter(2, value); } } public byte Pin { get => _Pin; set { _Pin = value; command.SetParameter(3, value); } } public SetSwitchImmediate(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[4]; } public SetSwitchImmediate(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[4]; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); var s = SwitchText; if (string.IsNullOrWhiteSpace(s)) { s = _Switch.ToString(); } lines.Add(new List() { $"DeviceID: {DeviceID}, Switch: {s}, Setting: {_Setting}, Port: {_Port}, Pin: {_Pin}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); } } public class QueryDACImmediate : QAandUtilityCommands { protected override Commands _Command => Commands.QueryDACImmediate; const int DACPosition = 0; const int ValuePosition = 1; const int CommandParameterLength = 1; private byte _dac = 0; private ushort _value = 0; public byte DAC { get => _dac; set { _dac = value; command.SetParameter(DACPosition, _dac); } } public ushort Value => _value; public QueryDACImmediate(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[CommandParameterLength]; } public QueryDACImmediate(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[CommandParameterLength]; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(ValuePosition, out _value); } else { _value = 0; } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Address: {DeviceID}, DAC: {DAC}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Value: {Value}" }); } } public class SetDACImmediate : QAandUtilityCommands { protected override Commands _Command => Commands.SetDACImmediate; const int DACPosition = 0; const int ValuePosition = 1; const int CommandParameterLength = 3; private byte _dac = 0; private ushort _value = 0; public byte DAC { get => _dac; set { _dac = value; command.SetParameter(DACPosition, _dac); } } public ushort Value { get => _value; set { _value = value; command.SetParameter(ValuePosition, _value); } } public SetDACImmediate(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[CommandParameterLength]; } public SetDACImmediate(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[CommandParameterLength]; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Address: {DeviceID}, DAC: {DAC}, Value: {Value}" }); } } public class QueryGainImmediate : QAandUtilityCommands { protected override Commands _Command => Commands.QueryGainImmediate; private byte _channel; private byte _gainstep; public byte Channel { get => _channel; set { _channel = value; command.SetParameter(0, value); } } public byte GainStep { get { return _gainstep; } } public QueryGainImmediate(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[1]; } public QueryGainImmediate(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[1]; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _gainstep); } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Address: {DeviceID}, Channel: {Channel}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"GainStep: {GainStep}" }); } } public class SetGainImmediate : QAandUtilityCommands { protected override Commands _Command => Commands.SetGainImmediate; private byte _Channel; private byte _GainStep; public byte Channel { set { _Channel = value; command.SetParameter(0, value); } } public byte GainStep { set { _GainStep = value; command.SetParameter(1, value); } } public SetGainImmediate(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[2]; } public SetGainImmediate(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[2]; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Address: {DeviceID}, Channel: {_Channel}, GainStep: {_GainStep}" }); } } public class QueryAAFilterImmediate : QAandUtilityCommands { protected override Commands _Command => Commands.QueryAAFilterImmediate; private float _frequency; public float FrequencyHz => _frequency; public QueryAAFilterImmediate(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public QueryAAFilterImmediate(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _frequency); } else { _frequency = 0.0f; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Cutoff Frequency Hz: {FrequencyHz}" }); } } public class SetAAFilterImmediate : QAandUtilityCommands { protected override Commands _Command => Commands.SetAAFilterImmediate; private float _frequency; public float FrequencyHz { get => _frequency; set { _frequency = value; command.SetParameter(0, _frequency); } } public SetAAFilterImmediate(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[sizeof(float)]; } public SetAAFilterImmediate(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[sizeof(float)]; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _frequency); } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Cutoff Frequency Hz: {FrequencyHz}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Cutoff Frequency Hz: {ResponseStatus}" }); } } public class ReadArbitraryFlash : QAandUtilityCommands { protected override Commands _Command => Commands.ReadArbitraryFlash; const int WhichCardPosition = 0; const int AddressPosition = 1; const int LengthPosition = 9; const int CommandParameterLength = 13; private byte _whichCard; public byte[] Data { get; private set; } public bool CardA { get => _whichCard == 0; set { _whichCard = value ? (byte)0 : (byte)1; command.SetParameter(WhichCardPosition, _whichCard); } } public uint Length { get { if (null == Data) return 0; return (uint)Data.Length; } set { Data = new byte[value]; command.SetParameter(LengthPosition, Data.Length); } } private ulong _address; public ulong Address { get { return _address; } set { _address = value; command.SetParameter(AddressPosition, _address); } } public ReadArbitraryFlash(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[CommandParameterLength]; Data = null; Address = 0; CardA = true; } public ReadArbitraryFlash(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[CommandParameterLength]; Data = null; Address = 0; CardA = true; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(LengthPosition, out uint resultLength); var resultData = new byte[resultLength]; for (var i = 0; i < resultLength; i++) { resultData[i] = response.Parameter[CommandParameterLength + i]; } Length = resultLength; Data = resultData; } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Address: {Address}, Length: {Length}, Card: {(CardA ? "A" : "B")}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Length: {Length}" }); } } public class WriteArbitraryFlash : QAandUtilityCommands { protected override Commands _Command => Commands.WriteArbitraryFlash; private byte[] _data; public byte[] Data { get => _data; set { byte[] newParameter = null == value ? (new byte[12]) : (new byte[value.Length + 12]); command.Parameter.CopyTo(newParameter, 0); command.Parameter = newParameter; _data = value; if (null != _data) { command.SetParameter(8, _data.Length); command.SetParameter(12, _data); } } } public uint Length => null == _data ? 0 : (uint)_data.Length; private ulong _address; public ulong Address { get => _address; set { _address = value; command.SetParameter(0, _address); } } public WriteArbitraryFlash(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { Data = null; Address = 0; command.Parameter = new byte[12]; } public WriteArbitraryFlash(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { Data = null; Address = 0; command.Parameter = new byte[12]; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Address: {Address}, Length: {Length}" }); } } public class SelfTestFlash : QAandUtilityCommands { protected override Commands _Command => Commands.SelfTestFlash; const uint DefaultBlocksToTest = 20000u; const byte DefaultTestType = 0; const uint DefaultBlocksPerMBW = 1024u; //===================================== const uint DefaultPreErase = 81920; const ushort DefaultAU_WriteSize = 8192; const ushort DefaultAU_PreErase = 8192; const ushort DefaultMagicBlocks = 8192; const ushort DefaultEventSkipBlocks = 1024; const uint DefaultLongDelay = 100000; //===================================== const byte DefaultFirstDualErase = 1; const byte DefaultDualPreEraseGarbageWrite = 1; const byte DefaultSecondDualErase = 1; const byte DefaultPreEraseGarbageWriteA = 1; const byte DefaultPreEraseGarbageWriteB = 0; const byte DefaultPreWritePreErase = 1; const byte DefaultDoFlashClear = 1; const byte DefaultWriteTillDelay = 0; private byte _testtype; public byte TestType { get => _testtype; set { _testtype = value; command.SetParameter(0, _testtype); } } private uint _blocks; public uint BlocksToTest { get => _blocks; set { _blocks = value; command.SetParameter(1, _blocks); } } private uint _blocksPerMBW; public uint BlocksPerMBW { get => _blocksPerMBW; set { _blocksPerMBW = value; command.SetParameter(5, _blocksPerMBW); } } //========================================================================= private uint _preErase; public uint PreErase { get => _preErase; set { _preErase = value; command.SetParameter(9, _preErase); } } private ushort _auWriteSize; public ushort AU_WriteSize { get => _auWriteSize; set { _auWriteSize = value; command.SetParameter(13, _auWriteSize); } } private ushort _auPreErase; public ushort AU_PreErase { get => _auPreErase; set { _auPreErase = value; command.SetParameter(15, _auPreErase); } } private ushort _magicBlocks; public ushort MagicBlocks { get => _magicBlocks; set { _magicBlocks = value; command.SetParameter(17, _magicBlocks); } } private ushort _eventSkipBlocks; public ushort EventSkipBlocks { get => _eventSkipBlocks; set { _eventSkipBlocks = value; command.SetParameter(19, _eventSkipBlocks); } } private uint _longDelay; public uint LongDelay { get => _longDelay; set { _longDelay = value; command.SetParameter(21, _longDelay); } } //========================================================================= private byte _firstDualErase; public byte FirstDualErase { get => _firstDualErase; set { _firstDualErase = value; command.SetParameter(25, _firstDualErase); } } private byte _dualPreEraseGarbageWrite; public byte DualPreEraseGarbageWrite { get => _dualPreEraseGarbageWrite; set { _dualPreEraseGarbageWrite = value; command.SetParameter(26, _dualPreEraseGarbageWrite); } } private byte _secondDualErase; public byte SecondDualErase { get => _secondDualErase; set { _secondDualErase = value; command.SetParameter(27, _secondDualErase); } } private byte _preEraseGarbageWriteA; public byte PreEraseGarbageWriteA { get => _preEraseGarbageWriteA; set { _preEraseGarbageWriteA = value; command.SetParameter(28, _preEraseGarbageWriteA); } } private byte _preEraseGarbageWriteB; public byte PreEraseGarbageWriteB { get => _preEraseGarbageWriteB; set { _preEraseGarbageWriteB = value; command.SetParameter(29, _preEraseGarbageWriteB); } } private byte _preWritePreErase; public byte PreWritePreErase { get => _preWritePreErase; set { _preWritePreErase = value; command.SetParameter(30, _preWritePreErase); } } private byte _doFlashClear; public byte DoFlashClear { get => _doFlashClear; set { _doFlashClear = value; command.SetParameter(31, _doFlashClear); } } private byte _writeTillDelay; public byte WriteTillDelay { get => _writeTillDelay; set { _writeTillDelay = value; command.SetParameter(32, _writeTillDelay); } } public SelfTestFlash(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[33]; BlocksToTest = DefaultBlocksToTest; TestType = DefaultTestType; BlocksPerMBW = DefaultBlocksPerMBW; //===================================== PreErase = DefaultPreErase; AU_WriteSize = DefaultAU_WriteSize; AU_PreErase = DefaultAU_PreErase; MagicBlocks = DefaultMagicBlocks; EventSkipBlocks = DefaultEventSkipBlocks; LongDelay = DefaultLongDelay; //===================================== FirstDualErase = DefaultFirstDualErase; DualPreEraseGarbageWrite = DefaultDualPreEraseGarbageWrite; SecondDualErase = DefaultSecondDualErase; PreEraseGarbageWriteA = DefaultPreEraseGarbageWriteA; PreEraseGarbageWriteB = DefaultPreEraseGarbageWriteB; PreWritePreErase = DefaultPreWritePreErase; DoFlashClear = DefaultDoFlashClear; WriteTillDelay = DefaultWriteTillDelay; } public SelfTestFlash(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[33]; BlocksToTest = DefaultBlocksToTest; TestType = DefaultTestType; BlocksPerMBW = DefaultBlocksPerMBW; //===================================== PreErase = DefaultPreErase; AU_WriteSize = DefaultAU_WriteSize; AU_PreErase = DefaultAU_PreErase; MagicBlocks = DefaultMagicBlocks; EventSkipBlocks = DefaultEventSkipBlocks; LongDelay = DefaultLongDelay; //===================================== FirstDualErase = DefaultFirstDualErase; DualPreEraseGarbageWrite = DefaultDualPreEraseGarbageWrite; SecondDualErase = DefaultSecondDualErase; PreEraseGarbageWriteA = DefaultPreEraseGarbageWriteA; PreEraseGarbageWriteB = DefaultPreEraseGarbageWriteB; PreWritePreErase = DefaultPreWritePreErase; DoFlashClear = DefaultDoFlashClear; WriteTillDelay = DefaultWriteTillDelay; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"-> SelfTestFlash [{command.SequenceNumber.ToString("00000000")}]" }); lines.Add(new List() { $" Blocks to test: {BlocksToTest}, test type: {TestType}, blocks per mbw: {BlocksPerMBW}" }); lines.Add(new List() { $" SD Total Blocks: {PreErase}, AU Write Size: {AU_WriteSize}, AU_PreErase: {AU_PreErase}, Magic Blocks: {MagicBlocks}, EventSkipBlocks: {EventSkipBlocks}" }); lines.Add(new List() { $" FirstDualErase: {FirstDualErase}, DualPreEraseGarbageWrite: {DualPreEraseGarbageWrite}, SecondDualErase: {SecondDualErase}" }); lines.Add(new List() { $" PreEraseGarbageWriteA: {PreEraseGarbageWriteA}, PreEraseGarbageWriteB: {PreEraseGarbageWriteB}, PreWritePreErase: {PreWritePreErase}" }); lines.Add(new List() { $" LongDelay: {LongDelay}, WriteTillDelay: {WriteTillDelay}" }); } public override void ResponseToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"-> SelfTestFlash [{command.SequenceNumber.ToString("00000000")}]" }); lines.Add(new List() { $" Blocks to test: {BlocksToTest}, test type: {TestType}, blocks per mbw: {BlocksPerMBW}" }); lines.Add(new List() { $" SD Total Blocks: {PreErase}, AU Write Size: {AU_WriteSize}, AU_PreErase: {AU_PreErase}, Magic Blocks: {MagicBlocks}, EventSkipBlocks: {EventSkipBlocks}" }); lines.Add(new List() { $" FirstDualErase: {FirstDualErase}, DualPreEraseGarbageWrite: {DualPreEraseGarbageWrite}, SecondDualErase: {SecondDualErase}" }); lines.Add(new List() { $" PreEraseGarbageWriteA: {PreEraseGarbageWriteA}, PreEraseGarbageWriteB: {PreEraseGarbageWriteB}, PreWritePreErase: {PreWritePreErase}" }); lines.Add(new List() { $" LongDelay: {LongDelay}, WriteTillDelay: {WriteTillDelay}" }); } } public class QueryTime : QAandUtilityCommands { protected override Commands _Command => Commands.QueryTime; public DateTime Value { get; private set; } public QueryTime(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public QueryTime(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out ulong tenms); // Each tick = 100 ns, so each tenms = 10 ticks Value = new DateTime(0).AddTicks((long)(10000 * tenms)); } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Value: {Value.ToString("o")}" }); } } public class RestartSDCard : QAandUtilityCommands { protected override Commands _Command => Commands.RestartSDCard; public RestartSDCard(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public RestartSDCard(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } } public class QueryEventPhysicalStartAddress : QAandUtilityCommands { protected override Commands _Command => Commands.QueryEventPhysicalStartAddress; const int EventNumberPosition = 0; const int StartAddressPosition = 2; const int CommandLength = 2; private ushort _eventnumber = 0; public ushort EventNumber { set { _eventnumber = value; command.SetParameter(EventNumberPosition, value); } get => _eventnumber; } public ulong StartAddress { get; set; } public QueryEventPhysicalStartAddress(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[CommandLength]; MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.PhysicalStartAddress); } public QueryEventPhysicalStartAddress(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[CommandLength]; MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.PhysicalStartAddress); } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(StartAddressPosition, out ulong newStartAddress); StartAddress = newStartAddress; } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"EventNumber: {EventNumber}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines[0].Add($"Physical Address: 0x{StartAddress.ToString("XXXXXXXXXXXXXXXX")}"); } } public class SetEventPhysicalStartAddress : QAandUtilityCommands { protected override Commands _Command => Commands.SetEventPhysicalStartAddress; const int EventNumberPosition = 0; const int StartAddressPosition = 2; const int CommandLength = 10; private ushort _eventnumber = 0; public ushort EventNumber { set { _eventnumber = value; command.SetParameter(EventNumberPosition, value); } get => _eventnumber; } private ulong _startaddress = 0L; public ulong StartAddress { set { _startaddress = value; command.SetParameter(StartAddressPosition, value); } get => _startaddress; } public SetEventPhysicalStartAddress(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[CommandLength]; MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.PhysicalStartAddress); } public SetEventPhysicalStartAddress(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[CommandLength]; MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.PhysicalStartAddress); } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { ulong newStartAddress; response.GetParameter(StartAddressPosition, out newStartAddress); StartAddress = newStartAddress; } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"EventNumber: {EventNumber}, Physical Address: 0x{StartAddress.ToString("XXXXXXXXXXXXXXXX")}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"EventNumber: {EventNumber}, Physical Address: 0x{StartAddress.ToString("XXXXXXXXXXXXXXXX")}" }); } } public class TestCommunication : QAandUtilityCommands { protected override Commands _Command => Commands.TestCommunication; const int LengthPosition = 0; private ushort _responselength = 0; public ushort ResponseLength { get => _responselength; set { command.SetParameter(LengthPosition, value); _responselength = value; } } public ushort ActualLength { get; private set; } = 0; public TestCommunication(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[2]; command.SetParameter(LengthPosition, (ushort)0); MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.TestCommunication); } public TestCommunication(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[2]; command.SetParameter(LengthPosition, (ushort)0); MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.TestCommunication); } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { ActualLength = response.ParameterLength; } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Requested Response Length: {ResponseLength}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines[0].Add($"Actual Response Length: {ActualLength}"); } } public class SetStackLowPowerMode : QAandUtilityCommands { protected override Commands _Command => Commands.SetStackLowPowerMode; const int LengthPosition = 0; private ushort _responselength = 0; public ushort ResponseLength { get => _responselength; set { command.SetParameter(LengthPosition, value); _responselength = value; } } public ushort ActualLength { get; private set; } = 0; public SetStackLowPowerMode(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[2]; command.SetParameter(LengthPosition, (ushort)0); MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.StackLowPowerMode); } public SetStackLowPowerMode(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[2]; command.SetParameter(LengthPosition, (ushort)0); MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.StackLowPowerMode); } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { ActualLength = response.ParameterLength; } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Requested Response Length: {ResponseLength}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines[0].Add($"Actual Response Length: {ActualLength}"); } } public class SetTiltSensorRange : QAandUtilityCommands { protected override Commands _Command => Commands.SetTiltSensorRange; const int Channel1RangePosition = 0; const int Channel2RangePosition = 2; const int Channel3RangePosition = 4; const int CommandParameterLength = 6; private ushort _channel_1_range; private ushort _channel_2_range; private ushort _channel_3_range; public ushort Channel1RangeG { get => _channel_1_range; set { _channel_1_range = value; command.SetParameter(Channel1RangePosition, _channel_1_range); } } public ushort Channel2RangeG { get => _channel_2_range; set { _channel_2_range = value; command.SetParameter(Channel2RangePosition, _channel_2_range); } } public ushort Channel3RangeG { get => _channel_3_range; set { _channel_3_range = value; command.SetParameter(Channel3RangePosition, _channel_3_range); } } public SetTiltSensorRange(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[CommandParameterLength]; } public SetTiltSensorRange(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[CommandParameterLength]; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Channel 1 range: {_channel_1_range}G Channel 2 range: {_channel_2_range}G Channel 3 range: {_channel_3_range}G" }); } } public class QueryTiltSensorRange : QAandUtilityCommands { protected override Commands _Command => Commands.QueryTiltSensorRange; private ushort _channel_1_range; private ushort _channel_2_range; private ushort _channel_3_range; public ushort Channel1RangeG => _channel_1_range; public ushort Channel2RangeG => _channel_2_range; public ushort Channel3RangeG => _channel_3_range; public QueryTiltSensorRange(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public QueryTiltSensorRange(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _channel_1_range); response.GetParameter(2, out _channel_2_range); response.GetParameter(4, out _channel_3_range); } else { _channel_1_range = 0; _channel_2_range = 0; _channel_3_range = 0; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Channel 1 range: {_channel_1_range}G Channel 2 range: {_channel_2_range}G Channel 3 range: {_channel_3_range}G" }); } } public class QueryTiltSensorData : QAandUtilityCommands { protected override Commands _Command => Commands.QueryTiltSensorData; private short _channel_1_adc; private short _channel_2_adc; private short _channel_3_adc; public short Channel1ValueAdc => _channel_1_adc; public short Channel2ValueAdc => _channel_2_adc; public short Channel3ValueAdc => _channel_3_adc; public QueryTiltSensorData(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public QueryTiltSensorData(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _channel_1_adc); response.GetParameter(2, out _channel_2_adc); response.GetParameter(4, out _channel_3_adc); } else { _channel_1_adc = 0; _channel_2_adc = 0; _channel_3_adc = 0; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Channel 1 ADC: {_channel_1_adc} Channel 2 ADC: {_channel_2_adc} Channel 3 ADC: {_channel_3_adc}" }); } } public class QueryTiltSensorSensitivity : QAandUtilityCommands { protected override Commands _Command => Commands.QueryTiltSensorSensitivity; private float _sensitivity_1; private float _sensitivity_2; private float _sensitivity_3; public float Channel1Sensitivity => _sensitivity_1; public float Channel2Sensitivity => _sensitivity_2; public float Channel3Sensitivity => _sensitivity_3; public QueryTiltSensorSensitivity(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public QueryTiltSensorSensitivity(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _sensitivity_1); response.GetParameter(4, out _sensitivity_2); response.GetParameter(8, out _sensitivity_3); } else { _sensitivity_1 = 0; _sensitivity_2 = 0; _sensitivity_3 = 0; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Channel 1 sensitivity: {_sensitivity_1} Channel 2 sensitivity: {_sensitivity_2} Channel 3 sensitivity: {_sensitivity_3}" }); } } public class EthernetMacTableEntry { public EthernetMacTableEntry(ushort age, ushort port, ushort filter, byte[] address) { Age = age; Port = port; Filter = filter; Mac = new PhysicalAddress(address); } public ushort Age { get; private set; } public ushort Port { get; private set; } public ushort Filter { get; private set; } public PhysicalAddress Mac { get; private set; } public string Name { get; set; } } public class QueryEthernetMacTable : QAandUtilityCommands { const int FilterPosition = 0; const int CommandParameterLength = 6; protected override Commands _Command => Commands.QueryEthernetMacTable; private string _filterString; public List MacTable { get; } public string Filter { get => _filterString; set => SetFilter(value); } private void SetFilter(string filter) { _filterString = filter; //Encoding.ASCII.GetBytes(filter); var array = HexEncoding.GetBytes(filter, out int discarded); if (!string.IsNullOrEmpty(filter) && (null != array)) { command.Parameter = new byte[CommandParameterLength]; command.SetParameter(FilterPosition, array); } } public QueryEthernetMacTable(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MacTable = new List(); } public QueryEthernetMacTable(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MacTable = new List(); } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { ushort offset = 0; response.GetParameter(offset, out ushort entries); offset += 2; for (ushort i = 0; i < entries; i++) { var address = new byte[6]; response.GetParameter(offset, out ushort age); offset += 2; response.GetParameter(offset, out ushort port); offset += 2; response.GetParameter(offset, out ushort filter); offset += 2; Buffer.BlockCopy(response.Parameter, offset, address, 0, 6); offset += 6; var entry = new EthernetMacTableEntry(age, port, filter, address); MacTable.Add(entry); } } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Filter: {Filter}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Mac Table Entries: {MacTable.Count}" }); } } public class EthernetMacIpTableEntry { public EthernetMacIpTableEntry(ushort setport, ushort setdown, byte[] address, byte[] ip, byte[] sn, byte[] location, byte[] version) { Port = setport; Down = setdown; Mac = address; Ip = ip; Sn = sn; Location = location; Version = version; } public ushort Port { get; private set; } public ushort Down { get; private set; } public byte[] Mac { get; private set; } public byte[] Ip { get; private set; } public byte[] Sn { get; private set; } public byte[] Location { get; private set; } public byte[] Version { get; private set; } public byte[] Swapped { get; private set; } public string Name { get; set; } } public class QueryEthernetMacIpTable : QAandUtilityCommands { const int COMMAND_PAYLOAD_SIZE = 1; const int FilterPosition = 0; const int CommandParameterLength = 6; private byte _updatebuffer = 0; protected override Commands _Command => Commands.QueryMacIpTable; public List MacIpTable { get; } public bool UpdateBuffer { set { _updatebuffer = Convert.ToByte(value); command.SetParameter(0, _updatebuffer); } } public QueryEthernetMacIpTable(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MacIpTable = new List(); command.Parameter = new byte[COMMAND_PAYLOAD_SIZE]; } public QueryEthernetMacIpTable(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MacIpTable = new List(); command.Parameter = new byte[COMMAND_PAYLOAD_SIZE]; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { ushort offset = 0; response.GetParameter(offset, out ushort entries); offset += 2; for (ushort i = 0; i < entries; i++) { try { byte[] address = new byte[18]; byte[] ip = new byte[16]; byte[] sn = new byte[10]; byte[] location = new byte[10]; byte[] version = new byte[6]; response.GetParameter(offset, out ushort setport); offset += 2; response.GetParameter(offset, out ushort setdown); offset += 2; Buffer.BlockCopy(response.Parameter, offset, address, 0, 18); offset += 18; Buffer.BlockCopy(response.Parameter, offset, ip, 0, 16); offset += 16; Buffer.BlockCopy(response.Parameter, offset, sn, 0, 10); offset += 10; Buffer.BlockCopy(response.Parameter, offset, location, 0, 10); offset += 10; Buffer.BlockCopy(response.Parameter, offset, version, 0, 6); offset += 6; var entry = new EthernetMacIpTableEntry(setport, setdown, address, ip, sn, location, version); MacIpTable.Add(entry); } catch (Exception ex) { APILogger.Log($"Failure in QueryEthernetMacIpTable - {ex.Message}"); } } } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Update Buffer {_updatebuffer}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Mac Table Entries: {MacIpTable.Count}" }); } } public class TestEthernetCable : QAandUtilityCommands { private const int PortPosition = 0; private const int PairPosition = 2; private const int ResultPosition = 0; private const int CommandParameterLength = 4; protected override Commands _Command { get { return Commands.TestEthernetCable; } } private ushort _port; private ushort _pair; private ushort _result; private float _length; public ushort Port { get => _port; set { _port = value; command.SetParameter(PortPosition, _port); } } public ushort Pair { get => _pair; set { _pair = value; command.SetParameter(PairPosition, _pair); } } public ushort Result => _result; public float Length => _length; public TestEthernetCable(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[CommandParameterLength]; } public TestEthernetCable(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[CommandParameterLength]; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _result); response.GetParameter(2, out _length); } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Port: {_port} Pair: {_pair}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Result: {_result} Length: {_length}" }); } } public class MeasureEventDelay : QAandUtilityCommands { const int COMMAND_PAYLOAD_SIZE = 1; protected override Commands _Command => Commands.MeasureEventDelay; private byte _saveAtribute = 0; private uint _delay; public bool SaveAttribute { set { _saveAtribute = Convert.ToByte(value); command.SetParameter(0, _saveAtribute); } } public uint DelayNs => _delay; public MeasureEventDelay(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[COMMAND_PAYLOAD_SIZE]; } public MeasureEventDelay(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[COMMAND_PAYLOAD_SIZE]; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _delay); } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Save Attribute {_saveAtribute}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Delay: {_delay}" }); } } public class MeasureStartDelay : QAandUtilityCommands { const int COMMAND_PAYLOAD_SIZE = 1; protected override Commands _Command => Commands.MeasureStartDelay; private byte _saveAtribute = 0; private uint _delay; public bool SaveAttribute { set { _saveAtribute = Convert.ToByte(value); command.SetParameter(0, _saveAtribute); } } public uint DelayNs => _delay; public MeasureStartDelay(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[COMMAND_PAYLOAD_SIZE]; } public MeasureStartDelay(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[COMMAND_PAYLOAD_SIZE]; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _delay); } return CommandReceiveAction.StopReceiving; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Save Attribute {_saveAtribute}" }); } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Delay: {_delay}" }); } } public class SetSwitchTestMode : QAandUtilityCommands { protected override Commands _Command => Commands.SetSwitchTestMode; private byte _enabled; public bool Enabled { set { _enabled = Convert.ToByte(value); command.SetParameter(0, value); } } public SetSwitchTestMode(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[1]; } public SetSwitchTestMode(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[1]; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); if (0 == DeviceID) { lines.Add(new List() { $"Enabled: {_enabled}" }); } } } public class QuerySwitchTestMode : QAandUtilityCommands { protected override Commands _Command => Commands.QuerySwitchTestMode; private byte _enabled = 0; public bool Enabled => Convert.ToBoolean(_enabled); public QuerySwitchTestMode(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[1]; } public QuerySwitchTestMode(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[1]; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _enabled); } else { _enabled = 0; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Enabled: {_enabled}" }); } } public enum TiltSensorMif : ushort { [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.UInt32)] MifVersion = 1, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.Unicode)] SerialNumber = 2, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.UInt16)] HardwareConfiguration = 3, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.Float32)] TemperatureCF = 4, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.Int16)] TemperatureOffset = 5, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.Float32Star)] TiltSensorCF = 6, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.Int16Star)] TiltSensorOffset = 7, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.Float32Star)] TiltSensorRange = 8, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.Float32Star)] TiltSensorCal = 9, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.Int16)] TiltSensorEEPROM = 10, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.Float32)] TiltSensorMultipleMIF = 11, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.Float32)] TiltSensorData = 12, [AttributeTypes.AttributeDataTypesAttribute(AttributeTypes.AttributeDataTypes.Float32)] TiltSenosrList = 13, [AttributeTypes.AttributeDataTypes(AttributeTypes.AttributeDataTypes.Int16)] RtcRam = 14, } public class TiltSensorGet : QAandUtilityCommands { protected override Commands _Command => Commands.TiltSensorGet; private byte _tilt_id = 0; private TiltSensorMif _sub_cmd = 0; private byte _data_sub_cmd = 0; private byte _data_type = 0; private ushort _data_length = 0; private ushort _data_offset = 0; private readonly byte _data_cmd = 4; private byte[] _data; protected const int MAX_DATA_LENGTH = 2000; public byte Tilt_id { get => _tilt_id; set { _tilt_id = value; command.SetParameter(0, value); } } public TiltSensorMif Sub_cmd { get => _sub_cmd; set { _sub_cmd = value; command.SetParameter(1, (byte)value); } } public ushort Data_Offset { get => _data_offset; set { _data_offset = value; command.SetParameter(2, _data_offset); } } public ushort Data_Length { get => _data_length; set { _data_length = value; command.SetParameter(4, _data_length); } } public byte[] Data { get => _data; set { if (null == value) { return; } if (MAX_DATA_LENGTH < value.Length) { throw new NotImplementedException(); } _data = value; } } private uint _mifversion; public uint MIFversion => _mifversion; private string _serialnumber; public string Serialnumber => _serialnumber; private ushort _hardwardconfig; public ushort HardwareConfig => _hardwardconfig; private float _temperaturecf; public float TemperaturCF => _temperaturecf; private short _temperatureoffset; public short TemperatureOffset => _temperatureoffset; private float _tiltsensorcfx; public float TiltSensorCFx => _tiltsensorcfx; private float _tiltsensorcfy; public float TiltSensorCFy => _tiltsensorcfy; private float _tiltsensorcfz; public float TiltSensorCFz => _tiltsensorcfz; private short _tiltsensoroffsetx; public short TiltSensorOffsetx => _tiltsensoroffsetx; private short _tiltsensoroffsety; public short TiltSensorOffsety => _tiltsensoroffsety; private short _tiltsensoroffsetz; public short TiltSensorOffsetz => _tiltsensoroffsetz; private float _tiltsensorrangex; public float TiltSensorRangex => _tiltsensorrangex; private float _tiltsensorrangey; public float TiltSensorRangey => _tiltsensorrangey; private float _tiltsensorrangez; public float TiltSensorRangez => _tiltsensorrangez; private float[] _tiltsensorcalcf = new float[18]; public float[] TiltSensorCal_CF => _tiltsensorcalcf; private short _channel_1_adc; public short Channel1ValueAdc => _channel_1_adc; private short _channel_2_adc; public short Channel2ValueAdc => _channel_2_adc; private short _channel_3_adc; public short Channel3ValueAdc => _channel_3_adc; private ushort _numberoftilt; public ushort NumberOfTilt => _numberoftilt; private byte[] _tiltaddress = new byte[8]; public byte[] Tilt_Address => _tiltaddress; public ushort RTCSerialNumber { get; private set; } public ushort RTCProductionDaysSince1970 { get; private set; } public ushort RTCBatteryInstallationDaysSince1970 { get; private set; } private void ParseData(TiltSensorMif cmd, int offset) { if (cmd == TiltSensorMif.MifVersion) { response.GetParameter(offset, out _mifversion); } if (cmd == TiltSensorMif.SerialNumber) { response.GetParameter(offset, out _serialnumber); } if (cmd == TiltSensorMif.HardwareConfiguration) { response.GetParameter(offset, out _hardwardconfig); } if (cmd == TiltSensorMif.TemperatureCF) { response.GetParameter(offset, out _temperaturecf); } if (cmd == TiltSensorMif.TemperatureOffset) { response.GetParameter(offset, out _temperatureoffset); } if (cmd == TiltSensorMif.TiltSensorCF) { response.GetParameter(offset, out _tiltsensorcfx); response.GetParameter(offset + 4, out _tiltsensorcfy); response.GetParameter(offset + 8, out _tiltsensorcfz); } if (cmd == TiltSensorMif.TiltSensorOffset) { response.GetParameter(offset, out _tiltsensoroffsetx); response.GetParameter(offset + 2, out _tiltsensoroffsety); response.GetParameter(offset + 4, out _tiltsensoroffsetz); } if (cmd == TiltSensorMif.TiltSensorRange) { response.GetParameter(offset, out _tiltsensorrangex); response.GetParameter(offset + 4, out _tiltsensorrangey); response.GetParameter(offset + 8, out _tiltsensorrangez); } if (cmd == TiltSensorMif.TiltSensorData) { response.GetParameter(offset, out _channel_1_adc); response.GetParameter(offset + 2, out _channel_2_adc); response.GetParameter(offset + 4, out _channel_3_adc); } if (cmd == TiltSensorMif.TiltSensorCal) { for (int i = 0; i < 18; i++) { response.GetParameter(offset + i * 4, out _tiltsensorcalcf[i]); } } if (cmd == TiltSensorMif.TiltSenosrList) { response.GetParameter(2, out _numberoftilt); for (int i = 0; i < _numberoftilt; i++) { response.GetParameter(4 + i, out _tiltaddress[i]); } } } public TiltSensorGet(ICommunication sock) : base(sock) { command.Parameter = new byte[6]; } public TiltSensorGet(ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[6]; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { response.GetParameter(0, out _data_sub_cmd); if (_data_sub_cmd == (byte)TiltSensorMif.TiltSensorMultipleMIF) { int nextcmd = 1; for (int i = 0; i < 9; i++) { response.GetParameter(nextcmd + 0, out _data_sub_cmd); response.GetParameter(nextcmd + 1, out _data_type); response.GetParameter(nextcmd + 2, out _data_length); ParseData((TiltSensorMif)_data_sub_cmd, nextcmd + _data_cmd); nextcmd = nextcmd + _data_cmd + _data_length; } } else if (_data_sub_cmd == (byte)TiltSensorMif.TiltSensorEEPROM || _data_sub_cmd == (byte)TiltSensorMif.RtcRam) { response.GetParameter(0, out _data_sub_cmd); response.GetParameter(1, out _data_offset); response.GetParameter(3, out _data_length); _data = new byte[_data_length]; for (int i = 0; i < _data_length; i++) { response.GetParameter(5 + i, out _data[i]); } if (_data_sub_cmd == (byte)TiltSensorMif.RtcRam) { ParseRTC(); } } else if (_data_sub_cmd == (byte)TiltSensorMif.RtcRam) { response.GetParameter(0, out _data_sub_cmd); response.GetParameter(1, out _data_offset); response.GetParameter(3, out _data_length); _data = new byte[_data_length]; for (int i = 0; i < _data_length; i++) { response.GetParameter(5 + i, out _data[i]); } } else { response.GetParameter(1, out _data_type); response.GetParameter(2, out _data_length); _data_offset = 4; ParseData((TiltSensorMif)_data_sub_cmd, _data_offset); } } else { _channel_1_adc = 0; _channel_2_adc = 0; _channel_3_adc = 0; } return CommandReceiveAction.StopReceiving; } private void ParseRTC() { if (_data.Length >= 2) { RTCSerialNumber = BitConverter.ToUInt16(_data, 0); } if (_data.Length >= 4) { RTCProductionDaysSince1970 = BitConverter.ToUInt16(_data, 2); } if (_data.Length >= 6) { RTCBatteryInstallationDaysSince1970 = BitConverter.ToUInt16(_data, 4); } } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); switch (_sub_cmd) { case TiltSensorMif.RtcRam: RTCRamResponseToString(ref lines); break; default: DefaultResponseToString(ref lines); break; } } private void RTCRamResponseToString(ref List> lines) { lines.Add(new List() { $"Tilt Get: Sub_cmd: {_sub_cmd}, Tilt ID: {_tilt_id}, Data Type: {_data_type}, Data length: {_data_length}, RTC SerialNumber: {RTCSerialNumber}, RTC Production_Days; {RTCProductionDaysSince1970}, RTC_Install_Days: {RTCBatteryInstallationDaysSince1970}" }); } private void DefaultResponseToString(ref List> lines) { lines.Add(new List() { $"Tilt Get: Sub_cmd: {_sub_cmd} Tilt ID: {_tilt_id} Data Type: {_data_type} Data length: {_data_length}" }); } } public class TiltSensorSet : QAandUtilityCommands { protected override Commands _Command => Commands.TiltSensorSet; private TiltSensorMif _sub_cmd = 0; private byte _tilt_id = 0; private byte _data_type = 0; private ushort _data_length = 0; private const int CommandParameterLength = 20; private uint _mifversion; private string _serialnumber; private ushort _hardwareconfiguration; private float _temperaturecf; // correction factor for temperature private short _temperatureoffset; //offset temperature private float[] _tiltsensorCF = new float[3]; // correction factor for tilt sensors private short[] _tiltsensorOffset = new short[3]; //offset for tilt sensors private float[] _tiltsensorRange = new float[3]; //range for tilt sensors private float[] _tiltsensorCalCF = new float[18];    //  tilt sensors 4*18 reserves bytes //private Int16 _reserved; //offset reserved private ushort _data_offset; //private UInt16 _data_lenght; private byte[] _data; public ushort Data_Offset { get { return _data_offset; } set { _data_offset = value; } } public byte[] Data { get { return _data; } set { _data = value; } } public byte Tilt_id { get => _tilt_id; set { _tilt_id = value; } } public TiltSensorMif Sub_cmd { get => _sub_cmd; set { _sub_cmd = value; } } public byte DataType { get => _data_type; set { _data_type = value; } } public ushort DataLength { get => _data_length; set { _data_length = value; } } public uint MIFVersion { get => _mifversion; set { _mifversion = value; } } public string SerialNumber { get => _serialnumber; set { _serialnumber = value; } } public ushort HWConfig { get => _hardwareconfiguration; set { _hardwareconfiguration = value; } } public float TemperatureCF { get => _temperaturecf; set { _temperaturecf = value; } } public short TemperatureOffset { get => _temperatureoffset; set { _temperatureoffset = value; } } public float TilteSensorCFx { set { _tiltsensorCF[0] = value; } } public float TilteSensorCFy { set { _tiltsensorCF[1] = value; } } public float TilteSensorCFz { set { _tiltsensorCF[2] = value; } } public short TilteSensorOffsetx { set { _tiltsensorOffset[0] = value; } } public short TilteSensorOffsety { set { _tiltsensorOffset[1] = value; } } public short TilteSensorOffsetz { set { _tiltsensorOffset[2] = value; } } public float TilteSensorRangex { set { _tiltsensorRange[0] = value; } } public float TilteSensorRangey { set { _tiltsensorRange[1] = value; } } public float TilteSensorRangez { set { _tiltsensorRange[2] = value; } } public float[] TiltSensorCalCF { set { _tiltsensorCalCF = value; } } public void SetSingle(byte id, TiltSensorMif cmd, object value) { _tilt_id = id; command.SetParameter(0, _tilt_id); _sub_cmd = cmd; command.SetParameter(1, (byte)_sub_cmd); if (cmd == TiltSensorMif.MifVersion) { _mifversion = (uint)value; command.SetParameter(5, _mifversion); _data_length = sizeof(uint); _data_type = (byte)AttributeTypes.AttributeDataTypes.UInt32; } if (cmd == TiltSensorMif.SerialNumber) { _serialnumber = (string)value; command.SetParameter(5, _serialnumber); _data_length = (ushort)_serialnumber.Length; _data_type = (byte)AttributeTypes.AttributeDataTypes.Ascii; } if (cmd == TiltSensorMif.HardwareConfiguration) { _hardwareconfiguration = (ushort)value; command.SetParameter(5, _hardwareconfiguration); _data_length = sizeof(ushort); _data_type = (byte)AttributeTypes.AttributeDataTypes.UInt16; } if (cmd == TiltSensorMif.TemperatureCF) { _temperaturecf = (float)value; command.SetParameter(5, _temperaturecf); _data_length = sizeof(float); _data_type = (byte)AttributeTypes.AttributeDataTypes.Float32; } if (cmd == TiltSensorMif.TemperatureOffset) { _temperatureoffset = (short)value; command.SetParameter(5, _temperatureoffset); _data_length = sizeof(short); _data_type = (byte)AttributeTypes.AttributeDataTypes.UInt16; } if (cmd == TiltSensorMif.TiltSensorCF) { _tiltsensorCF = (float[])value; command.SetParameter(5, _tiltsensorCF[0]); command.SetParameter(9, _tiltsensorCF[1]); command.SetParameter(13, _tiltsensorCF[2]); _data_length = sizeof(float) * 3; _data_type = (byte)AttributeTypes.AttributeDataTypes.Float32Star; } if (cmd == TiltSensorMif.TiltSensorOffset) { _tiltsensorOffset = (short[])value; command.SetParameter(5, _tiltsensorOffset[0]); command.SetParameter(7, _tiltsensorOffset[1]); command.SetParameter(9, _tiltsensorOffset[2]); _data_length = sizeof(ushort) * 3; _data_type = (byte)AttributeTypes.AttributeDataTypes.Int16Star; } if (cmd == TiltSensorMif.TiltSensorRange) { _tiltsensorRange = (float[])value; command.SetParameter(5, _tiltsensorRange[0]); command.SetParameter(9, _tiltsensorRange[1]); command.SetParameter(13, _tiltsensorRange[2]); _data_length = sizeof(float) * 3; _data_type = (byte)AttributeTypes.AttributeDataTypes.Float32Star; } if (cmd == TiltSensorMif.TiltSensorCal) { _tiltsensorCalCF = (float[])value; for (int i = 0; i < 18; i++) { command.SetParameter(5 + i * 4, _tiltsensorCalCF[i]); } _data_length = sizeof(float) * 18; _data_type = (byte)AttributeTypes.AttributeDataTypes.UInt32Star; } command.SetParameter(2, _data_type); command.SetParameter(3, _data_length); } public void SetEEPROM(byte id, ushort dataOffset, object value) { _sub_cmd = TiltSensorMif.TiltSensorEEPROM; _tilt_id = id; _data = (byte[])value; _data_length = (ushort)_data.Length; _data_offset = dataOffset; command.Parameter = new byte[6 + _data_length]; for (int i = 0; i < _data_length; i++) { command.SetParameter(6 + i, _data[i]); } command.SetParameter(0, _tilt_id); command.SetParameter(1, (byte)_sub_cmd); command.SetParameter(2, _data_offset); command.SetParameter(4, _data_length); } public void SetMultiple(byte id, TiltSensorMif cmd) { if (cmd == TiltSensorMif.TiltSensorMultipleMIF) { command.Parameter = new byte[250]; int offset = 0; command.SetParameter(0, _tilt_id); command.SetParameter(1, (byte)cmd); offset = 2; _sub_cmd = TiltSensorMif.MifVersion; command.SetParameter(offset + 0, (byte)_sub_cmd); _data_type = (byte)AttributeTypes.AttributeDataTypes.UInt32; command.SetParameter(offset + 1, _data_type); _data_length = sizeof(uint); command.SetParameter(offset + 2, _data_length); command.SetParameter(offset + 4, _mifversion); offset = offset + 4 + _data_length; _sub_cmd = TiltSensorMif.HardwareConfiguration; command.SetParameter(offset + 0, (byte)_sub_cmd); _data_type = (byte)AttributeTypes.AttributeDataTypes.UInt16; command.SetParameter(offset + 1, _data_type); _data_length = sizeof(ushort); command.SetParameter(offset + 2, _data_length); command.SetParameter(offset + 4, _hardwareconfiguration); offset = offset + 4 + _data_length; _sub_cmd = TiltSensorMif.TemperatureCF; command.SetParameter(offset + 0, (byte)_sub_cmd); _data_type = (byte)AttributeTypes.AttributeDataTypes.Float32; command.SetParameter(offset + 1, _data_type); _data_length = sizeof(float); command.SetParameter(offset + 2, _data_length); command.SetParameter(offset + 4, _temperaturecf); offset = offset + 4 + _data_length; _sub_cmd = TiltSensorMif.TemperatureOffset; command.SetParameter(offset + 0, (byte)_sub_cmd); _data_type = (byte)AttributeTypes.AttributeDataTypes.Int16; command.SetParameter(offset + 1, _data_type); _data_length = sizeof(short); command.SetParameter(offset + 2, _data_length); command.SetParameter(offset + 4, _temperatureoffset); offset = offset + 4 + _data_length; _sub_cmd = TiltSensorMif.TiltSensorCF; command.SetParameter(offset + 0, (byte)_sub_cmd); _data_type = (byte)AttributeTypes.AttributeDataTypes.Float32Star; command.SetParameter(offset + 1, _data_type); _data_length = sizeof(float) * 3; command.SetParameter(offset + 2, _data_length); command.SetParameter(offset + 4, _tiltsensorCF[0]); command.SetParameter(offset + 8, _tiltsensorCF[1]); command.SetParameter(offset + 12, _tiltsensorCF[2]); offset = offset + 4 + _data_length; _sub_cmd = TiltSensorMif.TiltSensorOffset; command.SetParameter(offset + 0, (byte)_sub_cmd); _data_type = (byte)AttributeTypes.AttributeDataTypes.Int16Star; command.SetParameter(offset + 1, _data_type); _data_length = sizeof(short) * 3; command.SetParameter(offset + 2, _data_length); command.SetParameter(offset + 4, _tiltsensorOffset[0]); command.SetParameter(offset + 6, _tiltsensorOffset[1]); command.SetParameter(offset + 8, _tiltsensorOffset[2]); offset = offset + 4 + _data_length; _sub_cmd = TiltSensorMif.TiltSensorRange; command.SetParameter(offset + 0, (byte)_sub_cmd); _data_type = (byte)AttributeTypes.AttributeDataTypes.Float32Star; command.SetParameter(offset + 1, _data_type); _data_length = sizeof(float) * 3; command.SetParameter(offset + 2, _data_length); command.SetParameter(offset + 4, _tiltsensorRange[0]); command.SetParameter(offset + 8, _tiltsensorRange[1]); command.SetParameter(offset + 12, _tiltsensorRange[2]); offset = offset + 4 + _data_length; _sub_cmd = TiltSensorMif.TiltSensorCal; command.SetParameter(offset + 0, (byte)_sub_cmd); _data_type = (byte)AttributeTypes.AttributeDataTypes.Float32Star; command.SetParameter(offset + 1, _data_type); _data_length = sizeof(float) * 18; command.SetParameter(offset + 2, _data_length); for (int i = 0; i < 18; i++) { command.SetParameter(offset + 4 + i * 4, _tiltsensorCalCF[i]); } offset = offset + 4 + _data_length; //_sub_cmd = TiltSensorMif.TiltSensorEEPROM; //command.SetParameter(offset + 0, (byte)_sub_cmd); //_data_type = (byte)AttributeDataTypes.Int16; //command.SetParameter(offset + 1, _data_type); //_data_length = sizeof(short); //command.SetParameter(offset + 2, _data_length); //command.SetParameter(offset + 4, _reserved); //offset = offset + 4 + _data_length; _sub_cmd = TiltSensorMif.SerialNumber; command.SetParameter(offset + 0, (byte)_sub_cmd); _data_type = (byte)AttributeTypes.AttributeDataTypes.Ascii; command.SetParameter(offset + 1, _data_type); _data_length = (ushort)_serialnumber.Length; command.SetParameter(offset + 2, _data_length); command.SetParameter(offset + 4, _serialnumber); offset = offset + 4 + _data_length; } } public TiltSensorSet(ICommunication sock) : base(sock) { command.Parameter = new byte[CommandParameterLength]; } public TiltSensorSet(ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[CommandParameterLength]; } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { $"Tilt Set: Sub_cmd: {_sub_cmd} Tilt ID: {_tilt_id} Data Type: {_data_type} Data length: {_data_length}" }); } } }