gpt4 book ai didi

c# - 使用 AT 命令

转载 作者:行者123 更新时间:2023-11-30 20:51:24 24 4
gpt4 key购买 nike

<分区>

我想用AT命令调用电话,我成功了。现在我想获得最后一次通话时长..为了得到我尝试使用 AT+CLCC 命令..它应该返回一些字符串..但它仍然不会。这是我的 C# 代码...

string phonenr = "";
// string mesaj;
if (!_serialPort.IsOpen)
{
_serialPort.Open();
}
_serialPort.WriteLine("AT\r");

{
Console.WriteLine("Enter the phone number:", phonenr);
phonenr = Console.ReadLine();
_serialPort.WriteLine("ATD" + phonenr + ";" + "\r");
Console.WriteLine("Ring...");
Thread.Sleep(3000);


_serialPort.WriteLine("AT"+"CLAC");
_serialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);



private static void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
{
SerialPort sp = (SerialPort)sender;
string indata = sp.ReadExisting();
Console.WriteLine("Data Received:");
Console.Write(indata);
}

我该怎么做????我想将返回字符串赋值给变量

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com