Controller .NET SDK

I’ve been experimenting with this new SDK (R1.0.0.0) to see if I would be able to use it on future projects and found that I cannot start or stop charts through the WriteChartStatus method.

Here is some c# test code with the WriteChartStatus command:


using Opto22.Controller;
using System;


namespace TagIOConsole
{
    class Program
    {
        static String sControllerIpAddress = "127.0.0.1";
        static Int32 i32ControllerPort = 22001;
        static Int32 i32InitialTimeoutMs = 1000;


        static void Main(string[] args)
        {
            Controller controller = new Controller();


            Controller.ErrorResponse eMethodResponse;
            eMethodResponse = controller.OpenSession(sControllerIpAddress, i32ControllerPort, i32InitialTimeoutMs);


            if (eMethodResponse != Controller.ErrorResponse.Success)
            {
                Console.WriteLine("OpenSession() Failed");
                Console.ReadLine();
                return;
            }
            
            float fTest;
            eMethodResponse = controller.Read32BitFloatVariable("f32", false, out fTest);
            if (eMethodResponse != Controller.ErrorResponse.Success)
            {
                Console.WriteLine("Read f32 returned {0}.", eMethodResponse);
            }
            Console.WriteLine("Float is: {0}", fTest);

//The following line fails with a CommunicationFault
            eMethodResponse = controller.WriteChartStatus("Test", Controller.Item.eItemTypes.suspendchart);
            if (eMethodResponse != Controller.ErrorResponse.Success)
            {
                Console.WriteLine("WriteChartStatus() Failed");
            }


            controller.CloseSession();
            controller.Dispose();


            Console.ReadLine();
        }
    }
}

Second, why is there no ReadChartStatus?

To get the chart status I am doing this:


            string sChartName = "Test";
            Opto22.Controller.Controller.Item[] items = new Controller.Item[1];
            Opto22.Controller.Controller.Item chart = new Controller.Item();
            items[0] = chart;
            chart.SetRead(sChartName, Controller.Item.eItemTypes.chart);


            eMethodResponse = controller.ReadGroupItems(items, 0, 1);
            if (eMethodResponse != Controller.ErrorResponse.Success)
            {
                Console.WriteLine("RegdGroupItems() Failed");
            }
            else
            {
                Controller.eChartStatus status;
                if (chart.GetData(out status))
                {
                    if (status == Controller.eChartStatus.Running)
                        Console.WriteLine("{0} is: {1}", sChartName, "Running");
                    else
                        Console.WriteLine("{0} is: {1}", sChartName, "Not Running");
                }
                else
                    Console.WriteLine("Unable to get Chart Status");
            }

Can this be better encapsulated in the API?

For anyone following this, or looking at this in the future: An Opto22 developer reached out to me and fixed both of these issues super quick. I’m told there should be an updated version to download soon.