如何使用 AT 命令通过 CIP 传输二进制数据?

物联网 GSM
2021-05-30 09:02:25

我正在尝试使用 Ai-Thinker A6 GPRS 模块传输二进制数据。问题是它不支持 AT+CIPSEND=[length] 命令(看起来像固件错误)。如果您使用没有长度的简单 AT+CIPSEND 命令,CTRL-Z(也作为零字节)被解释为输入完成,这意味着,例如,并非所有数字都可以作为数据传递。我在这些命令中没有找到任何有关转义的信息。我能用这个做什么?

最后一个数据表:链接
摘要 Ai-Thinker GPRS 页面:链接

1个回答

GPRS 网络的 AT 命令集已标准化,因此您可以在其他页面上搜索帮助,例如[link1][link2]

除此之外,建议您也从该链接[link3] 中查看示例

下面的示例只是从这个页面复制/编辑的片段,所以我相信这是一个很好的起点。建议不要使用与制造商相关的特定命令,以保持您的代码可重用。

GPRS 用户可以激活或停用套接字。然后用户可以使用 AT 命令测试器与远程服务器建立 TCP 或 UDP 连接。

一旦通过套接字建立了 TCP 或 UDP 连接,用户就可以使用其他应用服务,如 HTTP、FTP、SMTP 等。

例如:

Command: AT+CREG? 
Success Result: +CREG=1,1 OK 
Note: This means the SIM is ready and has connected to the network. 

Command: AT+CGATT? 
Response: +CGATT: 1 
Note: Check if the SIM has Internet access. 

Command: AT+CIPSTATUS 
Response : OK 
Note: Query the IP settings. 

Command: AT+CIPMUX=0
Response: OK 
Note: Configure modem to make a single port open for connections. 

Command: AT+CSTT="www.server.com","","" 
Response: OK 
Note: Connect to Internet (Parameters are as follows; 
"APN","USERNAME","PASSWORD", 
have in mind that both the Username and Password are blank in the above instance. 

Command: AT+CIICR 
Response: OK 
Note: Bring up wireless network. 
Ensure that the modem has a SIM with credit and/or has a data plan is activated. 

Command: AT+CIPSTART="TCP","584.287.743.894","80" 
Response: OK CONNECT OK 
Note: Make a TCP Connection to the server at 584.287.743.894 on Port 80, the Default TCP and HTTP port. 

Command: AT+CIPSEND 
Response: > 
Note: This command allows you to make request of the server. You enter 
your request after the prompt (>). 

Commands may either be GET, PUT or POST. 
Each command has a specific manner in which the command is to be 
written. 
GET request to the server example is below. 
--------
GET /my_page.html HTTP/1.1 
Host: 124.456.798:80 Connection: keep-alive .... Connection 
Successful!

Command: AT+CIPCLOSE
--------