I and using the .NET Controller SDK and is experiencing an error when I try to write to a string table only.
I can connect to the EPIC successfully
I can read from integer variables successfully
I can write to integer variables successfully
I can read from string variables successfully
I can write to string variables successfully
I can read from string tables successfully
BUT I cannot write to a string table using “controller.WriteStringTable()”
This returns a “CommunicationError” message and then I have to disconnect and reconnect from the controller before I can communicate with it at all after this error.
Welcome to the forums Gerhard.
Will need to check in with some engineers Monday morning California time to ask about that one.
I’ve never used the .NET stuff.
Hi Gerhard,
I did a quick test and the write to string table works for me.
Here is the c# code in case you want to try it, but it is almost right out of the example provided with the SDK.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using PACController;
namespace OptoConsole
{
internal class Program
{
static void Main(string[] args)
{
String sControllerIpAddress = "127.0.0.1";
Int32 i32ControllerPort = 22001;
Int32 i32InitialTimeoutMs = 1000;
Console.WriteLine("Opto Console");
Controller controller = new Controller();
Controller.ErrorResponse eMethodResponse = controller.OpenSession(sControllerIpAddress, i32ControllerPort, i32InitialTimeoutMs);
if (eMethodResponse != Controller.ErrorResponse.Success)
{
Console.WriteLine("OpenSession failed with ERROR {0}.", eMethodResponse);
return;
}
else
{
Console.WriteLine("Opening connection to {0}:{1} succeeded", sControllerIpAddress, i32ControllerPort);
}
// read an integer
eMethodResponse = controller.Read32BitIntegerVariable("flagCoverOff", false, out int iStatus);
if (eMethodResponse == Controller.ErrorResponse.Success)
{
Console.WriteLine("Read int32 flagCoverOff status returned value {0}.", iStatus);
}
else
{
Console.WriteLine("Read int32 flagCoverOff returned ERROR {0}.", eMethodResponse);
}
// Write String Table
String[] saryTestValues = new String[100];
saryTestValues[0] = "Testing Alarm0";
saryTestValues[1] = "Testing Alarm1";
eMethodResponse = controller.WriteStringTable("AlarmLog", false, saryTestValues, 0, 2);
if (eMethodResponse == Controller.ErrorResponse.Success)
{
Console.WriteLine("Write String table AlarmLog status returned value {0}.", iStatus);
}
else
{
Console.WriteLine("Write iString table AlarmLog returned ERROR {0}.", eMethodResponse);
}
}
}
}