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

📄 config.h

📁 工业组态软件modbus驱动源代码, 包括帮助文件.共享.
💻 H
字号:
/* $Header: "%n Ver=%v  %f  LastEdit=%w  Locker=%l" */
/* "CONFIG.H Ver=2  24-Nov-97,15:51:14  LastEdit=JIMV  Locker=***_NOBODY_***" */
/***********************************************************************\
*                                                                       *
*       Copyright Wonderware Software Development Corp. 1989-1997       *
*                                                                       *
*               ThisFileName="L:\ww\dde_serv\src\udsample\config.h"     *
*               LastEditDate="1997 Nov 24  17:51:00"                    *
*                                                                       *
\***********************************************************************/

#ifndef H__config
#define H__config

#include "ntconv.h"
#include "protypes.h"
#include "wwcomdlg.h"

#ifdef __cplusplus
extern "C" {
#endif

extern  HANDLE  hInst;          /* handle of instance */
extern  HWND    hWndParent;     /* handle of parent window */
extern  char    szCmdLine[];    /* command line and parameters */
extern  char    szCfgPath[];    /* configuration path */

#ifdef __cplusplus
}
#endif

/** These are the file names to be used for the configuration file.
    The configuration file keeps information about the comm ports and
    the nodes defined for this protocol driver.

    In addition to the configuration file name, we define the name for the
    backup configuration file.  Before we update the configuration file, we
    rename the previous configuration file with the backup name provided
    here.

    When updating the configuration file care is taken not to destroy the
    old configuration file before we know that the updated file has been
    safely written.  To accomplish this, the updated file is written first
    with a temp file name.  If this is successful, the old configuration
    file is renamed to the backup name and the new configuration file is
    renamed to the real file name.
*/

/*
#define configFileName          "UDSAMPLE.CFG"
#define configBackupName        "UDSAMPLE.CBK"
#define configTempName          "UDSAMPLE.C$$"
*/

#define configFileName          GetString(STRUSER+107)
#define configBackupName        GetString(STRUSER+108)
#define configTempName          GetString(STRUSER+109)

/*************************************************************************/
/** Defines for configuration file contents:

    These values are used to verify that the configuration file is for
    this server, and to identify which version of the configuration file
    is being used.  Whenever the format of the configuration file or of
    the configuration structures is changed, the value CFGVER should be
    updated, and some way should be provided for converting old-format
    files to the current format.  This is not necessary if the configuration
    file consists of ASCII commands, identified by using the version number
    0x54584554, which corresponds to the string "TEXT".
*/

#define FMAGIC  0x55474643L     /* "CFGU" */
#define CFGVER  2
#define CFGTXT  0x54584554      /* "TEXT" */
#define PadSize 36

/* file version header -- define this structure as needed */

typedef struct tagFILEVER {
    unsigned long fv_magic;
    unsigned long fv_version;
    char          fv_date [10];
    char          fv_time [10];
    char          fv_pad [PadSize];     /* pad to 64 bytes */
} FILEVER;
typedef FILEVER *FILEVERP;

/***********************************************************************/
/** ComPort configuration structure
    This data structure is used by WriteBoardCfgASCII() to store
    the configuration settings for a comport with the port ID
    for the serial port **/

typedef struct tagCOMPORT_CFG_WITHID {
    int          channelID;    /* space for comport ID */
    WW_CP_PARAMS comport;      /* standard comport structure */
} COMPORT_CFG_WITHID;
typedef COMPORT_CFG_WITHID FAR *LPCOMPORT_CFG_WITHID;

/***********************************************************************/
/* number of serial ports available */

#define   NUM_COMPORTS   32     /* total number of serial ports handled */

#ifdef WIN32
#define   MAX_COMPORT    32     /* number of serial ports on Win32 platform */
#else
#define   MAX_COMPORT     9     /* number of serial ports on Win16 platform */
#endif

/***********************************************************************/
/** Board configuration structure
    This data structure is used by WriteBoardCfgStruct() to store
    the configuration settings for a board in a disk file and by
    ReadBoardCfgStruct() to retrieve them. **/

typedef struct tagBOARD_CFG {
    CHAINLINK       cp_chainLink;
    DWORD           cp_channelID;
    char            cp_name[33];
    WORD            cp_memSegment;
    WORD            cp_ioAddr;
    short           cp_replyTimeout;
} BOARD_CFG;
typedef BOARD_CFG FAR *LPBOARD_CFG;

/***********************************************************************/
/*  These are the default settings for the board.
    They should be changed to suit the protocol being supported.
*/

#define SD_MEMORY_RANGE         "(D000 - DC00 by 400)"
#define DEFAULT_REPLY_TIMEOUT   3       /* seconds */
#define DEFAULT_UPDATE_PERIOD   1000    /* milliseconds */
#define DEFAULT_IOBASE          0x250
#define DEFAULT_IRQ             3
#define DEFAULT_SEGMENT         0xD000

/***********************************************************************/
/** Topic configuration structure
    This data structure is used by WriteTopicCfgStruct() to store
    the configuration settings for a Topic in a disk file and by
    ReadTopicCfgStruct() to retrieve them. **/

typedef struct tagTOPIC_CFG {
    CHAINLINK       tc_chainLink;
    DWORD           tc_channelID;
    char            tc_name[33];
    BYTE            tc_topicAddress;
    WORD            tc_coilReadSize;
    WORD            tc_regReadSize;
    LONG            tc_updateInterval;
} TOPIC_CFG, FAR *LPTOPIC_CFG;

/*************************************************************************/
/*  This data structure is used by ValidateTopic() to convey all of the
    pertinent information about a topic to the caller.

    It should be changed to suit the protocol being supported.
*/

typedef struct tagSTNPARAM {
    char        spChannelName [33];     /* name for I/O channel         */
    char        spConfigString [20];    /* e.g. COM1:9600,n,8,1         */
    WORD        spMemSegment;           /* memory segment for board     */
    WORD        spIoAddr;               /* I/O address for board        */
    int         spReplyTimeout;         /* timeout (in sec)             */
    WORD        spCoilReadSize;         /* coil read block size         */
    WORD        spRegReadSize;          /* register read block size     */
    DWORD       spUpdatePeriod;         /* update frequency (in msec)   */
    BYTE        spTopicID;              /* Slave ID                     */
} STNPARAM;
typedef STNPARAM FAR *LPSTNPARAM;

/***********************************************************************/
/** This data structure is used by ValidatePoint() to convey all of the
    pertinent information about a point to the caller.

    It should be changed to match the protocol being supported.
    Anything that distinguishes one point name from another should be
    reflected in the structure of the symbol table entry for the point.
    Examples:  point address, memory segment, data length, data subtype.

    Note:  In the comments below, a "cell" refers to an indivisible
           unit of data.  For example, a device may be addressed as
           16-bit words, i.e. 2 bytes per "cell".  It may also be possible
           to group cells into larger chunks, such as DWORDS, real numbers,
           strings, etc.  So a count of the number of "cells" would be needed.
**/

typedef struct tagPPS {
    WORD        ppsAlias;          /* address of point */
    WORD        ppsBitPos;         /* bit position within a point "cell" */
    WORD        ppsNumBytes;       /* number of bytes per "cell" */
    PTTYPE      ppsDdeType;        /* data type */
    BYTE        ppsCount;          /* number of "cells" */
    BYTE        ppsPlcDataType;    /* data segment for device, e.g. address group */
    BYTE        ppsSubType;        /* data subtype, e.g. signed, BCD, etc. */
} PPS;
typedef PPS FAR *LPPPS;

/***********************************************************************/
/** definition of buffered file for fast access with character I/O **/

typedef struct tagBUFFERED_FILE {
    HFILE FileH;                 /* file handle                         */
    LPSTR FileName;              /* pointer to file name                */
    LPSTR FileBuf;               /* pointer to buffer for handling file */
    unsigned int BufSize;        /* size of buffer                      */
    unsigned int BufPtr;         /* location in buffer                  */
    /* the following variables are used for buffered read  */
    unsigned int MaxCharsToRead; /* end of buffer contents              */
    BOOL more_data;              /* TRUE if more chars left             */
    BOOL AllBlocksRead;          /* TRUE if all chunks read             */
    BOOL AllCharsRead;           /* TRUE if all chars read              */
    int  error;                  /* non-zero if last operation failed   */
} BUFFERED_FILE;

#endif

⌨️ 快捷键说明

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