gpt4 book ai didi

c++ - Qt : send AT command to GPRS modem

转载 作者:太空宇宙 更新时间:2023-11-04 11:31:41 24 4
gpt4 key购买 nike

我有一 block 带有 GPRS 扩展板的 Arduino 开发板。我可以使用 Arduino 的 IDE 发送和接收 SMS,但我现在要使用 Wavecom GPRS 调制解调器。

我可以将字符串从 Qt 连接并发送到 Arduino 板,这样当 Arduino 从 Qt 收到一个特殊字符串时,它会发送一条短信。请参阅下面的代码。

但现在,我被卡住了...不知道如何直接从 Qt 发送 AT 命令,而不仅仅是发送 Arduino 等待发送 SMS 的字符串...

现在有人可以从 Qt 向 GPRS 调制解调器发送 AT 命令吗?

Arduino 代码:

void  loop()
{
//Check if available
if (Serial.available())
{
// read the incoming byte:
incomingByte = Serial.read();

//Just to show how it works
if(incomingByte == 'X')
{
AT commands to send an sms
}
}
else
delay(5); // there is nothing to read, so wait a few msec's
}

最佳答案

AT 命令通常通过串行端口发送,由 GPRS 调制解调器上的 Controller 软件处理。因此,您只需要在 Qt 应用程序中处理发送端。

因此,您只需通过 QtSerialPort 模块使用 QIODevice::write() 接口(interface):

mySerialPort->write("My AT command");

关于c++ - Qt : send AT command to GPRS modem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24534511/

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