无法使用Sierra GSM / GPRS模块使用HTTP命令发送数据

时间:2018-08-01 12:23:05

标签: gprs thingsboard

我正在使用Sierra GSM / GPRS模块将HTTP数据上传到Thingsboard服务器上。 使用以下AT + Command序列发送数据:

激活硬件流控制

AT&K3<CR>
OK

Set GPRS parameters (APN, login, password)
AT+KCNXCFG=1,"GPRS","www.airtelgprs.com",,,"0.0.0.0","0.0.0.0","0.0.0.0"<CR>

OK

Activate GPRS profile
AT+KCNXPROFILE=0<CR>
OK

Be sure to attach to network
AT+CGATT=1<CR>
OK

Set HTTP address, port number and http version
AT+KHTTPCFG=0,"****IP****Address",8080,0,"tenant@thingsboard.org","tenant"<CR>
+KHTTPCFG: 0
OK

Set the header of the request
AT+KHTTPHEADER=0<CR>
CONNECT

<CR><LF>Content-Type:application/json<CR><LF>
<CR><LF>token:yB00dpprAKhtlkKuVLf9<CR><LF>
<CR><LF>Host: ***IP****Address**:8080<CR><LF>

--EOF--Pattern--
OK

Send the data to the HTTP server
AT+KHTTPSPOST=0,,"/api/v1/yB00dpprAKhtlkKuVLf9/telemetry"<CR>
CONNECT
     HTTP/1.1 415                                                              
    X-Content-Type-Options: nosniff  


    X-XSS-Protection: 1; mode=block                                              
    Cache-Control: no-cache, no-store, max-age=0, must-revalidate                
    Pragma: no-cache                                                             
    Expires: 0                                                                   
    Content-Type: application/json;charset=UTF-8                                 
    Transfer-Encoding: chunked                                                   
    Date: Thu, 26 Jul 2018 13:25:42 GMT

    1e0

    {"timestamp":1532611542256,"status":415,"error":"Unsupported Media Type",
    "exception":"org.springframework.web.HttpMediaTypeNotSupportedException",
    "message":"Invalid mime type \"application/json;charset=utf-8Content-Length: 30
    token: yB00dpprAKhtlkKuVLf9Authorization: Basic dGVuYW50QHRoaW5nc2JvYXJkLm9yZzp0ZW5hbnQ=\": utf-8Content-Length: 30
    token: yB00dpprAKhtlkKuVLf9Authorization: Basic dGVuYW50QHRoaW5nc2JvYXJkLm9yZzp0ZW5hbnQ=","path":"/api/v1/yB00dpprAKhtlkKuVLf9/attributes/"}

我无法使用AT + HTTPPOST命令发送遥测数据。 请让我知道发送中可能出现的问题。

0 个答案:

没有答案