/* Function for handling callbacks from pstorage module. 
Handles pstorage results for clear and storage operation. For detailed description of the parameters provided with the callback, please refer to pstorage_ntf_cb_t.  */
static void pstorage_callback_handler(pstorage_handle_t *p_handle, uint8_t op_code, uint32_t result, uint8_t *p_data, uint32_t data_len)
/* Function for handling callbacks from pstorage module. 
Handles pstorage results for clear and storage operation. For detailed description of the parameters provided with the callback, please refer to pstorage_ntf_cb_t.  */
static void pstorage_callback_handler(pstorage_handle_t *p_handle, uint8_t op_code, uint32_t result, uint8_t *p_data, uint32_t data_len)
{
    switch (op_code)
    {
        case PSTORAGE_STORE_OP_CODE:
            if ((m_dfu_state == DFU_STATE_RX_DATA_PKT) && (m_data_pkt_cb != NULL))
            {
                m_data_pkt_cb(DATA_PACKET, result, p_data);
            }
            break;
        case PSTORAGE_CLEAR_OP_CODE:
            if (m_dfu_state == DFU_STATE_PREPARING)
            {
                m_functions.cleared();
                m_dfu_state = DFU_STATE_RDY;
                if (m_data_pkt_cb != NULL)
                {
                    m_data_pkt_cb(START_PACKET, result, p_data);
                }
            }
            break;
        default:
            break;
    }
    APP_ERROR_CHECK(result);
}