⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lvgvpdll_api.h

📁 相机传输图像程序源代码 拜耳模式(RAW格式文件)与RGB图像数据互相转换函数库
💻 H
字号:
#ifndef LvGvpDll_api_h
#define LvGvpDll_api_h

//#include "LvGvpDef.h"
#include "lvdef.h"
#include "lvgvpglobal.h"
#include "lvbus.h"


#if defined(__cplusplus)
#ifdef __WIN64__
#ifdef _LVGVPDLL_
  #define DLLENTRY extern "C" __declspec(dllexport)
#else
  #define DLLENTRY extern "C" __declspec(dllimport)
#endif
#else
  #define DLLENTRY extern "C"
#endif
#else
  #define DLLENTRY
#endif


// ------------------------------------------------------------
// Notes:
// . Communication parameters for streaming between camera and GVSP
//   should be 'calculated' by the library depending on the host
//   hardware (10/100/1000Mbs or installed drivers (when we will
//   have one).
//   Streaming packet size should be negotiated with the camera,
//   using jumbo frames whenever possible.
//
// . Keep as hidden as possible to upper levels the GVP structures/
//   definitions. Make LV defines even if they duplicate GVP items.
//
// . For specific camera settings (Exposure/shutter/...) keep in mind
//   Jan's work about camera parameters.


// Values. Keep aligned with GVP specs. Anyway preference
// to LV defined.

// ------------------------------------------------------------
// Channel handle

#define INVALID_LVGVPHANDLE  0x00000000
typedef U32BIT LVGVPHANDLE;

typedef enum _tagLvGvpPrivilege {
    LvGvpPrivileg_Exclusive = 0x1,
    LvGvpPrivileg_Control   = 0x2,
    LvGvpPrivileg_Monitor   = 0x4,
} LvGvpPrivilege;

// ------------------------------------------------------------
// Grabbing callback
typedef struct _tagLvGvpAcquisition LvGvpAcquisition;
typedef struct _tagLvGvpImageInfo LvGvpImageInfo;
typedef void (WINAPI* LVGPGrabCallbackFunction) (U32BIT ImgNr, U32BIT CurrentImgNr, LVGVPHANDLE ChanHandle, LvGvpAcquisition *ImgCfg, LvGvpImageInfo* ImgInfo);

#include <lvpackon.h>

// ------------------------------------------------------------
// Image acquisition configuration
// Defines the properties of the acquisition from the camera.
typedef struct _tagLvGvpAcquisition {
    U32BIT Size;            // Size of the structure. sizeof(LvGvpAcquisition)+(NrBuffer-1)*sizeof(U8BIT *)
    U32BIT Flags;           // Flags and modifiers.

    // acquisition mode (binning, partial, etc.)
    U32BIT AcqSizeMode;
    U32BIT AcqSizeWidth;
    U32BIT AcqSizeHeight;
    U32BIT AcqSizeClock;

    // Image params
    U32BIT ImgStartX;       // Image X origin in pixels
    U32BIT ImgStartY;       // Image Y origin in lines
    U32BIT ImgWidth;        // Image X width in pixels
    U32BIT ImgHeight;       // Image Y width in lines
    U32BIT ColorFormat;     // ColF_ definitions in dsydef.h

    // Network Parameter
    // param==0   --> take default/ini-Entries
    // param!=0   --> value is then param-1
    U32BIT PktSize;         // this packet size includes all headers (gvp/udp/ip) and can now be euqal the MTU
    U32BIT PktDelay;        // defines the delay between two packets
    U32BIT FrameDelay;
    U32BIT ChunkDelay;

    // Processing
    LVRAWPTR UserParam;       // Parameter for user app
    LVGPGrabCallbackFunction GrabCallback;  // Callback function.
    // Buffer params
    U32BIT LineIncrement;   // Raw format=ImgWidth*PixelSize.
                            // Better implementations can use this value to avoid
                            // reformatting at app level.
    U32BIT NrBuffer;        // Nr of acqusition buffers
    U32BIT *LockTable;
    U32BIT *CurrentFrame;
    // mst, 5.1.07: hold buffer offsets instead of fix buffer pointers, need this for buffer locking by driver
    U8BIT  *BaseMemPtr;
    U32BIT BuffOff[1];
} LvGvpAcquisition;


#include <lvpackof.h>
// ------------------------------------------------------------
// Flags for acquisition
// #define LvGvpCfg_Default     0xffffffff
#define LvGvpCfg_Default     0x00000000
#define LvGvpFlag_UserBuffer 0x00000001    // The buffers are allocated by the user app.


// DLLENTRY BOOL WINAPI DllMain(HINSTANCE hInst, DWORD  ulReasonCalled, LPVOID lpReserved);


// ------------------------------------------------------------
// gev_Init
// gev_Uninit
// Not needed. Initialization/configuration is per channel and
// depending on the LVSDS settings. Use Link/Unlink


// ------------------------------------------------------------
// gev_LinkToCamera -> LvGvpLink
// Opens a command/streaming channel to the camera specified by
// the IP address.
//
// Params:
//     IPCamera:
//         We can select the parameter type for the IP address string
//         with dotted notation or the packed version in U32BIT, I would
//         vote for the U32BIT style.
//         The interface keeps U32BIT instead of the struct in_addr socket
//         type because I don't like to depend too much from MS headers
//         (that struct is already mentioned that has to be changed in
//         wsock2.h)
//         If we want to let it open for IPv6 (address is 128 bits),
//         the param should be a pointer to an array of U32BITs, but probably
//         much more changes has to be introduced.
//     Mode: Requested ownership of the channel (privilege) from Gvp
//         specs. May be combined with LV flags as needed.
//     ChanHandle: Handle identifying the newly open channel with the
//         camera specified in IPCamera.
//
// Returns: GVP_NoError on success or status code on error.
//

//DLLENTRY LVGVPSTATUS WINAPI LvGvpLink(U32BIT  IPCamera, U32BIT Mode, LVGVPHANDLE *ChanHandle);
DLLENTRY LVGVPSTATUS WINAPI LvGvpLink(char   *HostNameIP, U16BIT Mode, LVGVPHANDLE *ChanHandle);


// ------------------------------------------------------------
// gev_Unlink -> LvGvpUnlink
// Closes the specified communication channel with the camera.
//
// Params:
//     ChanHandle: Handle identifying the channel to be closed.
//
// Returns: GVP_NoError on success or status code on error.
//

DLLENTRY LVGVPSTATUS WINAPI LvGvpUnlink(LVGVPHANDLE ChanHandle);


// ------------------------------------------------------------
// gev_ConfigureCamera -> LvGvpSetAcquisitionCfg
// Configures the camera for the requested acquisition format/mode.
// The configuration structure contain the params needed by LVSDS,
// these have to be converted to Gvp specific values/procs.
// Default values can be specified.
//
// Params:
//     ChanHandle: Handle identifying the channel to be configured.
//
//     Cfg: Configuration to be used for acquisition. Any default
//          value must be filled by the library with default/current
//          values. Invalid settings must be reported and the
//          configuration does not get active.
//
// Returns: GVP_NoError on success or status code on error.
//

DLLENTRY LVGVPSTATUS WINAPI LvGvpSetAcquisitionCfg(LVGVPHANDLE ChanHandle, LvBusAcquisition *Cfg);

// ------------------------------------------------------------
// LvGvpGetAcquisitionCfg
// Retrieves the current camera configuration. No default values are
// allowed.
//
// Params:
//     ChanHandle: Handle identifying the channel whose cfg is returned.
//
//     Cfg: Pointer to an app provided buffer to store the current
//          configuration. Attention should be payed to the buffer
//          pointers exceeding the struct nominal size, check the
//          Size field that must be set up by the app.
//
// Returns: GVP_NoError on success or status code on error.
//
DLLENTRY LVGVPSTATUS WINAPI LvGvpGetAcquisitionCfg(LVGVPHANDLE ChanHandle, LvBusAcquisition *Cfg);

// ------------------------------------------------------------
// gev_StartGrabbing -> LvGvpStartGrabbing
// Starts an image stream from the specified camera with the
// current configuration.
// If NrImg is >0 then the acquisition is automatically stopped
// adter the specified nr of images, otherwiae the app must
// explicitly call LvGvpStopGrabbing to terminate the image
// streaming.
//
// Params:
//     ChanHandle: Handle identifying the channel to be started.
//
//     NrImg: Number of images to be acquired and stored. If 0
//          the acquisition is continuous and the app must call
//          StopGrabbing explicitly.
//
// Returns: GVP_NoError on success or status code on error.
//

DLLENTRY LVGVPSTATUS WINAPI LvGvpStartGrabbing(LVGVPHANDLE ChanHandle, U32BIT NrImg);

// ------------------------------------------------------------
// gev_StopGrabbing -> LvGvpStopGrabbing
// Stops the image stream from the specified camera.
//
// Params:
//     ChanHandle: Handle identifying the channel to be stopped.
//
// Returns: GVP_NoError on success or status code on error.
//

DLLENTRY LVGVPSTATUS WINAPI LvGvpStopGrabbing(LVGVPHANDLE ChanHandle);



// ------------------------------------------------------------
// Functions operating on camera settings.
// Jan says....

DLLENTRY LVGVPSTATUS WINAPI LvGvpSetExposureTime(LVGVPHANDLE ChanHandle, U32BIT dwExposureTime);

// ------------------------------------------------------------
// Check if the given channel is still active or not
//
// Returnvalue: Non-Zero if successfull
// Params:
//      Reserved:
DLLENTRY U32BIT WINAPI LvGvpChannelIsAlive(LVGVPHANDLE ChanHandle, U32BIT Reserved);


// ------------------------------------------------------------
// Dral specific registers
// Bruno says...
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqConfig(LVGVPHANDLE ChanHandle, U32BIT AcqMode, U32BIT FlowType, U32BIT IoIn, U32BIT IoInPol, U32BIT IoOut, U32BIT IoOutPol);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqSetUserOutput(LVGVPHANDLE ChanHandle, U32BIT Type, U32BIT Enable, U32BIT Which, U32BIT Pol, U32BIT Delay, U32BIT Duration);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqSetInputConfig(LVGVPHANDLE ChanHandle, U32BIT Function, U32BIT Enable, U32BIT Which, U32BIT Pol);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqInit(LVGVPHANDLE ChanHandle);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqStart(LVGVPHANDLE ChanHandle);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqStop(LVGVPHANDLE ChanHandle);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqPause(LVGVPHANDLE ChanHandle);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqContinue(LVGVPHANDLE ChanHandle);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqSetExternalEvent(LVGVPHANDLE ChanHandle, U32BIT ExtEv);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqGetExternalEvent(LVGVPHANDLE ChanHandle, U32BIT *ExtEv);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqSetShutterTime(LVGVPHANDLE ChanHandle, U32BIT Tusec);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqGetShutterTime(LVGVPHANDLE ChanHandle, U32BIT *Tusec);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqSetFlashMode(LVGVPHANDLE ChanHandle, U32BIT FshMode, U32BIT FshEn);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqGetFlashMode(LVGVPHANDLE ChanHandle, U32BIT* FshMode, U32BIT* FshEn);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqSetRestartDelay(LVGVPHANDLE ChanHandle, U32BIT Tusec);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqGetRestartDelay(LVGVPHANDLE ChanHandle, U32BIT *Tusec);
DLLENTRY BOOL        WINAPI LvGvpSeqIsPaused(LVGVPHANDLE ChanHandle);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqSetFreeIO(LVGVPHANDLE ChanHandle, U32BIT Opto, U32BIT OptoMask, U32BIT Gpio, U32BIT GpioMask);
DLLENTRY LVGVPSTATUS WINAPI LvGvpSeqGetFreeIO(LVGVPHANDLE ChanHandle, U32BIT *Opto, U32BIT *Gpio);

// ------------------------------------------------------------
// Camera generic functions
DLLENTRY LVGVPSTATUS WINAPI LvGvpCamSetExposureTime(LVGVPHANDLE ChanHandle, U32BIT uSec);
DLLENTRY LVGVPSTATUS WINAPI LvGvpCamGetExposureTime(LVGVPHANDLE ChanHandle, U32BIT* uSec, U32BIT* EnumList, U32BIT ListSize);
DLLENTRY LVGVPSTATUS WINAPI LvGvpCamSetGain(LVGVPHANDLE ChanHandle, U32BIT Type, U32BIT Gain);
DLLENTRY LVGVPSTATUS WINAPI LvGvpCamGetGain(LVGVPHANDLE ChanHandle, U32BIT Type, U32BIT* Gain, U32BIT* MinGain, U32BIT* MaxGain);
DLLENTRY LVGVPSTATUS WINAPI LvGvpCamSetBlackLevel(LVGVPHANDLE ChanHandle, U32BIT BlackLevel);
DLLENTRY LVGVPSTATUS WINAPI LvGvpCamGetBlackLevel(LVGVPHANDLE ChanHandle, U32BIT* BlackLevel, U32BIT* MinBlackLevel, U32BIT* MaxBlackLevel);
DLLENTRY LVGVPSTATUS WINAPI LvGvpCamSetColorRotator(LVGVPHANDLE ChanHandle, U32BIT Mode, S32BIT* Gain3x3);
DLLENTRY LVGVPSTATUS WINAPI LvGvpCamGetColorRotator(LVGVPHANDLE ChanHandle, U32BIT* Mode, S32BIT* Gain3x3);
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -