Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/155.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在^SYSINFO和a C++;终端程序_C++_At Command_Tty - Fatal编程技术网

C++ 在^SYSINFO和a C++;终端程序

C++ 在^SYSINFO和a C++;终端程序,c++,at-command,tty,C++,At Command,Tty,我已经写了一个程序,与USB 3g调制解调器串行连接。当我打开端口并写入AT命令时 AT 对于调制解调器,我得到正常的“OK”响应,可以使用串行读取功能读取。在终端中,当我编写命令时 AT^SYSINFO 我得到以下回应: ^SYSINFO:#,#,#,#,#,# 用#表示数字。但是,当我尝试使用我的程序串行编写相同的命令时,我仅读取此响应: AT^SYSINFO 然后我尝试读取另一行传入数据,但没有数据。 有人能帮我吗?^SYSINFO消息中有我需要提取的信息。您必须使用\r终止AT命

我已经写了一个程序,与USB 3g调制解调器串行连接。当我打开端口并写入AT命令时

AT
对于调制解调器,我得到正常的“OK”响应,可以使用串行读取功能读取。在终端中,当我编写命令时

AT^SYSINFO
我得到以下回应:

^SYSINFO:#,#,#,#,#,#
用#表示数字。但是,当我尝试使用我的程序串行编写相同的命令时,我仅读取此响应:

AT^SYSINFO
然后我尝试读取另一行传入数据,但没有数据。
有人能帮我吗?^SYSINFO消息中有我需要提取的信息。

您必须使用
\r
终止AT命令行,而无需其他任何操作(除非您修改了
ATS3
,但您不应该这样做)1。引述:

DCE意味着调制解调器

(我删除了上面引文中的IA5引用,因为这只会让人困惑)


一,
使用
\r\n
终止通常会起作用,但这只是因为125毫秒的中止超时延迟使得额外的
\n
不会中止命令。

串行端口读取功能是如何工作的?听起来可能是它获取了比应该获取的更多的数据,然后丢弃了这些数据,或者类似的事情。如果看不到你的代码,几乎不可能说出来(代码可能也不容易,因为这些东西可能非常微妙)。我使用一个非常基本的读取函数,可以在我的写入函数中找到。调用readline的代码?你可以发现,通过发布到pastebin的链接,你似乎暗示个人帮助台也是如此,现在只为你解决你的问题!不是。这是一个问答数据库。你的问题应该包含使问题有意义所需的任何内容。
5.2.1   Command line general format

A command line is made up of three elements: the prefix, the body, and
the termination character. The command line prefix consists of the
characters "AT" or "at", or, to repeat the execution of the previous
command line, the characters "A/" or "a/". The body is made up of
individual commands as specified later in this Recommendation. Space
characters are ignored and may be used freely for formatting purposes,
unless they are embedded in numeric or string constants (see 5.4.2.1
or 5.4.2.2). The termination character may not appear in the body. The
DCE shall be capable of accepting at least 40 characters in the body.
The termination character may be selected by a user option (parameter S3),
the default being CR (ASCII value 13).