C#中pdu的AT命令 [英] AT command for pdu in c#

查看:162
本文介绍了C#中pdu的AT命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过流动命令以pdu模式发送短信,"length"是一个显示pdu长度的标签,当我写AT+CMGS=20或任何长度时我的代码都可以工作,但是我希望该代码采用标签insted的值在代码中编写静态值的方法,即时通讯以下面提到的方式使用了它,但是它不起作用.

如果我做错方法,谁能帮我写代码?

I m sending sms in pdu mode through flowing command, "length" is a label which shows pdu length, my code is working when I write AT+CMGS=20 or whatever the length is but i want that code take value of label insted of writing static value in code, i m using it below mention way but it is not working.

can anyone help me about how can i write in code if i m doing in wrong way?

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");

推荐答案

我希望在label1.text中显示的长度将作为pdu的长度,在这一部分at + cmgs =<任何"=" length =">命令,实际上在我的代码中pdu legth被计算并显​​示在label1上.
I want that length displays in label1.text will work as length of pdu, in this part of command at+cmgs=<whatever the="" length="">, actualy in my code pdu legth is calculated and show on label1.


如果您的问题的措词正确,我不太确定,而AND长度实际上是一个标签,而不是其他变量,那么您需要进行更改
IF your question is correctly worded, which I am not too sure about, AND length is actually a label an not some other variable, then you would need to change
string command = "AT+CMGS=\""+ length +" \"";

>


to

string command = "AT+CMGS=\""+ length.Text +" \"";


这篇关于C#中pdu的AT命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆