Ble_peripheral_server example

Hello,

In CUSTOMSS_MsgHandler function, I changed below code to test communication between server and client.

#if 0
            app_env_cs.temp_to_air_buffer[0] = (uint8_t)((encoded_temp & 0x000000FF) >> 0);
            app_env_cs.temp_to_air_buffer[1] = (uint8_t)((encoded_temp & 0x0000FF00) >> 8);
            app_env_cs.temp_to_air_buffer[2] = (uint8_t)((encoded_temp & 0x00FF0000) >> 16);
            app_env_cs.temp_to_air_buffer[3] = (uint8_t)((encoded_temp & 0xFF000000) >> 24);
#else
            app_env_cs.temp_to_air_buffer[0] = (uint8_t)((testCount & 0x000000FF) >> 0);
            app_env_cs.temp_to_air_buffer[1] = (uint8_t)((testCount & 0x0000FF00) >> 8);
            app_env_cs.temp_to_air_buffer[2] = (uint8_t)((testCount & 0x00FF0000) >> 16);
            app_env_cs.temp_to_air_buffer[3] = (uint8_t)((testCount & 0xFF000000) >> 24);
            testCount++;
#endif

It looks like that only one of ten message is received at client.
Since log at client is like

42 1d 00 00
4c 1d 00 00
56 1d 00 00
60 1d 00 00
6a 1d 00 00
74 1d 00 00

It is because GAPC_IsConnectionActive is not always True.

I want to send notification every 18 msec.
So changed input parameter of CUSTOMSS_NotifyOnTimeout to 18.
Could it effect ble speed?

@jiyeon.park

The CUSTOMSS_NotifyOnTimeout() enables kernel timers for each of the possible BLE connections up to BLE_CONNECTION_MAX. BLE_CONNECTION_MAX is set to 10, so that is 10 kernel timers that are set.

So for each notification interval there are 10 CUSTOMSS_NTF_TIMEOUT messages generated, one for each possible connection index. A notification is sent only to the active connections as determined by the call go GAPC_IsConnectionActive(conidx). So the behavior you’re seeing is expected.

Thank you for using community forum!