Hello,
I'm trying to develop an application sending GPS over HTTP requests.
I started from the "https client" and "agps" samples in the NRF Connect SDK: the single examples work fine.
I'm having trouble in merging the http example into the agps one.
After the modem configuration, I'm trying to execute the http request:
err = modem_configure();
if (err) {
LOG_ERR("Modem configuration failed with error %d",
err);
return;
}
#if HTTP_TEST
err = getaddrinfo("XXX-dev-iot.azurewebsites.net", NULL, &hints, &res);
if (err) {
printk("getaddrinfo() failed, err %d\n", errno);
return;
}
((struct sockaddr_in *)res->ai_addr)->sin_port = htons(HTTPS_PORT);
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TLS_1_2);
if (fd == -1) {
printk("Failed to open socket!\n");
//goto clean_up;
}
/* Setup TLS socket options */
err = tls_setup(fd);
if (err) {
//goto clean_up;
}
printk("Connecting to %s\n", "XXX-dev-iot.azurewebsites.net");
err = connect(fd, res->ai_addr, sizeof(struct sockaddr_in));
if (err) {
printk("connect() failed, err: %d\n", errno);
//goto clean_up;
}
off = 0;
do {
bytes = send(fd, &send_buf[off], HTTP_HEAD_LEN - off, 0);
if (bytes < 0) {
printk("send() failed, err %d\n", errno);
//goto clean_up;
}
off += bytes;
} while (off < HTTP_HEAD_LEN);
printk("Sent %d bytes\n", off);
off = 0;
do {
bytes = recv(fd, &recv_buf[off], RECV_BUF_SIZE - off, 0);
if (bytes < 0) {
printk("recv() failed, err %d\n", errno);
//goto clean_up;
}
off += bytes;
} while (bytes != 0 /* peer closed connection */);
printk("Received %d bytes\n", off);
/* Print HTTP response */
p = strstr(recv_buf, "\r\n");
if (p) {
off = p - recv_buf;
recv_buf[off + 1] = '\0';
printk("\n>\t %s\n\n", recv_buf);
}
printk("Finished, closing socket.\n");
Code stucks after the send command:
AT+CGACT?
+CGACT: 0,1
OK
Connecting to XXX-dev-iot.azurewebsites.net
Sent 116 bytes
+CSCON: 0
I believe that the PDM active time elapses during the receive command.
I tried to:
- remove the PDM using lte_lc_psm_req(false)
- increase the PDM active timemodyfing CONFIG_LTE_PSM_REQ_RAT in configuration file
These attempts didn't work: it's like the PDM active time does not change.
Do you have any suggestion? Am I doing something wrong?
Thank you