/* Send a new alert notification to the given category with the given info string. */
static int ble_svc_ans_new_alert_notify(uint8_t cat_id, const char *info_str)
/* Send a new alert notification to the given category with the given info string. */
static int ble_svc_ans_new_alert_notify(uint8_t cat_id, const char *info_str)
{
    int info_str_len;
    memset(&ble_svc_ans_new_alert_val, '\0',
           BLE_SVC_ANS_NEW_ALERT_MAX_LEN);
    ble_svc_ans_new_alert_val[0] = cat_id;
    ble_svc_ans_new_alert_val[1] = ble_svc_ans_new_alert_cnt[cat_id];
    if (info_str) {
        info_str_len = strlen(info_str);
        if (info_str_len > BLE_SVC_ANS_INFO_STR_MAX_LEN) {
            memcpy(&ble_svc_ans_new_alert_val[2], info_str,
                   BLE_SVC_ANS_INFO_STR_MAX_LEN);
        } else {
            memcpy(&ble_svc_ans_new_alert_val[2], info_str, info_str_len);
        }
    }
    return ble_gattc_notify(ble_svc_ans_conn_handle,
                            ble_svc_ans_new_alert_val_handle);
}