using ICC4cPwmSdk.Device;
using ICC4cPwmSdk.Dtos;

namespace Icc4c_SimpleExample
{
    internal class AnalogInputExample
    {
        // To run this example, rename AnaInMain to Main and in Example.cs rename Main to ExMain for example
        // static void Main(string[] args) -> is always an entry point
        static void AnaInMain(string[] args)
        {
            var controller = new ICC4cPwmSdkDeviceController();
            // Change comport number to correct value
            controller.Connect(14);

            // Control lens connected to channel 0 
            // Set input system to Analog input
            controller.InputStage.ChangeActiveSystem(EChannel.Channel0, EInputSignalStageSystem.AnalogInput);

            // Use current or focal power
            controller.InputStage.AnalogInput.SetAnalogInputType(EChannel.Channel0, EICC4cPwmUnitType.FocalPower);

            // Min and Max input [V]
            controller.InputStage.AnalogInput.SetAnalogInputVoltagePoints(EChannel.Channel0, new float[] { 0, 10 });

            // Min and Max focal power values [dpt]
            controller.InputStage.AnalogInput.SetAnalogInputValuePoints(EChannel.Channel0, new float[] { -2, 3 });

            // Save snapshot as number 1
            controller.SnapshotManager.SaveSnapshot(1);

            // Set number 1 as default snapshot to open it automatically on next connect
            controller.SnapshotManager.WriteStartupSnapshotNumber(1);

            // Disconnect
            controller.Disconnect(true);
        }
    }
}
