private void EnsureMinimumRequiredFirmwareVersion()
        {
            var versionTransaction = new SemVerTransaction(Constants.CmdGetRotatorVersion);

            processor.CommitTransaction(versionTransaction);
            versionTransaction.WaitForCompletionOrTimeout();
            versionTransaction.ThrowIfFailed();
            rotatorFirmwareVersion = versionTransaction.SemanticVersion;
            if (rotatorFirmwareVersion < MinimumRequiredRotatorVersion)
            {
                Log.Error().Message(
                    "Unsupported rotator firmware version {version}; will throw.",
                    rotatorFirmwareVersion).Write();
                MessageBox.Show(
                    "Your rotator firmware is too old to work with this driver.\nPlease contact NexDome for an upgrade.\n\n"
                    + $"Your version: {rotatorFirmwareVersion}\n"
                    + $"Minimum required version: {MinimumRequiredRotatorVersion}\n\n"
                    + "The connection will now close.\n\n" + "See the Seup Dialog for firmware update options.",
                    "Firmware Version Incompatible",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Stop);
                Close();
                throw new UnsupportedFirmwareVersionException(MinimumRequiredRotatorVersion, rotatorFirmwareVersion);
            }

            // versionTransaction = new SemVerTransaction(Constants.CmdGetShutterVersion);
            // processor.CommitTransaction(versionTransaction);
            // versionTransaction.WaitForCompletionOrTimeout();
            // versionTransaction.ThrowIfFailed();
            // shutterFirmwareVersion = versionTransaction.SemanticVersion;
            // if (rotatorFirmwareVersion < MinimumRequiredRotatorVersion)
            // {
            // Log.Error()
            // .Message("Unsupported shutter firmware version {version}; will throw.", shutterFirmwareVersion)
            // .Write();
            // MessageBox.Show(
            // "Your rotator firmware is too old to work with this driver.\nPlease contact NexDome for an upgrade.\n\n"
            // + $"Your version: {rotatorFirmwareVersion}\n"
            // + $"Minimum required version: {MinimumRequiredRotatorVersion}\n\n"
            // + "The connection will now close.", "Firmware Version Incompatible", MessageBoxButtons.OK,
            // MessageBoxIcon.Stop);
            // Close();
            // throw new UnsupportedFirmwareVersionException(MinimumRequiredRotatorVersion, rotatorFirmwareVersion);
            // }
            Log.Info().Message("Rotator firmware version {version}", rotatorFirmwareVersion).Write();

            // Log.Info().Message("Shutter firmware version {version}", shutterFirmwareVersion).Write();
            // if (rotatorFirmwareVersion != shutterFirmwareVersion)
            // Log.Warn()
            // .Message("Rotator/Shutter firmware version mismatch - this is not a recommended configuration");
        }
Example #2
0
        private void EnsureMinimumRequiredFirmwareVersion()
        {
            var versionTransaction = new SemVerTransaction(Constants.CmdGetRotatorVersion);

            processor.CommitTransaction(versionTransaction);
            versionTransaction.WaitForCompletionOrTimeout();
            versionTransaction.ThrowIfFailed();
            rotatorFirmwareVersion = versionTransaction.SemanticVersion;
            if (rotatorFirmwareVersion < MinimumRequiredRotatorVersion)
            {
                log.Error().Message(
                    "Unsupported rotator firmware version {firmware}; will throw.", rotatorFirmwareVersion).Write();
                MessageBox.Show(
                    "Your rotator firmware is too old to work with this driver.\nPlease contact NexDome for an upgrade.\n\n"
                    + $"Your version: {rotatorFirmwareVersion}\n"
                    + $"Minimum required version: {MinimumRequiredRotatorVersion}\n\n"
                    + "The connection will now close.\n\n" + "See the Seup Dialog for firmware update options.",
                    "Firmware Version Incompatible",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Stop);
                Close();
                throw new UnsupportedFirmwareVersionException(MinimumRequiredRotatorVersion, rotatorFirmwareVersion);
            }
            log.Info().Message("Rotator firmware version {firmware}", rotatorFirmwareVersion).Write();
            if (!configuration.ShutterIsInstalled || !IsShutterOperational)
            {
                return; // No shutter
            }
            versionTransaction = new SemVerTransaction(Constants.CmdGetShutterVersion);
            processor.CommitTransaction(versionTransaction);
            versionTransaction.WaitForCompletionOrTimeout();
            versionTransaction.ThrowIfFailed();
            shutterFirmwareVersion = versionTransaction.SemanticVersion;
            if (shutterFirmwareVersion < MinimumRequiredShutterVersion)
            {
                log.Error().Message(
                    "Unsupported shutter firmware version {firmware}; will throw.",
                    shutterFirmwareVersion).Write();
                MessageBox.Show(
                    "Your shutter firmware is too old to work with this driver.\nPlease contact NexDome for an upgrade.\n\n"
                    + $"Your version: {shutterFirmwareVersion}\n"
                    + $"Minimum required version: {MinimumRequiredShutterVersion}\n\n"
                    + "The connection will now close.\n\n" + "See the Setup screen for firmware update options.",
                    "Firmware Version Incompatible",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Stop);
                Close();
                throw new UnsupportedFirmwareVersionException(MinimumRequiredShutterVersion, shutterFirmwareVersion);
            }
            log.Info().Message("Shutter firmware version {firmware}", shutterFirmwareVersion).Write();
            if (rotatorFirmwareVersion != shutterFirmwareVersion)
            {
                log.Warn()
                .Message("Rotator/Shutter firmware version mismatch - this is not a recommended configuration")
                .Property("rotatorVersion", rotatorFirmwareVersion)
                .Property("shutterVersion", shutterFirmwareVersion)
                .Write();
                var messageBuilder = new StringBuilder();
                messageBuilder.AppendLine("Your shutter and rotator firmware versions do not match.");
                messageBuilder.AppendLine("This is not a recommended configuration.");
                messageBuilder.AppendLine("Please upgrade one or both units so they are on the same version.");
                messageBuilder.AppendLine();
                messageBuilder.AppendLine($"Rotator version: {rotatorFirmwareVersion}");
                messageBuilder.AppendLine($"Shutter version: {shutterFirmwareVersion}");
                messageBuilder.AppendLine();
                messageBuilder.AppendLine("See the Setup screen for firmware update options.");
                MessageBox.Show(messageBuilder.ToString(),
                                "Firmware Versions Mismatch",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
        }