/* Write authorization request event handler. 
The write authorization request event handler is only called when writing to the control point. */
static void on_rw_authorize_req(ble_lncp_t *p_lncp, ble_evt_t const *p_ble_evt)
/* Write authorization request event handler. 
The write authorization request event handler is only called when writing to the control point. */
static void on_rw_authorize_req(ble_lncp_t *p_lncp, ble_evt_t const *p_ble_evt)
{
    const ble_gatts_evt_rw_authorize_request_t * p_auth_req =
        &p_ble_evt->evt.gatts_evt.params.authorize_request;
    if (
        (p_auth_req->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE)
        &&
        (p_auth_req->request.write.handle == p_lncp->ctrlpt_handles.value_handle)
        &&
        (p_auth_req->request.write.op != BLE_GATTS_OP_PREP_WRITE_REQ)
        &&
        (p_auth_req->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)
        &&
        (p_auth_req->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL)
       )
    {
        on_ctrlpt_write(p_lncp, &p_auth_req->request.write);
    }
}