We use c# Serial Communication and in on Data receive we receive all the Tag XYZ values via USB connection.
But the problem is if we turn off and restart the program we are not able to read the tag data’s for the first time.
With the reference to DWM1001 Gateway Quick Deployment Guide document
If we open the Tera Term program means its working fine for all data gathering .
means for the every first time when we turn on the the PC and our c# program on DataReceived event is not tirgering and data gathering is not working.
For the first time when we turn on the computer and start the Tera Term and check for the data receive and after that close the Tera Term and run our application means its working fine.
Is there anything we are missing for the Data receive from C# windows application also this same for when we run the Android app for data gathering.
Here is our code
we connect and open serial communication like this.
//Serial connection
if (serialPort1.IsOpen)
{
serialPort1.Close();
}
serialPort1.PortName = “com1”
serialPort1.BaudRate = 115200;
serialPort1.DataBits = 8;
serialPort1.Parity = Parity.None;
serialPort1.StopBits = StopBits.One;
serialPort1.ReadTimeout = 1000;
serialPort1.WriteTimeout = 1000;
serialPort1.Handshake = Handshake.None;
serialPort1.RtsEnable = true;
serialPort1.DtrEnable = true;
serialPort1.DataReceived += new SerialDataReceivedEventHandler(serialPort1_DataReceived);
serialPort1.Open();
//Data Received event
private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
string inData = serialPort1.ReadLine();
string[] input = inData.Split(new string[] { "est[" }, StringSplitOptions.None);
string str = Convert.ToString(input[1]);
displayToWindow(str);
string[] text = str.Split(new string[] { "," }, StringSplitOptions.None);
string text1 = Convert.ToString(text[0]);
string text2 = Convert.ToString(text[1]);
string text3 = Convert.ToString(text[2]);
return;
}