C# 如何从标签中获取pdu的长度值

C# 如何从标签中获取pdu的长度值,c#,at-command,C#,At Command,我通过流动命令以PDU模式发送短信。“长度”是显示pdu长度的标签 当我以+CMGS=20或任意长度编写代码时,我的代码是有效的,但我希望代码采用标签的值,而不是在代码中编写静态值,我使用下面提到的方法,但它不起作用 如果我用错误的方式写代码,有人能帮助我吗 string recievedData = ExecCommand(port, "AT", 500000, "No phone connected"); recievedData = ExecCommand(port, "AT+CMGF=0

我通过流动命令以PDU模式发送短信。“长度”是显示pdu长度的标签

当我以+CMGS=20或任意长度编写代码时,我的代码是有效的,但我希望代码采用标签的值,而不是在代码中编写静态值,我使用下面提到的方法,但它不起作用

如果我用错误的方式写代码,有人能帮助我吗

string recievedData = ExecCommand(port, "AT", 500000, "No phone connected");
recievedData = ExecCommand(port, "AT+CMGF=0", 500000, "Failed to set message format.");

string command = "AT+CMGS=\""+ length +" \"";
recievedData = ExecCommand(port, command, 500000, "Failed to accept phoneNo");
command = p1 + char.ConvertFromUtf32(26) + "\r";
recievedData = ExecCommand(port, command, 5000, "Failed to send message");
线路

string command = "AT+CMGS=\""+ length +" \"";
将在+CMGS=“20”时生成
。如果你想让它变成
AT+CMGS=20
你应该写

string command = "AT+CMGS="+ length;
线路

string command = "AT+CMGS=\""+ length +" \"";
将在+CMGS=“20”
时生成
。如果你想让它变成
AT+CMGS=20
你应该写

string command = "AT+CMGS="+ length;