/**
 * \brief Increase ISDU request with Fast Processing mode
 * !!!Important: Described functionality is supported only with iqInterface HW Version >= 3.0 and FW Version 1.2.3.x
 * \copyright 2022, IQ² Development GmbH, Germany. All rights reserved.
 */

#ifndef _iqi_fast_processing_mode_h
#define _iqi_fast_processing_mode_h

#include "iqi_define.h" 

/**
 * \brief Activate fast processing mode
 *
 * \param[in]   uiPortNo      COM or virtual ethernet port number of iqInterface
 * \param[out]  cpErrMsg      an error message (minimum 256 symbols!)
 * 
 * \return error code
 */
DLL_API
int16 fast_processing_Activate(
    uint16 uiPortNo, 
    char08* cpErrMsg);

/**
 * \brief Deactivate fast processing mode
 *
 * \param[in]   uiPortNo      COM or virtual ethernet port number of iqInterface
 * \param[out]  cpErrMsg      an error message (minimum 256 symbols!)
 *
 * \return error code
 */
DLL_API
int16 fast_processing_Deactivate(
    uint16 uiPortNo,
    char08* cpErrMsg);

/**
 * \brief Read on-request data
 *
 * Short hand for mst_StartReadOD() + mst_WaitODRsp() + mst_GetReadODRsp()
 *
 * \param[in]   uiPortNo        COM or virtual ethernet port number of iqInterface
 * \param[in]   uiIndex         an IO-Link parameter index
 * \param[in]   ucSubindex      an IO-Link parameter sub-index
 * \param[out]  ucpBuf          a data buffer
 * \param[in]   uiBufSize       a data buffer size
 * \param[out]  uipISDUErr      a pointer to store an ISDU error code
 * \param[out]  cpErrMsg        an error message (minimum 256 symbols!)
 *
 * \return the actual size of readed on-request data bytes
 */
DLL_API
int16 fast_processing_ReadOD(uint16 uiPortNo,
    uint16 uiIndex,
    uchar08 ucSubindex,
    uchar08* ucpBuf,
    uint16 uiBufSize,
    uint16* uipISDUErr,
    char08* cpErrMsg);

/**
    * \brief Write on-request data
    *
    * Short hand for mst_StartWriteOD() + mst_WaitODRsp() + mst_GetWriteODRsp()
    *
    * \param[in]   uiPortNo        COM or virtual ethernet port number of iqInterface
    * \param[in]   uiIndex         an IO-Link parameter index
    * \param[in]   ucSubindex      an IO-Link parameter sub-index
    * \param[in]   ucpBuf          a data buffer
    * \param[in]   ucBytesCount    a count of bytes to send
    * \param[out]  uipISDUErr      a pointer to store an ISDU error code
    * \param[out]  cpErrMsg        an error message (minimum 256 symbols!)
    */
DLL_API
int16 fast_processing_WriteOD(uint16 uiPortNo,
    uint16 uiIndex,
    uchar08 ucSubindex,
    uchar08* ucpBuf,
    uint16 uiBytesCount,
    uint16* uipISDUErr,
    char08* cpErrMsg);

#endif //_iqi_fast_processing_mode_h
