Hi !
In example "ble_app_hids_keyboard" in on_adv_evt() (SDK 15.2, 15.3) we see a code:
if (m_peer_id != PM_PEER_ID_INVALID)
{
...
}
but variable "m_peer_id" where not initialized. Rather, it is initialized to 0 when it is defined, and nothing else.
static pm_peer_id_t m_peer_id; /**< Device reference handle to the current bonded central. */
First question: Is the working code in the condition if (m_peer_id != PM_PEER_ID_INVALID) ?
But if we see example "ble_app_cgms", here the variable is local and it is set by
pm_peer_id_t peer_id = PM_PEER_ID_INVALID;
err_code = pm_peer_id_get(m_conn_handle , &peer_id);
And after this checks for condition:
if (peer_id != PM_PEER_ID_INVALID) {...}.
In the same example "ble_app_hids_keyboard" on SDK 12.3, variable "m_peer_id" initialized in case PM_EVT_CONN_SEC_SUCCEEDED:
like this:
m_peer_id = p_evt->peer_id;
Second question: where the code is written correctly in SDK 15 or in SDK 12 ?
Thanks.