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

📄 dtl.h

📁 AB_5000_PLC以太网通讯动态连接库
💻 H
📖 第 1 页 / 共 5 页
字号:
#define DTL_VERSION_SIZE1	(sizeof(sVERSION) - (size_t)&(((sVERSION*)0)->dwVersion))

/**********
 * Drivers
 **********/
#define DTL_DRIVER_NAME_MAX	(16)
#define DTL_DRIVER_ALIAS_MAX	(16)
#define	DTL_MAX_DRIVERS		(16)

/* The function call DTL_DRIVER_OPEN requires a driver identifier and driver name parameter.
 * This function binds the identifier to the name, permitting subsequent DTL_C_DEFINE calls
 * to use the identifier as an indirect referrence to the driver name.
 * Similarly, the identifier is used as an indirect reference to the driver name in DTSA structures.
 *
 * Below are the valid range of driver identifiers:
 */
#define	DTL_DRIVER_ID_MIN	(0)
/* Temporarily disable large id range.
#define	DTL_DRIVER_ID_MAX	(DTL_GetRSLinxDriverID() - 1)
*/
#define	DTL_DRIVER_ID_MAX	(15)

/* Internal use only. */
#define DTL_DRIVER_INDEX_MIN	(DTL_DRIVER_ID_MIN + DTL_MAX_DRIVERS)
#define DTL_DRIVER_INDEX_MAX	(DTL_DRIVER_ID_MAX + DTL_MAX_DRIVERS)

/* Certain applications need to send packets to the RSLinx server, but not direct those packets to a particular RSLinx driver.
 * This definition (which translates to a function call) is used for that special identifier that will direct the packet to RSLinx.
 */
#define DTL_RSLINX_DRIVER_ID	(DTL_GetRSLinxDriverID())	/* Used in DTSA_AB_CIP_PATH to access internal RSLinx CIP objects */

/* In addition to being able to put driver identifiers in the DTL_C_DEFINE string and the DTSA structures
 * you can also use the driver handle directly in those places.
 * The driver handle is the dwHandle member of the DTLDRIVER structure that is returned from the DTL_DRIVER_LIST and DTL_DRIVER_LIST_EX functions.
 * When using the driver handle it is not neccessary to use perform the DTL_DRIVER_OPEN prior to making I/O calls with the handle.
 * If desirable however you may call DTL_DRIVER_OPEN using the handle as the driver identifier,
 * and doing so will offer your application the benifit of "informing" RSLinx that your application
 * is actively using that driver and that RSLinx should not permit the driver to be removed until
 * you call DTL_DRIVER_CLOSE on that handle.
 */


/* The definitions and structure used by DTL_DRIVER_LIST() to return information about drivers.
 *
 * These are the valid server type constants.
 * You will get one of the the DTL_SERVER_TYPE_xxx back from the DTL_GET_SERVER_TYPE_BY_DRIVER_NAME() call.
 */
#define	DTL_SERVER_TYPE_UNKNOWN	(0)
#define	DTL_SERVER_TYPE_WINLINX	(16)
#define	DTL_SERVER_TYPE_RSLINX	(32)
#define	DTL_SERVER_TYPE_GWLINX	(0x0100 + DTL_SERVER_TYPE_RSLINX)

/* Internal definitions. */
#define DTL_SERVER_NAME_MAX	(64)
#define DTL_MACHINE_NAME_MAX	(64)

/* If you call DTL_DRIVER_LIST() you may want to consider switching to DTL_DRIVER_LIST_EX().
 * The differences are:
 *	1. You can tell DTL_DRIVER_LIST_EX() how many DTLDRIVER structures your block of memory can hold.
 *	   To do this you set the dwNumDrivers parameters prior to making the call.
 *	2. DTL_DRIVER_LIST_EX() fetches a new list of drivers from the Linx server whereas DTL_DRIVER_LIST() reads a cached list.
 *
 * If you do change to DTL_DRIVER_LIST_EX() then you may also want to consider using a run-time check for the largest number
 * of drivers available instead of the constant DTL_MAX_DRIVERS.
 * The run-time check is made by calling DTL_MaxDrivers(), then allocating space for that many driver structures, e.g.:
 *		DTLDRIVER* pDrivers = (DTLDRIVER*)malloc(DTL_MaxDrivers() * sizeof(DTLDRIVER));
 */

/* Structure filled in by the DTL_DRIVER_LIST call. */
typedef struct dtldriver
{
	WORD	wType;		// The type of this structure.
#		define	DTL_DVRLIST_TYPE2	(2)
	WORD	wLength;	// The size of the rest of this structure.
				// See below for constant DTL_DVRLIST_SIZE2.
	WORD	wMfgMask;       // Bitmap indicating supported manufacturer(s)
#		define	DTL_MFG_AB		(1)
	WORD	wNetworkType;   // Network type code (DHTYPE_DHP, DHTYPE_INET, etc.)
#		define	DTL_NETTYPE_DH		(1)
#		define	DTL_NETTYPE_DHP		(2)
#		define	DTL_NETTYPE_485		(4)
#		define	DTL_NETTYPE_DHPKA5	(8)
#		define	DTL_NETTYPE_ENET	(16)
#		define	DTL_NETTYPE_CNET	(64)
#		define	DTL_NETTYPE_ICP		(128)
#		define	DTL_NETTYPE_DNET	(256)
#		define	DTL_NETTYPE_DF1		(512)
	WORD	wDriverID;      // Type code for the driver instance itself
	WORD	wDstDriverID;   // Type code for the final driver to which the driver instance
                                //   is connected; normally the same as wDriverID, but may be
                                //   different if this driver is a client of a server's driver
#		define	DTL_DVRTYPE_PLC_OR_KF2	(0xA3)	// Direct connection to PLC or connection to KF2.
#		define	DTL_DVRTYPE_SLC_OR_KF3	(0xCC)	// Direct connection to SLC or connection to KF3.
#		define	DTL_DVRTYPE_KFC		(0xDB)	// Connection to KFC.
#		define	DTL_DVRTYPE_LINX_CLIENT	(0x16)	// WinLinx or RSLinx client driver connected to WinLinx or RSLinx server.
#		define	DTL_DVRTYPE_ETHERNET	(0x1C)	// Ethernet.
#		define	DTL_DVRTYPE_KT_DHP	(0xBB)	// 1784-KT on DH+.
#		define	DTL_DVRTYPE_PCMK_DHP	(0x9D)	// 1784-PCMK on DH+.
#		define	DTL_DVRTYPE_PCMK_DH485	(0xEE)	// 1784-PCMK on DH485.
#		define	DTL_DVRTYPE_KTX_DHP	(0xFD)	// 1784-KTX on DH+.
#		define	DTL_DVRTYPE_KTX_DH485	(0xDA)	// 1784-KTX on DH485.
#		define	DTL_DVRTYPE_KTC_CNET	(0xE1)	// 1784-KTC.
#		define	DTL_DVRTYPE_VLINK	(0x5E)	// RSLinx Virtual Link driver.
#		define	DTL_DVRTYPE_APP_INTFC	(0x3C)	// WinLinx AutoRouter/App Interface driver.
#		define	DTL_DVRTYPE_PIC		(0xCE)	// 1747-PIC.
#		define	DTL_DVRTYPE_SOFT5	(0x14)	// Soft 5.
#		define	DTL_DVRTYPE_EMU5	(0x0F)	// PLC-5 Emulator.
#		define	DTL_DVRTYPE_EMU500	(0x13)	// SLC-500 Emulator.
#		define  DTL_DVRTYPE_PCC_CNET (0x104) // 1784-PCC
	DWORD	dwHandle;       // Handle to be used in LINX_SEND_PACKET commands
	DWORD	dwStation;      // Driver's own station address on its network
	DWORD	dwMaxStation;   // Maximum station address on driver's network
	WORD	wCapabilities;  // Bitmap of device capabilities:
#       define  DTL_DRIVER_M_REMOTE      (0x0001)  // Supports offlink routes
#       define  DTL_DRIVER_M_NODETABLE   (0x0002)  // Has a node table
#       define  DTL_DRIVER_M_UNSOLICITED (0x0004)  // Can generate unsolicited messages
	WORD	wMTU;           // Maximum Transmission Unit on the driver's network
	char	szDriverName[DTL_DRIVER_NAME_MAX];
	char	szDriverAlias[DTL_DRIVER_ALIAS_MAX];
	BYTE	bAddrRadix;     // Station address radix (8, 10, etc.)
	BYTE	bReserved[3];   // Padding to 64 bytes
} DTLDRIVER, *PDTLDRIVER;
#define DTL_DVRLIST_SIZE2	(sizeof(DTLDRIVER) - (size_t)&(((DTLDRIVER*)0)->wMfgMask))

/* Structure filled in by the DTL_DRIVER_LIST call.
 * If you seed the wType with the value DTL_DVRLIST_TYPE_EX
 * then you will be given the structure below in your reply.
 */
typedef struct dtldriver_ex
{
	WORD	wType;		// The type of this structure.
#		define	DTL_DVRLIST_TYPE_EX	(0x010f)
	WORD	wLength;	// The size of the rest of this structure.
				// See below for constant DTL_DVRLIST_SIZE2.
	WORD	wMfgMask;       // Bitmap indicating supported manufacturer(s)
	WORD	wNetworkType;   // Network type code (DHTYPE_DHP, DHTYPE_INET, etc.)
	WORD	wDriverID;      // Type code for the driver instance itself
	WORD	wDstDriverID;   // Type code for the final driver to which the driver instance
                                //   is connected; normally the same as wDriverID, but may be
                                //   different if this driver is a client of a server's driver
	DWORD	dwHandle;       // Handle to be used in LINX_SEND_PACKET commands
	DWORD	dwStation;      // Driver's own station address on its network
	DWORD	dwMaxStation;   // Maximum station address on driver's network
	WORD	wCapabilities;  // Bitmap of device capabilities:
	WORD	wMTU;           // Maximum Transmission Unit on the driver's network
	char	szServerName[DTL_SERVER_NAME_MAX];
	char	szDriverName[DTL_DRIVER_NAME_MAX];
	char	szDriverAlias[DTL_DRIVER_ALIAS_MAX];
	BYTE	bAddrRadix;     // Station address radix (8, 10, etc.)
	BYTE	bReserved[3];   // Padding to 64 bytes
} DTLDRIVER_EX, *PDTLDRIVER_EX;
#define DTL_DVRLIST_SIZE_EX	(sizeof(DTLDRIVER_EX) - (size_t)&(((DTLDRIVER_EX*)0)->wMfgMask))
#pragma pack(pop)

/*-------------------------- function definitions  ---------------------*/

#ifdef __cplusplus
extern "C" {
#endif

typedef int  (DTL_CALLBACK *DTL_REPORT_PROC)(unsigned long,REPORT_UDC LIBPTR*);
typedef void (DTL_CALLBACK *DTL_IO_CALLBACK_PROC)(unsigned long,unsigned long);
typedef int  (DTL_CALLBACK *DTL_CIP_CONNECTION_PACKET_PROC)(unsigned long,
	unsigned long,unsigned char LIBPTR*,unsigned long);
typedef int  (DTL_CALLBACK *DTL_CIP_CONNECTION_STATUS_PROC)(unsigned long,
	unsigned long,unsigned long,unsigned char LIBPTR*,unsigned long);
typedef int  (DTL_CALLBACK *DTL_CIP_APPLICATION_CONNECT_PROC)(unsigned long,
	unsigned long,unsigned long,unsigned char LIBPTR*,
	DTL_CIP_TRANSPORT_CONNECTION LIBPTR*);
typedef int  (DTL_CALLBACK *DTL_CIP_APPLICATION_SERVICE_PROC)(unsigned long,
	unsigned long,unsigned long,unsigned char,unsigned char LIBPTR*,
	unsigned char LIBPTR*,unsigned long);

DWORD LIBMEM DTL_MaxDrivers(void);
long LIBMEM DTL_GetRSLinxDriverID(void);
DTL_RETVAL LIBMEM DTL_C_CONNECT(unsigned long,const char LIBPTR*,void (DTL_CALLBACK *)(unsigned long LIBPTR*,unsigned long LIBPTR*,unsigned long LIBPTR*));
DTL_RETVAL LIBMEM DTL_C_DEFINE ( unsigned long LIBPTR *, const char LIBPTR * );
DTL_RETVAL LIBMEM DTL_CANCEL_RECV ( void );
DTL_RETVAL LIBMEM DTL_CHANGE_MODE (DTSA_TYPE LIBPTR *, unsigned long );
DTL_RETVAL LIBMEM DTL_CIP_APPLICATION_REGISTER ( unsigned long LIBPTR *, unsigned long,
						 DTL_CIP_IDENTITY LIBPTR *, unsigned long,
						 void LIBPTR *, unsigned int, unsigned int,
						 DTL_CIP_APPLICATION_SERVICE_PROC,
						 DTL_CIP_APPLICATION_CONNECT_PROC,
						 unsigned long );
DTL_RETVAL LIBMEM DTL_CIP_APPLICATION_UNREGISTER ( unsigned long, unsigned long );
DTL_RETVAL LIBMEM DTL_CIP_CONNECTION_ACCEPT ( unsigned long, unsigned long,
					      DTL_CIP_TRANSPORT_CONNECTION LIBPTR *,
					      unsigned char LIBPTR *, unsigned long,
					      DTL_CIP_CONNECTION_PACKET_PROC,
					      DTL_CIP_CONNECTION_STATUS_PROC,
					      unsigned long );
DTL_RETVAL LIBMEM DTL_CIP_CONNECTION_CLOSE ( unsigned long, unsigned long );
DTL_RETVAL LIBMEM DTL_CIP_CONNECTION_OPEN ( DTSA_TYPE LIBPTR *, unsigned char LIBPTR *,
					    unsigned long LIBPTR *, unsigned long,
					    DTL_CIP_TRANSPORT_CONNECTION LIBPTR *,
					    DTL_CIP_CONNECTION_PACKET_PROC,
					    DTL_CIP_CONNECTION_STATUS_PROC,
					    unsigned long );
DTL_RETVAL LIBMEM DTL_CIP_CONNECTION_REJECT ( unsigned long, int, unsigned char LIBPTR *,
					      unsigned long );
DTL_RETVAL LIBMEM DTL_CIP_CONNECTION_SEND ( unsigned long, unsigned long,
					    unsigned char LIBPTR *, unsigned long );
DTL_RETVAL LIBMEM DTL_CIP_MESSAGE_REPLY ( unsigned long, int,
					  unsigned char LIBPTR *, unsigned long,
					  unsigned char LIBPTR *, unsigned long );
DTL_RETVAL LIBMEM DTL_CIP_MESSAGE_SEND_CB ( DTSA_TYPE LIBPTR *, int,
					    unsigned char LIBPTR *,
					    unsigned char LIBPTR *, unsigned long,
					    unsigned char LIBPTR *, unsigned long LIBPTR *,
					    unsigned char LIBPTR *, unsigned long LIBPTR *,
					    unsigned long, DTL_IO_CALLBACK_PROC,
					    unsigned long );
DTL_RETVAL LIBMEM DTL_CIP_MESSAGE_SEND_W ( DTSA_TYPE LIBPTR *, int,
					   unsigned char LIBPTR *,
					   unsigned char LIBPTR *, unsigned long,
					   unsigned char LIBPTR *, unsigned long LIBPTR *,
					   unsigned char LIBPTR *, unsigned long LIBPTR *,
					   unsigned long LIBPTR *, unsigned long );
DTL_RETVAL LIBMEM DTL_CLEAR_FAULTS (DTSA_TYPE LIBPTR *, unsigned long );
DTL_RETVAL LIBMEM DTL_CLEAR_MEMORY (DTSA_TYPE LIBPTR * );
DTL_RETVAL LIBMEM DTL_CLOCK ( void );
DTL_RETVAL LIBMEM DTL_CLR_MASK ( unsigned long LIBPTR *, unsigned long );
DTL_RETVAL LIBMEM DTL_CLR_WID ( unsigned long );
DTL_RETVAL LIBMEM DTL_COMPARE ( DTSA_TYPE LIBPTR *, DTSA_TYPE LIBPTR *,
				unsigned long, unsigned long LIBPTR *,
				unsigned long, unsigned long );
DTL_RETVAL LIBMEM DTL_COMPARE_CB ( DTSA_TYPE LIBPTR *, DTSA_TYPE LIBPTR *,
				   unsigned long, unsigned long,
				   DTL_IO_CALLBACK_PROC, unsigned long );
DTL_RETVAL LIBMEM DTL_COMPARE_RCB ( DTSA_TYPE LIBPTR *, DTSA_TYPE LIBPTR *,
				    unsigned long, unsigned long,
				    DTL_REPORT_PROC, DTL_IO_CALLBACK_PROC,
				    unsigned long );
DTL_RETVAL LIBMEM DTL_COMPARE_W ( DTSA_TYPE LIBPTR *, DTSA_TYPE LIBPTR *,
				  unsigned long, unsigned long LIBPTR *,
				  unsigned long );
DTL_RETVAL LIBMEM DTL_DOWNLOAD ( DTSA_TYPE LIBPTR *, DTSA_TYPE LIBPTR *,
				 unsigned long, unsigned long LIBPTR *,
				 unsigned long, unsigned long );
DTL_RETVAL LIBMEM DTL_DOWNLOAD_CB ( DTSA_TYPE LIBPTR *, DTSA_TYPE LIBPTR *,
				    unsigned long, unsigned long,
				    DTL_IO_CALLBACK_PROC, unsigned long );
DTL_RETVAL LIBMEM DTL_DOWNLOAD_RCB ( DTSA_TYPE LIBPTR *, DTSA_TYPE LIBPTR *,
				     unsigned long, unsigned long,
				     DTL_REPORT_PROC, DTL_IO_CALLBACK_PROC,
				     unsigned long );
DTL_RETVAL LIBMEM DTL_DOWNLOAD_W ( DTSA_TYPE LIBPTR *, DTSA_TYPE LIBPTR *,
				   unsigned long, unsigned long LIBPTR *,
				   unsigned long );
DTL_RETVAL LIBMEM DTL_DEF_AVAIL ( unsigned long LIBPTR *);
DTL_RETVAL LIBMEM DTL_DISCONNECT ( unsigned long );
void LIBMEM DTL_ERROR ( unsigned long );
void LIBMEM DTL_ERROR_S ( unsigned long, char LIBPTR *, int );
void LIBMEM DTL_ERROR_P( unsigned long, unsigned long );
#if defined(_INC_STDIO)
void LIBMEM DTL_ERROR_F(FILE LIBPTR*,unsigned long);
void LIBMEM DTL_ERROR_FP(FILE LIBPTR*,unsigned long,unsigned long);
#else
void LIBMEM DTL_ERROR_F();
void LIBMEM DTL_ERROR_FP();
#endif
DTL_RETVAL LIBMEM DTL_FCREATE ( unsigned long );
DTL_RETVAL LIBMEM DTL_FDELETE ( unsigned long );
DTL_RETVAL LIBMEM DTL_FSIZE ( unsigned long, unsigned long LIBPTR * );
DTL_RETVAL LIBMEM DTL_GET_3BCD ( unsigned char LIBPTR *,
				 unsigned long LIBPTR * );
DTL_RETVAL LIBMEM DTL_GET_4BCD ( unsigned char LIBPTR *,
				 unsigned long LIBP

⌨️ 快捷键说明

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