/* Indicates whether we should tre to connect to the sender of the specified advertisement. The function returns a positive result if the device advertises connectability and support for the Alert Notification service.  */
static int wm_ble_client_demo_should_connect(const struct ble_gap_disc_desc *disc)
/* Indicates whether we should tre to connect to the sender of the specified advertisement. The function returns a positive result if the device advertises connectability and support for the Alert Notification service.  */
static int wm_ble_client_demo_should_connect(const struct ble_gap_disc_desc *disc)
{
    struct ble_hs_adv_fields fields;
    int rc;
    int i;
    if (disc->event_type != BLE_HCI_ADV_RPT_EVTYPE_ADV_IND &&
        disc->event_type != BLE_HCI_ADV_RPT_EVTYPE_DIR_IND) {
        return 0;
    }
    rc = ble_hs_adv_parse_fields(&fields, disc->data, disc->length_data);
    if (rc != 0) {
        return rc;
    }
    for (i = 0; i < fields.num_uuids16; i++) {
        if (ble_uuid_u16(&fields.uuids16[i].u) == WM_BLE_SERVER_SVC_UUID) {
            return 1;
        }
    }
    return 0;
}