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

📄 db_obj.h

📁 基于EthernetIP协议的应用程序,可以读取AB公司Controllogix系列Ethernetip协议PLC数据. 此软件代码可用于工业控制.
💻 H
字号:
/****************************************************************************
*****************************************************************************
**
** File Name
** ---------
**
** DB_OBJ.H
**
*****************************************************************************
*****************************************************************************
**
** Description
** -----------
**
** Private interfaces for the Debug Object.
**
*****************************************************************************
*****************************************************************************
**
** Source Change Indices
** ---------------------
**
** Porting Changes
**
** Porting: <none>0----<major>         Customization: <none>----4<major>
**
*****************************************************************************
*****************************************************************************
**
** Services List
** -------------
**
**  db_ObjectTask             - Object request processing task
**  db_ProcessPacket          - Process request packet and build response
**  db_TradeComBuf            - Trade rq combuf for buigger response combuf
**
*****************************************************************************
*****************************************************************************
**                                                                         **
** ETHERNET/IP EXAMPLE CODE                                                **
** COPYRIGHT (c) 2000-2005 ODVA (Open DeviceNet Vendor Association)		   **
**						   & ControlNet International Ltd.                 **
**                                                                         **
** All rights reserved, except as specifically licensed in writing.        **
** Use of the Ethernet/IP Example Protocol Software is subject to          **
** ODVA's and ControlNet International's Terms of Use Agreement.           **
** The following work constitutes example program code and is intended     **
** merely to illustrate useful programming techniques.  The user is        **
** responsible for applying the code correctly.  The code is provided      **
** AS IS without warranty and is in no way guaranteed to be error-free.    **
**                                                                         **
*****************************************************************************
*****************************************************************************
*/

/****************************************************************************
*****************************************************************************
**
** Change Log
** ----------
**
**
*****************************************************************************
*****************************************************************************
*/

#ifndef DB_OBJ_H
#define DB_OBJ_H



/****************************************************************************
*****************************************************************************
**
** Network object interface - Constants
**
*****************************************************************************
*****************************************************************************
*/

/* None defined */



/****************************************************************************
*****************************************************************************
**
** Network object interface - Packets
**
*****************************************************************************
*****************************************************************************
*/

/* None defined */



#ifdef DEBUG_OBJECT
/****************************************************************************
*****************************************************************************
**
** Private internal object interface - Constants
**
*****************************************************************************
*****************************************************************************
*/

/*---------------------------------------------------------------------------
**
** DB_MAX_READ_BUFFER
**
** Max size of response to a read request.
** CNet specific (max packet size less packet & UCMM headers).
**
**---------------------------------------------------------------------------
*/

#define DB_MAX_READ_BUFFER 498



/****************************************************************************
*****************************************************************************
**
** Private internal object interface - Enums
**
*****************************************************************************
*****************************************************************************
*/

/* None defined */



/****************************************************************************
*****************************************************************************
**
** Private internal object interface - Structures
**
*****************************************************************************
*****************************************************************************
*/

/*---------------------------------------------------------------------------
**
** db_DataType
**
** Internal data for the debug object.
**
**---------------------------------------------------------------------------
*/

typedef struct db_DataType
{
   DB_TrrblType  *pRqTrrbl;      /* Parking space for remote request       */
   UINT16         iSeqCount;     /* Sequence count for remote request      */
   GS_TimerType   xTimer;        /* Remote request watchdog timer          */
}
db_DataType;



/****************************************************************************
*****************************************************************************
**
** Public internal object interface - Tribbles
**
*****************************************************************************
*****************************************************************************
*/

/*---------------------------------------------------------------------------
**
** Union of pointers to all tribble types used by the Debug Object
** Helps to eliminate those unsightly type casts.
**
**---------------------------------------------------------------------------
*/

typedef union db_upsTrrblType
{
   GS_TrrblType              *Generic;
   CM_AppOpenCloseTrrblType  *AppOpen;
   CD_PacketTrrblType        *Packet;
   DB_TrrblType              *Debug;
}
db_upsTrrblType;



/****************************************************************************
*****************************************************************************
**
** Private internal object interface - Globals
**
*****************************************************************************
*****************************************************************************
*/

/* None defined */



/****************************************************************************
*****************************************************************************
**
** Private internal object interface - Services
**
*****************************************************************************
*****************************************************************************
*/

/*---------------------------------------------------------------------------
**
** db_ObjectTask()
**
** Request processing task for the Debug object.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    None
**
** Outputs:
**    None
**
** Usage:
**    GS_NewTask( db_ObjectTask()... );
**
**---------------------------------------------------------------------------
*/

EXTFUNC TASKRETURN db_ObjectTask( TASKPARAM );



/*---------------------------------------------------------------------------
**
** db_ProcessPacket()
**
** Process a single request packet.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pComBuf                 - Combuf containing request packet
**
** Outputs:
**    Return                  - Pointer to combuf containing reply packet
**
** Usage:
**    pComBufNew = db_ProcessPacket( pComBuf );
**
**---------------------------------------------------------------------------
*/

EXTFUNC CB_ComBufType* db_ProcessPacket( CB_ComBufType *pComBuf );



/*---------------------------------------------------------------------------
**
** db_TradeComBuf()
**
** Try to get a big enough combuf to hold the reply packet.
** If the trade in fails, build an error header in the old combuf.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    ppComBuf                - Pointer to pointer to request combuf
**    iSize                   - Size of reply data
**    bService                - Service of request (in case of error)
**
** Outputs:
**    Return                  - Success/failure status
**
** Usage:
**    if( dbTradeComBuf( &pComBuf, iSize ) != SUCCESS )...
**
**---------------------------------------------------------------------------
*/

EXTFUNC StatusType db_TradeComBuf( CB_ComBufType**  ppComBuf, UINT16 iSize, UINT8 bService );



#endif /* #ifdef DEBUG_OBJECT */
#endif  /* inclusion lock */

/****************************************************************************
**
** End of DB_OBJ.H
**
*****************************************************************************
*/

⌨️ 快捷键说明

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