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

◆ PN_API_IOD_setDeviceState()

uint32_t PN_API_IOD_setDeviceState ( PN_API_IOD_Handle_t *const  pnHandle,
uint32_t  devState 
)

Sets the IO device state to either "operate" or "clear".

During startup, this function should be invoked once to transition the IO device to the "operate" state. When called with the "clear" option, all IO submodules retain their "superordinated locked" state until another call with the "operate" option is made. Each invocation of this function terminates any ongoing AR. The initial invocation with the "operate" option doesn't need to be performed separately, as its call is currently incorporated within PN_API_IOD_startup().

Warning
Resetting to "clear" can signal a critical device error, causing valid IO data no longer to be processed. Therefore, only use this function in exceptional cases.
Parameters
[in]pnHandleProfinet API Handle.
[in]devStateDEVICE_STATE_OPERATE or DEVICE_STATE_CLEAR.
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_device.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 PN_API_IOD_setDeviceState(PN_API_IOD_Handle_t *const pnHandle, uint32_t devState)
Sets the IO device state to either "operate" or "clear".
#define DEVICE_STATE_CLEAR
Device state "clear".
Definition pn_api_iod_device.h:29
PN_API_IOD_Handle_t * PN_API_IOD_new(void)
Creates Profinet API handle.
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