API to intialize, configure and opening Stack
goal_mbInit()
Code Block | ||
---|---|---|
| ||
GOAL_STATUS_T goal_mbInit ( void ) |
Initialize Modbus Stack.
Returns:
GOAL_STATUS_T
result
goal_mbCfgDataRegionDefine()
Code Block | ||
---|---|---|
| ||
GOAL_STATUS_T goal_mbCfgDataRegionDefine ( uint8_t dataType, uint16_t addrStart, uint16_t quantity ) |
Define Data Regions for appropriate Types.
This functions defines allowed ranges for supported data types.
Returns:
GOAL_STATUS_T
result
Parameters:
dataType
appropriate data typeaddrStart
start addressquantity
number of objects
goal_mbCfgProdCodeSet()
Code Block |
---|
GOAL_STATUS_T goal_mbCfgProdCodeSet ( const char ∗ pStrProdCode ) |
Configure Device Production Code.
Returns:
GOAL_STATUS_T
result
Parameters:
pStrProdCode
production code string
goal_mbCfgRevisionSet()
Code Block |
---|
GOAL_STATUS_T goal_mbCfgRevisionSet ( const char ∗ pStrRevision ) |
Configure Device Revision.
Returns:
GOAL_STATUS_T
result
Parameters:
pStrRevision
revision string
goal_mbCfgVendorNameSet()
Code Block |
---|
GOAL_STATUS_T goal_mbCfgVendorNameSet ( const char ∗ pStrVendorName ) |
Configure Vendor Name.
Returns:
GOAL_STATUS_T
result
Parameters:
pStrVendorName
vendor name string
goal_mbNew()
Code Block |
---|
GOAL_STATUS_T goal_mbNew ( GOAL_MB_T ** ppHdlMb, const uint32_t idMb, GOAL_MB_FUNC_CB_T pFunc ) |
New Modbus Stack Handle.
Start the Stack and Create a new Modbus Instance Handle.
Returns:
GOAL_STATUS_T
result
Parameters:
out
ppHdlMb
Modbus handleidMb
Modbus handle idin
pFunc
callback function
goal_mbLedSet()
Code Block |
---|
GOAL_STATUS_T goal_mbLedSet ( GOAL_MB_T ∗ pHdlMb, GOAL_MB_LED_STATE_T status ) |
Set LEDs.
This Function is called by the Stack to set the LEDs. The State of the LEDs depends on available connections.
Returns:
GOAL_STATUS_T
result
Parameters:
in
pHdlMb
Modbus handlestatus
stack status
goal_mbRecvCb()
Code Block |
---|
GOAL_STATUS_T goal_mbRecvCb ( GOAL_MB_T * pHdlMb ) |
New Modbus Data from Transport Layer.
This function is called by the Stack, if new Data arrived via the Transportation Layer.
Returns:
GOAL_STATUS_T
result
Parameters:
in
pHdlMb
Modbus handle
goal_mbShutdown()
Code Block |
---|
GOAL_STATUS_T goal_mbShutdown ( void ) |
Shut down the Modbus Stack.
Returns:
GOAL_STATUS_T
result
API to add, get and set Objects
goal_mbDataAdd()
Code Block |
---|
GOAL_STATUS_T goal_mbDataAdd ( GOAL_MB_T ∗ pMbHdl, uint16_t index, uint8_t dataType, uint16_t value ) |
Add Object.
This Function adds a new Object with an Index of the specified Type. A Start Value can also be set. Only writeable Objects can be created.
Returns:
GOAL_STATUS_T
result
Parameters:
in
pMbHdl
Modbus handleindex
index of datadataType
data typevalue
value
goal_mbDataGet()
Code Block |
---|
GOAL_STATUS_T goal_mbDataGet ( GOAL_MB_T ∗ pMbHdl, uint8_t dataType, uint16_t startingAddress, uint16_t quantity, uint8_t ∗ pBuf, uint16_t bufLen, uint16_t ∗ pWrittenLen ) |
Get Object.
This Function writes the requested object values to a given buffer pointer. It also sets the written length.
Returns:
GOAL_STATUS_T
result
Parameters:
in
pMbHdl
Modbus handledataType
data typestartingAddress
address of dataquantity
number of requested valuesin/out
pBuf
bufferbufLen
buffer lenout
pWrittenLen
written buffer len
goal_mbDataSet()
Code Block |
---|
GOAL_STATUS_T goal_mbDataGet ( GOAL_MB_T ∗ pMbHdl, uint8_t dataType, uint16_t startingAddress, uint16_t quantity, uint8_t ∗ pBuf, uint16_t bufLen, uint16_t ∗ pWrittenLen ) |
Set Object.
This Function sets the requested object values from a given buffer pointer. It also sets the written length.
Returns:
GOAL_STATUS_T
result
Parameters:
in
pMbHdl
Modbus handledataType
data typestartingAddress
address of dataquantity
number of requested valuesin/out
pBuf
bufferbufLen
buffer lenout
pWrittenLen
written buffer len
API for Transportation Layer
goal_mbTcpInit()
Code Block |
---|
GOAL_STATUS_T goal_mbTcpInit ( void ) |
Initialize the Modbus TCP stack.
This function initializes stack specifica.
Returns:
GOAL_STATUS_T
result
goal_mbTcpNew()
Code Block |
---|
GOAL_STATUS_T goal_mbTcpNew ( GOAL_MB_T ∗ pHdlMb ) |
Open the Modbus TCP stack.
This function opens up the socket interface and initialize the ring buffer for receiving messages.
Returns:
GOAL_STATUS_T
result
Parameters:
in
pHdlMb
Modbus handle
goal_mbTcpShutdown()
Code Block |
---|
GOAL_STATUS_T goal_mbTcpShutdown ( GOAL_MB_T ∗ pHdlMb ) |
Shutdown the Modbus TCP stack.
Returns:
GOAL_STATUS_T
result
Parameters:
in
pHdlMb
Modbus handle