Index: Components/PN_Stack/PN_Device/Sources/PNIOCMDEV_ownsm.c =================================================================== --- Components/PN_Stack/PN_Device/Sources/PNIOCMDEV_ownsm.c (revision 120286) +++ Components/PN_Stack/PN_Device/Sources/PNIOCMDEV_ownsm.c (working copy) @@ -195,8 +195,10 @@ return NULL; } - /* check if plug state machine ready */ - if(PNS_PLUGSM_STATE_IDLE != Pns_PLUGSM_GetState(&(ptAR->tPLUG))) + /* check if plug state machine ready : + -# Plug State machine ready to process a new Plug + -# Alarm channel is not blocked by CMSRL state machine (by missing Primary AR) */ + if(!Pns_PLUGSM_isReady(ptAR)) { DBGLOG_INFO("Pns: AR[%hhu]: Deferring plug due plugsm state %hhu", ptAR->uARIndex, Pns_PLUGSM_GetState(&(ptAR->tPLUG))); Index: Components/PN_Stack/PN_Device/Sources/PNIOCMDEV_plugsm.c =================================================================== --- Components/PN_Stack/PN_Device/Sources/PNIOCMDEV_plugsm.c (revision 120286) +++ Components/PN_Stack/PN_Device/Sources/PNIOCMDEV_plugsm.c (working copy) @@ -269,12 +269,9 @@ } /** - * @brief Handles CPMs NewData indication for a submodule + * @brief Handles CPMs NewData indication for plugged submodule * - * @param [in] ptRsc pointer to task resources. - * @param [in] ptRequestAr pointer to the AR that issued the WriteRequest. - * - * @return Result of operation. + * @param [in] ptAR pointer to task resources. */ void Pns_PLUGSM_NewData_Ind(PNS_AR_T *ptAR) @@ -288,6 +285,27 @@ } /** + * @brief This function checks whether a plug alarm might be issued. + * + * @param [in] ptAR pointer to releated AR. + * + * @return True if Plug Alarm may be reported to the IOC. + */ +bool +Pns_PLUGSM_isReady(PNS_AR_T *ptAR) +{ + /* check if plug state machine ready */ + if(PNS_PLUGSM_STATE_IDLE != Pns_PLUGSM_GetState(&(ptAR->tPLUG))) + return false; + + /* Check that alarm channel is not blocked */ + if(!Pns_CMSRL_CanTransmitAlarm(ptAR)) + return false; + + return true; +} + +/** * @} */