Hi,
I'm trying to send custom messages between server and client, based on the light switch example. I've modified button_event_handler and the client was able to receive the messages. However, when the message read-out at the client-side was somehow "periodic". The server was sending a few messages per second (by pressing the button) continuously, while the client would only receive 1 message roughly every second. 3 of the 4 messages were discarded. The following is my modified code:
static void button_event_handler(uint32_t button_number)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Button %u pressed\n", button_number);
switch (button_number)
{
case 1:
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "User action \n");
hal_led_pin_set(ONOFF_SERVER_0_LED, !hal_led_pin_get(ONOFF_SERVER_0_LED));
char msg[11];
sprintf(msg, "Count=%d", count_for_button_press);
count_for_button_press ++;
if (count_for_button_press == 255){
count_for_button_press = 0;
}
app_onoff_status_publish(&m_onoff_server_0, msg);
break;
}
}
}
Is this because of network congestion? Or is there a time-out callback for the client to read messages, like a period of one second?
Thanks!