/* Simple write access callback for the alert level characteristic.  */
static int ble_svc_ias_access(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg)
/* Simple write access callback for the alert level characteristic.  */
static int ble_svc_ias_access(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg)
{
    int rc;
    assert(ctxt->chr == &ble_svc_ias_defs[0].characteristics[0]);
    switch (ctxt->op) {
    case BLE_GATT_ACCESS_OP_WRITE_CHR:
        rc = ble_svc_ias_chr_write(ctxt->om,
                                   sizeof ble_svc_ias_alert_level,
                                   sizeof ble_svc_ias_alert_level,
                                   &ble_svc_ias_alert_level, NULL);
	if (ble_svc_ias_cb_fn) {
		ble_svc_ias_cb_fn(ble_svc_ias_alert_level);
	}
        return rc;
    default:
        assert(0);
        return BLE_ATT_ERR_UNLIKELY;
    }
    return 0;
}