SeeedJP / WioLTEforArduino

GNU General Public License v2.0
33 stars 19 forks source link

Https Post (Not Working #39

Closed grady34 closed 6 months ago

grady34 commented 6 months ago

Hello. I can not get the httppost to work when posting to a https host. It seems like the conversion is in the code, but I don't see any response errors. Can anyone help?

grady34 commented 6 months ago

I just keep getting a 701 error code.

matsujirushi commented 6 months ago

Hi @grady34 , Could you tell me details?

  1. SeeedJP STM32 Boards version (1.9?)
  2. Wio LTE for Arduino library version (2.13.0?)
  3. Please provide debug logs (Tools > Debug > DebugON)
  4. Please send me a short reprocedure code
  5. How frequently do errors occur?
grady34 commented 6 months ago

Hello @matsujirushi

  1. Yes I am using version 1.9
  2. Yes I am using version 2.13.0
  3. I do have the debug enable not sure how to get it to you.
  4. Here is my code.

    include

    include

define APN "soracom.io"

define USERNAME "sora"

define PASSWORD "sora"

define WEBHOOK_URL "https://removedforprivacy"

define INTERVAL (60000)

WioLTE Wio;

void setup() { delay(200);

SerialUSB.begin(115200); SerialUSB.println(""); SerialUSB.println("--- START ---------------------------------------------------");

SerialUSB.println("### I/O Initialize."); Wio.Init();

SerialUSB.println("### Power supply ON."); Wio.PowerSupplyLTE(true); delay(500);

SerialUSB.println("### Turn on or reset."); if (!Wio.TurnOnOrReset()) { SerialUSB.println("### ERROR! ###"); return; }

SerialUSB.println("### Connecting to \""APN"\"."); if (!Wio.Activate(APN, USERNAME, PASSWORD)) { SerialUSB.println("### ERROR! ###"); return; }

SerialUSB.println("### Setup completed."); }

void loop() { char data[100]; int status; WioLTEHttpHeader header; header["Accept"] = "/"; header["User-Agent"] = "QUECTEL_MODULE"; header["Connection"] = "keep-alive"; header["Content-Type"] = "application/x-www-form-urlencoded"; header["Accept-Encoding"] = "gzip, deflate, br"; header["Authorization"] = "Bearer tokenremovedforprivacy";

SerialUSB.println("### Post."); sprintf(data, "lat=35.439247&lng=-97.601626&device_name=Test&marker_color=red", millis() / 1000); SerialUSB.print("Post:"); SerialUSB.print(data); SerialUSB.println(""); if (!Wio.HttpPost(WEBHOOK_URL, data, &status, header, 120000)) { //SerialUSB.print(Wio.HttpPost(WEBHOOK_URL, data, &status, header)); SerialUSB.println("### ERROR! ###");

goto err;

}

SerialUSB.print("Status:"); SerialUSB.println(status);

err: SerialUSB.println("### Wait."); delay(INTERVAL); }

  1. Every time it runs I get this error: - AT+QHTTPPOST=377,120,120 -> -> +CME ERROR: 701

    TIMEOUT

    ERROR! 1251

grady34 commented 6 months ago

it seems like it is failing at this line of code in the WIOLTE.cpp file. Line 1253

if (!str.WriteFormat("AT+QHTTPPOST=%d,%d,%d", headerSb.Length() + strlen(data), timeoutSec, timeoutSec)) return RET_ERR(false, E_UNKNOWN);

matsujirushi commented 6 months ago

From the information you have given us, all we know is that there is an error inside the Quectel EC21.

-> +CME ERROR: 701

701 is "HTTP unkown error". (-> HTTP(S) AT Commands Manual)

grady34 commented 6 months ago

Okay. I will look into that. Thank you for your help!