简体   繁体   English

AT ^ SYSINFO和C ++终端程序

[英]AT^SYSINFO and a C++ terminal program

I have written a program that comminucates serially with a USB 3g Modem. 我编写了一个程序,可以与USB 3g调制解调器串行通讯。 When I open the port and write the AT command 当我打开端口并写AT命令时

AT

To the modem, I get the normal "OK" response and can read it using a serial read function. 对于调制解调器,我得到了正常的“ OK”响应,并且可以使用串行读取功能对其进行读取。 In a terminal, when I write the command 在终端中,当我编写命令时

AT^SYSINFO

I get the following response: 我得到以下回应:

^SYSINFO:#,#,#,#,#,#

With the #'s being numbers. #是数字。 However, when I attempt to write the same command serially using my program, I read only this reponse: 但是,当我尝试使用程序串行写入同一命令时,我仅读取以下响应:

AT^SYSINFO

I try to then read another line of incoming data, but no data comes. 然后,我尝试读取另一行传入的数据,但是没有数据来。 Can anyone help me with this? 谁能帮我这个? There is information in the ^SYSINFO message that I need to extract. ^ SYSINFO消息中有我需要提取的信息。

You MUST terminate an AT command line with \\r and nothing else (unless you have modified ATS3 , but you should not) 1 . 必须使用\\r终止AT命令行,并且不能使用其他命令终止(除非您已修改ATS3 ,但您不应这样做) 1 To quote the V.250 specification : 引用V.250规范

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).

DCE means modem. DCE表示调制解调器。

(I removed the IA5 references in the quote above as that is only confusing) (我删除了上面引文中的IA5参考,因为这只是令人困惑)


1 Terminating with \\r\\n will usually work, but that is only because of the 125ms abort timeout delay that makes the extra \\n not abort the command. 1\\r\\n终止通常可以工作,但这仅是因为125ms的中止超时延迟使得额外的\\n不会中止命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM