#ifndef TYPES_H
#define TYPES_H

#ifndef __cplusplus
    #if _MSC_VER > 1700
        #include <stdbool.h>
    #else
        #ifndef bool
        #define bool int
        #define false 0
        #define true 1
        #endif
    #endif
    typedef unsigned short                          uint16_t;
    typedef int                                     int32_t;
    typedef unsigned int                            uint32_t;
    typedef long long                               int64_t;
    typedef unsigned long long                      uint64_t;
#else
    #if _MSC_VER > 1700 || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)
        #include <cstdint>
    #else
        #ifndef ANDROID
            typedef unsigned short                          uint16_t;
            typedef int                                     int32_t;
            typedef unsigned int                            uint32_t;
            typedef long long                               int64_t;
            typedef unsigned long long                      uint64_t;
        #endif
    #endif
#endif
#define ATTR_TXT_SIZE_IN_BYTES 128
/*!
  \file Types.h
  \brief A header file that contains variable declarations
  */
typedef bool (*FrameProcCbFunc) (unsigned short* pFrameBuf, uint16_t iFrameID, int32_t iFrameWidth, int32_t iFrameHeight, uint32_t iFrameTimeCount, void* pParam);
typedef void (*FirmwareDownloadCbFunc) (char* pPartName, uint32_t iProgress, void* pUserParam);
/*!
 \brief Errors
*/
enum BG_ERR_LIST
{
    BG_ERR_SUCCESS          = 0,
    BG_ERR_PROBE            = -1,
};
typedef int32_t BG_ERR;
/*!
 \brief Device type
*/
typedef enum
{
    ANY=0,
    CUSTOM,
    CXP,
} EDeviceType;
/*!
 \brief A struct to describle a device
 */
#pragma pack(1)
typedef struct
{
    const char* pMac;
    const char* pIP;
    int32_t iCtrlPort;
    int32_t iDataPort;
    const char* pMask;
    const char* pGateway;
    const char* pVenderName;
    const char* pModelName;
    const char* pVersion;
    const char* pSerialNumber;
    EDeviceType eType;
    bool bReachable;
} SDeviceInfo;
/*!
 \brief A struct to define the content to be sent when calling "ForceIP"
 */
typedef struct
{
    const char* pMac;
    const char* pIp;
    const char* pMask;
    const char* pGateway;
} SForceInfo;

/*!
 \brief A struct to describle a network interface card
 */
typedef struct
{
    const char* pMac;
    const char* pIP;
    const char* pMask;
    const char* pInterfaceName;
    const char* pBroadcast;
} SNICInfo;
#pragma pack()
/*!
 \brief An enumeration to define attribute types of a device
 */
typedef enum
{
    INT_T=0,
    DOUBLE_T,
    STRING_T,
    ENUMERATION_T,
    UNKNOWN,
} EAttrType;
/*!
 \brief An enumeration to define the access mode of an attribute
 */
typedef enum
{
    RO_T=0,
    RW_T,
} EAttrAccessMode;
/*!
 \brief An enumeration to define the location of the attribute
 */
typedef enum
{
    DDR_T=0,
    USER_ROM_T
} EAttrLocation;
/*!
 \brief An enumeration to define the retransfer mode
 */
typedef enum
{
    RT_OFF_T=0,
    RT_PACKET_T,
    RT_FRAME_T
} ERetransferMode;
/*!
 \brief An enumeration to define the status of the stream
 */
typedef enum
{
    /*!Not available*/
    NA=0,
    /*!Running*/
    RUNNING,
    /*!Normal stop*/
    STOP_WELL,
    /*!Abnormal stop*/
    STOP_BAD
} EStreamStatus;
/*!
 \brief An enumeration to define the types of the frame processing
 */
typedef enum
{
    /*!Clockwise rotate*/
    ROTATE=0,
    /*!Average the frames with ID from (I- N + 1) to I as the frame I, N is the averge number*/
    AVERAGE,
    /*!Merge into one frame every N frames by average, N is the merge number*/
    MERGE,
    /*!Enable or disable the linear map. 0:disable, others:Enable and the default is disabled*/
    LINEAR_MAP_ENABLE,
    /*!The start point of the linear map that is mapped to 0, and the default is 0*/
    LINEAR_MAP_START,
    /*!The end point of the linear map that is mapped to 255, and the default is the pow(2.f, PixelBits) - 1 */
    LINEAR_MAP_END
} EFrameProcType;
#endif // TYPES_H
