"AT+CEREG=2"
"AT+CFUN=1"
Getting the correct responses of above mentioned AT commands.
But after that, when any command is send on LTE Socket, "at_host_at_socket_write" API hangs the device.
void at_host_at_socket_write(const void *data, size_t datalen)
{
if ((data != NULL) && (datalen > 0)) {
printf("Cell Tx: %d, %d, Rx Data: %s\r\n",at_socket_fd, datalen, (char *)data);
int bytes_written = send(at_socket_fd, data, datalen, 0);
if (bytes_written <= 0) {
LOG_ERR("\n Could not send AT-command to modem: [ %d ]", bytes_written);
}
gtsSR_ProcessState.CellRespPending = true;
printf("Cell Tx1: %d, Rx Data: %s\r\n", datalen, (char *)data);
}
}
void at_host_at_socket_read(void)
{
uint8_t data_buf[SR_UART_RRB_SIZE];
int err;
/* Read AT socket in non-blocking mode. */
int bytes = recv(at_socket_fd, data_buf, sizeof(data_buf), MSG_DONTWAIT);
/* Forward the data over UART if any. */
/* If no data, errno is set to EGAIN and we will try again. */
if (bytes > 0)
{
}
}
int at_socket_init(void)
{
at_socket_fd = socket(AF_LTE, 0, NPROTO_AT);
// printk("Starting simple AT socket application\n\r");
if (at_socket_fd < 0) {
printk("Socket err: %d, errno: %d\r\n", at_socket_fd, errno);
}
return at_socket_fd;
}