Como eu faço para receber string com este formato?
Estou recebendo via porta serial, esta sequencia mas o software não reconhece.
String chtxt = null, str = null;
public void RecepcaoSerial()
{
chtxt += SerialCom.ReadExisting();
txt_rec += chtxt;
str += chtxt;
chtxt = null;
//Texto [000000]
//Texto 01234567
if (str.Substring(0, 1).Equals("[") && str.Substring(7, 1).Equals("]"))
{
if (str.Length >= 8)
{
if (str.Substring(1, 1).Equals("P"))
{
txtPitch.Text = str.Substring(2, 5); //Recebe eixo X
}
else if (str.Substring(1, 1).Equals("R"))
{
txtRoll.Text = str.Substring(2, 5); //Recebe eixo Y
}
else if (str.Substring(1, 1).Equals("Y"))
{
txtAngle.Text = str.Substring(2, 5); //Recebe eixo Z
}
else if (str.Substring(1, 1).Equals("I"))
{
txtIntTemp.Text = str.Substring(2, 5); //Recebe temperatura Interna
}
else if (str.Substring(1, 1).Equals("E"))
{
txtExtTemp.Text = str.Substring(2, 5); //Recebe temperatura Externa
}
else if (str.Substring(1, 1).Equals("D"))
{
txtDepth.Text = str.Substring(2, 5); //Recebe profundidade
}
str = null;
}
}
}