public void TestMultipleSubsystems() { // Create a serial number string serialStr = "01KBXV00000000000000000000000001"; SerialNumber serialNum = new SerialNumber(serialStr); // Test the serial number Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString())); Assert.AreEqual(4, serialNum.SubSystemsDict.Count, string.Format("Number of SubSystems did not match 4 {0}", serialNum.SubSystemsDict.Count)); // Upper case K Subsystem ss = new Subsystem("K", 0); Assert.AreEqual(ss, serialNum.SubSystemsDict[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsDict[0].ToString())); // Lower case K Subsystem ssNot = new Subsystem("k", 0); Assert.AreNotEqual(ssNot, serialNum.SubSystemsDict[0], string.Format("Subsystems should not match {0} {1}", ssNot.ToString(), serialNum.SubSystemsDict[0].ToString())); Subsystem ss1 = new Subsystem("B", 1); Assert.AreEqual(ss1, serialNum.SubSystemsDict[1], string.Format("Subsystems do not match {0} {1}", ss1.ToString(), serialNum.SubSystemsDict[1].ToString())); Subsystem ss2 = new Subsystem("X", 2); Assert.AreEqual(ss2, serialNum.SubSystemsDict[2], string.Format("Subsystems do not match {0} {1}", ss2.ToString(), serialNum.SubSystemsDict[2].ToString())); Subsystem ss3 = new Subsystem("V", 3); Assert.AreEqual(ss3, serialNum.SubSystemsDict[3], string.Format("Subsystems do not match {0} {1}", ss3.ToString(), serialNum.SubSystemsDict[3].ToString())); Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber)); }
/// <summary> /// Return a subsystem for this firmware version. /// This will use the SubsystemCode to create a /// subsystem to return. /// /// FOR BACKWARDS COMPATITBILITY /// Old subsystems in the ensemble were set by the Subsystem Index in Firmware. /// This means the that a subsystem code of 0 could be passed because /// the index was 0 to designate the first subsystem index. Firmware revision 0.2.13 changed /// SubsystemIndex to SubsystemCode. This will check which Firmware version this ensemble is /// and convert to the new type using SubsystemCode. /// /// If the firmwawre is a debug firmware, the Major number will be set to 99. So also 99.2.13 or less uses the old form. /// </summary> /// <param name="serial">Serial number to get the subsystem code if the firmware version is less than 0.2.13.</param> /// <returns>Subsystem for this firmware.</returns> public Subsystem GetSubsystem(SerialNumber serial) { // The DVL serial number is a special serial number // used to designate the ensemble as a DVL ensemble // Give the DVL subsystem code as the DVL if (serial == SerialNumber.DVL) { // Get the Subsystem code from the serialnumber, there should only be 1 subsystem string code = serial.SubSystems.Substring(0, 1); SubsystemCode = Subsystem.ConvertSubsystemCode(code[0]); // Create a subsystem with the code return(new Subsystem(SubsystemCode)); } if ((FirmwareMajor <= 0 || FirmwareMajor == DEBUG_MAJOR_VER) && FirmwareMinor <= 2 && FirmwareRevision <= 13) { // Set the correct subsystem based off the serial number // Get the index for the subsystem byte index = SubsystemCode; // Ensure the index is not out of range of the subsystem string if (serial.SubSystems.Length > index) { // Get the Subsystem code from the serialnumber based off the index found string code = serial.SubSystems.Substring(index, 1); // Create a subsystem with the code and index return(new Subsystem(Subsystem.ConvertSubsystemCode(code[0]), index)); } } return(new Subsystem(SubsystemCode)); }
public void TestChangeSubsystemDict() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); Subsystem ss = new Subsystem("3", 0); Subsystem ss1 = new Subsystem(Subsystem.SUB_1_2MHZ_4BEAM_20DEG_PISTON_2, 1); List <Subsystem> list = new List <Subsystem>(); list.Add(ss); list.Add(ss1); serial.SubSystemsList = list; Assert.AreEqual("320000000000000", serial.SubSystems, "Subsystem String is incorrect."); Assert.AreEqual(2, serial.SubSystemsList.Count, "Subsystem Dict Count is incorrect."); // Subsystem type 3 Assert.AreEqual(ss, serial.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serial.SubSystemsList[0].ToString())); // Subsystem type 2 Assert.AreEqual(ss1, serial.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss1.ToString(), serial.SubSystemsList[1].ToString())); }
/// <summary> /// Get the CEPO configuration character and index within the CEPO command. /// The configuration character is the Subsystem code for the configuration. It /// represents the system type. The Index represents where in teh CEPO command /// the configuration was located. This determines the ping order of the configurations. /// It also make the configuration unique for a SubsystemConfiguration for a Subsystem. /// Get the Subsystem using the serial number and subsystem code. /// /// SubsystemConfiguaration CommandSetup: Index of the Configuration within Subsystem. (Based off counting configurations for a subsystem) /// index: Location in CEPO for the Subsystem configuration. /// </summary> /// <param name="ssCode">Subsystem Code from the CEPO command.</param> /// <param name="cepoIndex">Location in the CEPO command of the Subsystem Code.</param> /// <param name="serial">Serial number for the ADCP.</param> /// <returns>Return the AdcpSubsystemConfig created or null if one could not be created.</returns> private AdcpSubsystemConfig AddConfig(byte ssCode, int cepoIndex, SerialNumber serial) { AdcpSubsystemConfig asConfig = null; // Get the Subsystem index from the serial number // If it cannot be found in the serial number, then it is // a bad Subsystem and we can not use the command. Subsystem ss = serial.GetSubsystem(ssCode); if (!ss.IsEmpty()) { // Determine how many of the given subsystem have been added to the dictionary // We need to generate SubsystemConfiguration index value. // SubsystemConfiguration index is based off the number of SubsystemConfigurations already // in the dictionary before this configuration is added. ushort ssCount = 0; foreach (AdcpSubsystemConfig configuration in SubsystemConfigDict.Values) { // If the subsystems are the same, then increment the value if (configuration.SubsystemConfig.SubSystem.Code == ssCode) { ssCount++; } } // Create all the subsystem configurations and add to the dictionary SubsystemConfiguration ssConfig = new SubsystemConfiguration(ss, (byte)cepoIndex, (byte)ssCount); // SubsystemConfiguration with the CEPO index and Index of the SubsystemConfiguration asConfig = new AdcpSubsystemConfig(ssConfig); // AdcpSubsystemConfig with the Subsystem, SubsystemConfig and CEPO index SubsystemConfigDict.Add(asConfig.ToString(), asConfig); // Add to the dictionary the configuration with the string as the key } return(asConfig); }
/// <summary> /// Validate if the serial number string is /// a valid serial number. This will test /// the length and if an object can be created. /// If any fail, it will return false. /// </summary> /// <param name="serialNum">Serial Number string to create a SerialNumber object.</param> /// <returns>TRUE = valid serial number string.</returns> public static bool Validate(string serialNum) { bool result = true; // Verify length if (serialNum.Length != SerialNumber.NUM_BYTES) { return(false); } // Try to create the object try { // Try to convert the serial number to an int Convert.ToUInt32(serialNum.Substring(SERIAL_START, SERIAL_NUM_BYTES)); // Try to create a serial number SerialNumber serial = new SerialNumber(serialNum); } catch (Exception) { // If any exceptions thrown, return false // One exception is trying to convert the serial number to an int return(false); } return(result); }
public void TestGetSubsystemVersion() { SerialNumber serial = new SerialNumber("01300000000000000000000000000001"); Firmware fw = new Firmware(Subsystem.SUB_600KHZ_4BEAM_20DEG_PISTON_3, 0, 2, 3); Subsystem ss = new Subsystem(fw.GetSubsystemCode(serial)); Assert.AreEqual(ss, fw.GetSubsystem(serial), "GetSubsystem is incorrect."); }
public void TestGetSubsystem() { SerialNumber serial = new SerialNumber("01300000000000000000000000000001"); Firmware fw = new Firmware(0x3, 1, 2, 3); Subsystem ss = new Subsystem(fw.GetSubsystemCode(new SerialNumber())); Assert.AreEqual(ss, fw.GetSubsystem(serial), "GetSubsystem is incorrect."); }
public void TestConvertStringToSubsystemCode() { // Create a serial number string serialStr = "01200000000000000000000000000001"; SerialNumber serialNum = new SerialNumber(serialStr); byte subsystemCode = Subsystem.ConvertSubsystemCode(serialNum.SubsystemsString(), 0); Assert.AreEqual(50, subsystemCode, "Subsystem Code value is incorrect."); Assert.AreEqual(Subsystem.SUB_1_2MHZ_4BEAM_20DEG_PISTON_2, subsystemCode, "Subsystem Code is incorrect."); }
public void AdcpSubsystemConfigExist() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01200000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("2", serial); Subsystem ss = new Subsystem("2", 0); // Subsystem code and Index within serial number SubsystemConfiguration ssConfig = new SubsystemConfiguration(ss, 0, 0); // Number of configurations for a given subsystem Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig), "AdcpSubsystemConfigExist() is incorrect."); }
public void TestBadSerial() { // Create a serial number string serialStr = "z"; SerialNumber serialNum = new SerialNumber(serialStr); // Test the serial number Assert.AreEqual(new SerialNumber().SerialNumberString, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", new SerialNumber().SerialNumberString, serialNum.ToString())); Assert.AreEqual(0, serialNum.SubSystemsList.Count, string.Format("Number of SubSystems did not match 0 {0}", serialNum.SubSystemsList.Count)); Assert.AreEqual(0, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 0, serialNum.SystemSerialNumber)); }
/// <summary> /// Determine if the given object is equal to this /// object. This will check the serial number strings /// to see if they match. /// </summary> /// <param name="obj">Object to compare with this object.</param> /// <returns>TRUE = serial number strings matched.</returns> public override bool Equals(object obj) { //Check for null and compare run-time types. if (obj == null || GetType() != obj.GetType()) { return(false); } SerialNumber p = (SerialNumber)obj; return(SerialNumberString == p.ToString()); }
public void TestChangeSerialBad() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); serial.SystemSerialNumber = 9999999; Assert.AreEqual(1, serial.SystemSerialNumber, "Sys Serial Number is incorrect."); Assert.AreEqual("01300000000000000000000000000001", serial.SerialNumberString, "Serial Number String is incorrect."); Assert.AreEqual("01300000000000000000000000000001", serial.ToString(), "ToString is incorrect."); }
public void TestChangeBaseHardwareBad() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); serial.BaseHardware = "22322323"; Assert.AreEqual("01", serial.BaseHardware, "BaseHardware is incorrect."); Assert.AreEqual("01300000000000000000000000000001", serial.SerialNumberString, "Serial Number String is incorrect."); Assert.AreEqual("01300000000000000000000000000001", serial.ToString(), "ToString is incorrect."); }
public void TestChangeSpare1() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); serial.Spare = "123456789"; Assert.AreEqual(1, serial.SystemSerialNumber, "Sys Serial Number is incorrect."); Assert.AreEqual("123456789", serial.Spare, "Spare is incorrect."); Assert.AreEqual("01300000000000000123456789000001", serial.SerialNumberString, "Serial Number String is incorrect."); Assert.AreEqual("01300000000000000123456789000001", serial.ToString(), "ToString is incorrect."); }
/// <summary> /// Decode the CEPO command and populate the dictionary. /// /// Ex: /// CEPO 222 /// 1 Subsystem /// 3 SubsystemConfigurations for Subsystem 2 /// /// CEPO 232 /// 2 Subsystems /// 2 SubsystemConfigurations for Subsystem 2 and /// 1 SubsystemConfiguration for Subsystem 3 /// /// </summary> /// <param name="cepo">CEPO command to decode.</param> /// <param name="serial">Serial number to determine the system type.</param> /// <returns>Dictionary of all subsystem configurations found.</returns> private Dictionary <string, AdcpSubsystemConfig> DecodeCepo(string cepo, SerialNumber serial) { // Clear the current dictionary SubsystemConfigDict.Clear(); // Add each configuration in the command for (int x = 0; x < cepo.Length; x++) { AddConfig(Subsystem.ConvertSubsystemCode(cepo, x), x, serial); } // Return the populated dictionary return(SubsystemConfigDict); }
public void TestConstructor() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serialNum = new SerialNumber(serialStr); // Test the serial number Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString())); Assert.AreEqual(1, serialNum.SubSystemsDict.Count, string.Format("Number of SubSystems did not match 1 {0}", serialNum.SubSystemsDict.Count)); Subsystem ss = new Subsystem("3", 0); Assert.AreEqual(ss, serialNum.SubSystemsDict[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsDict[0].ToString())); Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber)); }
public void TestChangeSubsystemsBad() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); serial.SubSystems = "34000000000000099"; Assert.AreEqual("300000000000000", serial.SubSystems, "Subsystem String is incorrect."); Assert.AreEqual(1, serial.SubSystemsList.Count, "Subsystem Dict Count is incorrect."); // Subsystem type 3 Subsystem ss = new Subsystem("3", 0); Assert.AreEqual(ss, serial.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serial.SubSystemsList[0].ToString())); }
/// <summary> /// Take the CEPO command and decode the command /// for the ADCP configuration. /// </summary> /// <param name="cepo">CEPO command value.</param> /// <param name="serial">Serial number to determine the system type.</param> /// <returns>Returns a dictionary with all the AdcpSubsystemConfigs created.</returns> public Dictionary <string, AdcpSubsystemConfig> SetCepo(string cepo, SerialNumber serial) { // Verify the CEPO given is valid if (ValidateCEPO(cepo, serial)) { // Set CEPO and serial //CEPO = cepo; Commands.CEPO = cepo; _serialNumber = serial; // Set the private property for serial number or CEPO will be reset // Decode CEPO command DecodeCepo(cepo, serial); } // Return the dictionary return(SubsystemConfigDict); }
public void AdcpSubsystemConfigExist1() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01230000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("23", serial); Subsystem ss2 = new Subsystem("2", 0); // Subsystem code and Index within serial number Subsystem ss3 = new Subsystem("3", 1); // Subsystem code and Index within serial number SubsystemConfiguration ssConfig20 = new SubsystemConfiguration(ss2, 0, 0); // Configuration SS2 with Config Number 0 SubsystemConfiguration ssConfig21 = new SubsystemConfiguration(ss2, 1, 1); // Configuration SS2 with Config Number 1 SubsystemConfiguration ssConfig30 = new SubsystemConfiguration(ss3, 0, 0); // Configuration SS3 with Config Number 0 SubsystemConfiguration ssConfig31 = new SubsystemConfiguration(ss3, 1, 1); // Configuration SS3 with Config Number 1 Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig20), "AdcpSubsystemConfigExist() 2 0 is incorrect."); Assert.AreEqual(false, config.AdcpSubsystemConfigExist(ssConfig30), "AdcpSubsystemConfigExist() 3 0 is incorrect."); Assert.AreEqual(false, config.AdcpSubsystemConfigExist(ssConfig21), "AdcpSubsystemConfigExist() 2 1 is incorrect."); Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig31), "AdcpSubsystemConfigExist() 3 1 is incorrect."); }
public void TestDualFrequency() { // Create a serial number string serialStr = "01340000000000000000000000000001"; SerialNumber serialNum = new SerialNumber(serialStr); // Test the serial number Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString())); Assert.AreEqual(2, serialNum.SubSystemsList.Count, string.Format("Number of SubSystems did not match 2 {0}", serialNum.SubSystemsList.Count)); Subsystem ss = new Subsystem("3", 0); Assert.AreEqual(ss, serialNum.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsList[0].ToString())); Subsystem ss1 = new Subsystem("4", 1); Assert.AreEqual(ss1, serialNum.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss1.ToString(), serialNum.SubSystemsList[1].ToString())); Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber)); }
public void Test150KhzFrequency() { // Create a serial number string serialStr = "01K00000000000000000000000000001"; SerialNumber serialNum = new SerialNumber(serialStr); // Test the serial number Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString())); Assert.AreEqual(1, serialNum.SubSystemsList.Count, string.Format("Number of SubSystems did not match 1 {0}", serialNum.SubSystemsList.Count)); // Upper case K Subsystem ss = new Subsystem("K", 0); Assert.AreEqual(ss, serialNum.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsList[0].ToString())); // Lower case k Subsystem ss1 = new Subsystem("k", 0); Assert.AreNotEqual(ss1, serialNum.SubSystemsList[0], string.Format("Subsystems should not match {0} {1}", ss1.ToString(), serialNum.SubSystemsList[0].ToString())); Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber)); }
public void TestAddSubsystem() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); Subsystem ss1 = new Subsystem(Subsystem.SUB_1_2MHZ_4BEAM_20DEG_PISTON_2, 1); serial.AddSubsystem(ss1); Assert.AreEqual(2, serial.SubSystemsList.Count, "Dictionary count is incorrect."); Assert.AreEqual("320000000000000", serial.SubSystems, "Subsystem String is incorrect."); Assert.AreEqual(2, serial.SubSystemsList.Count, "Subsystem Dict Count is incorrect."); // Subsystem type 3 Subsystem ss = new Subsystem("3", 0); Assert.AreEqual(ss, serial.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serial.SubSystemsList[0].ToString())); // Subsystem type 2 Assert.AreEqual(ss1, serial.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss1.ToString(), serial.SubSystemsList[1].ToString())); }
public void TestSerialJSON() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); // Convert to JSON and back string json = Newtonsoft.Json.JsonConvert.SerializeObject(serial); // Serialize object to JSON SerialNumber serialNum = Newtonsoft.Json.JsonConvert.DeserializeObject <SerialNumber>(json); // Deserialize the JSON // Test the serial number Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString())); Assert.AreEqual(1, serialNum.SubSystemsList.Count, string.Format("Number of SubSystems did not match 1 {0}", serialNum.SubSystemsList.Count)); Subsystem ss = new Subsystem("3", 0); Assert.AreEqual(ss, serialNum.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsList[0].ToString())); Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber)); }
/// <summary> /// Validate the CEPO value. This will look at each value in the CEPO and /// verify a Subsystem code exist in the serial number. If any value in CEPO /// is not found as a Subsystem in the serial number, the method will return FALSE. /// </summary> /// <param name="cepo">CEPO command.</param> /// <param name="serial">Adcp Serial number.</param> /// <returns>TRUE = CEPO is valid / FALSE = CEPO given is invalid.</returns> public static bool ValidateCEPO(string cepo, SerialNumber serial) { // Verify a string was given if (string.IsNullOrEmpty(cepo)) { return(false); } // Assume good bool result = true; // Check if the given Subsystems in the CEPO string exist // in the serial number List <Subsystem> list = serial.SubSystemsList; for (int cepoIndex = 0; cepoIndex < cepo.Length; cepoIndex++) { bool test = false; foreach (Subsystem ss in list) { // If the CEPO value matched a subsystem code // Then it was a valid value if (cepo[cepoIndex] == ss.Code) { test = true; } } // If CEPO value never matched any Subsystem code // Then it was a bad value and return false if (test == false) { return(false); } } return(result); }
public void Test150KhzFrequency() { // Create a serial number string serialStr = "01K00000000000000000000000000001"; SerialNumber serialNum = new SerialNumber(serialStr); // Test the serial number Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString())); Assert.AreEqual(1, serialNum.SubSystemsDict.Count, string.Format("Number of SubSystems did not match 1 {0}", serialNum.SubSystemsDict.Count)); // Upper case K Subsystem ss = new Subsystem("K", 0); Assert.AreEqual(ss, serialNum.SubSystemsDict[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsDict[0].ToString())); // Lower case k Subsystem ss1 = new Subsystem("k", 0); Assert.AreNotEqual(ss1, serialNum.SubSystemsDict[0], string.Format("Subsystems should not match {0} {1}", ss1.ToString(), serialNum.SubSystemsDict[0].ToString())); Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber)); }
/// <summary> /// Get the Subsystem code. The subsystem code is gotten in 2 /// different ways depending on the firmware version. /// /// Firmare Version less than or equal to 0.2.13 /// The code stored is the index within the serial number. /// Get the serial numbers subsystems and use the index /// to get the code. /// /// If the firmwawre is a debug firmware, the Major number will be set to 99. So also 99.2.13 or less uses the old form. /// /// Firmware Version greater than 0.2.13 /// The code stored is the code. /// </summary> /// <param name="serial">Serial number used if the firmware version is less than 0.2.13</param> /// <returns>Subsystem code.</returns> public byte GetSubsystemCode(SerialNumber serial) { // The DVL serial number is a special case // No Subsystem or Subsystem configuration is given // for a DVL message. This will be a generic response // to a DVL message if (serial == SerialNumber.DVL) { // Get the Subsystem code from the serialnumber, there should only be 1 subsystem string code = serial.SubSystems.Substring(0, 1); SubsystemCode = Subsystem.ConvertSubsystemCode(code[0]); return(SubsystemCode); } // If the firmware version is less than 0.2.13, // then the code store is actually the index and we must use // the serial number to get the code // A DVL serial number is a special case where nothing should change if ((FirmwareMajor <= 0 || FirmwareMajor == DEBUG_MAJOR_VER) && FirmwareMinor <= 2 && FirmwareRevision <= 13 && !serial.IsEmpty()) { // Set the correct subsystem based off the serial number // Get the index for the subsystem byte index = SubsystemCode; // Ensure the index is not out of range of the subsystem string if (serial.SubSystems.Length > index) { // Get the Subsystem code from the serialnumber based off the index found string code = serial.SubSystems.Substring(index, 1); return(Subsystem.ConvertSubsystemCode(code[0])); } } // Based off the firmware version, the code stored is the correct code return(SubsystemCode); }
/// <summary> /// Initialize values. /// </summary> public AdcpConfiguration() { // Initialize values SubsystemConfigDict = new Dictionary <string, AdcpSubsystemConfig>(); Commands = new AdcpCommands(); _serialNumber = new SerialNumber(); DeploymentOptions = new DeploymentOptions(); AdcpSerialOptions = new AdcpSerialPort.AdcpSerialOptions(); IsGps1SerialEnabled = false; IsGps2SerialEnabled = false; IsNmea1SerialEnabled = false; IsNmea2SerialEnabled = false; Gps1SerialOptions = new SerialOptions(); Gps2SerialOptions = new SerialOptions(); Nmea1SerialOptions = new SerialOptions(); Nmea2SerialOptions = new SerialOptions(); HardwareOptions = new EngConf(); EthernetOptions = new AdcpEthernetOptions(); VesselMountOptions = new VesselMountOptions(); EngPort = ""; AdditionalCommands = ""; }
public void TestRemoveSubsystemWrongIndex() { // Create a serial number string serialStr = "01345600000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); Subsystem ss = new Subsystem("4", 4); serial.RemoveSubsystem(ss); Assert.AreEqual(3, serial.SubSystemsList.Count, "Subsystem count is incorrect."); // Subsystem type 3 Subsystem ss0 = new Subsystem("3", 0); Assert.AreEqual(ss0, serial.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss0.ToString(), serial.SubSystemsList[0].ToString())); // Subsystem type 2 Subsystem ss2 = new Subsystem("5", 1); Assert.AreEqual(ss2, serial.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss2.ToString(), serial.SubSystemsList[1].ToString())); }
/// <summary> /// Initialize values. /// </summary> public SerialNumberGeneratorViewModel() : base("Serial Number Generator") { // Initialize the value _SerialNumber = new SerialNumber("01000000000000000000000000000001"); // Populate the subsystem list PopulateSubsystemList(); // Populate Base Electronic Type List PopulateBaseElectronicTypeList(); _isSerialNumValueVis = false; _isSpareValueVis = false; _isSubsystemValueVis = true; _isBaseElectTypeValueVis = false; UpdateProperties(); // Commands SerialNumValueViewCommand = ReactiveCommand.Create(); SerialNumValueViewCommand.Subscribe(_ => On_SerialNumValueViewCommand()); SpareValueViewCommand = ReactiveCommand.Create(); SpareValueViewCommand.Subscribe(_ => On_SpareValueViewCommand()); SubsystemValueViewCommand = ReactiveCommand.Create(); SubsystemValueViewCommand.Subscribe(_ => On_SubsystemValueViewCommand()); AddSubsystemCommand = ReactiveCommand.Create(); AddSubsystemCommand.Subscribe(_ => On_AddSubsystemCommand()); RemoveSubsystemCommand = ReactiveCommand.Create(); RemoveSubsystemCommand.Subscribe(_ => On_RemoveSubsystemCommand()); BaseElecTypeValueViewCommand = ReactiveCommand.Create(); BaseElecTypeValueViewCommand.Subscribe(_ => On_BaseElecTypeValueViewCommand()); }
/// <summary> /// Initialize values. /// </summary> public AdcpConfiguration(SerialNumber serial) { // Initialize values SubsystemConfigDict = new Dictionary <string, AdcpSubsystemConfig>(); Commands = new AdcpCommands(); _serialNumber = serial; SetCepo(_serialNumber.SubsystemsString(), _serialNumber); // Must go after Commands is created DeploymentOptions = new DeploymentOptions(); AdcpSerialOptions = new AdcpSerialPort.AdcpSerialOptions(); IsGps1SerialEnabled = false; IsGps2SerialEnabled = false; IsNmea1SerialEnabled = false; IsNmea2SerialEnabled = false; Gps1SerialOptions = new SerialOptions(); Gps2SerialOptions = new SerialOptions(); Nmea1SerialOptions = new SerialOptions(); Nmea2SerialOptions = new SerialOptions(); HardwareOptions = new EngConf(); EthernetOptions = new AdcpEthernetOptions(); VesselMountOptions = new VesselMountOptions(); EngPort = ""; AdditionalCommands = ""; }
public void GetAdcpSubsystemConfig() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01200000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("2", serial); Subsystem ss = new Subsystem("2", 0); // Subsystem code and Index within serial number SubsystemConfiguration ssConfig = new SubsystemConfiguration(ss, 0 , 0); // Number of configurations for a given subsystem AdcpSubsystemConfig asConfig = config.GetAdcpSubsystemConfig(ssConfig); Assert.NotNull(asConfig, "GetAdcpSubsystemConfig() is incorrect."); }
/// <summary> /// Test the AddConfiguration() method. /// </summary> public void AddConfiguration() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01200000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("2", serial); Subsystem ss = new Subsystem("2", 0); // Subsystem code and Index within serial number SubsystemConfiguration ssConfig0 = new SubsystemConfiguration(ss, 0, 0); // Number of configurations for a given subsystem SubsystemConfiguration ssConfig1 = new SubsystemConfiguration(ss, 1, 1); // A second configuration for a subsystem AdcpSubsystemConfig asConfig1 = null; // Create an AdcpSubsystemConfig to get the result bool addConfigResult = config.AddConfiguration(ss, out asConfig1); // Add another configuration for Subsystem 2 Assert.IsTrue(addConfigResult, "AddConfiguration() is incorrect."); Assert.IsNotNull(asConfig1, "asConfig1 is incorrect."); Assert.AreEqual(ss, asConfig1.SubsystemConfig.SubSystem, "asConfig1 Subsystem is incorrect."); Assert.AreEqual(1, asConfig1.SubsystemConfig.CepoIndex, "asConfig1 CEPO index is incorrect."); Assert.AreEqual(ssConfig1, asConfig1.SubsystemConfig, "asConfig1 SubsystemConfiguration is incorrect."); Assert.IsNotNull(asConfig1.Commands, "asConfig1 Commands is incorrect."); Assert.AreEqual(ss, asConfig1.Commands.SubsystemConfig.SubSystem, "asConfig1 Commands Subsystem is incorrect."); Assert.AreEqual(1, asConfig1.Commands.SubsystemConfig.CepoIndex, "asConfig1 Commands CEPO index is incorrect."); Assert.AreEqual("22", config.Commands.CEPO, "Commands CEPO is incorrect."); Assert.AreEqual(2, config.SubsystemConfigDict.Count, "SubsystemConfigDict Count is incorrect."); Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig0), "AdcpSubsystemConfigExist() 2 0 is incorrect."); Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig1), "AdcpSubsystemConfigExist() 2 1 is incorrect."); Assert.NotNull(config.GetAdcpSubsystemConfig(ssConfig0), "GetAdcpSubsystemConfig() 2 0 is incorrect."); Assert.NotNull(config.GetAdcpSubsystemConfig(ssConfig1), "GetAdcpSubsystemConfig() 2 1 is incorrect."); }
/// <summary> /// Test the AddConfiguration() method. /// /// Add bad Subsystem. /// </summary> public void AddConfiguration3() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01200000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("22", serial); Subsystem ss2 = new Subsystem("2", 0); // Subsystem code and Index within serial number Subsystem ss3 = new Subsystem("3", 1); // Subsystem code and Index within serial number SubsystemConfiguration ssConfig20 = new SubsystemConfiguration(ss2, 0, 0); // Configuration SS2 with Config Number 0 SubsystemConfiguration ssConfig21 = new SubsystemConfiguration(ss2, 1, 1); // Configuration SS2 with Config Number 1 SubsystemConfiguration ssConfig30 = new SubsystemConfiguration(ss3, 0, 0); // Configuration SS3 with Config Number 0 SubsystemConfiguration ssConfig31 = new SubsystemConfiguration(ss3, 1, 1); // Configuration SS3 with Config Number 1 AdcpSubsystemConfig asConfig1 = null; bool addConfigResult = config.AddConfiguration(ss3, out asConfig1); // Add another configuration for Subsystem 2 Assert.IsTrue(addConfigResult, "AddConfiguration() is incorrect."); Assert.IsNotNull(asConfig1, "asConfig1 is incorrect."); Assert.AreEqual(ss3, asConfig1.SubsystemConfig.SubSystem, "asConfig1 Subsystem is incorrect."); Assert.AreEqual(2, asConfig1.SubsystemConfig.CepoIndex, "asConfig1 CEPO index is incorrect."); Assert.AreEqual(ssConfig31, asConfig1.SubsystemConfig, "asConfig1 SubsystemConfiguration is incorrect."); Assert.IsNotNull(asConfig1.Commands, "asConfig1 Commands is incorrect."); Assert.AreEqual(ss3, asConfig1.Commands.SubsystemConfig.SubSystem, "asConfig1 Commands Subsystem is incorrect."); Assert.AreEqual(2, asConfig1.Commands.SubsystemConfig.CepoIndex, "asConfig1 Commands CEPO index is incorrect."); Assert.AreEqual("22", config.Commands.CEPO, "Commands CEPO is incorrect."); Assert.AreEqual(2, config.SubsystemConfigDict.Count, "SubsystemConfigDict Count is incorrect."); Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig20), "AdcpSubsystemConfigExist() 2 0 is incorrect."); Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig21), "AdcpSubsystemConfigExist() 2 1 is incorrect."); Assert.AreEqual(false, config.AdcpSubsystemConfigExist(ssConfig30), "AdcpSubsystemConfigExist() 3 0 is incorrect."); Assert.AreEqual(false, config.AdcpSubsystemConfigExist(ssConfig31), "AdcpSubsystemConfigExist() 3 1 is incorrect."); Assert.NotNull(config.GetAdcpSubsystemConfig(ssConfig20), "GetAdcpSubsystemConfig() 2 0 is incorrect."); Assert.NotNull(config.GetAdcpSubsystemConfig(ssConfig21), "GetAdcpSubsystemConfig() 2 1 is incorrect."); Assert.IsNull(config.GetAdcpSubsystemConfig(ssConfig30), "GetAdcpSubsystemConfig() 3 0 is incorrect."); Assert.IsNull(config.GetAdcpSubsystemConfig(ssConfig31), "GetAdcpSubsystemConfig() 3 1 is incorrect."); }
public void TestValidateCEPO4() { SerialNumber serial = new SerialNumber("01230000000000000000000000000004"); bool result = AdcpConfiguration.ValidateCEPO("2323232332", serial); Assert.AreEqual(true, result, "ValidateCEPO is incorrect."); }
public void TestValidateCEPO6() { SerialNumber serial = new SerialNumber(); bool result = AdcpConfiguration.ValidateCEPO("", serial); Assert.AreEqual(false, result, "ValidateCEPO is incorrect."); }
public void TestSingleSubsystem() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01200000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("2", serial); // Get the last item in the dictionary // Should be only 1 anyway AdcpSubsystemConfig resultConfig = null; foreach(AdcpSubsystemConfig asConfig in result.Values) { resultConfig = asConfig; } Assert.AreEqual(1, result.Count, "Number of configurations is incorrect."); Assert.NotNull(resultConfig, "Dictionary entry is not null"); Assert.AreEqual('2', Convert.ToChar(resultConfig.SubsystemConfig.SubSystem.Code), "Subsystem Code is incorrect."); Assert.AreEqual(0, resultConfig.SubsystemConfig.SubSystem.Index, "Subsystem index is incorrect."); Assert.AreEqual(0, resultConfig.SubsystemConfig.CepoIndex, "SubsystemConfiguration CommandSetup is incorrect."); Assert.AreEqual(0, resultConfig.SubsystemConfig.CepoIndex, "AdcpSubsystemConfig index is incorrect."); Assert.AreEqual("[0] 1.2 MHz 4 beam 20 degree piston", resultConfig.ToString(), "AdcpSubsystemConfig toString is incorrect."); Assert.AreEqual("2", config.Commands.CEPO, "Commands CEPO is incorrect."); }
/// <summary> /// Check if the serial number is empty. /// If it is empty, try to get the serial number /// from the first ensemble. /// </summary> private void CheckSerialNumber() { if (SerialNumber.IsEmpty()) { // Get the serialnumber from the first ensemble DataSet.Ensemble ens = GetFirstEnsemble(); if (ens != null && ens.IsEnsembleAvail) { SerialNumber = ens.EnsembleData.SysSerialNumber; } } }
public void TestMultipleSubsystems() { // Create a serial number string serialStr = "01KBXV00000000000000000000000001"; SerialNumber serialNum = new SerialNumber(serialStr); // Test the serial number Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString())); Assert.AreEqual(4, serialNum.SubSystemsList.Count, string.Format("Number of SubSystems did not match 4 {0}", serialNum.SubSystemsList.Count)); // Upper case K Subsystem ss = new Subsystem("K", 0); Assert.AreEqual(ss, serialNum.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsList[0].ToString())); // Lower case K Subsystem ssNot = new Subsystem("k", 0); Assert.AreNotEqual(ssNot, serialNum.SubSystemsList[0], string.Format("Subsystems should not match {0} {1}", ssNot.ToString(), serialNum.SubSystemsList[0].ToString())); Subsystem ss1 = new Subsystem("B", 1); Assert.AreEqual(ss1, serialNum.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss1.ToString(), serialNum.SubSystemsList[1].ToString())); Subsystem ss2 = new Subsystem("X", 2); Assert.AreEqual(ss2, serialNum.SubSystemsList[2], string.Format("Subsystems do not match {0} {1}", ss2.ToString(), serialNum.SubSystemsList[2].ToString())); Subsystem ss3 = new Subsystem("V", 3); Assert.AreEqual(ss3, serialNum.SubSystemsList[3], string.Format("Subsystems do not match {0} {1}", ss3.ToString(), serialNum.SubSystemsList[3].ToString())); Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber)); }
public void TestBadSubsystem2() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01200000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("$%^", serial); // Get the last item in the dictionary // Should be only 1 anyway AdcpSubsystemConfig resultConfig = null; foreach (AdcpSubsystemConfig asConfig in result.Values) { resultConfig = asConfig; } Assert.AreEqual(0, result.Count, "Number of configurations is incorrect."); Assert.IsNull(resultConfig, "Dictionary entry is not null"); Assert.AreEqual("", config.Commands.CEPO, "Commands CEPO is incorrect."); Assert.AreEqual(AdcpCommands.DEFAULT_CEPO, config.Commands.CEPO, "Commands CEPO Default is incorrect."); }
public void TestChangeSubsystems1() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); serial.SubSystems = "123456789ABCDEf"; Assert.AreEqual("123456789ABCDEf", serial.SubSystems, "Subsystem String is incorrect."); Assert.AreEqual(15, serial.SubSystemsList.Count, "Subsystem Dict Count is incorrect."); // Subsystem type 1 Subsystem ss = new Subsystem("1", 0); Assert.AreEqual(ss, serial.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serial.SubSystemsList[0].ToString())); // Subsystem type 2 Subsystem ss1 = new Subsystem("2", 1); Assert.AreEqual(ss1, serial.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss1.ToString(), serial.SubSystemsList[1].ToString())); // Subsystem type 3 Subsystem ss2 = new Subsystem("3", 2); Assert.AreEqual(ss2, serial.SubSystemsList[2], string.Format("Subsystems do not match {0} {1}", ss2.ToString(), serial.SubSystemsList[2].ToString())); // Subsystem type 4 Subsystem ss3 = new Subsystem("4", 3); Assert.AreEqual(ss3, serial.SubSystemsList[3], string.Format("Subsystems do not match {0} {1}", ss3.ToString(), serial.SubSystemsList[3].ToString())); // Subsystem type 5 Subsystem ss4 = new Subsystem("5", 4); Assert.AreEqual(ss4, serial.SubSystemsList[4], string.Format("Subsystems do not match {0} {1}", ss4.ToString(), serial.SubSystemsList[4].ToString())); // Subsystem type 6 Subsystem ss5 = new Subsystem("6", 5); Assert.AreEqual(ss5, serial.SubSystemsList[5], string.Format("Subsystems do not match {0} {1}", ss5.ToString(), serial.SubSystemsList[5].ToString())); // Subsystem type 7 Subsystem ss6 = new Subsystem("7", 6); Assert.AreEqual(ss6, serial.SubSystemsList[6], string.Format("Subsystems do not match {0} {1}", ss6.ToString(), serial.SubSystemsList[6].ToString())); // Subsystem type 8 Subsystem ss7 = new Subsystem("8", 7); Assert.AreEqual(ss7, serial.SubSystemsList[7], string.Format("Subsystems do not match {0} {1}", ss7.ToString(), serial.SubSystemsList[7].ToString())); // Subsystem type 9 Subsystem ss8 = new Subsystem("9", 8); Assert.AreEqual(ss8, serial.SubSystemsList[8], string.Format("Subsystems do not match {0} {1}", ss8.ToString(), serial.SubSystemsList[8].ToString())); // Subsystem type A Subsystem ss9 = new Subsystem("A", 9); Assert.AreEqual(ss9, serial.SubSystemsList[9], string.Format("Subsystems do not match {0} {1}", ss9.ToString(), serial.SubSystemsList[9].ToString())); // Subsystem type B Subsystem ssB = new Subsystem("B", 10); Assert.AreEqual(ssB, serial.SubSystemsList[10], string.Format("Subsystems do not match {0} {1}", ssB.ToString(), serial.SubSystemsList[10].ToString())); // Subsystem type C Subsystem ssC = new Subsystem("C", 11); Assert.AreEqual(ssC, serial.SubSystemsList[11], string.Format("Subsystems do not match {0} {1}", ssC.ToString(), serial.SubSystemsList[11].ToString())); // Subsystem type D Subsystem ssD = new Subsystem("D", 12); Assert.AreEqual(ssD, serial.SubSystemsList[12], string.Format("Subsystems do not match {0} {1}", ssD.ToString(), serial.SubSystemsList[12].ToString())); // Subsystem type E Subsystem ssE = new Subsystem("E", 13); Assert.AreEqual(ssE, serial.SubSystemsList[13], string.Format("Subsystems do not match {0} {1}", ssE.ToString(), serial.SubSystemsList[13].ToString())); // Subsystem type f Subsystem ssf = new Subsystem("f", 14); Assert.AreEqual(ssf, serial.SubSystemsList[14], string.Format("Subsystems do not match {0} {1}", ssf.ToString(), serial.SubSystemsList[14].ToString())); }
public void Test2Subsystem() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01230000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("23", serial); // Get each config based off the subsystem code AdcpSubsystemConfig resultConfig2 = null; AdcpSubsystemConfig resultConfig3 = null; foreach (AdcpSubsystemConfig asConfig in result.Values) { if (asConfig.SubsystemConfig.SubSystem.Code == '2') { resultConfig2 = asConfig; } if (asConfig.SubsystemConfig.SubSystem.Code == '3') { resultConfig3 = asConfig; } } Assert.AreEqual(2, result.Count, "Number of configurations is incorrect."); Assert.NotNull(resultConfig2, "Dictionary 2 entry is not null"); Assert.AreEqual('2', Convert.ToChar(resultConfig2.SubsystemConfig.SubSystem.Code), "Subsystem 2 Code is incorrect."); Assert.AreEqual(0, resultConfig2.SubsystemConfig.SubSystem.Index, "Subsystem 2 index is incorrect."); Assert.AreEqual(0, resultConfig2.SubsystemConfig.CepoIndex, "SubsystemConfiguration 2 CommandSetup is incorrect."); Assert.AreEqual("[0] 1.2 MHz 4 beam 20 degree piston", resultConfig2.ToString(), "AdcpSubsystemConfig 2 toString is incorrect."); Assert.NotNull(resultConfig3, "Dictionary 3 entry is not null"); Assert.AreEqual('3', Convert.ToChar(resultConfig3.SubsystemConfig.SubSystem.Code), "Subsystem 3 Code is incorrect."); Assert.AreEqual(1, resultConfig3.SubsystemConfig.SubSystem.Index, "Subsystem 3 index is incorrect."); Assert.AreEqual(1, resultConfig3.SubsystemConfig.CepoIndex, "SubsystemConfiguration 3 CommandSetup is incorrect."); Assert.AreEqual("[1] 600 kHz 4 beam 20 degree piston", resultConfig3.ToString(), "AdcpSubsystemConfig 3 toString is incorrect."); Assert.AreEqual("23", config.Commands.CEPO, "Commands CEPO is incorrect."); }
public void TestIsEmptySpare() { SerialNumber serial = new SerialNumber("01000000000000000000100000000000"); Assert.IsTrue(serial.IsEmpty(), "IsEmpty() is incorrect."); }
/// <summary> /// Validate if the serial number string is /// a valid serial number. This will test /// the length and if an object can be created. /// If any fail, it will return false. /// </summary> /// <param name="serialNum">Serial Number string to create a SerialNumber object.</param> /// <returns>TRUE = valid serial number string.</returns> public static bool Validate(string serialNum) { bool result = true; // Verify length if (serialNum.Length != SerialNumber.NUM_BYTES) { return false; } // Try to create the object try { // Try to convert the serial number to an int Convert.ToUInt32(serialNum.Substring(SERIAL_START, SERIAL_NUM_BYTES)); // Try to create a serial number SerialNumber serial = new SerialNumber(serialNum); } catch (Exception) { // If any exceptions thrown, return false // One exception is trying to convert the serial number to an int return false; } return result; }
public void GetAdcpSubsystemConfig5() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("0123000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("232332", serial); Subsystem ss2 = new Subsystem("2", 0); // Subsystem code and Index within serial number Subsystem ss3 = new Subsystem("3", 1); // Subsystem code and Index within serial number SubsystemConfiguration ssConfig20 = new SubsystemConfiguration(ss2, 0, 0); // Configuration SS2 with Config Number 0 SubsystemConfiguration ssConfig21 = new SubsystemConfiguration(ss2, 2, 2); // Configuration SS2 with Config Number 1 SubsystemConfiguration ssConfig22 = new SubsystemConfiguration(ss2, 5, 5); // Configuration SS2 with Config Number 2 SubsystemConfiguration ssConfig30 = new SubsystemConfiguration(ss3, 1, 1); // Configuration SS3 with Config Number 0 SubsystemConfiguration ssConfig31 = new SubsystemConfiguration(ss3, 3, 3); // Configuration SS3 with Config Number 1 SubsystemConfiguration ssConfig32 = new SubsystemConfiguration(ss3, 4, 4); // Configuration SS3 with Config Number 2 Assert.NotNull(config.GetAdcpSubsystemConfig(ssConfig20), "GetAdcpSubsystemConfig() 2 0 is incorrect."); Assert.NotNull(config.GetAdcpSubsystemConfig(ssConfig30), "GetAdcpSubsystemConfig() 3 0 is incorrect."); Assert.NotNull(config.GetAdcpSubsystemConfig(ssConfig21), "GetAdcpSubsystemConfig() 2 1 is incorrect."); Assert.NotNull(config.GetAdcpSubsystemConfig(ssConfig31), "GetAdcpSubsystemConfig() 3 1 is incorrect."); Assert.NotNull(config.GetAdcpSubsystemConfig(ssConfig22), "GetAdcpSubsystemConfig() 2 2 is incorrect."); Assert.NotNull(config.GetAdcpSubsystemConfig(ssConfig32), "GetAdcpSubsystemConfig() 3 2 is incorrect."); }
/// <summary> /// Update the serial number with a given serial number. /// </summary> /// <param name="serialNumber">New serial number.</param> public void UpdateSerialNumber(SerialNumber serialNumber) { _SerialNumber = serialNumber; UpdateProperties(); }
public void TestIsEmptySubsystem() { SerialNumber serial = new SerialNumber("01200000000000000000000000000000"); Assert.IsFalse(serial.IsEmpty(), "IsEmpty() is incorrect."); }
public void TestSerialJSON() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); // Convert to JSON and back string json = Newtonsoft.Json.JsonConvert.SerializeObject(serial); // Serialize object to JSON SerialNumber serialNum = Newtonsoft.Json.JsonConvert.DeserializeObject<SerialNumber>(json); // Deserialize the JSON // Test the serial number Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString())); Assert.AreEqual(1, serialNum.SubSystemsList.Count, string.Format("Number of SubSystems did not match 1 {0}", serialNum.SubSystemsList.Count)); Subsystem ss = new Subsystem("3", 0); Assert.AreEqual(ss, serialNum.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsList[0].ToString())); Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber)); }
public void TestAdcpCommands() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01200000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("2", serial); Assert.AreEqual(AdcpCommands.DEFAULT_C232B, config.Commands.C232B, "Default 232B is incorrect."); }
public void TestMultipleDiffSubsystem() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01230000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("23223233", serial); // Get each config based off the subsystem code AdcpSubsystemConfig resultConfig2_1 = null; AdcpSubsystemConfig resultConfig2_2 = null; AdcpSubsystemConfig resultConfig2_3 = null; AdcpSubsystemConfig resultConfig2_4 = null; AdcpSubsystemConfig resultConfig3_1 = null; AdcpSubsystemConfig resultConfig3_2 = null; AdcpSubsystemConfig resultConfig3_3 = null; AdcpSubsystemConfig resultConfig3_4 = null; foreach (AdcpSubsystemConfig asConfig in result.Values) { // Subsystem 2 if (asConfig.SubsystemConfig.SubSystem.Code == '2') { if (resultConfig2_1 == null) { resultConfig2_1 = asConfig; } else { if (resultConfig2_2 == null) { resultConfig2_2 = asConfig; } else { if (resultConfig2_3 == null) { resultConfig2_3 = asConfig; } else { if (resultConfig2_4 == null) { resultConfig2_4 = asConfig; } } } } } // Subsystem 3 if (asConfig.SubsystemConfig.SubSystem.Code == '3') { if (resultConfig3_1 == null) { resultConfig3_1 = asConfig; } else { if (resultConfig3_2 == null) { resultConfig3_2 = asConfig; } else { if (resultConfig3_3 == null) { resultConfig3_3 = asConfig; } else { if (resultConfig3_4 == null) { resultConfig3_4 = asConfig; } } } } } } Assert.AreEqual(8, result.Count, "Number of configurations is incorrect."); Assert.NotNull(resultConfig2_1, "Dictionary 2_1 entry is not null"); Assert.AreEqual('2', Convert.ToChar(resultConfig2_1.SubsystemConfig.SubSystem.Code), "Subsystem 2_1 Code is incorrect."); Assert.AreEqual(0, resultConfig2_1.SubsystemConfig.SubSystem.Index, "Subsystem 2_1 index is incorrect."); Assert.AreEqual(0, resultConfig2_1.SubsystemConfig.CepoIndex, "SubsystemConfiguration 2_1 CommandSetup is incorrect."); Assert.AreEqual(0, resultConfig2_1.SubsystemConfig.CepoIndex, "CEPO 2_1 index is incorrect."); Assert.AreEqual("[0] 1.2 MHz 4 beam 20 degree piston", resultConfig2_1.ToString(), "AdcpSubsystemConfig 2_1 toString is incorrect."); Assert.NotNull(resultConfig2_2, "Dictionary 2_2 entry is not null"); Assert.AreEqual('2', Convert.ToChar(resultConfig2_2.SubsystemConfig.SubSystem.Code), "Subsystem 2_2 Code is incorrect."); Assert.AreEqual(0, resultConfig2_2.SubsystemConfig.SubSystem.Index, "Subsystem 2_2 index is incorrect."); Assert.AreEqual(2, resultConfig2_2.SubsystemConfig.CepoIndex, "SubsystemConfiguration 2_2 CommandSetup is incorrect."); Assert.AreEqual(2, resultConfig2_2.SubsystemConfig.CepoIndex, "CEPO 2_2 index is incorrect."); Assert.AreEqual("[2] 1.2 MHz 4 beam 20 degree piston", resultConfig2_2.ToString(), "AdcpSubsystemConfig 2_2 toString is incorrect."); Assert.NotNull(resultConfig2_3, "Dictionary 2_3 entry is not null"); Assert.AreEqual('2', Convert.ToChar(resultConfig2_3.SubsystemConfig.SubSystem.Code), "Subsystem 2_3 Code is incorrect."); Assert.AreEqual(0, resultConfig2_3.SubsystemConfig.SubSystem.Index, "Subsystem 2_3 index is incorrect."); Assert.AreEqual(3, resultConfig2_3.SubsystemConfig.CepoIndex, "SubsystemConfiguration 2_3 CommandSetup is incorrect."); Assert.AreEqual(3, resultConfig2_3.SubsystemConfig.CepoIndex, "CEPO 2_3 index is incorrect."); Assert.AreEqual("[3] 1.2 MHz 4 beam 20 degree piston", resultConfig2_3.ToString(), "AdcpSubsystemConfig 2_3 toString is incorrect."); Assert.NotNull(resultConfig2_4, "Dictionary 2_4 entry is not null"); Assert.AreEqual('2', Convert.ToChar(resultConfig2_4.SubsystemConfig.SubSystem.Code), "Subsystem 2_4 Code is incorrect."); Assert.AreEqual(0, resultConfig2_4.SubsystemConfig.SubSystem.Index, "Subsystem 2_4 index is incorrect."); Assert.AreEqual(5, resultConfig2_4.SubsystemConfig.CepoIndex, "SubsystemConfiguration 2_4 CommandSetup is incorrect."); Assert.AreEqual(5, resultConfig2_4.SubsystemConfig.CepoIndex, "CEPO 2_4 index is incorrect."); Assert.AreEqual("[5] 1.2 MHz 4 beam 20 degree piston", resultConfig2_4.ToString(), "AdcpSubsystemConfig 2_4 toString is incorrect."); Assert.NotNull(resultConfig3_1, "Dictionary 3_1 entry is not null"); Assert.AreEqual('3', Convert.ToChar(resultConfig3_1.SubsystemConfig.SubSystem.Code), "Subsystem 3_1 Code is incorrect."); Assert.AreEqual(1, resultConfig3_1.SubsystemConfig.SubSystem.Index, "Subsystem 3_1 index is incorrect."); Assert.AreEqual(1, resultConfig3_1.SubsystemConfig.CepoIndex, "SubsystemConfiguration 3_1 CommandSetup is incorrect."); Assert.AreEqual(1, resultConfig3_1.SubsystemConfig.CepoIndex, "CEPO 3_1 index is incorrect."); Assert.AreEqual("[1] 600 kHz 4 beam 20 degree piston", resultConfig3_1.ToString(), "AdcpSubsystemConfig 3_1 toString is incorrect."); Assert.NotNull(resultConfig3_2, "Dictionary 3_2 entry is not null"); Assert.AreEqual('3', Convert.ToChar(resultConfig3_2.SubsystemConfig.SubSystem.Code), "Subsystem 3_2 Code is incorrect."); Assert.AreEqual(1, resultConfig3_2.SubsystemConfig.SubSystem.Index, "Subsystem 3_2 index is incorrect."); Assert.AreEqual(4, resultConfig3_2.SubsystemConfig.CepoIndex, "SubsystemConfiguration 3_2 CommandSetup is incorrect."); Assert.AreEqual(4, resultConfig3_2.SubsystemConfig.CepoIndex, "CEPO 3_2 index is incorrect."); Assert.AreEqual("[4] 600 kHz 4 beam 20 degree piston", resultConfig3_2.ToString(), "AdcpSubsystemConfig 3_2 toString is incorrect."); Assert.NotNull(resultConfig3_3, "Dictionary 3_3 entry is not null"); Assert.AreEqual('3', Convert.ToChar(resultConfig3_3.SubsystemConfig.SubSystem.Code), "Subsystem 3_3 Code is incorrect."); Assert.AreEqual(1, resultConfig3_3.SubsystemConfig.SubSystem.Index, "Subsystem 3_3 index is incorrect."); Assert.AreEqual(6, resultConfig3_3.SubsystemConfig.CepoIndex, "SubsystemConfiguration 3_3 CommandSetup is incorrect."); Assert.AreEqual(6, resultConfig3_3.SubsystemConfig.CepoIndex, "CEPO 3_3 index is incorrect."); Assert.AreEqual("[6] 600 kHz 4 beam 20 degree piston", resultConfig3_3.ToString(), "AdcpSubsystemConfig 3_3 toString is incorrect."); Assert.NotNull(resultConfig3_4, "Dictionary 3_4 entry is not null"); Assert.AreEqual('3', Convert.ToChar(resultConfig3_4.SubsystemConfig.SubSystem.Code), "Subsystem 3_4 Code is incorrect."); Assert.AreEqual(1, resultConfig3_4.SubsystemConfig.SubSystem.Index, "Subsystem 3_4 index is incorrect."); Assert.AreEqual(7, resultConfig3_4.SubsystemConfig.CepoIndex, "SubsystemConfiguration 3_4 CommandSetup is incorrect."); Assert.AreEqual(7, resultConfig3_4.SubsystemConfig.CepoIndex, "CEPO 3_4 index is incorrect."); Assert.AreEqual("[7] 600 kHz 4 beam 20 degree piston", resultConfig3_4.ToString(), "AdcpSubsystemConfig 3_4 toString is incorrect."); Assert.AreEqual("23223233", config.Commands.CEPO, "Commands CEPO is incorrect."); }
public void TestJSON() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01200000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("2", serial); // Get the last item in the dictionary // Should be only 1 anyway AdcpSubsystemConfig ssConfig = null; foreach (AdcpSubsystemConfig asConfig in result.Values) { ssConfig = asConfig; } // Change AdcpCommands config.Commands.C232B = Baudrate.BAUD_9600; // Change the Subsystem Configuration ssConfig.Commands.CBTBL = 4; ssConfig.Commands.CBTMX = 32.36f; string json = Newtonsoft.Json.JsonConvert.SerializeObject(config); // Serialize object to JSON AdcpConfiguration newConfig = Newtonsoft.Json.JsonConvert.DeserializeObject<AdcpConfiguration>(json); // Deserialize the JSON Assert.AreEqual("2", newConfig.Commands.CEPO, "Commands CEPO is incorrect."); Assert.AreEqual(Baudrate.BAUD_9600, newConfig.Commands.C232B, "JSON C232B is incorrect."); // Get the last item in the dictionary // Should be only 1 anyway AdcpSubsystemConfig newSsConfig = null; foreach (AdcpSubsystemConfig asConfig in newConfig.SubsystemConfigDict.Values) { newSsConfig = asConfig; } Assert.AreEqual(4, newSsConfig.Commands.CBTBL, "CBTBL is incorrect."); Assert.AreEqual(32.36f, newSsConfig.Commands.CBTMX, "CBTMX is incorrect."); }
public void TestMultipleSameSubsystem() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01200000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("2222", serial); // Get each config based off the subsystem code AdcpSubsystemConfig resultConfig1 = null; AdcpSubsystemConfig resultConfig2 = null; AdcpSubsystemConfig resultConfig3 = null; AdcpSubsystemConfig resultConfig4 = null; foreach (AdcpSubsystemConfig asConfig in result.Values) { if (resultConfig1 == null) { resultConfig1 = asConfig; } else { if (resultConfig2 == null) { resultConfig2 = asConfig; } else { if (resultConfig3 == null) { resultConfig3 = asConfig; } else { if (resultConfig4 == null) { resultConfig4 = asConfig; } } } } } Assert.AreEqual(4, result.Count, "Number of configurations is incorrect."); Assert.NotNull(resultConfig1, "Dictionary 1 entry is not null"); Assert.AreEqual('2', Convert.ToChar(resultConfig1.SubsystemConfig.SubSystem.Code), "Subsystem 1 Code is incorrect."); Assert.AreEqual(0, resultConfig1.SubsystemConfig.SubSystem.Index, "Subsystem 1 index is incorrect."); Assert.AreEqual(0, resultConfig1.SubsystemConfig.CepoIndex, "SubsystemConfiguration 1 CommandSetup is incorrect."); Assert.AreEqual("[0] 1.2 MHz 4 beam 20 degree piston", resultConfig1.ToString(), "AdcpSubsystemConfig 1 toString is incorrect."); Assert.NotNull(resultConfig2, "Dictionary 2 entry is not null"); Assert.AreEqual('2', Convert.ToChar(resultConfig2.SubsystemConfig.SubSystem.Code), "Subsystem 2 Code is incorrect."); Assert.AreEqual(0, resultConfig2.SubsystemConfig.SubSystem.Index, "Subsystem 2 index is incorrect."); Assert.AreEqual(1, resultConfig2.SubsystemConfig.CepoIndex, "SubsystemConfiguration 2 CommandSetup is incorrect."); Assert.AreEqual("[1] 1.2 MHz 4 beam 20 degree piston", resultConfig2.ToString(), "AdcpSubsystemConfig 2 toString is incorrect."); Assert.NotNull(resultConfig3, "Dictionary 3 entry is not null"); Assert.AreEqual('2', Convert.ToChar(resultConfig3.SubsystemConfig.SubSystem.Code), "Subsystem 3 Code is incorrect."); Assert.AreEqual(0, resultConfig3.SubsystemConfig.SubSystem.Index, "Subsystem 3 index is incorrect."); Assert.AreEqual(2, resultConfig3.SubsystemConfig.CepoIndex, "SubsystemConfiguration 3 CommandSetup is incorrect."); Assert.AreEqual("[2] 1.2 MHz 4 beam 20 degree piston", resultConfig3.ToString(), "AdcpSubsystemConfig 3 toString is incorrect."); Assert.NotNull(resultConfig4, "Dictionary 4 entry is not null"); Assert.AreEqual('2', Convert.ToChar(resultConfig4.SubsystemConfig.SubSystem.Code), "Subsystem 4 Code is incorrect."); Assert.AreEqual(0, resultConfig4.SubsystemConfig.SubSystem.Index, "Subsystem 4 index is incorrect."); Assert.AreEqual(3, resultConfig4.SubsystemConfig.CepoIndex, "SubsystemConfiguration 4 CommandSetup is incorrect."); Assert.AreEqual("[3] 1.2 MHz 4 beam 20 degree piston", resultConfig4.ToString(), "AdcpSubsystemConfig 4 toString is incorrect."); Assert.AreEqual("2222", config.Commands.CEPO, "Commands CEPO is incorrect."); }
public void TestJSONFull() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01200000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("2", serial); // Get the last item in the dictionary // Should be only 1 anyway AdcpSubsystemConfig ssConfig = null; foreach (AdcpSubsystemConfig asConfig in result.Values) { ssConfig = asConfig; } #region AdcpCommands // Change AdcpCommands config.Commands.Mode = AdcpCommands.AdcpMode.DVL; config.Commands.CEI_Hour = 3; config.Commands.CEI_Minute = 3; config.Commands.CEI_Second = 3; config.Commands.CEI_HunSec = 3; //config.Commands.CETFP.Year = 2022; //config.Commands.CETFP.Month = 2; //config.Commands.CETFP.Day = 2; //config.Commands.CETFP_Hour = 2; //config.Commands.CETFP_Minute = 2; //config.Commands.CETFP_Second = 2; //config.Commands.CETFP_HunSec = 2; config.Commands.CETFP = new DateTime(2022, 2, 2, 2, 2, 2); config.Commands.CERECORD_EnsemblePing = false; config.Commands.CEOUTPUT = AdcpCommands.AdcpOutputMode.ASCII; config.Commands.CWS = 33; config.Commands.CWT = 3.33f; config.Commands.CTD = 3.33f; config.Commands.CWSS = 3.33f; config.Commands.CHO = 33.33f; config.Commands.CHS = HeadingSrc.SERIAL; config.Commands.CVSF = 33.33f; config.Commands.C232B = Baudrate.BAUD_9600; config.Commands.C485B = Baudrate.BAUD_921600; config.Commands.C422B = Baudrate.BAUD_4800; #endregion #region SubsystemConfig // Change the Subsystem Configuration ssConfig.Commands.CWPON = false; ssConfig.Commands.CWPBB_LagLength = 0.2345f; ssConfig.Commands.CWPBB_TransmitPulseType = AdcpSubsystemCommands.eCWPBB_TransmitPulseType.BROADBAND_PULSE_TO_PULSE; ssConfig.Commands.CWPAP_NumPingsAvg = 34; ssConfig.Commands.CWPAP_TimeBetweenPing = 23.45f; ssConfig.Commands.CWPAP_Lag = 0.2345f; ssConfig.Commands.CWPAP_Blank = 45.56f; ssConfig.Commands.CWPAP_BinSize = 12.34f; ssConfig.Commands.CWPST_CorrelationThresh = 0.4578f; ssConfig.Commands.CWPST_VVelocityThresh = 0.4678f; ssConfig.Commands.CWPST_QVelocityThresh = 0.4778f; ssConfig.Commands.CWPBL = 78.96f; ssConfig.Commands.CWPBS = 34.56f; ssConfig.Commands.CWPX = 12.34f; ssConfig.Commands.CWPBN = 12; ssConfig.Commands.CWPP = 13; ssConfig.Commands.CWPBP_NumPingsAvg = 34; ssConfig.Commands.CWPBP_TimeBetweenBasePings = 56.23f; ssConfig.Commands.CWPAI = new TimeValue(1, 2, 3, 4); ssConfig.Commands.CWPTBP = 4567.67f; ssConfig.Commands.CBTON = false; ssConfig.Commands.CBTBB_Mode = AdcpSubsystemCommands.eCBTBB_Mode.BROADBAND_NON_CODED; ssConfig.Commands.CBTBB_LongRangeDepth = 23.456f; ssConfig.Commands.CBTBB_PulseToPulseLag = 34.567f; ssConfig.Commands.CBTST_CorrelationThresh = 0.4578f; ssConfig.Commands.CBTST_VVelocityThresh = 0.4678f; ssConfig.Commands.CBTST_QVelocityThresh = 0.4778f; ssConfig.Commands.CBTT_DepthGain = 45.232f; ssConfig.Commands.CBTT_DepthSNR = 234.567f; ssConfig.Commands.CBTT_SNRDeepDetectionThresh = 45.67f; ssConfig.Commands.CBTT_SNRShallowDetectionThresh = 56.432f; ssConfig.Commands.CBTBL = 4; ssConfig.Commands.CBTMX = 32.36f; ssConfig.Commands.CBTTBP = 23987.345f; ssConfig.Commands.CWTON = false; ssConfig.Commands.CWTBB = false; ssConfig.Commands.CWTBL = 23.345f; ssConfig.Commands.CWTBS = 28.12234f; ssConfig.Commands.CWTTBP = 3434.234f; #endregion #region Deployment Options config.DeploymentOptions.BatteryType = DeploymentOptions.AdcpBatteryType.Lithium_7DD; config.DeploymentOptions.DepthToBottom = 23; config.DeploymentOptions.Duration = 45; config.DeploymentOptions.NumBatteries = 12; #endregion // Convert to JSON and back string json = Newtonsoft.Json.JsonConvert.SerializeObject(config); // Serialize object to JSON AdcpConfiguration newConfig = Newtonsoft.Json.JsonConvert.DeserializeObject<AdcpConfiguration>(json); // Deserialize the JSON Assert.AreEqual(serial, newConfig.SerialNumber, "Serial is incorrect."); Assert.AreEqual("2", newConfig.Commands.CEPO, "Commands CEPO is incorrect."); Assert.AreEqual(1, newConfig.SubsystemConfigDict.Count, "Number of SubsystemConfig is incorrect."); #region AdcpCommands Assert.AreEqual(3, newConfig.Commands.CEI_Hour, "CEI_Hour is incorrect."); Assert.AreEqual(3, newConfig.Commands.CEI_Minute, "CEI_Minute is incorrect."); Assert.AreEqual(3, newConfig.Commands.CEI_Second, "CEI_Second is incorrect."); Assert.AreEqual(3, newConfig.Commands.CEI_HunSec, "CEI_HunSec is incorrect."); Assert.AreEqual(2022, newConfig.Commands.CETFP.Year, "CETFP_Year is incorrect."); Assert.AreEqual(2, newConfig.Commands.CETFP.Month, "CETFP_Month is incorrect."); Assert.AreEqual(2, newConfig.Commands.CETFP.Day, "CETFP_Day is incorrect."); Assert.AreEqual(2, newConfig.Commands.CETFP.Hour, "CETFP_Hour is incorrect."); Assert.AreEqual(2, newConfig.Commands.CETFP.Minute, "CETFP_Minute is incorrect."); Assert.AreEqual(2, newConfig.Commands.CETFP.Second, "CETFP_Second is incorrect."); //Assert.AreEqual(2, newConfig.Commands.CETFP_HunSec, "CETFP_HunSec is incorrect."); Assert.AreEqual(false, newConfig.Commands.CERECORD_EnsemblePing, "CERECORD is incorrect."); Assert.AreEqual(AdcpCommands.AdcpOutputMode.ASCII, newConfig.Commands.CEOUTPUT, "CEOUTPUT is incorrect."); Assert.AreEqual(33, newConfig.Commands.CWS, 0.0001, "CWS is incorrect."); Assert.AreEqual(3.33f, newConfig.Commands.CWT, 0.0001, "CWT is incorrect."); Assert.AreEqual(3.33f, newConfig.Commands.CTD, 0.0001, "CTD is incorrect."); Assert.AreEqual(3.33f, newConfig.Commands.CWSS, 0.0001, "CWSS is incorrect."); Assert.AreEqual(33.33f, newConfig.Commands.CHO, 0.0001, "CHO is incorrect."); Assert.AreEqual(HeadingSrc.SERIAL, newConfig.Commands.CHS, "CHS is incorrect."); Assert.AreEqual(33.33f, newConfig.Commands.CVSF, 0.0001, "CVSF is incorrect."); Assert.AreEqual(Baudrate.BAUD_9600, newConfig.Commands.C232B, "JSON C232B is incorrect."); Assert.AreEqual(Baudrate.BAUD_921600, newConfig.Commands.C485B, "JSON C485B is incorrect."); Assert.AreEqual(Baudrate.BAUD_4800, newConfig.Commands.C422B, "JSON C422B is incorrect."); #endregion // Get the last item in the dictionary // Should be only 1 anyway AdcpSubsystemConfig newSsConfig = null; foreach (AdcpSubsystemConfig asConfig in newConfig.SubsystemConfigDict.Values) { newSsConfig = asConfig; } Assert.AreEqual("[0] 1.2 MHz 4 beam 20 degree piston", newSsConfig.ToString(), "SubsystemConfig string is incorrect."); #region SubsystemConfig Assert.AreEqual(false, newSsConfig.Commands.CWPON, "CWPON is incorrect."); Assert.AreEqual(0.2345f, newSsConfig.Commands.CWPBB_LagLength, 0.0001, "CWPBB_LagLength is incorrect."); Assert.AreEqual(AdcpSubsystemCommands.eCWPBB_TransmitPulseType.BROADBAND_PULSE_TO_PULSE, newSsConfig.Commands.CWPBB_TransmitPulseType, "CWPBB_TransmitPulseType is incorrect."); Assert.AreEqual(34, newSsConfig.Commands.CWPAP_NumPingsAvg, "CWPAP_NumPingsAvg is incorrect."); Assert.AreEqual(0.2345f, newSsConfig.Commands.CWPBB_LagLength, 0.0001, "CWPBB_LagLength is incorrect."); Assert.AreEqual(23.45f, newSsConfig.Commands.CWPAP_TimeBetweenPing, 0.0001, "CWPAP_TimeBetweenPing is incorrect."); Assert.AreEqual(0.2345f, newSsConfig.Commands.CWPAP_Lag, 0.0001, "CWPAP_Lag is incorrect."); Assert.AreEqual(45.56f, newSsConfig.Commands.CWPAP_Blank, 0.0001, "CWPAP_Blank is incorrect."); Assert.AreEqual(12.34f, newSsConfig.Commands.CWPAP_BinSize, 0.0001, "CWPAP_BinSize is incorrect."); Assert.AreEqual(0.4578f, newSsConfig.Commands.CWPST_CorrelationThresh, 0.0001, "CWPST_CorrelationThresh is incorrect."); Assert.AreEqual(0.4678f, newSsConfig.Commands.CWPST_VVelocityThresh, 0.0001, "CWPST_VVelocityThresh is incorrect."); Assert.AreEqual(0.4778f, newSsConfig.Commands.CWPST_QVelocityThresh, 0.0001, "CWPST_QVelocityThresh is incorrect."); Assert.AreEqual(78.96f, newSsConfig.Commands.CWPBL, 0.0001, "CWPBL is incorrect."); Assert.AreEqual(34.56f, newSsConfig.Commands.CWPBS, 0.0001, "CWPBS is incorrect."); Assert.AreEqual(12.34f, newSsConfig.Commands.CWPX, 0.0001, "CWPX is incorrect."); Assert.AreEqual(12, newSsConfig.Commands.CWPBN, "CWPBN is incorrect."); Assert.AreEqual(13, newSsConfig.Commands.CWPP, "CWPP is incorrect."); Assert.AreEqual(34, newSsConfig.Commands.CWPBP_NumPingsAvg, "CWPBP_NumPingsAvg is incorrect."); Assert.AreEqual(56.23f, newSsConfig.Commands.CWPBP_TimeBetweenBasePings, 0.0001, "CWPBP_TimeBetweenBasePings is incorrect."); Assert.AreEqual(new TimeValue(1,2,3,4), newSsConfig.Commands.CWPAI, "CWPBP_NumPingsAvg is incorrect."); Assert.AreEqual(4567.67f, newSsConfig.Commands.CWPTBP, 0.0001, "CWPTBP is incorrect."); Assert.AreEqual(false, newSsConfig.Commands.CBTON, "CBTON is incorrect."); Assert.AreEqual(AdcpSubsystemCommands.eCBTBB_Mode.BROADBAND_NON_CODED, newSsConfig.Commands.CBTBB_Mode, "CBTBB_Mode is incorrect."); Assert.AreEqual(23.456f, newSsConfig.Commands.CBTBB_LongRangeDepth, 0.0001, "CBTBB_LongRangeDepth is incorrect."); Assert.AreEqual(34.567f, newSsConfig.Commands.CBTBB_PulseToPulseLag, 0.0001, "CBTBB_PulseToPulseLag is incorrect."); Assert.AreEqual(0.4578f, newSsConfig.Commands.CBTST_CorrelationThresh, 0.0001, "CBTST_CorrelationThresh is incorrect."); Assert.AreEqual(0.4678f, newSsConfig.Commands.CBTST_VVelocityThresh, 0.0001, "CBTST_VVelocityThresh is incorrect."); Assert.AreEqual(0.4778f, newSsConfig.Commands.CBTST_QVelocityThresh, 0.0001, "CBTST_QVelocityThresh is incorrect."); Assert.AreEqual(45.232f, newSsConfig.Commands.CBTT_DepthGain, 0.0001, "CBTT_DepthGain is incorrect."); Assert.AreEqual(234.567f, newSsConfig.Commands.CBTT_DepthSNR, 0.0001, "CBTT_DepthSNR is incorrect."); Assert.AreEqual(45.67f, newSsConfig.Commands.CBTT_SNRDeepDetectionThresh, 0.0001, "CBTT_SNRDeepDetectionThresh is incorrect."); Assert.AreEqual(56.432f, newSsConfig.Commands.CBTT_SNRShallowDetectionThresh, 0.0001, "CBTT_SNRShallowDetectionThresh is incorrect."); Assert.AreEqual(23987.345f, newSsConfig.Commands.CBTTBP, 0.0001, "CBTTBP is incorrect."); Assert.AreEqual(4, newSsConfig.Commands.CBTBL, "CBTBL is incorrect."); Assert.AreEqual(32.36f, newSsConfig.Commands.CBTMX, "CBTMX is incorrect."); Assert.AreEqual(false, newSsConfig.Commands.CWTON, "CWTON is incorrect."); Assert.AreEqual(false, newSsConfig.Commands.CWTBB, "CWTBB is incorrect."); Assert.AreEqual(23.345f, newSsConfig.Commands.CWTBL, 0.0001, "CWTBL is incorrect."); Assert.AreEqual(28.12234f, newSsConfig.Commands.CWTBS, 0.0001, "CWTBS is incorrect."); Assert.AreEqual(3434.234f, newSsConfig.Commands.CWTTBP, 0.0001, "CWTTBP is incorrect."); #endregion #region DeploymentOptions Assert.AreEqual(DeploymentOptions.AdcpBatteryType.Lithium_7DD, newConfig.DeploymentOptions.BatteryType, "Battery Type is incorrect."); Assert.AreEqual(23, newConfig.DeploymentOptions.DepthToBottom, "Depth to bottom is incorrect."); Assert.AreEqual(45, newConfig.DeploymentOptions.Duration, "Duration is incorrect."); Assert.AreEqual(12, newConfig.DeploymentOptions.NumBatteries, "NumBatteries is incorrect."); #endregion }
public void TestRemoveConfigurationBad() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01230000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("233", serial); Subsystem ss2 = new Subsystem("2", 0); // Subsystem code and Index within serial number Subsystem ss3 = new Subsystem("3", 1); // Subsystem code and Index within serial number SubsystemConfiguration ssConfig20 = new SubsystemConfiguration(ss2, 0, 0); // Configuration SS2 with Config Number 0 //SubsystemConfiguration ssConfig21 = new SubsystemConfiguration(ss2, 1, 1); // Configuration SS2 with Config Number 1 //SubsystemConfiguration ssConfig22 = new SubsystemConfiguration(ss2, 2, 2); // Configuration SS2 with Config Number 2 SubsystemConfiguration ssConfig30 = new SubsystemConfiguration(ss3, 1, 1); // Configuration SS3 with Config Number 0 SubsystemConfiguration ssConfig31 = new SubsystemConfiguration(ss3, 2, 2); // Configuration SS3 with Config Number 1 SubsystemConfiguration ssConfig32 = new SubsystemConfiguration(ss3, 3, 3); // Configuration SS3 with Config Number 2 AdcpSubsystemConfig asConfig3_2 = config.GetAdcpSubsystemConfig(ssConfig32); // Get the Subsystem 3 Configuration 0 bool resultRemove = config.RemoveAdcpSubsystemConfig(asConfig3_2); Assert.IsNull(asConfig3_2, "Config 3_2 is incorrect."); Assert.AreEqual(false, resultRemove, "ResultRemove is incorrect."); Assert.AreEqual("233", config.Commands.CEPO, "Commands CEPO is incorrect."); }
/// <summary> /// Create the serial number based off the /// serial number string. If the serial number /// is empty, then create an empty serial number. /// </summary> /// <param name="serialNumStr">Serial Number string.</param> private void CreateSerialNumber(string serialNumStr) { if (string.IsNullOrEmpty(serialNumStr)) { SerialNumber = new SerialNumber(); } else { SerialNumber = new SerialNumber(serialNumStr); } }
public void TestRemoveConfigurationMultiple() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01230000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("233232", serial); Subsystem ss2 = new Subsystem("2", 0); // Subsystem code and Index within serial number Subsystem ss3 = new Subsystem("3", 1); // Subsystem code and Index within serial number SubsystemConfiguration ssConfig20 = new SubsystemConfiguration(ss2, 0, 0); // Configuration SS2 with Config Number 0 SubsystemConfiguration ssConfig21 = new SubsystemConfiguration(ss2, 3, 3); // Configuration SS2 with Config Number 1 SubsystemConfiguration ssConfig22 = new SubsystemConfiguration(ss2, 5, 5); // Configuration SS2 with Config Number 2 SubsystemConfiguration ssConfig30 = new SubsystemConfiguration(ss3, 1, 1); // Configuration SS3 with Config Number 0 SubsystemConfiguration ssConfig31 = new SubsystemConfiguration(ss3, 2, 2); // Configuration SS3 with Config Number 1 SubsystemConfiguration ssConfig32 = new SubsystemConfiguration(ss3, 4, 4); // Configuration SS3 with Config Number 2 AdcpSubsystemConfig asConfig3_0 = config.GetAdcpSubsystemConfig(ssConfig30); // Get the Subsystem 3 Configuration 0 AdcpSubsystemConfig asConfig3_1 = config.GetAdcpSubsystemConfig(ssConfig31); // Get the Subsystem 3 Configuration 0 AdcpSubsystemConfig asConfig3_2 = config.GetAdcpSubsystemConfig(ssConfig32); // Get the Subsystem 3 Configuration 2 // Verify 3 configuration exist for Subsystem 3 and Subsystem 2 Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig20), "Config Exist 2_0 True is incorrect."); Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig21), "Config Exist 2_1 True is incorrect."); Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig22), "Config Exist 2_2 True is incorrect."); Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig30), "Config Exist 3_0 True is incorrect."); Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig31), "Config Exist 3_1 True is incorrect."); Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig32), "Config Exist 3_2 True is incorrect."); Assert.AreEqual(6, config.SubsystemConfigDict.Count, "SubsystemConfigDict pre count is incorrect."); Assert.AreEqual(0, config.GetAdcpSubsystemConfig(ssConfig20).SubsystemConfig.CepoIndex, "CEPO index 2_0 pre is incorrect."); Assert.AreEqual(0, config.GetAdcpSubsystemConfig(ssConfig20).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_0 pre is incorrect."); Assert.AreEqual(1, config.GetAdcpSubsystemConfig(ssConfig30).SubsystemConfig.CepoIndex, "CEPO index 3_0 pre is incorrect."); Assert.AreEqual(1, config.GetAdcpSubsystemConfig(ssConfig30).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 3_0 pre is incorrect."); Assert.AreEqual(2, config.GetAdcpSubsystemConfig(ssConfig31).SubsystemConfig.CepoIndex, "CEPO index 3_1 pre is incorrect."); Assert.AreEqual(2, config.GetAdcpSubsystemConfig(ssConfig31).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 3_1 pre is incorrect."); Assert.AreEqual(3, config.GetAdcpSubsystemConfig(ssConfig21).SubsystemConfig.CepoIndex, "CEPO index 2_1 pre is incorrect."); Assert.AreEqual(3, config.GetAdcpSubsystemConfig(ssConfig21).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_1 pre is incorrect."); Assert.AreEqual(4, config.GetAdcpSubsystemConfig(ssConfig32).SubsystemConfig.CepoIndex, "CEPO index 3_2 pre is incorrect."); Assert.AreEqual(4, config.GetAdcpSubsystemConfig(ssConfig32).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 3_2 pre is incorrect."); Assert.AreEqual(5, config.GetAdcpSubsystemConfig(ssConfig22).SubsystemConfig.CepoIndex, "CEPO index 2_2 pre is incorrect."); Assert.AreEqual(5, config.GetAdcpSubsystemConfig(ssConfig22).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_2 pre is incorrect."); //bool resultRemove0 = config.RemoveAdcpSubsystemConfig(asConfig3_0); // Remove the first Subsystem 3 Configuration //bool resultRemove1 = config.RemoveAdcpSubsystemConfig(asConfig3_1); // Remove the first Subsystem 3 Configuration //bool resultRemove2 = config.RemoveAdcpSubsystemConfig(asConfig3_2); // Remove the first Subsystem 3 Configuration //Assert.AreEqual(true, resultRemove0, "ResultRemove is incorrect."); //Assert.AreEqual(true, resultRemove1, "ResultRemove is incorrect."); //Assert.AreEqual(true, resultRemove2, "ResultRemove is incorrect."); //Assert.AreEqual("222", config.Commands.CEPO, "Commands CEPO is incorrect."); //Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig20), "Config Exist 2_0 True 1 is incorrect."); //Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig21), "Config Exist 2_1 True 1 is incorrect."); //Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig22), "Config Exist 2_2 True 1 is incorrect."); //Assert.AreEqual(false, config.AdcpSubsystemConfigExist(ssConfig30), "Config Exist 3_0 True 1 is incorrect."); //Assert.AreEqual(false, config.AdcpSubsystemConfigExist(ssConfig31), "Config Exist 3_1 True 1 is incorrect."); //Assert.AreEqual(false, config.AdcpSubsystemConfigExist(ssConfig32), "Config Exist 3_2 False 1 is incorrect."); //Assert.AreEqual(3, config.SubsystemConfigDict.Count, "SubsystemConfigDict post count is incorrect."); //Assert.AreEqual(0, config.GetAdcpSubsystemConfig(ssConfig20).SubsystemConfig.CepoIndex, "CEPO index 2_0 is incorrect."); //Assert.AreEqual(0, config.GetAdcpSubsystemConfig(ssConfig20).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_0 is incorrect."); //Assert.AreEqual(1, config.GetAdcpSubsystemConfig(ssConfig21).SubsystemConfig.CepoIndex, "CEPO index 2_1 is incorrect."); //Assert.AreEqual(1, config.GetAdcpSubsystemConfig(ssConfig21).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_1 is incorrect."); //Assert.AreEqual(2, config.GetAdcpSubsystemConfig(ssConfig22).SubsystemConfig.CepoIndex, "CEPO index 2_2 is incorrect."); //Assert.AreEqual(2, config.GetAdcpSubsystemConfig(ssConfig22).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_2 is incorrect."); }
/// <summary> /// Initialize CSHOW test strings. /// </summary> public DecodeCSHOWTest() { #region 1 Sub 1 Confg StringBuilder sb = new StringBuilder(); sb.Append("CSHOW\r\n"); sb.Append("\r\n"); sb.Append("DP1200 System Configuration:\r\n"); sb.Append(" Mode Profile\r\n"); sb.Append(" Sim 0 \r\n"); sb.Append(" CEI 00:00:01.00\r\n"); sb.Append(" CEPO 2\r\n"); sb.Append(" CBI[0] 00:00:01.00,100 \r\n"); sb.Append(" CETFP 2012/09/24,12:30:10.25\r\n"); sb.Append(" CERECORD 1,1\r\n"); sb.Append(" CEOUTPUT 1\r\n"); sb.Append(" CWPON[0] 1 \r\n"); sb.Append(" CWPBB[0] 1,0.042 \r\n"); sb.Append(" CWPAP[0] 10,0.15,0.06,0.04,0.01 \r\n"); sb.Append(" CWPBP[0] 1,0.02 \r\n"); sb.Append(" CWPST[0] 0.400,1.000,1.001 \r\n"); sb.Append(" CWPBL[0] 0.10 \r\n"); sb.Append(" CWPBS[0] 1.00 \r\n"); sb.Append(" CWPX [0] 0.01 \r\n"); sb.Append(" CWPBN[0] 30 \r\n"); sb.Append(" CWPP[0] 1 \r\n"); sb.Append(" CWPAI[0] 03:02:00.10 \r\n"); sb.Append(" CWPTBP[0] 0.13 \r\n"); sb.Append(" CBTON[0] 1 \r\n"); sb.Append(" CBTBB[0] 2, 1.023, 30.00 \r\n"); sb.Append(" CBTST[0] 0.900,1.002,1.001 \r\n"); sb.Append(" CBTBL[0] 0.05 \r\n"); sb.Append(" CBTMX[0] 75.00 \r\n"); sb.Append(" CBTTBP[0] 0.05 \r\n"); sb.Append(" CBTT[0] 15.0,25.0,5.0,2.0 \r\n"); sb.Append(" CWTON[0] 0 \r\n"); sb.Append(" CWTBB[0] 0 \r\n"); sb.Append(" CWTBL[0] 2.00 \r\n"); sb.Append(" CWTBS[0] 2.01 \r\n"); sb.Append(" CWTTBP[0] 0.13 \r\n"); sb.Append(" CWS 17.00\r\n"); sb.Append(" CWT 15.00\r\n"); sb.Append(" CTD 22.10\r\n"); sb.Append(" CWSS 1500.01\r\n"); sb.Append(" CHO 12.654\r\n"); sb.Append(" CHS 1\r\n"); sb.Append(" CVSF 1.023\r\n"); sb.Append(" C232B 115200\r\n"); sb.Append(" C485B 460800\r\n"); sb.Append(" C422B 19200\r\n"); sb.Append("CSHOW\r\n"); _singleSubsystemConfiguration = sb.ToString(); // Set serial number for single subsystem _singleSubsystemSerialNumber = new SerialNumber("01200000000000000000000000000004"); #endregion #region 1 Sub Multiple Config sb.Clear(); sb.Append("CSHOW\r\n"); sb.Append("\r\n"); sb.Append("DP1200 System Configuration:\r\n"); sb.Append(" Mode Profile\r\n"); sb.Append(" Sim 0 \r\n"); sb.Append(" CEI 02:00:01.00\r\n"); sb.Append(" CEPO 222\r\n"); sb.Append(" CBI[0] 00:00:01.01,101 [1] 00:00:01.02,102 [2] 00:00:03.01,103 \r\n"); sb.Append(" CETFP 2012/09/24,12:30:10.25\r\n"); sb.Append(" CERECORD 0,0\r\n"); sb.Append(" CEOUTPUT 0\r\n"); sb.Append(" CWPON[0] 1 [1] 0 [2] 1 \r\n"); sb.Append(" CWPBB[0] 1,0.042 [1] 2,0.043 [2] 3,0.044 \r\n"); sb.Append(" CWPAP[0] 10,0.15,0.06,0.04,0.01 [1] 11,0.16,0.07,0.05,0.02 [2] 12,0.17,0.08,0.06,0.03 \r\n"); sb.Append(" CWPBP[0] 1,0.02 [1] 2,0.04 [2] 3,0.05 \r\n"); sb.Append(" CWPST[0] 0.400,1.000,1.001 [1] 0.500,1.002,1.003 [2] 0.600,1.004,1.005 \r\n"); sb.Append(" CWPBL[0] 0.10 [1] 0.11 [2] 0.12 \r\n"); sb.Append(" CWPBS[0] 1.00 [1] 1.01 [2] 1.02 \r\n"); sb.Append(" CWPX [0] 0.01 [1] 0.02 [2] 0.03 \r\n"); sb.Append(" CWPBN[0] 30 [1] 31 [2] 32 \r\n"); sb.Append(" CWPP[0] 1 [1] 2 [2] 3 \r\n"); sb.Append(" CWPAI[0] 01:02:03.04 [1] 05:06:07.08 [2] 09:10:11.12 \r\n"); sb.Append(" CWPTBP[0] 0.13 [1] 0.14 [2] 0.15 \r\n"); sb.Append(" CBTON[0] 1 [1] 0 [2] 1 \r\n"); sb.Append(" CBTBB[0] 2, 4.440, 30.00 [1] 4, 2.020, 30.01 [2] 3, 1.000, 30.02 \r\n"); sb.Append(" CBTST[0] 0.900,1.003,1.005 [1] 0.901,1.006,1.007 [2] 0.902,1.008,1.009 \r\n"); sb.Append(" CBTBL[0] 0.05 [1] 0.06 [2] 0.07 \r\n"); sb.Append(" CBTMX[0] 75.00 [1] 75.01 [2] 75.02 \r\n"); sb.Append(" CBTTBP[0] 0.05 [1] 0.06 [2] 0.07 \r\n"); sb.Append(" CBTT[0] 15.0,25.0,5.0,2.0 [1] 15.1,25.1,5.1,2.1 [2] 15.2,25.2,5.2,2.2 \r\n"); sb.Append(" CWTON[0] 1 [1] 0 [2] 1 \r\n"); sb.Append(" CWTBB[0] 0 [1] 1 [2] 0 \r\n"); sb.Append(" CWTBL[0] 2.00 [1] 2.01 [2] 2.02 \r\n"); sb.Append(" CWTBS[0] 2.03 [1] 2.04 [2] 2.05 \r\n"); sb.Append(" CWTTBP[0] 0.13 [1] 0.14 [2] 0.15 \r\n"); sb.Append(" CWS 64.20\r\n"); sb.Append(" CWT 15.01\r\n"); sb.Append(" CTD 13.03\r\n"); sb.Append(" CWSS 1500.06\r\n"); sb.Append(" CHO 125.36\r\n"); sb.Append(" CHS 2\r\n"); sb.Append(" CVSF 1.040\r\n"); sb.Append(" C232B 4800\r\n"); sb.Append(" C485B 9600\r\n"); sb.Append(" C422B 230400\r\n"); sb.Append("CSHOW\r\n"); _multipleSubsystemConfigurations = sb.ToString(); #endregion #region Multiple Sub Multiple Config sb.Clear(); sb.Append("CSHOW\r\n"); sb.Append("\r\n"); sb.Append("DP1200 System Configuration:\r\n"); sb.Append(" Mode Profile\r\n"); sb.Append(" Sim 0 \r\n"); sb.Append(" CEI 13:20:01.33\r\n"); sb.Append(" CEPO 2232332\r\n"); sb.Append(" CBI[0] 00:00:01.01,101 [1] 00:00:01.02,102 [2] 00:02:03.01,102 [3] 00:00:01.03,103 [4] 00:00:03.04,104 [5] 00:00:01.05,105 [6] 00:06:03.01,106 \r\n"); sb.Append(" CETFP 2012/09/24,12:30:10.25\r\n"); sb.Append(" CERECORD 1,1\r\n"); sb.Append(" CEOUTPUT 1\r\n"); sb.Append(" CWPON[0] 1 [1] 0 [2] 1 [3] 1 [4] 0 [5] 1 [6] 1 \r\n"); sb.Append(" CWPBB[0] 1,0.042 [1] 2,0.042 [2] 3,0.084 [3] 2,0.044 [4] 1,0.084 [5] 1,0.085 [6] 3,0.043 \r\n"); sb.Append(" CWPAP[0] 10,0.15,0.06,0.04,0.01 [1] 11,0.16,0.07,0.05,0.02 [2] 12,0.17,0.08,0.06,0.03 [3] 13,0.18,0.09,0.07,0.04 [4] 14,0.19,0.10,0.08,0.05 [5] 15,0.20,0.11,0.09,0.06 [6] 16,0.21,0.12,0.10,0.07 \r\n"); sb.Append(" CWPBP[0] 1,0.02 [1] 2,0.03 [2] 3,0.04 [3] 4,0.05 [4] 5,0.06 [5] 6,0.07 [6] 7,0.08 \r\n"); sb.Append(" CWPST[0] 0.400,1.001,1.002 [1] 0.500,1.003,1.004 [2] 0.600,1.005,1.006 [3] 0.700,1.007,1.008 [4] 0.800,1.009,1.010 [5] 0.900,1.011,1.012 [6] 0.300,1.013,1.014 \r\n"); sb.Append(" CWPBL[0] 0.10 [1] 0.11 [2] 0.22 [3] 0.13 [4] 0.24 [5] 0.25 [6] 0.16 \r\n"); sb.Append(" CWPBS[0] 1.00 [1] 1.01 [2] 2.02 [3] 1.03 [4] 2.04 [5] 2.05 [6] 1.06 \r\n"); sb.Append(" CWPX [0] 0.01 [1] 0.02 [2] 0.03 [3] 0.04 [4] 0.05 [5] 0.06 [6] 0.70 \r\n"); sb.Append(" CWPBN[0] 30 [1] 31 [2] 32 [3] 33 [4] 34 [5] 35 [6] 36 \r\n"); sb.Append(" CWPP[0] 1 [1] 2 [2] 3 [3] 4 [4] 5 [5] 6 [6] 7 \r\n"); sb.Append(" CWPAI[0] 01:02:03.04 [1] 05:06:07.08 [2] 09:10:11.12 [3] 13:14:15.16 [4] 17:18:19.20 [5] 20:21:22.23 [6] 24:25:26.27 \r\n"); sb.Append(" CWPTBP[0] 0.13 [1] 0.14 [2] 0.25 [3] 0.16 [4] 0.27 [5] 0.28 [6] 0.19 \r\n"); sb.Append(" CBTON[0] 1 [1] 0 [2] 1 [3] 0 [4] 0 [5] 1 [6] 0 \r\n"); sb.Append(" CBTBB[0] 0, 1.001, 30.00 [1] 1, 2.002, 30.02 [2] 3, 3.003, 50.03 [3] 4, 4.004, 30.04 [4] 5, 5.005, 50.05 [5] 6, 6.006, 50.06 [6] 7, 7.007, 30.07 \r\n"); sb.Append(" CBTST[0] 0.901,1.002,1.003 [1] 0.904,1.005,1.006 [2] 0.907,1.008,1.009 [3] 0.910,1.011,1.012 [4] 0.913,1.015,1.016 [5] 0.917,1.018,1.019 [6] 0.920,1.021,1.022 \r\n"); sb.Append(" CBTBL[0] 0.05 [1] 0.07 [2] 0.18 [3] 0.09 [4] 0.11 [5] 0.12 [6] 0.013 \r\n"); sb.Append(" CBTMX[0] 75.00 [1] 75.01 [2] 125.02 [3] 75.03 [4] 125.04 [5] 125.05 [6] 75.06 \r\n"); sb.Append(" CBTTBP[0] 0.05 [1] 0.06 [2] 0.17 [3] 0.08 [4] 0.19 [5] 0.20 [6] 0.21 \r\n"); sb.Append(" CBTT[0] 15.0,25.0,5.0,2.0 [1] 15.1,25.1,5.1,2.1 [2] 15.2,50.2,5.2,4.2 [3] 15.3,25.3,5.3,2.3 [4] 15.4,50.4,5.4,4.4 [5] 15.5,50.5,5.5,4.5 [6] 15.6,25.6,5.6,2.6 \r\n"); sb.Append(" CWTON[0] 1 [1] 0 [2] 1 [3] 0 [4] 0 [5] 1 [6] 0 \r\n"); sb.Append(" CWTBB[0] 1 [1] 0 [2] 1 [3] 0 [4] 1 [5] 0 [6] 1 \r\n"); sb.Append(" CWTBL[0] 2.07 [1] 2.06 [2] 2.05 [3] 2.04 [4] 2.03 [5] 2.02 [6] 2.01 \r\n"); sb.Append(" CWTBS[0] 2.08 [1] 2.09 [2] 2.10 [3] 2.11 [4] 2.12 [5] 2.13 [6] 2.14 \r\n"); sb.Append(" CWTTBP[0] 0.132 [1] 0.131[2] 0.29 [3] 0.18 [4] 0.27 [5] 0.26 [6] 0.15 \r\n"); sb.Append(" CWS 69.69\r\n"); sb.Append(" CWT 15.033\r\n"); sb.Append(" CTD 13.13\r\n"); sb.Append(" CWSS 1500.30\r\n"); sb.Append(" CHO 14.14\r\n"); sb.Append(" CHS 1\r\n"); sb.Append(" CVSF 1.002\r\n"); sb.Append(" C232B 921600\r\n"); sb.Append(" C485B 2400\r\n"); sb.Append(" C422B 38400\r\n"); sb.Append("CSHOW\r\n"); _multipleSubsystemMultipleConfigurations = sb.ToString(); // Set serial number for Multiple subsystem _multipleSubsystemSerialNumber = new SerialNumber("01230000000000000000000000000004"); #endregion }
public void TestSetAdcpCommands() { AdcpConfiguration config = new AdcpConfiguration(); SerialNumber serial = new SerialNumber("01200000000000000000000000000004"); Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("2", serial); AdcpCommands commands = new AdcpCommands(); commands.C232B = Baudrate.BAUD_9600; config.Commands = commands; Assert.AreNotEqual(AdcpCommands.DEFAULT_C232B, config.Commands.C232B, "AdcpCommand Not is incorrect."); Assert.AreEqual(Baudrate.BAUD_9600, config.Commands.C232B, "AdcpCommand is incorrect."); }