/* Schedules a notification or indication for the specified peer-CCCD pair. If the update should be sent immediately, it is indicated in the return code. */
static uint8_t ble_gatts_schedule_update(struct ble_hs_conn *conn, struct ble_gatts_clt_cfg *clt_cfg)
/* Schedules a notification or indication for the specified peer-CCCD pair. If the update should be sent immediately, it is indicated in the return code. */
static uint8_t ble_gatts_schedule_update(struct ble_hs_conn *conn, struct ble_gatts_clt_cfg *clt_cfg)
{
    uint8_t att_op;
    if (!(clt_cfg->flags & BLE_GATTS_CLT_CFG_F_MODIFIED)) {
        att_op = 0;
    } else if (clt_cfg->flags & BLE_GATTS_CLT_CFG_F_NOTIFY) {
        att_op = BLE_ATT_OP_NOTIFY_REQ;
    } else if (clt_cfg->flags & BLE_GATTS_CLT_CFG_F_INDICATE) {
        if (conn->bhc_gatt_svr.indicate_val_handle != 0) {
            att_op = 0;
        } else {
            att_op = BLE_ATT_OP_INDICATE_REQ;
        }
    } else {
        att_op = 0;
    }
    if (att_op != 0) {
        clt_cfg->flags &= ~BLE_GATTS_CLT_CFG_F_MODIFIED;
    }
    return att_op;
}