PROFINET Device4.2.0
 
Loading...
Searching...
No Matches

◆ PN_API_IOD_addExtDiagChannel()

uint32_t PN_API_IOD_addExtDiagChannel ( PN_API_IOD_Handle_t *const  pnHandle,
const uint32_t  api,
PN_API_IOD_DevAddr_t *const  addr,
const uint16_t  channelNum,
const uint16_t  errorNum,
const PN_API_IOD_DiagChannelPropDirection_t  chanDir,
const PN_API_IOD_DiagChannelPropType_t  chanTyp,
const uint16_t  extChannelErrType,
const uint32_t  extChannelAddValue,
const bool  maintenanceReq,
const bool  maintenanceDem,
const uint16_t  diagTag 
)

Add extended channel diagnostic alarm to PN stack.

Installs an extended diagnostic record within a subslot. When the device owns this subslot in an AR, an extended 'Diagnostic alarm - incoming' is automatically dispatched to the IO controller. The PN_API_IOD_removeExtDiagChannel() function can be employed for eliminating the diagnostic record once the issue is resolved. The 'diagTag' value is a user-defined variable <> 0, serving to differentiate between various alarms for a single subslot that are concurrently valid. Therefore, it must always remain unique within one subslot. If only one alarm can be accessible at a given time, a constant value (e.g. 1) can be utilized. Otherwise, the application is responsible for managing 'diagTag' values and ensuring their uniqueness within this subslot.

Parameters
[in]pnHandleProfinet API Handle.
[in]apiApplication Process Identifier.
[in]addrGeographical address (slot/subslot) of the module/submodule.
[in]channelNumChannel number.
[in]errorNumError number, see PNIO specification coding of "ChannelErrorType".
[in]chanDirChannel direction (see PN_API_IOD_DiagChannelPropDirection_t).
[in]chanTypChannel type (see PN_API_IOD_DiagChannelPropType_t).
[in]extChannelErrTypeExtended channel error type (see PNIO specification).
[in]extChannelAddValueExtended channel add. value (see PNIO specification).
[in]maintenanceReqMaintenance required.
[in]maintenanceDemMaintenance demanded.
[in]diagTagUser defined diag tag != 0.
Returns
result of the operation as uint32_t.
Return values
PN_API_OKSuccess.
PN_API_NOT_OKSomething went wrong.
PN_API_ERR_PARAMInvalid parameter.
Example
#include "pn_api_iod_diagnostic.h"
#include "pn_api_iod_startup.h"
PN_API_IOD_Handle_t* pnHandle = NULL;
uint32_t status;
pnHandle = PN_API_IOD_new();
//Prepare and call PN_API_IOD_startup()
...
uint32_t api = 0;
uint16_t channelNum = 1;
uint16_t errorNum;
uint16_t diagTag = 1;
uint16_t extChannelErrType = ..; // look at IEC61158-5-10/
uint32_t extChannelAddValue = ....; // look at IEC61158-5-10/
bool maintenanceReq = 1, bool maintenanceDem = 0;
addr.address.geo.slot = 1;
addr.address.geo.subslot = 2;
status = PN_API_IOD_addExtDiagChannel(pnHandle, api, &addr, channelNum
errorNum, chanDir, chanTyp, extChannelErrType, extChannelAddValue, maintenanceReq,
maintenanceDem, diagTag);
uint32_t PN_API_IOD_addExtDiagChannel(PN_API_IOD_Handle_t *const pnHandle, const uint32_t api, PN_API_IOD_DevAddr_t *const addr, const uint16_t channelNum, const uint16_t errorNum, const PN_API_IOD_DiagChannelPropDirection_t chanDir, const PN_API_IOD_DiagChannelPropType_t chanTyp, const uint16_t extChannelErrType, const uint32_t extChannelAddValue, const bool maintenanceReq, const bool maintenanceDem, const uint16_t diagTag)
Add extended channel diagnostic alarm to PN stack.
PN_API_IOD_Handle_t * PN_API_IOD_new(void)
Creates Profinet API handle.
PN_API_IOD_DiagChannelPropType_t
Defines for channel properties.type.
Definition pn_api_iod_types.h:372
@ PN_API_IOD_DiagChannelPropTypeByte
Definition pn_api_iod_types.h:377
PN_API_IOD_DiagChannelPropDirection_t
Defines for channel properties.direction.
Definition pn_api_iod_types.h:359
@ PN_API_IOD_DiagChannelPropDirectionIn
Definition pn_api_iod_types.h:361
@ PN_API_IOD_AddrGeo
Definition pn_api_iod_types.h:155
struct PN_API_IOD_Handle PN_API_IOD_Handle_t
API handle instance which holds IO device's info.
Definition pn_api_iod_types.h:61
union PN_API_IOD_DevAddr_t::@0 address
PN_API_IOD_AddrType_t type
Definition pn_api_iod_types.h:446
struct PN_API_IOD_DevAddr_t::@0::@1 geo
uint32_t subslot
Definition pn_api_iod_types.h:453
uint32_t slot
Definition pn_api_iod_types.h:452
Module/Submodule address (logical/geographical).
Definition pn_api_iod_types.h:445