📄 cm.h
字号:
**
**---------------------------------------------------------------------------
*/
typedef struct CM_AppOpenCloseTrrblType
{
GS_TRRBL_HEADER; /* The standard tribble header */
CB_ComBufType *pComBuf; /* Pointer to fwd open/close combuf */
UINT16 iClass; /* Destination object class number */
UINT16 iInstance; /* Destination object instance number */
UINT16 iPort; /* Comm device port number */
struct CM_ConnectionRecordType *psConnRecord;
/* Pointer to connection record */
}
CM_AppOpenCloseTrrblType;
/*---------------------------------------------------------------------------
**
** CM_CloseTrrblType
**
** Tribble used to close a connection.
**
**---------------------------------------------------------------------------
*/
typedef struct CM_CloseTrrblType
{
GS_TRRBL_HEADER; /* the standard tribble header */
/*
** Handle for use by the task issuing the close request.
** Handle for use by the connection manager to identify the connection.
*/
void *xUserHandle;
UINT16 iConnectionSn;
BOOL fUnrequestedClose;
CB_ComBufType *pCombuf;
}
CM_CloseTrrblType;
/*---------------------------------------------------------------------------
**
** CM_InquireTrrblType
**
** Tribble used to inquire, deactivate or activate a connection.
**
**---------------------------------------------------------------------------
*/
typedef struct CM_InquireTrrblType
{
GS_TRRBL_HEADER; /* the standard tribble header */
/*
** Handle for use by the task issuing the request.
** Handle for use by the connection manager to identify the connection.
** Other ways of identifying the connection.
*/
void *xUserHandle;
UINT16 iConnectionSn;
UINT16 iClass;
UINT16 iInstance;
UINT16 iProConnPoint;
UINT16 iConConnPoint;
}
CM_InquireTrrblType;
/*---------------------------------------------------------------------------
**
** CM_OpenTrrblType
**
** Tribble used to originate a connection open.
**
**---------------------------------------------------------------------------
*/
typedef struct CM_OpenTrrblType
{
GS_TRRBL_HEADER; /* the standard tribble header */
/*
** Handle for use by the task issuing the origination request.
** Handle for use by the connection manager to identify the connection.
** (Used by the originating task to later close the connection.)
*/
void *xUserHandle;
UINT16 iConnectionSn;
/*
** General and extended response codes generated while
** opening the connection.
*/
UINT8 bGRC;
UINT16 iERC;
/*
** Connection parameters.
*/
UINT8 bTimeoutMult;
UINT8 bClassTrigger;
LeUINT32 lLeProRpi;
LeUINT16 iLeProParams;
LeUINT32 lLeConRpi;
LeUINT16 iLeConParams;
UINT8 bProSchedule;
UINT8 bConSchedule;
/*
** Connection path & module configuration.
*/
#ifdef CD_EN_OBJECTS
CB_ComBufType *pCbDestHost; /* Ptr to hostname/ip addr in a ComBuf */
UINT8 bProdInhibit; /* production inhibit time in ms */
#endif
UINT16 iPort;
UINT8 bOpenPathSize;
UINT8 bClosePathSize;
LeUINT16 *paiLePath;
UINT8 bConfigSize1;
LeUINT16 *paiLeConfig1;
UINT8 bConfigSize2;
LeUINT16 *paiLeConfig2;
/*
** Data mapping information on our side.
*/
UINT16 iClass;
UINT16 iInstance;
UINT16 iProConnPoint;
UINT16 iConConnPoint;
/*
** Timeout for forward open packet. The CM will hand this to the UCMM
** in the client request TRRBL. In addition, it will use this value
** to generate the tick-time and time-per-tick values for the forward open.
*/
GS_MSecType nFwdOpenTimeout;
/*
** Combuf to hold the application reply data
*/
CB_ComBufType *psAppReplyData;
}
CM_OpenTrrblType;
/*---------------------------------------------------------------------------
**
** CM_ConnectionRecordType
**
** Public portion of the connection record. The application may snoop
** in here for information regarding the connection is is being asked
** to accept.
**
**---------------------------------------------------------------------------
*/
typedef struct CM_ConnectionRecordType
{
/*
** Handle for this connection supplied by the task issuing the
** open connection request tribble.
*/
void *xUserHandle;
/*
** Connection serial number (for this node).
** Guaranteed to be unique and non zero.
** A simple way for other objects to distinguish this connection from
** others (if they support multiple connections). Otherwise, the other
** objects would have to save and compare the vendor ID, device SN, and
** connection SN to look for matching requests.
*/
UINT16 iConnectionSn;
/*
** Are we the originator or target for this connection.
*/
BOOL fOriginator;
/*
** General and extended status return codes.
** These may be filled in at any time by any object processing the
** connection. The connection manager will check them each step of
** processing the connection and abort & cleanup at any error.
*/
UINT8 bGRC;
UINT16 iERC;
/*
** The following items are pulled from the forward open.
** This information has been swizzled from little endian to native format.
*/
#ifdef CD_EN_OBJECTS
CB_ComBufType *pCbDestHost; /* Ptr to hostname/ip addr in a ComBuf */
#endif
UINT8 bOpenPriorityTickTime; /* Connection open prio and time tick */
UINT8 bOpenTimeoutTicks; /* Connection open timeout */
LeUINT32 lLeProConnId; /* Connection ids (tags) */
LeUINT32 lLeConConnId;
UINT16 iOrigConnectionSn; /* Originator conn serial number */
UINT16 iOrigVendorId; /* Originator device vendor ID */
UINT32 lOrigDeviceSn; /* Originator device serial number */
UINT8 bTimeoutMult; /* 4 << this * API is the conn timeout */
/* The following two items are set to the */
/* RPI initially and are overwritten with */
/* the API when it is available */
UINT32 lProApi; /* Producer actual packet interval (usecs)*/
UINT32 lConApi; /* Consumer actual packet interval (usecs)*/
#ifdef CD_EN_OBJECTS
UINT32 lProInhib; /* Minimum packet interval for change of state data (Msecs)*/
#endif
UINT16 iProConnParams; /* Producer connection parameters */
UINT16 iConConnParams; /* Consumer connection parameters */
UINT8 bClassTrigger; /* Connection class & trigger */
UINT32 lTimeout; /* Connection timeout in milliseconds */
/*
** Information from the connection path segment of the forward open packet.
** Pointers are into the combuf containing the forward open packet.
** They will be NULL if the corresponding segments were not found.
** The class, instance and connection point data are for the local node.
*/
UINT16 iClass; /* Class and instance to connect to */
UINT16 iInstance;
UINT16 iProConnPoint; /* Consumer connection point */
UINT16 iConConnPoint; /* Producer connection point */
UINT8 bProStartNut; /* Scheduled producer starting nut */
UINT8 bProRate; /* Scheduled producer rate (in nuts) */
CI_KeyType sKey; /* Electronic key segment */
UINT8 *pLeDataSeg; /* Pointer to data segment */
UINT8 bDataSegSize; /* Size of data segment in words */
/*
** start edits: September,9th 2005, H.F.
**
** A target may only accept one exclusive owner connection which specifies
** the same O=>T path. Therefore it must be differentiate between Exclusive
** Owner Connections and other Application Connection Types
*/
BOOL bExclusiveOwnerConn; /* indicates an Exclusive Owner Connection */
/*
** end edits: September,9th 2005, H.F.
*/
/*
** Transport oriented information for the connection.
**
** If the application has specific buffer areas, it should fill in
** pointers to them in the buffer pointer variables at app open time.
** If not, buffers will be allocated by the connection manager and
** pointers to these will be available to the application at
** app open complete time.
**
** The same rules apply if the application wants to reuse a transport
** from a previously established connection.
**
** For class 1 connections, both the Pro & Con transports are used.
** For class 3 connections, only the Con transport is used.
*/
UINT16 iProAppSize; /* App portion of packet (status+data) */
UINT16 iConAppSize;
FD_pFuncPPPIType pProCopyFunction;/* Class 1 data copy functions */
FD_pFuncPPPIType pConCopyFunction;
void *xProAppHandle; /* App handle to pass to copy funcs */
void *xConAppHandle;
GS_MsgQueueType xQid; /* Queue to send class 3 packets to */
BOOL fDupNotify; /* Pass on dup class 3 packets */
UINT16 iConTransportId; /* Transports for this connection */
UINT16 iProTransportId; /* with the RadioActive bits */
/*
** Handle for this connection supplied by ( or to ) the cd layer
*/
void *xCdHandle;
#ifdef CD_EN_OBJECTS
ECE sEce; /* Contains connection information, specifically the SID
which is used to identify the session the connection was started on.
USED much like macid for ControlNet */
#endif
/*
** App open/close tribble. (NULL if non outstanding.)
*/
CM_AppOpenCloseTrrblType *pTrrblAppOpenClose;
/*
** Bridge specific stuff...
*/
UINT8 bProTransportType;
UINT8 bConTransportType;
UINT16 iPort;
UINT16 iOtherPort;
UINT16 iOtherConnectionSn;
struct CM_ConnectionRecordType *psOtherConnRecord;
}
CM_ConnectionRecordType;
/****************************************************************************
**
** Globals
**
*****************************************************************************
*/
/*---------------------------------------------------------------------------
**
** CM_xQid
**
** Connection Manager object request queue id.
**
**---------------------------------------------------------------------------
*/
extern GS_MsgQueueType CM_xQid;
/****************************************************************************
**
** Services
**
*****************************************************************************
*/
/*---------------------------------------------------------------------------
**
** CM_DecodeTimePerTickAndTicks()
**
** Given the number of ticks and time per ticks, calulate the time in
** mili-seconds. See Chapter 4, section 4.2.6 of the ControlNet spec.
**
**---------------------------------------------------------------------------
**
** Inputs:
** bTimePerTick - Time per tick.
** bNumTicks - Number of ticks.
**
** Outputs:
** Return - Timeout value in mili-seconds
**
** Usage:
** nTimeoutInMs = CM_DecodeTimePerTickAndTicks( bTickTime, bTicks );
**
**---------------------------------------------------------------------------
*/
GS_MSecType CM_DecodeTimePerTickAndTicks( UINT8 bTimePerTick , UINT8 bNumTicks );
/*---------------------------------------------------------------------------
**
** CM_EncodeTimePerTickAndTicks()
**
** Given a time in mili-seconds, calulate the number of ticks and time per
** tick. See Chapter 4, section 4.2.6 of the ControlNet spec.
**
**---------------------------------------------------------------------------
**
** Inputs:
** nTimeout - Timeout value in mili-seconds
**
** Outputs:
** pbTimePerTick - Pointer to place to store the time per tick.
** pbNumTicks - Pointer to place to store the number of ticks.
** Return - TRUE for success, FALSE otherwise.
**
** Usage:
** CM_EncodeTimePerTickAndTicks( nFwdOpenTimeoutInMs, &bTickTime, &bTicks );
**
**---------------------------------------------------------------------------
*/
BOOL CM_EncodeTimePerTickAndTicks( GS_MSecType nTimeout, UINT8 *pbTimePerTick , UINT8 *pbNumTicks );
/*---------------------------------------------------------------------------
**
** CM_IsConnectionTypeNull()
**
**---------------------------------------------------------------------------
*/
#define CM_IsConnectionTypeNull( psConnRecord ) \
( ( ( (psConnRecord)->iProConnParams & CM_CP_TYPE_MASK ) == CM_CP_TYPE_NULL ) && \
( ( (psConnRecord)->iConConnParams & CM_CP_TYPE_MASK ) == CM_CP_TYPE_NULL ) )
/*---------------------------------------------------------------------------
**
** CM_Init()
**
** Connection Manager object data/task creation/allocation/initialization.
**
**---------------------------------------------------------------------------
**
** Inputs:
** iOptions - Bit mask of initialization options
**
** Outputs:
** Return - Success/failure status
**
** Usage:
** eStatus = CM_Init( AB_COLD_START_RESOURCE );
**
**---------------------------------------------------------------------------
*/
EXTFUNC StatusType CM_Init( UINT16 iOptions );
#endif /* CORE_OBJECTS */
#endif /* inclusion lock */
/****************************************************************************
**
** End of CM.H
**
*****************************************************************************
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -