I am trying to capture the net weight from a IND560 using C#'s streamReader and streamWriter classes. It seems a connection is made, but no matter the command I send, I get a response back: 83 Command not recognized. I see the command (wt0111) in the IND560 under Communications>Template>output for template1.
The code is below if anyone has any suggestions to help me move forward it would be much appreciated!
static void writeToStream(string cmd)
{
if (tcpClient.Connected)
{
Console.WriteLine("Sending CMD: {0}\\n", cmd);
// tried with appending a \r, \n, and \r\n same result: 83 command not found
clientStreamWriter.Write(cmd + '\n');
clientStreamWriter.Flush();
}
}
Here is a sample output of the program showing the response 83:
You would need to use read command for the purpose (according to link here)
Format: read SDV#1 SDV#2
Example 1: read wt0101 wt0103
Response 1: 00R003~ 17.08~lb~
So, in your case
read wt0101
read wt0111
In your case you would need to prepend "read" before the field ID (wt0101).
if (tcpClient.Connected)
{
Console.WriteLine("Sending CMD: {0}\\n", cmd);
clientStreamWriter.Write($"read {cmd}" + '\n');
clientStreamWriter.Flush();
}
I would suggest to provide your users an option to input the command to "read" "write", "help", along with field name, in case you are intending to support more command.