/* Says whether the specified address is already connected or not.  */
static int ble_ll_adv_already_connected(const uint8_t *addr, uint8_t addr_type)
/* Says whether the specified address is already connected or not.  */
static int ble_ll_adv_already_connected(const uint8_t *addr, uint8_t addr_type)
{
    struct ble_ll_conn_sm *connsm;
    SLIST_FOREACH(connsm, &g_ble_ll_conn_active_list, act_sle) {
        if (!memcmp(&connsm->peer_addr, addr, BLE_DEV_ADDR_LEN)) {
            if (addr_type == BLE_ADDR_RANDOM) {
                if (connsm->peer_addr_type & 1) {
                    return 1;
                }
            } else {
                if ((connsm->peer_addr_type & 1) == 0) {
                    return 1;
                }
            }
        }
    }
    return 0;
}