📄 ci.h
字号:
GNU_PACKED CI_PacketTMinusType;
/*---------------------------------------------------------------------------
**
** CI_LePacketTuiType
**
** Format of the ControlNet TUI packet from a keeper.
**
**---------------------------------------------------------------------------
*/
typedef packet_struct CI_LePacketTuiType
{
/* CI_FixedTagHeaderType sHeader; */
LeUINT32 lLeCrc;
LeUINT16 iLeFlags;
UINT8 bKeeperMacId;
UINT8 bReserved;
LeUINT16 iLeNrVendorId; /* ID of who the network resource is */
LeUINT32 lLeNrSerialNumber; /* being held for */
LeUINT32 lLeNrClass;
LeUINT32 lLeNrInstance;
}
GNU_PACKED CI_LePacketTuiType;
/*---------------------------------------------------------------------------
**
** CI_PacketWamiType
**
** Format of ControlNet Wami LPacket.
**
**---------------------------------------------------------------------------
*/
typedef packet_struct CI_PacketWamiType
{
/* CI_FixedTagHeaderType sHeader; */
UINT8 bRequestMacId;
UINT8 bResponseMacId;
UINT8 abPad[ 6 ];
}
GNU_PACKED CI_PacketWamiType;
/****************************************************************************
**
** Services
**
*****************************************************************************
*/
/*---------------------------------------------------------------------------
**
** CI_ParseSegment()
** CI_ParseIoiSegment()
** CI_ParsePathSegment()
**
** Parse 1 segment from an IOI or path in a packet in a combuf.
** Return the segment type and value.
** Optionally strip the segment from the combuf after retrieving the info.
** GetIoiSegment & GetPathSegment adjust the appropriate size byte as well.
**
**---------------------------------------------------------------------------
**
** Inputs:
** pCombuf - Pointer to combuf containing message to parse
** piOffset - Pointer to variable containing offset into packet
** in buffer to start parsing at
** pbType - Pointer to variable to return segment type
** (with size bits removed)
** piValue - Pointer to variable to return segment value
** fStrip - Strip the segment after data retrieval
**
** Outputs:
** Return - CNet general return code from parsing
**
** Usage:
** bGRC = CI_ParseSegment( pCombuf, &iOffset, &bType, &iValue, TRUE );
** bGRC = CI_ParseIoiSegment( pCombuf, &bType, &iValue, TRUE );
** bGRC = CI_ParsePathSegment( pCombuf, &iOffset, &bType, &iValue, FALSE );
**
**---------------------------------------------------------------------------
*/
#define CI_ParseSegment( pComBuf, piOffset, pbType, piValue, fStrip ) \
ci_ParseSegment( (pComBuf), (piOffset), (pbType), (piValue), FALSE, (fStrip) )
#define CI_ParseIoiSegment( pComBuf, pbType, piValue, fStrip ) \
ci_ParseSegment( (pComBuf), NULL, (pbType), (piValue), TRUE, (fStrip) )
#define CI_ParsePathSegment( pComBuf, piOffset, pbType, piValue, fStrip ) \
ci_ParseSegment( (pComBuf), (piOffset), (pbType), (piValue), TRUE, (fStrip) )
/*---------------------------------------------------------------------------
**
** CI_ParseIoiClassInstance()
**
** Parse the class and instance from an IOI in a packet in a combuf.
**
**---------------------------------------------------------------------------
**
** Inputs:
** pCombuf - Pointer to combuf containing message to parse
** piClass - Pointer to variable to return class value
** piInstance - Pointer to variable to return instance value
**
** Outputs:
** Return - CNet general return code from parsing
**
** Usage:
** bGRC = CI_ParseIoiClassInstance( pCombuf, &iClass, &iInstance );
**
**---------------------------------------------------------------------------
*/
EXTFUNC UINT8 CI_ParseIoiClassInstance( CB_ComBufType *pComBuf,
UINT16 *piClass,
UINT16 *piInstance );
/*---------------------------------------------------------------------------
**
** CI_IoiPathSize()
**
** Returns size in bytes of the ControlNet packet Ioi or path.
**
**---------------------------------------------------------------------------
**
** Inputs:
** pComBuf - Pointer to combuf containing packet
** iOffset - Byte offset into packet of IOI or path
** 0 = IOI
** >0 = Path
**
** Outputs:
** Returns - the size of the IOI or path in bytes
**
** Usage:
** iSize = CI_IoiPathSize( pComBuf, 0 )
**
**---------------------------------------------------------------------------
*/
EXTFUNC UINT16 CI_IoiPathSize( CB_ComBufType *pComBuf, UINT16 iOffset );
/*---------------------------------------------------------------------------
**
** CI_PrependIoi()
**
** Prepend an request IOI header to the message in a combuf.
**
**---------------------------------------------------------------------------
**
** Inputs:
** pCombuf - Pointer to combuf containing message
** bServiceCode - Service code for IOI
** bClass - Class number to address message to
** iInstance - Instance number to address message to
** iExtraIOI - Extra words of IOI already in combuf
**
** Outputs:
** None
**
** Usage:
** CI_PrependIoi( pComBuf, CI_SC_GET_ATTR_ALL, ID_CLASS_NUMBER, 0, 1 );
**
**---------------------------------------------------------------------------
*/
EXTFUNC void CI_PrependIoi( CB_ComBufType *pComBuf,
UINT8 bServiceCode,
UINT8 bClass,
UINT16 iInstance,
UINT16 iExtraIOI );
/*---------------------------------------------------------------------------
**
** CI_PrependReplyHeader()
**
** Prepend a CIP message reply header to the message in a combuf.
**
**---------------------------------------------------------------------------
**
** Inputs:
** pCombuf - Pointer to combuf containing message
** bServiceCode - Service code for reply message
** bGenStatus - General status byte to insert in header
** iObjStatus - Object specific status (0 to not include in header)
**
** Outputs:
** None
**
** Usage:
** CI_PrependReplyHeader( pComBuf, bServiceCode, bGenStatus, iObjStatus );
**
**---------------------------------------------------------------------------
*/
EXTFUNC void CI_PrependReplyHeader( CB_ComBufType *pComBuf,
UINT8 bServiceCode,
UINT8 bGenStatus,
UINT16 iObjStatus );
/*---------------------------------------------------------------------------
**
** CI_PrependReplyHeaderWithExtendedERC()
**
** Prepend a CIP message reply header to the message in a combuf.
**
**---------------------------------------------------------------------------
**
** Inputs:
** pCombuf - Pointer to combuf containing message
** bServiceCode - Service code for reply message
** bGenStatus - General status byte to insert in header
** iERClength - Length of extended error code (a.k.a. ObjStatus)
** piERC - Pointer to extended error code information.
**
** Outputs:
** None
**
** Usage:
** CI_PrependReplyHeader( pComBuf, bServiceCode, bGenStatus, iERClength, &iERC );
**
**---------------------------------------------------------------------------
*/
EXTFUNC void CI_PrependReplyHeaderWithExtendedERC( CB_ComBufType *pComBuf,
UINT8 bServiceCode,
UINT8 bGenStatus,
UINT16 iERClength,
UINT16* piERC );
/*---------------------------------------------------------------------------
**
** CI_StripIoiPath()
**
** Strip off any remaining portions of an IOI or path in a packet.
**
**---------------------------------------------------------------------------
**
** Inputs:
** pCombuf - Pointer to combuf containing message to strip
** iOffset - Offset into packet
** 0 = IOI
** Odd = path without pad byte after size
** Even = path with pad byte after size
**
** Outputs:
** None
**
** Usage:
** CI_StripIoiPath( pCombuf, 0 );
**
**---------------------------------------------------------------------------
*/
EXTFUNC void CI_StripIoiPath( CB_ComBufType *pComBuf, UINT16 iOffset );
/****************************************************************************
**
** Private Services
**
*****************************************************************************
*/
/*---------------------------------------------------------------------------
**
** ci_ParseSegment()
**
** Parse 1 segment from an IOI or path in a packet in a combuf.
** Return the segment type and value.
** Optionally strip the segment from the combuf after retrieving the info.
** Adjust any appropriate size byte.
**
**---------------------------------------------------------------------------
**
** Inputs:
** pCombuf - Pointer to combuf containing message to parse
** piOffset - Pointer to variable containing offset into packet
** in buffer to start parsing at
** pbType - Pointer to variable to return segment type
** (with size bits removed)
** piValue - Pointer to variable to return segment value
** fSize - Size byte involved in the parsing
** fStrip - Strip the segment after data retrieval
**
** Outputs:
** Return - CNet general return code from parsing
**
** Usage:
** bGRC = ci_ParseSegment( pCombuf, &iOffset, &bType, &iValue, TRUE, TRUE );
**
**---------------------------------------------------------------------------
*/
EXTFUNC UINT8 ci_ParseSegment( CB_ComBufType *pCombuf,
UINT16 *piOffset,
UINT8 *pbType,
UINT16 *piValue,
BOOL fSize,
BOOL fStrip );
#endif /* defined(CD_EN_OBJECTS) */
#endif /* inclusion lock */
/****************************************************************************
**
** End of CI.H
**
*****************************************************************************
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -