CEcWrapperDotNet

3.2. CEcWrapperDotNet

class EcWrapperDotNet.CEcWrapperDotNet : IDisposable

Subclassed by EcWrapperDotNet.CEcMasterMbxGatewayClientDotNet, EcWrapperDotNet.CEcMasterMbxGatewayServerDotNet, EcWrapperDotNet.CEcMasterRasServerDotNet, EcWrapperDotNet.CEcMonitorDotNet, EcWrapperDotNet.CEcMonitorRasServerDotNet, EcWrapperDotNet.CEcRasClientDotNet, EcWrapperDotNet.CEcSimulatorDotNet, EcWrapperDotNet.CEcSimulatorRasServerDotNet, EcWrapperDotNet.CEcWrapperDotNetEx

Public Functions

void Dispose ()

summary> Throws the EtherCAT-Notifications. The Type of the event depends on the notification code.

ECError SetCycFrameRxCallback (CycFrameRxCallback pfnCallback)

Set cyclic frame RX callback function.

This function will be called after the cyclic frame is received, if there is more than one cyclic frame after the last frame. The application has to assure that these functions will not block.

Param pfnCallback:

Callback function

Return:

EC_E_NOERROR or error code

EcRunMode GetRunMode ()

Return run mode.

Return:

Run mode

ECError RegisterClient (out DN_EC_T_REGISTERRESULTS pRegRes)

Register a client with the EtherCAT Master.

Param pRegRes:

out Registration results, a pointer to a structure of type REGISTERRESULTS

Return:

Error Code

ECError UnregisterClient ()

Unregister a client from the EtherCAT master.

Return:

Error code

ECError RasGetConnectionInfo (out DN_EC_T_RAS_CONNECTION_INFO pConInfo)

Get actual connection information /summary>

param pConInfo:

connection information

return:

EC_E_NOERROR on success, otherwise an error code.

ECError MbxGatewayCoeSdoDownload (ushort wAddress, ushort wObIndex, byte byObSubIndex, byte[] pbyData, uint dwDataLen, uint dwTimeout, uint dwFlags)

Initiate CoE SDO download transfer to mailbox gateway server.

Param wAddress:

slave address to download the SDO

Param wObIndex:

object index

Param byObSubIndex:

object sub-index

Param pbyData:

Param dwDataLen:

Param dwTimeout:

Timeout in milliseconds

Param dwFlags:

mailbox transfer flags

Return:

Depends on the implementation of the function OsSetLastError(), normally returns EC_E_NOERROR if it succeeds or error code if it fails

ECError MbxGatewayCoeSdoUpload (ushort wAddress, ushort wObIndex, byte byObSubIndex, byte[] pbyData, uint dwDataLen, out uint pdwOutDataLen, uint dwTimeout, uint dwFlags)

Initiate CoE SDO upload transfer from mailbox gateway server.

Param wAddress:

slave address to upload the SDO

Param wObIndex:

object index

Param byObSubIndex:

object sub-index

Param pbyData:

Param dwDataLen:

Param pdwOutDataLen:

Param dwTimeout:

Timeout in milliseconds

Param dwFlags:

mailbox transfer flags, see EC_MAILBOX_FLAG

Return:

Depends on the implementation of the function OsSetLastError(), normally returns EC_E_NOERROR if it succeeds or error code if it fails

void EnablePerformanceMeasuring (bool bEnable)

Enables performance monitoring. For every master function, the notification “PerfNotification” will be called.

Param bEnable:

True = Enables performance monitoring

void EnableTranslation (bool bEnable)

Enables translation. For every master string, the notification “TranslateNotification” will be called.

Param bEnable:

True = Enables translation

ECError OptimizeProcessPerformance ()

Optimize process performance.

Return:

EC_E_NOERROR on success, otherwise an error code.

String GetErrorText (ECError eErrorCode)

Return text tokens by Error code from master stack.

Param eErrorCode:

Error code

Return:

Error text for supplied error code

ECError ConfigureNetwork (FileInfo oConfigFile)

Configure the Master

param oConfigFile:

File with configuration parameters

Return:

Error code

ECError ConfigureNetwork (DN_EC_T_CNF_TYPE tConfigType, Stream oConfigData)

Configure the Master

param tConfigType:

Enum type of configuration data provided

param oConfigData:

Configuration data (stream)

Return:

Error code

ECError ExecJob (DN_EC_T_USER_JOB eUserJob)

Execute or initiate the requested master job.

Param eUserJob:

Requested job.

Return:

Error code

ECError ExecJobProcessAllRxFrames (out bool bPrevCycProcessed)

calls the process all rx frame job

Param bPrevCycProcessed:

true: previous send frame was received and processed, false: otherwise

Return:

EC_NOERROR or error code

ECError ExecJobProcessAllRxFrames ()

calls the process all rx frame job

Return:

EC_NOERROR or error code

ECError ExecJobSendCycFramesByTaskId (UInt32 dwTaskId)

sends a cycle frame by its task id

Param dwTaskId:

task id of the cyclic frame

Return:

EC_NOERROR or error code

string ConvertMasterStringFromBytes (byte[] abyData, int dwOffset, int dwLen)

Converts a master string into UTF8 format.

Param abyData:

Byte array to convert

Param dwOffset:

Offset

Param dwLen:

Length

Return:

Converted string

string ConvertMasterString (String val)

Converts a master string into UTF8 format.

Param val:

String to convert.

Return:

Converted string.

bool WaitForTimingTaskEvent ()

Waits for timing task event.

Return:

Wait event was triggered

ECError EoeInstallEndpoint (bool bCreateTxEvent, String strInterfaceName, String strInterfaceGuid)

Install EoE endpoint.

Param bCreateTxEvent:

Create TX Event

Param strInterfaceName:

Interface name (optional)

Param strInterfaceGuid:

Interface guid (optional)

Return:

Error code

ECError EoeUninstallEndpoint ()

Uninstall EoE endpoint.

Return:

Error code

ECError EoeTriggerTxEvent ()

Trigger TX Event, which must be called from JobTask after ExecJobProcessAllRxFrames()

Return:

Error code

string ESCTypeText (byte byEscType, bool bLong)

Gets the text of corresponding ESC type.

Param byEscType:

ESC type

Param bLong:

true: long text version, false: short text version

Return:

Text of corresponding ESC type

string SlaveVendorText (uint dwVendorId)

Gets the text of slave vendor.

Param dwVendorId:

Vendor ID

Return:

Text of slave vendor

string SlaveProdCodeText (uint dwVendorId, uint dwProductCode)

Gets the text of slave product code.

Param dwVendorId:

Vendor ID

Param dwProductCode:

Product code

Return:

Text of slave product code

ECError SetBusCnfReadProp (DN_ESC_SII_REG eEscSiiReg, uint dwTimeout)

Sets read property for bus configuration.

Param eEscSiiReg:

SII register

Param dwTimeout:

Time out of bus scan

Return:

Error code

ECError RestartScanBus (uint dwTimeout, bool bReadRevisionNo, bool bReadSerialNo)

Trigger Bus Scan.

Param dwTimeout:

Time out of bus scan

Param bReadRevisionNo:

Read revision number

Param bReadSerialNo:

Read serial number

Return:

Error code

ECError GetBusScanSlaveInfoDesc (short wAutoIncAddr, out DN_EC_T_SB_SLAVEINFO_DESC oSlaveInfoDesc)

This call will return the basic slave info determined in the last bus scan.

Param wAutoIncAddr:

Auto increment address of the slave

Param oSlaveInfoDesc:

Out parameter that contains different slave information after the call

Return:

Error code

ECError GetScanBusStatus (out DN_EC_T_SB_STATUS_NTFY_DESC oSbStatus)

Gets the status of the last bus scan.

Param oSbStatus:

The last bus scan status

Return:

Error code

ECError CoeGetODList (UInt32 dwSlaveId, DN_EC_T_COE_ODLIST_TYPE eListType, out UInt16[] pList, UInt32 dwLen, out UInt32 pdwOutLen, UInt32 dwTimeout)

Gets a list of object Ids that are available in a slave.

Param dwSlaveId:

slave ID

Param eListType:

Object list type. eODListType_ALL: Get all objects eODListType_RxPdoMap: Get PDO mappable objects eODListType_TxPdoMap: Get objects that can be changed eODListType_StoredFRepl: Get objects that are stored for a device replacement eODListType_StartupParm: Get objects that can be used as startup parameter

Param pList:

out Filled OD list

Param dwLen:

Length of list

Param pdwOutLen:

out Length of output list

Param dwTimeout:

Timeout

Return:

Error code

ECError CoeGetObjectDesc (UInt32 dwSlaveId, UInt16 wIndex, out DN_EC_T_COE_OBDESC oObjDesc, UInt32 dwTimeout)

Determines the description of a specific object.

Param dwSlaveId:

slave ID

Param wIndex:

Object index

Param oObjDesc:

out Description of a specific object

Param dwTimeout:

Timeout

Return:

Error code

ECError CoeGetEntryDesc (UInt32 dwSlaveId, UInt16 wIndex, Byte bySubIndex, Byte byValueInfoType, out DN_EC_T_COE_ENTRYDESC oEntryDesc, UInt32 dwTimeout)

Determines the description of a specific object entry.

Param dwSlaveId:

slave ID

Param wIndex:

Object index

Param bySubIndex:

Object subindex

Param byValueInfoType:

Bit mask to define which information to determine. The bit values are defined as follows: EC_COE_ENTRY_ObjAccess - Object access rights EC_COE_ENTRY_ObjCategory - Object category EC_COE_ENTRY_PdoMapping - Information if the object is PDO mappable EC_COE_ENTRY_UnitType - Unit EC_COE_ENTRY_DefaultValue - Default value EC_COE_ENTRY_MinValue - Minimum value EC_COE_ENTRY_MaxValue - Maximum value

Param oEntryDesc:

out Description of a specific object entry

Param dwTimeout:

Timeout

Return:

Error code

ECError MbxTferCreate (UInt32 dwTferId, UInt32 dwBufferSize, out IntPtr pMbxTfer)

Creates a mailbox transfer object.

Param dwTferId:

transfer ID (optional, can be 0)

Param dwBufferSize:

buffer size

Param pMbxTfer:

out mailbox transfer object

Return:

Error code

ECError MbxTferReset (IntPtr pMbxTfer)

Creates a mailbox transfer object.

Param pMbxTfer:

mailbox transfer object

Return:

Error code

void MbxTferDelete (IntPtr pMbxTfer)

Deletes a mailbox transfer object.

A transfer object may only be deleted if it is in the Idle state.

Param pMbxTfer:

Mailbox transfer object created with emMbxTferCreate

ECError MbxTferWait (IntPtr pMbxTfer)

Waits until mailbox transfer is finished.

Param pMbxTfer:

mailbox transfer object

Return:

Error code

ECError MbxTferCopyTo (IntPtr pMbxTfer, byte[] abyData, UInt32 dwDataLen)

Copies data to the mailbox transfer buffer.

Param pMbxTfer:

pMbxTfer

Param abyData:

abyData

Param dwDataLen:

dwDataLen

Return:

Error code

ECError MbxTferCopyFrom (IntPtr pMbxTfer, byte[] abyData, UInt32 dwDataLen, out UInt32 pdwOutDataLen)

Copies data from the mailbox transfer buffer.

Param pMbxTfer:

pMbxTfer

Param abyData:

abyData

Param dwDataLen:

dwDataLen

Param pdwOutDataLen:

pdwOutDataLen

Return:

Error code

ECError InitMotion ()

Initialize the motion.

Return:

Error code

ECError DeinitMotion ()

Deinitialize the motion.

Return:

Error code

ECError ControlMotion (EC_T_MOTION_CMD dwCmd, byte[] pInData, UInt16 wDataLen, out byte[] pOutData, UInt16 wOutLen)

Controls the motion.

Param dwCmd:

Command

Param pObj:

Object

Param pInData:

Input data

Param wDataLen:

Length of in data

Param pOutData:

Output data

Param wOutLen:

Length of output data field

Return:

Error code

void ReadIdentifyObj (ushort wFixedAddr)

Reads the identify object of a slave.

Param wFixedAddr:

Fixed station address

void AddDbgMsg (string strDbgMsg)

Adds a debug message to the print message queue.

Param strDbgMsg:

debug message

ECError GetSlaveInfoEx (DN_EC_T_SB_SLAVEINFO_REQ_DESC oReq, out DN_EC_T_SB_SLAVEINFO_RES_DESC oRes)

Gets the extended slave info determined in the last bus scan.

Param oReq:

Request parameter

Param oRes:

The extended slave information structure

Return:

Error code

ECError ForceSlvStatCollection ()

Sends datagrams to collect slave statistics counters.

Return:

Error code

ECError GetSlvStatistics (UInt32 dwSlaveId, out DN_EC_T_SLVSTATISTICS_DESC oStatistics)

Returns slave statistics counters.

Param dwSlaveId:

Slave ID

Param oStatistics:

out Statistics counters

Return:

Error code

ECError GetCyclicConfigInfo (out DN_EC_T_CYC_CONFIG_DESC[] oCyclicConfigInfo)

Returns an array of cyclic tasks.

Param oCyclicConfigInfo:

out Array of cyclic tasks

Return:

Error code

ECError SetAllSlavesMustReachState (bool bAllSlavesMustReachState)

Sets flag that all slaves must reach the requested master state.

Param bAllSlavesMustReachState:

EC_TRUE: All slaves must reach the requested master state

Return:

Error code

ECError SetAdditionalVariablesForSpecificDataTypesEnabled (bool bAdditionalVariablesForSpecificDataTypes)

Sets flag to enable additional variables for specific data types.

Param bAdditionalVariablesForSpecificDataTypes:

EC_TRUE: Enable additional variables for specific data types

Return:

Error code

ECError EnableNotification (UInt32 dwClientId, DN_NotifyCode tNotifyCode, bool bEnable)

Enables notification.

Param dwClientId:

Client Id

Param tNotifyCode:

Code of notification, which should be enabled

Param bEnable:

EC_TRUE: Enables notification

Return:

Error code

ECError ThrottleNotification (DN_NotifyCode tNotifyCode, uint dwTimeout)

Throttles notification.

Param tNotifyCode:

Code of notification, which should be throttled

Param dwTimeout:

0 = Not throttled, > 0 = Throttle timeout in ms

Return:

Error code

ECError SdoUploadMasterOd (UInt16 wObIndex, UInt32 dwTimeout, out object pobjMasterOd)

SdoUpload from Master Object Dictionary.

Param wObIndex:

Object index

Param dwTimeout:

Timeout in milliseconds

Param pobjMasterOd:

Read object (e.g. DN_EC_T_OBJ3XXX, EC_T_OBJ8XXX, EC_T_OBJ9XXX …)

Return:

Error code

ECError ReadSlaveEEPRomWithReq (uint dwClientId, uint dwTferId, bool bFixedAddressing, UInt16 wSlaveAddress, UInt16 wEEPRomStartOffset, byte[] pwReadData, UInt32 dwReadLen, out UInt32 pdwNumOutData, UInt32 dwTimeout)

Read EEPRom data from slave (REQ)

Param dwClientId:

Client ID returned by RegisterClient (0 if all registered clients shall be notified)

Param dwTferId:

Transfer ID. The application can set this ID to identify the transfer. It will be passed back to the application within EC_T_EEPROM_OPERATION_NTFY_DESC.

Param bFixedAddressing:

EC_TRUE: use station addressing, EC_FALSE: use auto increment addressing

Param wSlaveAddress:

Slave Address, station or auto increment address depending on bFixedAddressing

Param wEEPRomStartOffset:

Address to start EEPRom Read from

Param pwReadData:

Pointer to ushort array to carry the read data

Param dwReadLen:

Size of the ushort array provided at pwReadData (in ushorts)

Param pdwNumOutData:

out Pointer to uint carrying actually read data (in ushorts) after completion

Param dwTimeout:

Timeout in milliseconds. The function will block at most for this time. The timeout value must not be set to EC_NOWAIT

Return:

Error code

ECError WriteSlaveEEPRomWithReq (uint dwClientId, uint dwTferId, bool bFixedAddressing, UInt16 wSlaveAddress, UInt16 wEEPRomStartOffset, byte[] pwWriteData, UInt32 dwWriteLen, UInt32 dwTimeout)

Write EEPRom data from slave (REQ)

Param dwClientId:

Client ID returned by RegisterClient (0 if all registered clients shall be notified)

Param dwTferId:

Transfer ID. The application can set this ID to identify the transfer. It will be passed back to the application within EC_T_EEPROM_OPERATION_NTFY_DESC.

Param bFixedAddressing:

EC_TRUE: use station addressing, EC_FALSE: use auto increment addressing

Param wSlaveAddress:

Slave Address, station or auto increment address depending on bFixedAddressing

Param wEEPRomStartOffset:

Address to start EEPRom Write from

Param pwWriteData:

Pointer to WORD array carrying the write data.

Param dwWriteLen:

Sizeof Write Data WORD array (in WORDS)

Param dwTimeout:

Timeout in milliseconds. The function will block at most for this time. The timeout value must not be set to EC_NOWAIT

Return:

Error code

ECError InitInstance (DN_EC_T_INIT_PARMS oParms)

Initializes EtherCAT wrapper.

Param oParms:

Parameters

Return:

Error code

ECError DeinitInstance ()

Deinitialize EtherCAT wrapper.

Return:

Error code

ECError PerfMeasAppCreate (DN_EC_T_PERF_MEAS_APP_PARMS pPerfMeasAppParms, out IntPtr ppvPerfMeas)

Create PerfMeas object and bind it to the master instance.

This API can be called multiple times to create PerfMeas objects. The perfomance counters in each of the objects can be accessed in the following two ways:

  • by passing the PerfMeas object and the index of the performance measurement. The index ranges from [0-pPerfMeasAppParms->dwNumAppMeas]

  • by passing EC_NULL instead of a PerfMeas object and an index. In this case the index works across all PerfMeas objects bound to the master instance.

Param pPerfMeasAppParms:

Pointer to parameter definitions

Param ppvPerfMeas:

Created PerfMeas object.

Return:

EC_E_NOERROR or an error code

ECError PerfMeasAppDelete (IntPtr pvPerfMeas)

Delete application performance measurement and unbind it from the master instance.

Objects which are not deleted using PerfMeasAppDelete are automatically deleted when calling DeinitMaster.

Note

This invalidates the global index used when passing EC_NULL into the other PerfMeasApp functions

Param pvPerfMeas:

PerfMeas object to delete

Return:

EC_E_NOERROR or an error code

ECError PerfMeasAppStart (IntPtr pvPerfMeas, uint dwIndex)

Start application performance measurement.

Param pvPerfMeas:

PerfMeas object or EC_NULL to use continuous index

Param dwIndex:

Index of the performance measurement

Return:

EC_E_NOERROR or an error code

ECError PerfMeasAppEnd (IntPtr pvPerfMeas, uint dwIndex)

Stop application performance measurement.

Param pvPerfMeas:

PerfMeas object or EC_NULL to use continuous index

Param dwIndex:

Index of the performance measurement

Return:

EC_E_NOERROR or an error code

ECError PerfMeasAppReset (IntPtr pvPerfMeas, uint dwIndex)

Reset application performance measurement.

Param pvPerfMeas:

PerfMeas object or EC_NULL to use continuous index

Param dwIndex:

Index of the performance measurement, use 0xFFFFFFFF to reset all

Return:

EC_E_NOERROR or an error code

ECError PerfMeasAppGetRaw (IntPtr pvPerfMeas, uint dwIndex, DN_EC_T_PERF_MEAS_VAL[] pPerfMeasVal, DN_EC_T_PERF_MEAS_HISTOGRAM[] pPerfMeasHistogram, uint dwPerfMeasNumOf)

Get raw data of one/all application performance measurement.

Param pvPerfMeas:

PerfMeas object or EC_NULL to use continuous index

Param dwIndex:

Index of the performance measurement, use 0xFFFFFFFF to get all

Param pPerfMeasVal:

Pointer to a buffer receiving one/all performance measurement values or EC_NULL

Param pPerfMeasHistogram:

Pointer to a buffer receiving one/all performance measurement histograms or EC_NULL

Param dwPerfMeasNumOf:

Number of elements allocated in pPerfMeasVal and pPerfMeasHistogram

Return:

EC_E_NOERROR or an error code

ECError PerfMeasAppGetInfo (IntPtr pvPerfMeas, uint dwIndex, out DN_EC_T_PERF_MEAS_INFO[] pPerfMeasInfo, uint dwPerfMeasNumOf)

Get general info about one/all application performance measurement.

Param pvPerfMeas:

PerfMeas object or EC_NULL to use continous index

Param dwIndex:

Index of the performance measurement information, use 0xFFFFFFFF to get all

Param pPerfMeasInfo:

Pointer to a buffer receiving one/all performance measurement information

Param dwPerfMeasNumOf:

Number of elements allocated in pPerfMeasInfo

Return:

EC_E_NOERROR or an error code

ECError PerfMeasAppGetNumOf (IntPtr pvPerfMeas, out uint pdwNumOf)

Reset number of application performance measurement.

Param pvPerfMeas:

PerfMeas object or EC_NULL to get the number of performance measurements in all PerfMeas objects

Param pdwNumOf:

Number of performance measurements

Return:

EC_E_NOERROR or an error code

ECError PerfMeasResetByTaskId (uint dwTaskId, uint dwIndex)

Reset internal performance measurement.

Param dwTaskId:

Task Job ID

Param dwIndex:

Index of the performance measurement, use 0xFFFFFFFF to reset all

Return:

EC_E_NOERROR or an error code

ECError PerfMeasGetRawByTaskId (uint dwTaskId, uint dwIndex, DN_EC_T_PERF_MEAS_VAL[] pPerfMeasVal, DN_EC_T_PERF_MEAS_HISTOGRAM[] pPerfMeasHistogram, uint dwPerfMeasNumOf)

Get raw data of one/all application performance measurement.

Param dwTaskId:

Task Job ID

Param dwIndex:

Index of the performance measurement, use 0xFFFFFFFF to get all

Param pPerfMeasVal:

Pointer to a buffer receiving one/all performance measurement values or EC_NULL

Param pPerfMeasHistogram:

Pointer to a buffer receiving one/all performance measurement histograms or EC_NULL

Param dwPerfMeasNumOf:

Number of elements allocated in pPerfMeasVal and pPerfMeasHistogram

Return:

EC_E_NOERROR or an error code

ECError PerfMeasGetInfoByTaskId (uint dwTaskId, uint dwIndex, out DN_EC_T_PERF_MEAS_INFO[] pPerfMeasInfo, uint dwPerfMeasNumOf)

Get general info about one/all internal performance measurement.

Param dwTaskId:

Task Job ID

Param dwIndex:

Index of the performance measurement, use 0xFFFFFFFF to get all

Param pPerfMeasInfo:

Pointer to a buffer receiving one/all performance measurement infos

Param dwPerfMeasNumOf:

Number of elements allocated in pPerfMeasInfo

Return:

EC_E_NOERROR or an error code

ECError PerfMeasGetNumOfByTaskId (uint dwTaskId, out uint pdwNumOf)

Reset number of internal performance measurement.

Param dwTaskId:

Task Job ID

Param pdwNumOf:

Number of performance measurements

Return:

EC_E_NOERROR or an error code

ECError SetLogParms (DN_EC_T_LOG_PARMS pLogParms)

Sets log parameters. Used to change the parameters provided by emInitMaster().

EC_MONITOR Sets log parameters. Used to change the parameters provided by emonInitMonitor().

EC_SIMULATOR Sets log parameters. Used to change the parameters provided by esInitSimulator().

Param pLogParms:

New Log parameters

Return:

ECError IoCtl (uint dwCode, byte[] pbyInBuf, uint dwInBufSize, byte[] pbyOutBuf, uint dwOutBufSize, out uint pdwNumOutData)

A generic control interface between the application, the EtherCAT stack and its Link Layers.

Param dwCode:

IOCTL code (EC_IOCTL…)

Param pbyInBuf:

IOCTL input parameters

Param dwInBufSize:

Size of IOCTL input parameters in bytes

Param pbyOutBuf:

Buffer for IOCTL output

Param dwOutBufSize:

Size of buffer at pbyOutBuf in bytes

Param pdwNumOutData:

Amount of bytes written to pbyOutBuf by IOCTL. EC_NULL: amount not set by IOCTL.

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer

  • EC_E_NOMEMORY if memory cannot be allocated

  • EC_E_ADS_IS_RUNNING if the ADS server is running

ECError ScanBus (uint dwTimeout)

Scans all connected slaves.

Scans all connected slaves connected to EC-Master. If a configuration has been loaded, a validation between the configuration and the connected slaves is done. This function should not be called from within the JobTask’s context.

Param dwTimeout:

Timeout [ms]

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range

  • EC_E_LINK_DISCONNECTED if link is disconnected

  • EC_E_TIMEOUT if dwTimeout elapsed during the API call

  • EC_E_BUSCONFIG_MISMATCH if the slaves found do not match the configured ones

  • EC_E_LINE_CROSSED if a line crossed (cabling wrong) condition has been detected

  • EC_E_REDLINEBREAK if cable redundancy is configured and a line break condition has been detected

  • EC_E_JUNCTION_RED_LINE_BREAK if junction redundancy is configured and a line break condition has been detected

  • EC_E_MAX_BUS_SLAVES_EXCEEDED if the amount of slaves found exceeds EC_T_INIT_MASTER_PARMS.dwMaxBusSlaves

  • EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive

  • EC_E_ADS_IS_RUNNING if the ADS server is running

ECError ConfigureNetwork (DN_EC_T_CNF_TYPE eCnfType, byte[] pbyCnfData, uint dwCnfDataLen)

Configure the Network.

This function must be called after the initialization. Among others the EtherCAT topology defined in the given XML configuration file will be stored internally.

A client must not be registered prior to calling this function. Existing client registrations will be dropped.

Param eCnfType:

Type of configuration data provided

Param pbyCnfData:

Filename / configuration data, or EC_NULL if eCnfType is

Param dwCnfDataLen:

Length of configuration data in byte, or zero if eCnfType is

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized or eCnfType is eCnfType_GenPreopENI or eCnfType_GenOpENI and link is disconnected

  • EC_E_INVALIDPARM if dwInstanceID is out of range or pParms is EC_NULL contains some values out of range

  • EC_E_LINK_DISCONNECTED if link is disconnected

  • EC_E_FEATURE_DISABLED if a configured feature is not included in the license key

  • EC_E_NOTSUPPORTED if a configured feature is not supported (e.g not compiled in the library)

  • EC_E_CFGFILENOTFOUND if the ENI file cannot be found

  • EC_E_WRONG_FORMAT if format errors have been detected in the ENI or EEPROM in case of eCnfType_GenPreopENI or eCnfType_GenOpENI

  • EC_E_OEM_SIGNATURE_MISMATCH if the OEM signature in the ENI file doesn’t match the used OEM key

  • EC_E_ENI_ENCRYPTION_WRONG_VERSION if the ENI encryption version is not supported (e.g. the library is too old)

  • EC_E_ENI_ENCRYPTED if the ENI is encrypted and no OEM key has been set

  • EC_E_XML_CYCCMDS_MISSING if the ENI doesn’t contain cyclic commands

  • EC_E_XML_ALSTATUS_READ_MISSING if the ENI doesn’t contain any read AL status command

  • EC_E_XML_CYCCMDS_SIZEMISMATCH if the size of the cyclic commands in the ENI mismatch

  • EC_E_XML_INVALID_INP_OFF if some input offsets in the ENI are invalid

  • EC_E_XML_INVALID_OUT_OFF if some output offsets in the ENI are invalid

  • EC_E_XML_INVALID_CMD_WITH_RED if the ENI contains LRW commands and cable redundancy is configured

  • EC_E_XML_PREV_PORT_MISSING if some previous port information are missing in the ENI

  • EC_E_XML_DC_CYCCMDS_MISSING if the DC related cyclic commands are missing in the ENI

  • EC_E_XML_AOE_NETID_INVALID if the ENI contains some invalid NetID

ECError ConfigLoad (DN_EC_T_CNF_TYPE eCnfType, byte[] pbyCnfData, uint dwCnfDataLen)

Load the network configuration.

In combination with emConfigApply, this function replaces emConfigureNetwork and must be called after the initialization. Among others the EtherCAT topology defined in the given XML configuration file will be stored internally.

A client must not be registered prior to calling this function. Existing client registrations will be dropped.

Param eCnfType:

Type of configuration data provided

Param pbyCnfData:

Configuration data

Param dwCnfDataLen:

Length of configuration data in byte

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer

  • EC_E_NOMEMORY if some memory cannot be allocated

  • EC_E_ADS_IS_RUNNING if the ADS server is running

ECError ConfigExcludeSlave (ushort wStationAddress)

Exclude a slave from the network configuration.

It has to be called after emConfigLoad and prior to calling emConfigApply.

Param wStationAddress:

Station address of the slave to be excluded. A value of 0 excludes all slaves.

Return:

EC_E_NOERROR or error code

ECError ConfigIncludeSlave (ushort wStationAddress)

Include a slave in the network configuration.

Slaves that were previously excluded with emConfigSlaveExclude can be added again. It has to be called after emConfigLoad and prior to calling emConfigApply.

Param wStationAddress:

Station address of the slave to be included. A value of 0 includes all slaves.

Return:

EC_E_NOERROR or error code

ECError ConfigSetPreviousPort (ushort wStationAddress, ushort wStationAddressPrev, ushort wPortPrev)

Set previous port information of a slave.

It has to be called after emConfigLoad and prior to calling emConfigApply.

Param wStationAddress:

Station address of the slave

Param wStationAddressPrev:

Previous slave station address

Param wPortPrev:

Previous port

Return:

EC_E_NOERROR or error code

ECError ConfigApply ()

Apply the network configuration.

It has to be called after emConfigLoad.

Return:

EC_E_NOERROR or error code

ECError IsConfigured (out bool pbIsConfigured)

Returns if configuration has been applied.

Param pbIsConfigured:

EC_TRUE if configuration has been applied

Return:

EC_E_NOERROR or error code

DN_EC_T_STATE GetMasterState ()

Get the EtherCAT master current state.

Return:

EtherCAT master state

ECError GetMasterStateEx (out ushort pwCurrState, out ushort pwReqState)

Get the EtherCAT master current and requested state. Possible return values for current and requested state:

  • #DEVICE_STATE_UNKNOWN

  • #DEVICE_STATE_INIT

  • #DEVICE_STATE_PREOP

  • #DEVICE_STATE_SAFEOP

  • #DEVICE_STATE_OP

Param pwCurrState:

Current master state

Param pwReqState:

Requested master state

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range or the output pointers are EC_NULL

uint GetSlaveId (ushort wStationAddress)

Determines the slave ID using the slave station address.

Param wStationAddress:

Station address of the slave

Return:

Slave ID or INVALID_SLAVE_ID if the slave could not be found or the stack is not initialized

ECError GetSlaveFixedAddr (uint dwSlaveId, out ushort pwFixedAddr)

Determine slave station address according to its slave ID.

Param dwSlaveId:

Slave ID

Param pwFixedAddr:

Corresponding fixed address

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range or the output pointer is EC_NULL

  • EC_E_NOTFOUND if no slave matching dwSlaveId can be found

uint GetSlaveIdAtPosition (ushort wAutoIncAddress)

Determines the slave ID using the slave auto increment address.

Param wAutoIncAddress:

Auto increment address of the slave

Return:

Slave ID or INVALID_SLAVE_ID if no slave matching wAutoIncAddress can be found

bool GetSlaveProp (uint dwSlaveId, out DN_EC_T_SLAVE_PROP pSlaveProp)

Determines the properties of the slave device.

Param dwSlaveId:

Slave ID

Param pSlaveProp:

Slave properties

Return:

EC_TRUE if the slave exists, EC_FALSE if no slave matching dwSlaveId can be found

ECError GetSlaveState (uint dwSlaveId, out ushort pwCurrDevState, out ushort pwReqDevState)

Get the slave state.

The slave state is always read automatically from the AL_STATUS register whenever necessary. It is not forced by calling this function. This function may be called from within the JobTask’s context.

Param dwSlaveId:

Slave ID

Param pwCurrDevState:

Current slave state

Param pwReqDevState:

Requested slave state

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range or the output pointers are EC_NULL

  • EC_E_SLAVE_NOT_PRESENT if the slave is not present

  • EC_E_NOTFOUND if no slave matching dwSlaveId can be found

ECError GetProcessVarInfoNumOf (DN_EC_T_VAR_DIRECTION eVarDirection, DN_EC_T_VAR_SOURCE eVarSource, bool bFixedAddress, ushort wSlaveAddress, out uint pdwProcessVarInfoNumOf)

Get process variables information.

Param eVarDirection:

INPUTs, OUTPUTs, … . See EC_T_VAR_DIRECTION .

Param eVarSource:

Slave, Master, … . See EC_T_VAR_SOURCE .

Param bFixedAddress:

Use station address if EC_TRUE. Otherwise use AutoInc address.

Param wSlaveAddress:

Slave address according to bFixedAddress

Param pdwProcessVarInfoNumOf:

Process variables count

Return:

EC_E_NOERROR or error code

ECError GetProcessVarInfoEx (DN_EC_T_VAR_DIRECTION eVarDirection, DN_EC_T_VAR_SOURCE eVarSource, bool bFixedAddress, ushort wSlaveAddress, out DN_EC_T_PROCESS_VAR_INFO_EX[] aoVarInfo, uint dwMaxProcessVarInfoNumOf, out uint pdwProcessVarInfoNumOf)

Get process variables information.

Param eVarDirection:

INPUTs, OUTPUTs, … . See EC_T_VAR_DIRECTION .

Param eVarSource:

Slave, Master, … . See EC_T_VAR_SOURCE .

Param bFixedAddress:

Use station address if EC_TRUE. Otherwise use AutoInc address.

Param wSlaveAddress:

Slave address according to bFixedAddress

Param aoVarInfo:

The read process variable extended information entries

Param dwMaxProcessVarInfoNumOf:

Param pdwProcessVarInfoNumOf:

Return:

EC_E_NOERROR or error code

ECError TferSingleRawCmd (DN_EC_T_CMD eCmd, uint dwMemoryAddress, byte[] pbyData, ushort wLen, uint dwTimeout)

Transfers a single raw EtherCAT command to one or multiple slaves and waits for the result.

Using this function it is possible to exchange arbitrary data between the master and the slaves. When the master receives the response to the queued frame it raises EC_NOTIFY_RAWCMD_DONE to all clients. This function blocks until the command is completely processed. In case of read commands the slave data will be written back into the given memory area. If a timeout occurs (e.g. due to a bad line quality) the corresponding frame will be sent again. The timeout value and retry counter can be set using the master configuration parameters dwEcatCmdTimeout and dwEcatCmdMaxRetries. The call will return in any case (without waiting for the number of retries specified in dwEcatCmdMaxRetries) if the time determined with the dwTimeout parameter elapsed. Caveat: Using auto increment addressing (APRD, APWR, APRW) may lead to unexpected results in case the selected slave does not increment the working counter. In such cases the EtherCAT command would be handled by the slave directly behind the selected one. This function may not be called from within the JobTask’s context.

Param eCmd:

EtherCAT command type. See EC_T_CMD

Param dwMemoryAddress:

Slave memory address, depending on the command to be sent this is either a physical or a logical address

Param pbyData:

[in, out] Buffer containing or receiving transferred data

Param wLen:

Number of bytes to transfer

Param dwTimeout:

Timeout [ms]

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range or the command is not supported or the timeout value is set to EC_NOWAIT

  • EC_E_TIMEOUT if dwTimeout elapsed during the API call

  • EC_E_BUSY if another transfer request is already pending or the master or the corresponding slave is currently changing its operational state

  • EC_E_NOTREADY if the working counter was not set when sending the command (slave may not be connected or did not respond)

  • EC_E_INVALIDSIZE if the size of the complete command does not fit into a single Ethernet frame. The maximum amount of data to transfer must not exceed 1486 bytes.

  • EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive

ECError ReadSlaveRegister (bool bFixedAddressing, ushort wSlaveAddress, ushort wRegisterOffset, byte[] pbyData, ushort wLen, uint dwTimeout)

Reads data from the ESC memory that have so far been transferred to a slave and received by the EC-Monitor.

!(EC_MONITOR) Reads data from the ESC memory of a specified slave.

This function may not be called from within the JobTask’s context.

Param bFixedAddressing:

EC_TRUE: use station address, EC_FALSE: use AutoInc address

Param wSlaveAddress:

Slave address according bFixedAddressing

Param wRegisterOffset:

Register offset. I.e. use 0x0130 to read the AL Status register.

Param pbyData:

Buffer receiving transfered data

Param wLen:

Number of bytes to receive

Param dwTimeout:

Timeout [ms]

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range or the command is not supported or the timeout value is set to EC_NOWAIT

  • EC_E_SLAVE_NOT_PRESENT if the slave is not present

  • EC_E_NOTFOUND if no slave matching bFixedAddressing / wSlaveAddress can be found

  • EC_E_TIMEOUT if dwTimeout elapsed during the API call

  • EC_E_BUSY if another transfer request is already pending or the master or the corresponding slave is currently changing its operational state

  • EC_E_NOTREADY if the working counter was not set when sending the command (slave may not be connected or did not respond)

  • EC_E_INVALIDSIZE if the size of the complete command does not fit into a single Ethernet frame. The maximum amount of data to transfer must not exceed 1486 bytes.

uint GetNumConfiguredSlaves ()

Returns the number of slaves which are configured in the ENI.

Return:

Number of slaves

ECError CoeSdoDownloadReq (IntPtr pMbxTfer, uint dwSlaveId, ushort wObIndex, byte byObSubIndex, uint dwTimeout, uint dwFlags)

Initiates a CoE SDO download to an EtherCAT slave device and returns immediately.

The length of the data to be downloaded must be set in EC_T_MBXTFER.dwDataLen. A unique transfer ID must be written into EC_T_MBXTFER.dwTferId. EC_NOTIFY_MBOXRCV is given on completion.

Param pMbxTfer:

Mailbox transfer object

Param dwSlaveId:

Slave ID

Param wObIndex:

Object index

Param byObSubIndex:

Object sub index. If Complete Access only 0 or 1 allowed.

Param dwTimeout:

Timeout [ms]

Param dwFlags:

Mailbox Flags. Bit 0: set if Complete Access (EC_MAILBOX_FLAG_SDO_COMPLETE).

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer, or dwTimeout is EC_NOWAIT

  • EC_E_NOMEMORY if the mailbox protocol queue of the slave is full

  • EC_E_SLAVE_NOT_PRESENT if the slave is not present

  • EC_E_NOTFOUND if no slave matching dwSlaveId can be found

  • EC_E_NO_MBX_SUPPORT if the slave has no mailbox support

  • EC_E_INVALID_SLAVE_STATE if the slave is in an invalid state for mailbox transfer

  • EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive

  • EC_E_ADS_IS_RUNNING if the ADS server is running

  • EC_ERROR_CODES_COE “CoE SDO error code”

ECError CoeSdoDownload (uint dwSlaveId, ushort wObIndex, byte byObSubIndex, byte[] pbyData, uint dwDataLen, uint dwTimeout, uint dwFlags)

Initiates a CoE SDO download to an EtherCAT slave device and returns immediately.

The length of the data to be downloaded must be set in EC_T_MBXTFER.dwDataLen. A unique transfer ID must be written into EC_T_MBXTFER.dwTferId. EC_NOTIFY_MBOXRCV is given on completion.

Param dwSlaveId:

Slave ID

Param wObIndex:

Object index

Param byObSubIndex:

Object sub index. If Complete Access only 0 or 1 allowed.

Param pbyData:

Param dwDataLen:

Param dwTimeout:

Timeout [ms]

Param dwFlags:

Mailbox Flags. Bit 0: set if Complete Access (EC_MAILBOX_FLAG_SDO_COMPLETE).

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer, or dwTimeout is EC_NOWAIT

  • EC_E_NOMEMORY if the mailbox protocol queue of the slave is full

  • EC_E_SLAVE_NOT_PRESENT if the slave is not present

  • EC_E_NOTFOUND if no slave matching dwSlaveId can be found

  • EC_E_NO_MBX_SUPPORT if the slave has no mailbox support

  • EC_E_INVALID_SLAVE_STATE if the slave is in an invalid state for mailbox transfer

  • EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive

  • EC_E_ADS_IS_RUNNING if the ADS server is running

  • EC_ERROR_CODES_COE “CoE SDO error code”

ECError CoeSdoUploadReq (IntPtr pMbxTfer, uint dwSlaveId, ushort wObIndex, byte byObSubIndex, uint dwTimeout, uint dwFlags)

Initiates a CoE SDO upload from an EtherCAT slave device to the master and returns immediately.

A unique transfer ID must be written into EC_T_MBXTFER.dwTferId. EC_NOTIFY_MBOXRCV is given on completion.

Param pMbxTfer:

Mailbox transfer object created with emMbxTferCreate

Param dwSlaveId:

Slave ID

Param wObIndex:

Object index

Param byObSubIndex:

Object sub index. If Complete Access only 0 or 1 allowed.

Param dwTimeout:

Timeout [ms]

Param dwFlags:

Mailbox Flags. Bit 0: set if Complete Access (EC_MAILBOX_FLAG_SDO_COMPLETE).

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer, or dwTimeout is EC_NOWAIT

  • EC_E_NOMEMORY if the mailbox protocol queue of the slave is full

  • EC_E_SLAVE_NOT_PRESENT if slave not present

  • EC_E_NOTFOUND if no slave matching dwSlaveId can be found

  • EC_E_NO_MBX_SUPPORT if slave has no mailbox support

  • EC_E_INVALID_SLAVE_STATE if slave is in an invalid state for mailbox transfer

  • EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive

  • EC_E_ADS_IS_RUNNING if the ADS server is running

  • EC_ERROR_CODES_COE “CoE SDO error code”

ECError CoeSdoUpload (uint dwSlaveId, ushort wObIndex, byte byObSubIndex, byte[] pbyData, uint dwDataLen, out uint pdwOutDataLen, uint dwTimeout, uint dwFlags)

Initiates a CoE SDO upload from an EtherCAT slave device to the master and returns immediately.

A unique transfer ID must be written into EC_T_MBXTFER.dwTferId. EC_NOTIFY_MBOXRCV is given on completion.

Param dwSlaveId:

Slave ID

Param wObIndex:

Object index

Param byObSubIndex:

Object sub index. If Complete Access only 0 or 1 allowed.

Param pbyData:

Param dwDataLen:

Param pdwOutDataLen:

Param dwTimeout:

Timeout [ms]

Param dwFlags:

Mailbox Flags. Bit 0: set if Complete Access (EC_MAILBOX_FLAG_SDO_COMPLETE).

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer, or dwTimeout is EC_NOWAIT

  • EC_E_NOMEMORY if the mailbox protocol queue of the slave is full

  • EC_E_SLAVE_NOT_PRESENT if slave not present

  • EC_E_NOTFOUND if no slave matching dwSlaveId can be found

  • EC_E_NO_MBX_SUPPORT if slave has no mailbox support

  • EC_E_INVALID_SLAVE_STATE if slave is in an invalid state for mailbox transfer

  • EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive

  • EC_E_ADS_IS_RUNNING if the ADS server is running

  • EC_ERROR_CODES_COE “CoE SDO error code”

ECError CoeGetODListReq (IntPtr pMbxTfer, uint dwSlaveId, DN_EC_T_COE_ODLIST_TYPE eListType, uint dwTimeout)

Initiates retrieval of a list of object IDs that have so far been transferred to a slave and received by the EC-Monitor and returns immediately.

!(EC_MONITOR) Initiates retrieval of a list of object IDs that are available in a slave and returns immediately.

A unique transfer ID must be written into EC_T_MBXTFER.dwTferId. EC_NOTIFY_MBOXRCV is given on completion.

The mailbox transfer object will receive the slave response containing the list type followed by the list itself. Therefore the buffer must be 2 bytes bigger than the expected list size.

Param pMbxTfer:

Mailbox transfer

Param dwSlaveId:

Slave ID

Param eListType:

Which object types shall be transferred

Param dwTimeout:

Timeout [ms]

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer, or dwTimeout is EC_NOWAIT

  • EC_E_NOMEMORY if the mailbox protocol queue of the slave is full

  • EC_E_SLAVE_NOT_PRESENT if slave not present

  • EC_E_NOTFOUND if no slave matching dwSlaveId can be found

  • EC_E_NO_MBX_SUPPORT if slave has no mailbox support

  • EC_E_INVALID_SLAVE_STATE if slave is in an invalid state for mailbox transfer

  • EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive

  • EC_E_ADS_IS_RUNNING if ADS server is running

  • EC_ERROR_CODES_COE “CoE SDO error code”

ECError CoeGetObjectDescReq (IntPtr pMbxTfer, uint dwSlaveId, ushort wObIndex, uint dwTimeout)

Initiates retrieval of the description of a specific object and returns immediately.

A unique transfer ID must be written into EC_T_MBXTFER.dwTferId. EC_NOTIFY_MBOXRCV is given on completion.

Param pMbxTfer:

Mailbox transfer object

Param dwSlaveId:

Slave ID

Param wObIndex:

Object index

Param dwTimeout:

Timeout [ms]

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer, or dwTimeout is EC_NOWAIT

  • EC_E_NOMEMORY if the mailbox protocol queue of the slave is full

  • EC_E_SLAVE_NOT_PRESENT if slave not present

  • EC_E_NOTFOUND if no slave matching dwSlaveId can be found

  • EC_E_NO_MBX_SUPPORT if slave has no mailbox support

  • EC_E_INVALID_SLAVE_STATE if slave is in an invalid state for mailbox transfer

  • EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive

  • EC_E_ADS_IS_RUNNING if ADS server is running

  • EC_ERROR_CODES_COE “CoE SDO error code”

ECError CoeGetEntryDescReq (IntPtr pMbxTfer, uint dwSlaveId, ushort wObIndex, byte byObSubIndex, byte byValueInfo, uint dwTimeout)

Initiates retrieval of the description of a specific object entry and returns immediately.

A unique transfer ID must be written into EC_T_MBXTFER.dwTferId. EC_NOTIFY_MBOXRCV is given on completion.

Param pMbxTfer:

Mailbox transfer object

Param dwSlaveId:

Slave ID

Param wObIndex:

Object index

Param byObSubIndex:

Object sub-index

Param byValueInfo:

The value info bit mask includes which elements shall be in the response. See EC_COE_ENTRY_VALUEINFO “Value info flags” for available values.

Param dwTimeout:

Timeout [ms]

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer, or dwTimeout is EC_NOWAIT

  • EC_E_NOMEMORY if the mailbox protocol queue of the slave is full

  • EC_E_SLAVE_NOT_PRESENT if slave not present

  • EC_E_NOTFOUND if no slave matching dwSlaveId can be found

  • EC_E_NO_MBX_SUPPORT if slave has no mailbox support

  • EC_E_INVALID_SLAVE_STATE if slave is in an invalid state for mailbox transfer

  • EC_E_MASTER_RED_STATE_INACTIVE if Master Redundancy is configured and master is inactive

  • EC_E_ADS_IS_RUNNING if ADS server is running

  • EC_ERROR_CODES_COE “CoE SDO error code”

ECError CoeRxPdoTfer (IntPtr pMbxTfer, uint dwSlaveId, uint dwNumber, uint dwTimeout)

Initiate CoE RxPDO transfer.

Param pMbxTfer:

Mailbox transfer object

Param dwSlaveId:

Slave ID

Param dwNumber:

PDO number

Param dwTimeout:

Timeout [ms]

Return:

EC_E_NOERROR or error code

ECError AoeGetSlaveNetId (uint dwSlaveId, out DN_EC_T_AOE_NETID poAoeNetId)

Retrieve the NetID of a specific EtherCAT device.

Param dwSlaveId:

Slave ID

Param poAoeNetId:

AoE NetID of the corresponding slave

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range, the input pointer is EC_NULL or contains EC_NULL pointer, or dwTimeout is EC_NOWAIT

  • EC_E_SLAVE_NOT_PRESENT if slave not present

  • EC_E_NOTFOUND if no slave matching dwSlaveId can be found

  • EC_E_NO_MBX_SUPPORT if slave has no mailbox support

  • EC_E_ADS_IS_RUNNING if ADS server is running

ECError GetProcessData (bool bOutputData, uint dwOffset, byte[] pbyData, uint dwLength, uint dwTimeout)

Blocking function to retrieve consistent process data from outside the JobTask context.

This function requests a copy of the process data (stored in RAM). The actual memcpy operation is executed by the JobTask to ensure data consistency. While waiting for the copy to complete, the calling context blocks and repeatedly calls sleep with an interval of at least the cycle time or one millisecond, whichever is greater. The function returns either with the requested process data once the copy is finished, or when the specified timeout has expired.

The function is blocking and should be used carefully in time-sensitive contexts and may not be called from within the JobTask context.

This function may not be called from within the JobTask’s context.

Param bOutputData:

EC_TRUE: read output data, EC_FALSE: read input data

Param dwOffset:

Byte offset in Process data to read from

Param pbyData:

Buffer receiving transferred data

Param dwLength:

Param dwTimeout:

Timeout [ms]

Return:

EC_E_NOERROR or error code

ECError GetProcessDataBits (bool bOutputData, uint dwBitOffsetPd, byte[] pbyDataDst, uint dwBitLengthDst, uint dwTimeout)

Reads a specific number of bits from the process image to the given buffer with a bit offset (synchronized).

This function may not be called from within the JobTask’s context.

Param bOutputData:

EC_TRUE: read output data, EC_FALSE: write input data

Param dwBitOffsetPd:

Bit offset in Process data image

Param pbyDataDst:

Param dwBitLengthDst:

Param dwTimeout:

Timeout [ms]. The timeout value must not be set to EC_NOWAIT.

Return:

EC_E_NOERROR or error code

ECError ForceProcessDataBits (uint dwClientId, bool bOutputData, uint dwBitOffsetPd, ushort wBitLength, byte[] pbyData, uint dwTimeout)

Force a specific number of bits from a given buffer to the process image with a bit offset.

All output data set by this API are overwriting the values set by the application. All input data set by this API are overwriting the values read from the slaves. Forcing will be terminated by calling the corresponding functions. This function may not be called from within the JobTask’s context.

Param dwClientId:

Client ID returned by RegisterClient (0 if all registered clients shall be notified)

Param bOutputData:

EC_TRUE: write output data, EC_FALSE: write input data

Param dwBitOffsetPd:

Bit offset in Process data image

Param wBitLength:

Param pbyData:

Buffer containing transfered data

Param dwTimeout:

Timeout [ms]. The timeout value must not be set to EC_NOWAIT.

Return:

EC_E_NOERROR or error code

ECError ReleaseProcessDataBits (uint dwClientId, bool bOutputData, uint dwBitOffsetPd, ushort wBitLength, uint dwTimeout)

Release previously forced process data.

  • Forced output: Value set by application become valid again. Because forced process data bits are written directly into the process output image, the application has to update the process image with the required value, otherwise the forced value is still valid.

  • Forced input: Value read from the slaves become valid again.

This function may not be called from within the JobTask’s context.

Param dwClientId:

Client ID returned by RegisterClient (0 if all registered clients shall be notified)

Param bOutputData:

EC_TRUE: write output data, EC_FALSE: write input data

Param dwBitOffsetPd:

Bit offset in Process data image

Param wBitLength:

Number of bits that shall be written to the process image.

Param dwTimeout:

Timeout [ms]. The timeout value must not be set to EC_NOWAIT.

Return:

EC_E_NOERROR or error code

ECError ReleaseAllProcessDataBits (uint dwClientId, uint dwTimeout)

Release all previously forced process data for a dedicated client.

  • Forced output: Value set by application become valid again. Because forced process data bits are written directly into the process output image, the application has to update the process image with the required value, otherwise the forced value is still valid.

  • Forced input: Value read from the slaves become valid again.

This function may not be called from within the JobTask’s context.

Param dwClientId:

Client ID returned by RegisterClient (0 if all registered clients shall be notified)

Param dwTimeout:

Timeout [ms]. The timeout value must not be set to EC_NOWAIT.

Return:

EC_E_NOERROR or error code

uint GetNumConnectedSlaves ()

Get number of currently connected slaves.

Return:

Number of connected slaves

uint GetNumConnectedSlavesMain ()

Get the number of currently connected Slaves to main interface.

Return:

Number of connected slaves at main interface

uint GetNumConnectedSlavesRed ()

Get the number of currently connected Slaves to redundancy interface.

Return:

Number of connected slaves at redundancy interface

ECError HCGetNumGroupMembers (uint dwGroupIndex)

Get number of slaves belonging to a specific Hot-Connect group.

Param dwGroupIndex:

Index of Hot-Connect group, 0 is the mandatory group

Return:

Number of slaves

ECError HCGetSlaveIdsOfGroup (uint dwGroupIndex, out uint adwSlaveId, uint dwMaxNumSlaveIds)

Get a list of Slave ID’s belonging to a specific Hot-Connect group.

Param dwGroupIndex:

Index of Hot-Connect group, 0 is the mandatory group

Param adwSlaveId:

Preallocated Slave ID list buffer

Param dwMaxNumSlaveIds:

Size of Slave ID list buffer

Return:

EC_E_NOERROR or error code

ECError GetHcGroupNumOf ()

Get number of Hot-Connect groups.

Return:

number of HC groups

ECError GetHcGroupInfo (uint dwHcGroupIdx, DN_EC_T_HC_GROUP_INFO pHcGroupInfo)

Get informations of a specific Hot-Connect group.

Param dwHcGroupIdx:

Param pHcGroupInfo:

Hot connect group info

Return:

EC_E_NOERROR or error code

ECError DcEnable ()

Enable DC Support.

Return:

EC_E_NOERROR or error code

ECError DcDisable ()

Disable DC Support.

Return:

EC_E_NOERROR or error code

ECError GetSlaveInfo (bool bFixedAddressing, ushort wSlaveAddress, out DN_EC_T_GET_SLAVE_INFO pGetSlaveInfo)

Get Slave Info.

Use emGetCfgSlaveInfo or emGetBusSlaveInfo instead

Param bFixedAddressing:

EC_TRUE: use station address, EC_FALSE: use AutoInc address

Param wSlaveAddress:

Slave address according bFixedAddressing

Param pGetSlaveInfo:

Slave information

Return:

EC_E_NOERROR or error code

ECError GetCfgSlaveInfo (bool bStationAddress, ushort wSlaveAddress, out DN_EC_T_CFG_SLAVE_INFO pSlaveInfo)

Return information about a configured slave from the ENI file.

Param bStationAddress:

Param wSlaveAddress:

Slave address according bFixedAddressing

Param pSlaveInfo:

Information about the slave

Return:

EC_E_NOERROR or error code

ECError GetBusSlaveInfo (bool bStationAddress, ushort wSlaveAddress, out DN_EC_T_BUS_SLAVE_INFO pSlaveInfo)

Return information about a slave connected to the EtherCAT bus.

Param bStationAddress:

Param wSlaveAddress:

Slave address according bFixedAddressing

Param pSlaveInfo:

Information from the slave

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range

  • EC_E_NOTFOUND if no slave matching bFixedAddressing / wSlaveAddress can be found

ECError GetSlaveInpVarInfoNumOf (bool bFixedAddressing, ushort wSlaveAddress, out ushort pwSlaveInpVarInfoNumOf)

Gets the number of input variables of a specific slave.

Param bFixedAddressing:

EC_TRUE: use station address, EC_FALSE: use AutoInc address

Param wSlaveAddress:

Slave address according bFixedAddressing

Param pwSlaveInpVarInfoNumOf:

Number of found process variable entries

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range or the output pointer is EC_NULL

  • EC_E_NOTFOUND if no slave matching bFixedAddressing / wSlaveAddress can be found

ECError GetSlaveOutpVarInfoNumOf (bool bFixedAddressing, ushort wSlaveAddress, out ushort pwSlaveOutpVarInfoNumOf)

Gets the number of output variables of a specific slave.

Param bFixedAddressing:

EC_TRUE: use station address, EC_FALSE: use AutoInc address

Param wSlaveAddress:

Slave address according bFixedAddressing

Param pwSlaveOutpVarInfoNumOf:

Number of found process variables

Return:

EC_E_NOERROR or error code

ECError GetSlaveInpVarInfo (bool bFixedAddressing, ushort wSlaveAddress, ushort wNumOfVarsToRead, out DN_EC_T_PROCESS_VAR_INFO[] pSlaveProcVarInfoEntries, out ushort pwReadEntries)

Gets the number of input variables of a specific slave.

Param bFixedAddressing:

EC_TRUE: use station address, EC_FALSE: use AutoInc address

Param wSlaveAddress:

Slave address according bFixedAddressing

Param wNumOfVarsToRead:

Param pSlaveProcVarInfoEntries:

Param pwReadEntries:

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range or the output pointer is EC_NULL

  • EC_E_NOTFOUND if no slave matching bFixedAddressing / wSlaveAddress can be found

ECError GetSlaveInpVarInfoEx (bool bFixedAddressing, ushort wSlaveAddress, ushort wNumOfVarsToRead, out DN_EC_T_PROCESS_VAR_INFO_EX[] pSlaveProcVarInfoEntries, out ushort pwReadEntries)

Gets the input process variable extended information entries of a specific slave.

Param bFixedAddressing:

EC_TRUE: use station address, EC_FALSE: use AutoInc address

Param wSlaveAddress:

Slave address according bFixedAddressing

Param wNumOfVarsToRead:

Number process variable entries that have been stored in pSlaveProcVarInfoEntries

Param pSlaveProcVarInfoEntries:

Number process variable entries that have been stored in pSlaveProcVarInfoEntries

Param pwReadEntries:

The number of read process variable information entries

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range or the output pointer is EC_NULL

  • EC_E_NOTFOUND if no slave matching bFixedAddressing / wSlaveAddress can be found

ECError GetSlaveOutpVarInfo (bool bFixedAddressing, ushort wSlaveAddress, ushort wNumOfVarsToRead, out DN_EC_T_PROCESS_VAR_INFO[] pSlaveProcVarInfoEntries, out ushort pwReadEntries)

Gets the number of output variables of a specific slave.

Param bFixedAddressing:

EC_TRUE: use station address, EC_FALSE: use AutoInc address

Param wSlaveAddress:

Slave address according bFixedAddressing

Param wNumOfVarsToRead:

Param pSlaveProcVarInfoEntries:

Param pwReadEntries:

Return:

EC_E_NOERROR or error code

ECError GetSlaveOutpVarInfoEx (bool bFixedAddressing, ushort wSlaveAddress, ushort wNumOfVarsToRead, out DN_EC_T_PROCESS_VAR_INFO_EX[] pSlaveProcVarInfoEntries, out ushort pwReadEntries)

Gets the output process variable extended information entries of a specific slave.

Param bFixedAddressing:

EC_TRUE: use station address, EC_FALSE: use AutoInc address

Param wSlaveAddress:

Slave address according bFixedAddressing

Param wNumOfVarsToRead:

Number of process variable information entries

Param pSlaveProcVarInfoEntries:

The read process extended variable entries

Param pwReadEntries:

The number of read process variable information entries

Return:

EC_E_NOERROR or error code

ECError GetSlaveOutpVarByObjectEx (bool bFixedAddressing, ushort wSlaveAddress, ushort wIndex, ushort wSubIndex, out DN_EC_T_PROCESS_VAR_INFO_EX pProcessVarInfoEntry)

Gets the input process variable extended information entry by object index, subindex of a specific slave.

Param bFixedAddressing:

EC_TRUE: use station address, EC_FALSE: use AutoInc address

Param wSlaveAddress:

Slave address according bFixedAddressing

Param wIndex:

Object index

Param wSubIndex:

Object sub index

Param pProcessVarInfoEntry:

Process variable extended information entry

Return:

EC_E_NOERROR or error code

ECError GetSlaveInpVarByObjectEx (bool bFixedAddressing, ushort wSlaveAddress, ushort wIndex, ushort wSubIndex, out DN_EC_T_PROCESS_VAR_INFO_EX pProcessVarInfoEntry)

Gets the input process variable extended information entry by object index, subindex of a specific slave.

Param bFixedAddressing:

EC_TRUE: use station address, EC_FALSE: use AutoInc address

Param wSlaveAddress:

Slave address according bFixedAddressing

Param wIndex:

Object index

Param wSubIndex:

Object sub index

Param pProcessVarInfoEntry:

Process variable extended information entry

Return:

EC_E_NOERROR or error code

ECError FindOutpVarByName (string szVariableName, out DN_EC_T_PROCESS_VAR_INFO pSlaveOutpVarInfo)

Finds an output process variable information entry by the variable name.

Param szVariableName:

Variable name

Param pSlaveOutpVarInfo:

Return:

EC_E_NOERROR or error code

ECError FindOutpVarByNameEx (string szVariableName, out DN_EC_T_PROCESS_VAR_INFO_EX pProcessVarInfoEntry)

Finds an output process variable extended information entry by the variable name.

Param szVariableName:

Variable name

Param pProcessVarInfoEntry:

Process variable extended information entry

Return:

EC_E_NOERROR or error code

ECError FindInpVarByName (string szVariableName, out DN_EC_T_PROCESS_VAR_INFO pProcessVarInfoEntry)

Finds an input process variable information entry by the variable name.

Param szVariableName:

Variable name

Param pProcessVarInfoEntry:

Process variable information entry

Return:

EC_E_NOERROR or error code

ECError FindInpVarByNameEx (string szVariableName, out DN_EC_T_PROCESS_VAR_INFO_EX pProcessVarInfoEntry)

Finds an input process variable extended information entry by the variable name.

Param szVariableName:

Variable name

Param pProcessVarInfoEntry:

Process variable extended information entry

Return:

EC_E_NOERROR or error code

ECError IsSlavePresent (uint dwSlaveId, out bool pbPresence)

Returns whether a specific slave is currently connected to the Bus.

This function may be called from within the JobTask.

Param dwSlaveId:

Slave ID

Param pbPresence:

EC_TRUE if the slave is currently connected to the bus, EC_FALSE if not

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range

  • EC_E_NOTFOUND if no slave matching dwSlaveId can be found

ECError GetDiagnosisImageSize ()

Gets the diagnosis image size.

Return:

Diagnosis image size

ECError GetSrcMacAddress (out DN_ETHERNET_ADDRESS pMacSrc)

Gets the source MAC address.

Param pMacSrc:

6-byte buffer to write source MAC address to

Return:

EC_E_NOERROR or error code

ECError GetLicenseFingerprint (byte byMethod, string szLicenseFingerprint)

Gets the fingerprint needed for license key generation.

Param byMethod:

Method used to generate the fingerprint

Param szLicenseFingerprint:

Buffer for fingerprint string. Size must be at least EC_LICENSE_FINGERPRINT_STRSIZE.

Return:

EC_E_NOERROR or error code

ECError SetLicenseKey (string szLicenseKey)

Sets the license key for the protected version of EC-Master.

Must be called after initialization and before configuration. This function may not be called if a non protected version is used.

Param szLicenseKey:

License key as zero terminated string with 26, 53 or 56 characters

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range

  • EC_E_INVALIDSIZE if the format of the license key is wrong. The correct length is 26, 53 or 56 characters.

  • EC_E_LICENSE_MISSING if the license key doesn’t match the MAC Address

ECError GetVersion (out uint pdwVersion, out uint pdwVersionType)

Gets the version information.

Param pdwVersion:

Pointer to EC_T_DWORD to carry out version number as a 32-bit value

Param pdwVersionType:

Pointer to EC_T_DWORD to carry out version type. See EC_VERSION_TYPES “EC_VERSION_TYPE”.

Return:

  • EC_E_NOERROR if successful

  • EC_E_INVALIDSTATE if EtherCAT stack isn’t initialized

  • EC_E_INVALIDPARM if dwInstanceID is out of range or the output pointer is EC_NULL

ECError FastModeInit ()
Return:

ECError FastSendAllCycFrames ()
Return:

ECError FastProcessAllRxFrames (out bool pbAreAllCycFramesProcessed)
Param pbAreAllCycFramesProcessed:

Return:

ECError GetMemoryUsage (out uint pdwCurrentUsage, out uint pdwMaxUsage)

Returns information about memory usage.

All calls to malloc/free and new/delete are monitored.

Param pdwCurrentUsage:

Current memory usage in Bytes at the time where this function is called

Param pdwMaxUsage:

Maximum memory usage in Bytes since initialization at the time where this function is called

Return:

EC_E_NOERROR or error code

ECError GetSlaveStatistics (uint dwSlaveId, out DN_EC_T_SLVSTATISTICS_DESC pSlaveStatisticsDesc)

Get Slave’s statistics counter.

Param dwSlaveId:

Slave id

Param pSlaveStatisticsDesc:

Pointer to structure EC_T_SLVSTATISTICS_DESC

Return:

EC_E_NOERROR or error code

ECError ClearSlaveStatistics (uint dwSlaveId)

Clears all error registers of a slave.

Param dwSlaveId:

Slave Id, INVALID_SLAVE_ID clears all slaves

Return:

EC_E_NOERROR or error code

uint GetMasterSyncUnitInfoNumOf ()

Get number of Master Sync Units info entries.

Return:

Number of Master Sync Units info entries

ECError GetMasterSyncUnitInfo (ushort wMsuId, out DN_EC_T_MSU_INFO pMsuInfo)

Get number of Master Sync Units info entries.

Param wMsuId:

Param pMsuInfo:

Return:

Number of Master Sync Units info entries

ECError BadConnectionsDetect (bool bRefreshSlaveStatistics, uint dwTimeout)

Detects bad connections.

Analyzes the slave ESC error counters:

  • Invalid Frame Counter (0x0300),

  • RX Error Counter (0x0301),

  • Lost Link Counter (0x0310),

whether there is a problem in the area PHY - connector - cable - connector - PHY. If one of the above error counters shows a value not equal to zero, an EC_NOTIFY_BAD_CONNECTION is generated, which contains the exact position of the faulty connection.

Param bRefreshSlaveStatistics:

Param dwTimeout:

Timeout [ms]. not be EC_NOWAIT!

Return:

EC_E_NOERROR or error code

ECError EoeSendFrame (ushort wCfgFixedAddress, byte[] pbyFrame, uint dwFrameLen)

Send EoE frame (queued)

Param wCfgFixedAddress:

Param pbyFrame:

Param dwFrameLen:

Return:

_ #EC_E_NOERROR or error code

ECError GetMonitorStatus (out DN_EC_T_MONITOR_STATUS pStatus)

Get current Monitor status.

Information about the current status of the EtherCAT frame / cycle processing

Param pStatus:

Monitor status descriptor

Return:

  • EC_E_NOERROR on success

  • EC_E_INVALIDSTATE if Monitor isn’t initialized

  • EC_E_INVALIDPARM if pStatus invalid

ECError OpenPacketCapture (DN_EC_T_PACKETCAPTURE_PARMS pParms)

Open packet capture file (PCAP).

Opens a PCAP trace for further processing within the JobTask. No LinkLayer must have been loaded.

Param pParms:

Packet capture parameter

Return:

  • EC_E_NOERROR on success

  • EC_E_INVALIDSTATE if Monitor isn’t initialized or link layer loaded

  • EC_E_INVALIDPARM if parameter file name invalid

  • EC_E_OPENFAILED if file could not be opened

  • EC_E_NOMEMORY if not enough memory available

ECError ClosePacketCapture ()

Close packet capture file (PCAP).

Return:

  • EC_E_NOERROR on success

  • EC_E_INVALIDSTATE if Monitor isn’t initialized or link layer loaded

ECError GetPacketCaptureInfo (out DN_EC_T_PACKETCAPTURE_INFO pInfo)

Get packet capture file processing status information.

Param pInfo:

Packet capture info descriptor

Return:

  • EC_E_NOERROR on success

  • EC_E_INVALIDSTATE if Monitor isn’t initialized or link layer loaded

ECError StartLivePacketCapture (DN_EC_T_PACKETCAPTURE_PARMS pParms)

Start live packet capture (PCAP).

Starts a live recording of the EtherCAT frames in a specified PCAP file.

Only the PCAP file format is currently supported.

Param pParms:

Packet capture parameter

Return:

  • EC_E_NOERROR on success

  • EC_E_INVALIDPARM if parameter file name invalid

  • EC_E_OPENFAILED if file could not be opened

  • EC_E_NOMEMORY if not enough memory available

ECError StopLivePacketCapture ()

Stop live packet capture (PCAP).

Stops a previously started live recording of the EtherCAT frames.

Return:

  • EC_E_NOERROR on success

  • EC_E_INVALIDSTATE if Monitor isn’t initialized or no recording is in progress

ECError BacktracePacketCapture (DN_EC_T_PACKETCAPTURE_PARMS pParms)

Dump packet capture (PCAP) from backtrace buffer.

Writes a backtrace of the received frames in a specified PCAP file. The number of frames in the backtrace buffer is parameterized via EC_T_MONITOR_INIT_PARMS::dwBacktraceFrames.

Only the PCAP file format is currently supported.

Param pParms:

Packet capture parameter

Return:

  • EC_E_NOERROR on success

  • EC_E_BUSY if another dump is in progress

  • EC_E_INVALIDSTATE if backtrace buffer is not initialized

  • EC_E_INVALIDPARM if parameter file name invalid

  • EC_E_OPENFAILED if file could not be opened

  • EC_E_NOMEMORY if not enough memory available

ECError ExportEniBuilderConfig (string szFileName)

Export an EniBuilder file describing the observed network topology.

Param szFileName:

null-terminated export file path

Return:

  • EC_E_NOERROR on success

  • EC_E_INVALIDPARM if parameter file name invalid

  • EC_E_OPENFAILED if file could not be opened

  • EC_E_NOMEMORY if not enough memory available

Properties

uint s_EC_VERSION { get; set; }

EC_VERSION.

summary>ATECAT_SIGNATURE

uint s_ATECAT_SIGNATURE { get; set; }

summary>INVALID_SLAVE_ID

uint s_INVALID_SLAVE_ID { get; set; }

summary>MASTER_SLAVE_ID

uint s_MASTER_SLAVE_ID { get; set; }

summary>MAX_NUMOF_MASTER_INSTANCES

uint s_MAX_NUMOF_MASTER_INSTANCES { get; set; }

summary>MASTER_RED_SLAVE_ID

uint s_MASTER_RED_SLAVE_ID { get; set; }

summary>EL9010_SLAVE_ID

uint s_EL9010_SLAVE_ID { get; set; }

summary>FRAMELOSS_SLAVE_ID

uint s_FRAMELOSS_SLAVE_ID { get; set; }

summary>JUNCTION_RED_FLAG

Events

event EcNotification OnEcNotification

summary> Occurs when a application notification is raised.

event AppNotification OnAppNotification

summary> Occurs when a RAS notification is raised.

event RasNotification OnRasNotification

summary> Occurs when a translate notification is raised.

event TranslateNotification OnTranslateNotification

summary> Occurs when a performance monitoring notification is raised.

event PerfNotification OnPerfNotification

summary> Occurs when a debug message notification is raised.

Public Static Functions

bool IsRemoteServerUp (byte[] abyIpAddr, ushort wPort)

Checks if remote server is up by sending a “ping”.

Param abyIpAddr:

IPAddress

Param wPort:

Port

Return:

true, if server is up, else false if server is down

void CopyStream (Stream source, Stream target)

Copy a stream.

Param source:

Source.

Param target:

Target.

ECError CreateObjectFromBytes (byte[] bytes, ref object obj)

Creates object from byte array.

Param bytes:

Object data as byte array

Param obj:

Object which should be filled

Return:

Error code

ECError GetSizeOfObject (object obj, out uint size)

Get byte size of object (as required from CoeSdoUpload)

Param obj:

Object

Param size:

Byte size of object

Return:

Error code

uint GetBitLenOfDataType (DN_EC_T_DEFTYPE type)

Get bit length of data type.

Param type:

Data type

Return:

Bit length

object RunUnitTest (string cmd, object data)

Run unit test (for internal use)

Param cmd:

Command

Param data:

Input data

Return:

Output data

ECError ConvValueToBytes (DN_EC_T_DEFTYPE type, object value, out byte[] bytes)

Converts value to bytes.

Param type:

Data type

Param value:

Value

Param bytes:

Bytes

Return:

Error code

ECError ConvValueFromBytes (byte[] bytes, DN_EC_T_DEFTYPE type, out object value)

Converts value from bytes.

Param bytes:

Bytes

Param type:

Data type

Param value:

Value

Return:

Error code

ECError ReadValueFromBytes (byte[] bytes, uint bitOffset, uint bitLength, DN_EC_T_DEFTYPE type, out object value)

Read value from bytes.

Param bytes:

Bytes

Param bitOffset:

Bit offset

Param bitLength:

Bit length

Param type:

Data type

Param value:

Value

Return:

Error code

ECError ReadValueFromAddress (IntPtr address, uint bitOffset, uint bitLength, DN_EC_T_DEFTYPE type, out object value)

Read value from address.

Param address:

Address

Param bitOffset:

Bit offset

Param bitLength:

Bit length

Param type:

Data type

Param value:

Value

Return:

Error code

ECError WriteValueToBytes (byte[] bytes, uint bitOffset, uint bitLength, DN_EC_T_DEFTYPE type, object value)

Write value to bytes.

Param bytes:

Bytes

Param bitOffset:

Bit offset

Param bitLength:

Bit length

Param type:

Data type

Param value:

Value

Return:

Error code

ECError WriteValueToAddress (IntPtr address, uint bitOffset, uint bitLength, DN_EC_T_DEFTYPE type, object value)

Write value to address.

Param address:

Address

Param bitOffset:

Bit offset

Param bitLength:

Bit length

Param type:

Data type

Param value:

Value

Return:

Error code

object ConvValueFromString (DN_EC_T_DEFTYPE type, string value)

Converts value from string.

Param type:

Type

Param value:

Value

Return:

Value as object

string ConvValueToString (DN_EC_T_DEFTYPE type, object value)

Converts value to string.

Param type:

Type

Param value:

Value

Return:

Value as string

string ConvStringFromByteArray (byte[] data)

Converts byte array to string (e.g. 01 02)

Param data:

Data

Return:

Data as string

byte[] ConvStringToByteArray (string data)

Converts byte array from string (e.g. 01 02)

Param data:

Data

Return:

Data as byte array

void ReadPdBitsFromAddress (IntPtr address, uint bitOffset, uint bitLength, out byte[] pdBits)

Reads process data bits from address.

Param address:

Address

Param bitOffset:

Bit offset

Param bitLength:

Bit length

Param pdBits:

[out] Process data bits

void WritePdBitsToAddress (IntPtr address, uint bitOffset, uint bitLength, byte[] pdBits)

Writes process data bits to address.

Param address:

Address

Param bitOffset:

Bit offset

Param bitLength:

Bit length

Param pdBits:

Process data bits

void ReadPdBitsFromBytes (byte[] bytes, uint bitOffset, uint bitLength, out byte[] pdBits)

Reads process data bits from bytes.

Param bytes:

Bytes

Param bitOffset:

Bit offset

Param bitLength:

Bit length

Param pdBits:

[out] Process data bits

void WritePdBitsToBytes (byte[] bytes, uint bitOffset, uint bitLength, byte[] pdBits)

Writes process data bits to bytes.

Param bytes:

Bytes

Param bitOffset:

Bit offset

Param bitLength:

Bit length

Param pdBits:

Process data bits

void ReadPdBytesFromAddress (IntPtr address, uint offset, uint length, out byte[] pdBytes)

Reads process data bytes from address.

Param address:

Address

Param offset:

Offset

Param length:

Length

Param pdBytes:

[out] Process data bytes

void WritePdBytesToAddress (IntPtr address, uint offset, byte[] pdBytes)

Writes process data bytes to address.

Param address:

Address

Param offset:

Offset

Param pdBytes:

Process data bytes

void ReadPdBytesFromBytes (byte[] bytes, uint offset, uint length, out byte[] pdBytes)

Reads process data bytes from bytes.

Param bytes:

Bytes

Param offset:

Offset

Param length:

Length

Param pdBytes:

[out] Process data bytes

void WritePdBytesToBytes (byte[] bytes, uint offset, byte[] pdBytes)

Writes process data bytes to bytes.

Param bytes:

Bytes

Param offset:

Offset

Param pdBytes:

Process data bytes

Public Static Attributes

bool EnableExceptionHandling = false

Enables exception handling (functions will throw an exception instead of returning an error code)