Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

To use the full potential of EtherNet/IP the stack allows you to interact at several stages of the protocol. For example you may receive a callback after new assembly data has arrived.

The stack calls the callback handler registered via the function goal_eipNew(). The callback handler returns a GOAL_STATUS_T value.

parameters of the callback handler

Parameter

Description

GOAL_EIP_T *pHdlEip

GOAL EtherNet/IP handle

GOAL_EIP_CB_ID_T id

callback id

GOAL_EIP_CB_DATA_T *pCb

callback parameters

The callback parameter is an array of unions that has up to 10 elements.

/****************************************************************************/
/** EtherNet/IP Callback Handler
 *

  • This function collects all callbacks from the stack and decides if the

  • callback must be handled.

 */
GOAL_STATUS_T main_eipCallback(
    GOAL_EIP_T *pHdlEip,                        /**< PROFINET handle */
    GOAL_EIP_CB_ID_T id,                        /**< callback id */
    GOAL_EIP_CB_DATA_T *pCb                     /**< callback parameters */
)
{
    GOAL_STATUS_T res = GOAL_OK;                /* result */

    switch (id) {
        case GOAL_EIP_CB_ID_INIT:
            /* initialize application resources */
            break;

        /* ... */
    }

    return res;
}

GOAL_EIP_CB_ID_INIT

The stack was initialized. The application can initialize its resources.

Parameter

<none>

Return Value

  • GOAL_OK - success

  • other - fail

GOAL_EIP_CB_ID_READY

Initialization is done.

Parameter

<none>

Return Value

<ignored>

GOAL_EIP_CB_ID_CONNECT_EVENT

Inform the application about a connection event

Parameter

callback parameters of GOAL_EIP_CB_ID_CONNECT_EVENT

Element

Member

data type

Description

0

outputAssembly

uint32_t

instance id of output assembly

1

inputAssembly

uint32_t

instance id of output assembly

2

connectionEvent

uint32_t

GOAL_EIP_CONNECTION_EVENT_*

Return Value

<ignored>

GOAL_EIP_CB_ID_ASSEMBLY_DATA_RECV

New data for an assembly has been received.

Parameter

callback parameters of GOAL_EIP_CB_ID_ASSEMBLY_DATA_RECV

Element

Member

data type

Description

0

instanceNr

uint32_t

instance id of assembly

Return Value

  • GOAL_OK - success

  • other - fail

GOAL_EIP_CB_ID_ASSEMBLY_DATA_SEND

Inform application that data of an assembly will be sent.

Parameter

callback parameters of GOAL_EIP_CB_ID_ASSEMBLY_DATA_SEND

Element

Member

data type

Description

0

instanceNr

uint32_t

instance id of assembly

Return Value

  • GOAL_OK - data has changed

  • other - data has not changed

GOAL_EIP_CB_ID_RUN_IDLE_CHANGED

Inform application that the Run/Idle header of consumed cyclic data has changed.

Parameter

callback parameters of GOAL_EIP_CB_ID_RUN_IDLE_CHANGED

Element

Member

data type

Description

0

outputAssembly

uint32_t

instance id of output assembly

1

inputAssembly

uint32_t

instance id of output assembly

2

runIdleValue

uint32_t

current value of the run/idle flag

Return Value

<ignored>

GOAL_EIP_CB_ID_LED_CHANGED

Inform the application that a Module Status or Network Status LED must be changed. The parameter contains a bitmap made out of GOAL_EIP_LED_* macros. If a bit is set the corresponding LED must be set. Otherwise it must be cleared.

Parameter

callback parameters of GOAL_EIP_CB_ID_LED_CHANGED

Element

Member

data type

Description

0

leds

uint32_t

bitmap of active LEDs

Return Value

<ignored>

GOAL_EIP_CB_ID_DEVICE_RESET

Inform the application that the device will be reset. Depending on the platform the device is either reset or the reset is only simulated. Therefore the application must reinitialize its resources. The callback parameter indicates the reset type.

Parameter

callback parameters of GOAL_EIP_CB_ID_LED_CHANGED

Element

Member

data type

Description

0

resetState

uint32_t

GOAL_EIP_RESET_*

Return Value

<ignored>

  • No labels