Transmitting and receiving in regular interval

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi ,

I am using this UART Setup and UART Messages Over Webpage  code in wiced sdk 2.4.0 , i want to transmit and receive every 10 minutes.  Data has to be received only when the transmission is successful. I have modified the code like this

static void uart_rx_data_thread(uint32_t arg)

{

  uart_info_t* uart_info = (uart_info_t*) arg;

    char rxBuf[200];

  char c;

  int idx = 0;

while(1)

{

  wiced_rtos_delay_milliseconds(600000);   //10 min

  if (wiced_uart_transmit_bytes(uart_info->uart_id, str,7) == WICED_SUCCESS)

  {

    while (wiced_uart_receive_bytes(uart_info->uart_id, &c, 1, WICED_NEVER_TIMEOUT) == WICED_SUCCESS)

    {

          wiced_uart_transmit_bytes(uart_info->uart_id, &c,1);       // This i have given to find whether iam receiving the data properly are not

    if (!(c == uart_info->delimeter))

    rxBuf[idx++] = c;

    if (c == uart_info->delimeter && strlen(rxBuf) > 0)

    {

    wiced_rtos_lock_mutex(&msg_fwd_mutex);

    rxBuf[idx++] = '\0';

    strcpy(rx_msgs[rx_end_index], rxBuf);

    rx_end_index = (rx_end_index + 1) % HISTORY_LEN;

    wiced_rtos_unlock_mutex(&msg_fwd_mutex);

       idx = 0;

       break;  }

    }

  }

  else

  WPRINT_APP_INFO(("Transmit not success"));

}

}

I have given delay so that it will transmit data after every 10 min.  I want to receive the data only after 10 min and display it in the webpage. But if i receive the data in between 10min that data should not get displayed in the webpage.

But in this code if i receive the data in between 10 min that data is getting displayed in webpage at 10th min.

why it is happening. I don't  want this data to be received. please help me to solve this issue.

Thank you.

0 Likes
1 Reply