📄 port.h
字号:
#ifndef ___PORT_H
#define ___PORT_H
#include <dsylib.h>
#include <string.h>
#include <camopt.h>
#include <lvpackon.h>
LVDSYCLASS LvNode;
LVDSYCLASS LvAddressNode;
enum _PortMsgType {
PM_ActivateConnection = 100,
PM_DeactivateConnection,
PM_ChangeConfiguration,
PM_Connect,
PM_DestroyConnection,
PM_Command
};
enum _CmdResCode {
Crc_Done,
Crc_NotProcessed,
Crc_PassNext,
Crc_DonePassNext,
Crc_BadParameter,
Crc_Error
};
#define MaxColorCmp 4
typedef struct _LVEXPSTRUCT _tagLvPortSigMap {
U8BIT Support ;
U16BIT Video_1 ;
U16BIT Video_2 ;
U16BIT Video_3 ;
U16BIT Video_4 ;
U16BIT CSync ;
U16BIT HSync ;
U16BIT VSync ;
U16BIT PxClk ;
U16BIT Trg_1 ;
U16BIT Trg_2 ;
U16BIT FeedBack;
U16BIT DataValid;
} LvPortSigMap;
// To be modified => CameraName field
typedef struct _LVEXPSTRUCT _tagLvDFlowPortCfg {
char CameraName[30];
HCONNECTION hConnection;
int ConnId;
U8BIT ModuleNr;
U8BIT SyncNr;
U8BIT VideoStream;
U8BIT Target;
struct _LVEXPSTRUCT _tagImageFmt {
U16BIT Hiw;
U16BIT Viw;
U8BIT ArH;
U8BIT ArV;
U16BIT DefX;
U16BIT DefY;
} ImageFmt;
struct _LVEXPSTRUCT _tagPixelFmt {
U8BIT Depth;
U8BIT NrComponent;
U8BIT ColorPerComponent[MaxColorCmp];
U8BIT BitPerComponent[MaxColorCmp];
U8BIT DigitalFormat;
} PixelFmt;
struct _LVEXPSTRUCT _tagAnalogInfo {
U16BIT VideoType;
U8BIT ColorCoding;
} AnalogInfo;
struct _LVEXPSTRUCT _tagSync {
U8BIT Mode;
U32BIT CHIn;
U32BIT VIn;
U8BIT VCountHold;
U8BIT Flags;
} Sync;
struct _LVEXPSTRUCT _TagTiming {
U16BIT Type;
U16BIT Hll;
U16BIT Hsw;
U16BIT His;
U16BIT Hie;
U16BIT Hbe;
U16BIT Hbs;
U16BIT HDly;
U16BIT Fpf;
U16BIT Lpf;
U16BIT Vsw;
U16BIT Vis;
U16BIT Vie;
U16BIT Vbe;
U16BIT Vbs;
U16BIT VDly;
float Smp;
float SmpHz;
} Timing;
LvCameraSignal Signal[CSig_Last];
U8BIT ScanMode;
// Added 14.09.99
S32BIT CamOption[_MaxCamOpt];
// Added 05.05.01
LvPortSigMap SigMap;
} LvDFlowPortCfg;
typedef struct _LVEXPSTRUCT _tagLvAFlowPortCfg {
char CameraName[30];
HCONNECTION hConnection;
int ConnId;
U8BIT ModuleNr;
int MaxSyncLevel;
int VideoSel;
int SyncSel;
} LvAFlowPortCfg;
typedef struct _LVEXPSTRUCT _tagLvAccessPortCfg {
char CameraName[30];
HCONNECTION hConnection;
int ConnId;
U8BIT ModuleNr;
U8BIT IsCamera;
LvAddressNode *TheAddress;
LvROIInfo WinInfo;
} LvAccessPortCfg;
typedef struct _LVEXPSTRUCT _tagLvIdPortCfg {
U32BIT NodeType;
int Id;
LvNode *Node;
} LvIdPortCfg;
typedef union _LVEXPSTRUCT LvPortCfg {
LvDFlowPortCfg DFlow;
LvAFlowPortCfg AFlow;
LvAccessPortCfg Access;
LvIdPortCfg Id;
} LvPortCfg;
enum _PortType {
PT_NoPort,
PT_FirstPortType,
PT_AnalogFlow=PT_FirstPortType,
PT_DigitalFlow,
PT_Access,
PT_VideoBus,
PT_LastPortType,
PT_FirstInternalPortType=100,
PT_Id=PT_FirstInternalPortType,
PT_LastInternalPortType
};
enum _PortDirection {
PD_Out,
PD_In
};
LVDSYCLASS LvPort {
private:
protected:
int DataSize;
int Type;
int Id;
int InternalId;
LvPort *PortTo;
LvPort *NextPort;
LvNode *ParentNode;
int Active;
int Direction;
LvPortCfg PortCfg;
LVSTATUS SendMessageToNode(int MsgType, U16BIT wParam=0, LVRAWPTR lParam=0);
LVSTATUS DispatchMessage(int MsgType, U16BIT wParam=0, LVRAWPTR lParam=0);
// Other port interface
int Activate(char Dummy, U16BIT wParam, LVRAWPTR lParam);
int Deactivate(char Dummy, U16BIT wParam, LVRAWPTR lParam);
int Destroy(char Dummy);
LVSTATUS PassCommand(char Dummy, int CmdId, int wParam, LVRAWPTR lParam, LVSTATUS *RetVal);
LVSTATUS ChangeCfg(void);
void AddToDestroyPortList(void);
char Name[41];
public:
static int GetUniqueId(void);
int Activate(U16BIT wParam, LVRAWPTR lParam);
int Deactivate(U16BIT wParam, LVRAWPTR lParam);
int Destroy(void);
BOOL IsActive(void) { return Active; }
BOOL IsConnected(void) { return PortTo!=NULL; }
BOOL IsInternalPort(void) { return GetType()>=PT_FirstInternalPortType; }
int GetId(void) { return Id; }
void SetId(int NewId) { Id=NewId; }
char *GetName(void) { return Name; }
void SetName(char *NewName) { NewName ? strncpy(Name, NewName, sizeof(Name)) : 0; }
int GetInternalId(void) { return InternalId; }
void SetInternalId(int NewId) { InternalId=NewId; }
int GetType(void) { return Type; }
void SetType(int NewType=PT_DigitalFlow) { Type=NewType; }
int GetDirection(void) { return Direction; }
void SetDirection(int NewDir) { Direction=NewDir; }
int Connect(LvPort *Port);
void SetNextPort(LvPort *NPort) { NextPort=NPort; }
LvPort *GetNextPort(void) { return NextPort; }
BOOL IsPassThrough(void) { return NextPort!=NULL; }
int SetToPort(LvPort *ToPort);
LvPort *GetToPort(void) { return PortTo; }
BOOL IsFree(void) { return PortTo==NULL; }
LvNode *GetParentNode(void) { return ParentNode; }
LvPortCfg *GetConfiguration(void) { return &PortCfg; }
LVSTATUS SetConfiguration(LvPortCfg *NewCfg);
LVSTATUS SetConfiguration(LvPort *Port) { return Port ? SetConfiguration(Port->GetConfiguration()) : DSY_E_InvalidPort; }
LVSTATUS PassCommand(int CmdId, int wParam, LVRAWPTR lParam, LVSTATUS *RetVal);
LvPort(LvNode *Node, int aType, int anId, int aDirection, LvPort *ToPort=NULL);
~LvPort();
};
#include <lvpackof.h>
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -