Skip to content

Commit

Permalink
Fixed MS/TP Slave Node FSM to enable receiving DNER frames (bacnet-st…
Browse files Browse the repository at this point in the history
  • Loading branch information
skarg authored Oct 29, 2024
1 parent 3329dff commit 05c6d06
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
13 changes: 12 additions & 1 deletion ports/at91sam7s/dlmstp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1133,14 +1133,25 @@ static void MSTP_Slave_Node_FSM(void)
MSTP_Flag.ReceivePacketPending = true;
}
break;
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
if ((DestinationAddress == MSTP_BROADCAST_ADDRESS) &&
(npdu_confirmed_service(InputBuffer, DataLength))) {
/* quietly discard any Confirmed-Request-PDU, whose
destination address is a multicast or
broadcast address, received from the
network layer. */
} else {
/* indicate successful reception to higher layer */
MSTP_Flag.ReceivePacketPending = true;
}
break;
case FRAME_TYPE_TEST_REQUEST:
MSTP_Send_Frame(FRAME_TYPE_TEST_RESPONSE, SourceAddress,
This_Station, &InputBuffer[0], DataLength);
break;
case FRAME_TYPE_TOKEN:
case FRAME_TYPE_POLL_FOR_MASTER:
case FRAME_TYPE_TEST_RESPONSE:
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
default:
break;
}
Expand Down
13 changes: 12 additions & 1 deletion ports/bdk-atxx4-mstp/dlmstp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1163,14 +1163,25 @@ static void MSTP_Slave_Node_FSM(void)
MSTP_Flag.ReceivePacketPending = true;
}
break;
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
if ((DestinationAddress == MSTP_BROADCAST_ADDRESS) &&
(npdu_confirmed_service(InputBuffer, DataLength))) {
/* quietly discard any Confirmed-Request-PDU, whose
destination address is a multicast or
broadcast address, received from the
network layer. */
} else {
/* indicate successful reception to higher layer */
MSTP_Flag.ReceivePacketPending = true;
}
break;
case FRAME_TYPE_TEST_REQUEST:
MSTP_Send_Frame(FRAME_TYPE_TEST_RESPONSE, SourceAddress,
This_Station, &InputBuffer[0], DataLength);
break;
case FRAME_TYPE_TOKEN:
case FRAME_TYPE_POLL_FOR_MASTER:
case FRAME_TYPE_TEST_RESPONSE:
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
default:
break;
}
Expand Down
18 changes: 16 additions & 2 deletions src/bacnet/datalink/mstp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,22 @@ void MSTP_Slave_Node_FSM(struct mstp_port_struct_t *mstp_port)
(void)MSTP_Put_Receive(mstp_port);
}
break;
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
case FRAME_TYPE_BACNET_EXTENDED_DATA_NOT_EXPECTING_REPLY:
if ((mstp_port->DestinationAddress == MSTP_BROADCAST_ADDRESS) &&
(npdu_confirmed_service(
mstp_port->InputBuffer, mstp_port->DataLength))) {
/* quietly discard any Confirmed-Request-PDU,
whose destination address is a multicast or
broadcast address, received from the
network layer. */
} else {
/* ForUs */
/* indicate successful reception
to the higher layers */
(void)MSTP_Put_Receive(mstp_port);
}
break;
case FRAME_TYPE_TEST_REQUEST:
MSTP_Create_And_Send_Frame(
mstp_port, FRAME_TYPE_TEST_RESPONSE,
Expand All @@ -1263,8 +1279,6 @@ void MSTP_Slave_Node_FSM(struct mstp_port_struct_t *mstp_port)
case FRAME_TYPE_TOKEN:
case FRAME_TYPE_POLL_FOR_MASTER:
case FRAME_TYPE_TEST_RESPONSE:
case FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY:
case FRAME_TYPE_BACNET_EXTENDED_DATA_NOT_EXPECTING_REPLY:
default:
break;
}
Expand Down

0 comments on commit 05c6d06

Please sign in to comment.