📄 extdev.h
字号:
#ifndef ___EXTDEV_H
#define ___EXTDEV_H
#include <dsylib.h>
#include <node.h>
#include <lvcamdat.h>
#include <roi.h>
#include <lvclser.h>
#include <lvlut.h>
#include <lvpackon.h>
#define _MaxSwitch_ 8
/** Represents external equipment (camera or monitor). */
LVDSYCLASS LvExtDeviceNode : public LvNode {
private:
BOOL PLive;
protected:
LvPort *OutPort;
U16BIT Type;
U32BIT TypeIndex;
U16BIT TimingTypeIndex;
HCONNECTION hConn;
BOOL Connected;
BOOL IsCamera;
U8BIT TgtScale[Tgt_Last];
int TheConnIds[_MaxSwitch_];
U8BIT TheSyncNrs[_MaxSwitch_];
U8BIT Current;
U8BIT MaxSwitch;
U32BIT LiveParam;
U32BIT SubGrb;
void *CommPortRef;
virtual void InitCfg(LvPortCfg *Cfg, U16BIT DevType=B_NOBOARD);
virtual LVSTATUS CreateConnection(void);
virtual LVSTATUS _DoLive(U32BIT Mode);
virtual LVSTATUS _DoLiveShot(void);
virtual LVSTATUS _DoFreeze(U32BIT Mode);
virtual LVSTATUS _DoWaitSync(U8BIT SyncType);
virtual BOOL _DoCheckConnection(void);
virtual BOOL _DoCheckLocked(void);
virtual BOOL _DoCheckLive(void);
virtual LVSTATUS Disconnect(void);
void SetHandle(HCONNECTION Handle);
int GetConnId(U8BIT CamIndex=0xff);
LVSTATUS SetDeviceROI(U16BIT StartX, U16BIT StartY, U16BIT *Width, U16BIT *Height);
LVSTATUS GetDeviceROI(LvExtDeviceInfo *SrcInfo);
U16BIT GetSignalMappingDefault(int BoardIndex, int SigIniName, LvCameraInfo *Info);
U16BIT GetSignalMapping2ndSet(int BoardIndex, int SigIniName, U16BIT Value, int SigIniName2);
// Constructors & destructor
LvExtDeviceNode(U16BIT Type, U16BIT aConnId, U8BIT aSyncNr, U16BIT anId=0, LPSTR ExtName=NULL);
virtual ~LvExtDeviceNode(void);
virtual LVSTATUS Connect(LvNode *NodeTo, U16BIT PortType, U16BIT anId=0xffff);
virtual LVSTATUS ExecuteMCommand(U16BIT CmdId, U16BIT wParam, LVRAWPTR lParam, LVSTATUS *RetVal, LvPort *FromPort, U8BIT Direction);
virtual LVSTATUS SetScaleMode(U8BIT ScaleMode, U8BIT Targets=(U8BIT)Tgt_Default);
LVSTATUS AddDevice(U16BIT Type, U16BIT aConnId, U8BIT aSyncNr);
U16BIT GetDeviceType(void);
friend LVDSYCLASS LvGrabberNode;
public:
virtual U32BIT GetType(void) { return ND_Camera; }
virtual char FAR *GetName(void) { return "Camera"; }
/** Deactivates a previously connected and activated camera.
* Allow to deactivate this camera.
* @param Targets Actually unused
* @return @ref ErrorDefinitions
*/
virtual LVSTATUS Deactivate(U16BIT Targets=Tgt_Default);
//>>>>PS
/** Activates the camera.
* It behaves in the same way as the LvGrabberNode::ActivateCamera() method, in the
* LvGrabberNode class. In order to have more flexibility in next releases,
* the preferred method to activate the camera is the one in the
* LvGrabberNode class; applications should always use that method to
* activate the camera or monitor.
* @param Targets @ref Targets "Target" for which the camera has to be
* activated. If there are a need of to use more
* targets so these targets can be OR-ed.
* @sa Live(), Freeze(), LvGrabberNode::ActivateCamera()
*/
virtual LVSTATUS Activate(U16BIT Targets=Tgt_Default);
/** Copies the camera description to the user buffer.
* Copies the camera or monitor text description to the buffer provided by the
* calling application.\n
* This function is intended to be used in user interfaces.
* @param Buffer User allocated buffer where to copy the
* camera or monitor description.
* @param MaxChar Dimension in bytes of the passed buffer
* @return The user provided pointer in the Buffer parameter.
* @sa LvGrabberNode::ConnectCamera(), LvGrabberNode::ActivateCamera()
*/
char FAR *GetDescription(char FAR *Buffer, int MaxChar);
/*? Retrieves the Camera video type.
* @return The camera or monitor video type (see @ref VideoTypeId definitions)
*/
U16BIT GetVideoType(void);
/*? Retrieves the Camera timing type.
* @return The camera or monitor timing type (see @ref TimingType definitions)
*/
U16BIT GetVideoTimingType(void);
/*? Returns the scan mode of the camera.
* @return The scanning mode of the camera. One of the ScanModeId values
* @sa LvGrabberNode::ConnectCamera(), LvGrabberNode::ActivateCamera()
*/
U16BIT GetScanMode(void);
/*? Retrieves the Camera color coding.
* @return The camera color coding as defined in the Camera Editor.
* One of these definitions:
* @code
* ACC_ByPass - Do not care
* ACC_PAL - PAL color coding
* ACC_NTSC - NTSC color coding
* @endcode
*/
U16BIT GetColorCoding(void);
LVSTATUS GetSignalMapping(int BoardSigId, LvCeSignalInterface *Set_1, LvCeSignalInterface *Set_2);
/** Gets the handle associated with the camera object
* @return The handle associated with the camera object
*/
HCONNECTION GetHandle(void);
/*? Sets special parameters for camera live
* Sets special handling modes for the camera.
* @param Mode one or more (OR-ed) of the @ref CmdLiveMode definitions
* @return @ref ErrorDefinitions
* @sa Live(), Freeze()
*/
LVSTATUS SetLiveParam(U32BIT Mode);
/** Puts the camera in 'live' mode.
* Puts the camera in 'live' mode, that means the image flow coming from the
* camera is directly placed in the selected memory at the actual camera ROI
* position. \n
* Before making a camera live, this has to be activated; take note
* that when issuing a Freeze() command the camera is still active
* and a further Live() can be called without re-preparing the hardware.\n
* The Live() function can be synchronized on some input signals.\n
* The Live() functionality may be affected by parameters set through the
* SetLiveParam() method with parameter Clive_NoConnCheck which allows Live()
* and Freeze() operations on cameras not physically connected to the grabber
* or with not stable video timing.
* @param Mode One of these values:
* @code
* SY_None - No Synchronization required
* SY_Field_0 - Synchronize with the start of field 0
* SY_Field_1 - Synchronize with the start of field 1
* SY_Frame - Synchronize with the start of frame
* SY_VSync - Synchronize with the vertical sync pulse
* @endcode
* This value can be OR-ed with one of the
* @ref LiveFreeze_Target "LiveFreeze_Target" definitions to select
* the target to be lived.
* @return @ref ErrorDefinitions
* @sa LvGrabberNode::ActivateCamera(), LvROI, Freeze(), SetLiveParam()
*/
LVSTATUS Live(U32BIT Mode);
/** Puts the camera in 'freeze' mode.
* Puts the camera or monitor in 'freeze' mode, that means the image flow is
* stopped and can no more be placed in the memory.\n
* The @a freeze function can be synchronized on some input signals.\n
* \n
* The @a Freeze functionality may be affected by parameters set through the
* SetLiveParam() method with parameter Clive_NoConnCheck which allows Live()
* and Freeze() operations on cameras not physically connected to the
* grabber or with not stable video timing.
*
* @param Mode One of these values:
* @code
* SY_None - No Synchronization required
* SY_Field_0 - Synchronize with the start of field 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -