using MrEModuleSdk.Devices.Mre3;
using MrEModuleSdk.Dto;
using System;

namespace Mre3Example
{
    public partial class Mre3Example
    {
        private static void RunDeviceOverviewExample(IMrE3SdkComDeviceController controller)
        {
            Console.WriteLine("Device overview example");
            Console.WriteLine("Reads basic identification, temperatures, and several frequently used values.");
            Console.WriteLine();

            Console.WriteLine($"Product serial number: {controller.GetProductSerialNumber()}");
            Console.WriteLine($"Electronic serial number: {controller.GetElectronicSerialNumber()}");
            Console.WriteLine($"Firmware ID: {controller.Status.GetFirmwareSerialNumber()}");
            Console.WriteLine($"Firmware version: {controller.Status.GetBoardFirmwareMajorVersion()}." +
                $"{controller.Status.GetBoardFirmwareMinorVersion()}." +
                $"{controller.Status.GetBoardFirmwareBuildVersion()} " +
                $"({controller.Status.GetBoardFirmwareId() / 100}-" +
                $"{controller.Status.GetBoardFirmwareBranch():D2}-" +
                $"{controller.Status.GetBoardFirmwareType()})");
            Console.WriteLine($"Board output stage temperature: {controller.TemperatureManager.ReadBoardOutputStageTemperature():F2} deg C");
            Console.WriteLine($"Proxy temperature: {controller.TemperatureManager.ReadProxyTemperature():F2} deg C");
            Console.WriteLine($"Device temperature: {controller.TemperatureManager.ReadDeviceTemperature():F2} deg C");
            Console.WriteLine($"Current operation mode: {controller.MiscellaneousFeatures.GetOperationMode()}");
            Console.WriteLine($"Front-end voltage: {controller.MiscellaneousFeatures.GetUfe():F3} V");
            Console.WriteLine($"Current limit on axis X: {controller.SignalFlowManager.OutputStage.LinearOutput.ReadCurrentLimit(EAxis.X):F3} A");
            Console.WriteLine($"Current limit on axis Y: {controller.SignalFlowManager.OutputStage.LinearOutput.ReadCurrentLimit(EAxis.Y):F3} A");

            WaitForEnter();
        }
    }
}
