indented.
This commit is contained in:
@@ -303,8 +303,9 @@ static bool dlmstp_compare_data_expecting_reply(
|
||||
/* decode the request data */
|
||||
request.address.mac[0] = src_address;
|
||||
request.address.mac_len = 1;
|
||||
offset = npdu_decode(&request_pdu[0],
|
||||
NULL, &request.address, &request.npdu_data);
|
||||
offset =
|
||||
npdu_decode(&request_pdu[0], NULL, &request.address,
|
||||
&request.npdu_data);
|
||||
if (request.npdu_data.network_layer_message) {
|
||||
return false;
|
||||
}
|
||||
@@ -321,8 +322,8 @@ static bool dlmstp_compare_data_expecting_reply(
|
||||
/* decode the reply data */
|
||||
reply.address.mac[0] = dest_address;
|
||||
reply.address.mac_len = 1;
|
||||
offset = npdu_decode(&reply_pdu[0],
|
||||
&reply.address, NULL, &reply.npdu_data);
|
||||
offset =
|
||||
npdu_decode(&reply_pdu[0], &reply.address, NULL, &reply.npdu_data);
|
||||
if (reply.npdu_data.network_layer_message) {
|
||||
return false;
|
||||
}
|
||||
@@ -788,9 +789,7 @@ static bool MSTP_Master_Node_FSM(
|
||||
} else {
|
||||
frame_type = FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY;
|
||||
}
|
||||
MSTP_Send_Frame(frame_type,
|
||||
TransmitPacketDest,
|
||||
This_Station,
|
||||
MSTP_Send_Frame(frame_type, TransmitPacketDest, This_Station,
|
||||
(uint8_t *) & TransmitPacket[0], TransmitPacketLen);
|
||||
MSTP_Flag.TransmitPacketPending = false;
|
||||
FrameCount++;
|
||||
@@ -904,8 +903,8 @@ static bool MSTP_Master_Node_FSM(
|
||||
/* address at which a new master node may be found in that case. */
|
||||
TokenCount++;
|
||||
/* transmit a Token frame to NS */
|
||||
MSTP_Send_Frame(FRAME_TYPE_TOKEN,
|
||||
Next_Station, This_Station, NULL, 0);
|
||||
MSTP_Send_Frame(FRAME_TYPE_TOKEN, Next_Station,
|
||||
This_Station, NULL, 0);
|
||||
RetryCount = 0;
|
||||
EventCount = 0;
|
||||
Master_State = MSTP_MASTER_STATE_PASS_TOKEN;
|
||||
@@ -927,8 +926,8 @@ static bool MSTP_Master_Node_FSM(
|
||||
/* ResetMaintenancePFM */
|
||||
Poll_Station = This_Station;
|
||||
/* transmit a Token frame to NS */
|
||||
MSTP_Send_Frame(FRAME_TYPE_TOKEN,
|
||||
Next_Station, This_Station, NULL, 0);
|
||||
MSTP_Send_Frame(FRAME_TYPE_TOKEN, Next_Station,
|
||||
This_Station, NULL, 0);
|
||||
RetryCount = 0;
|
||||
TokenCount = 1; /* changed in Errata SSPC-135-2004 */
|
||||
EventCount = 0;
|
||||
@@ -937,8 +936,8 @@ static bool MSTP_Master_Node_FSM(
|
||||
} else {
|
||||
/* SendMaintenancePFM */
|
||||
Poll_Station = next_poll_station;
|
||||
MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER,
|
||||
Poll_Station, This_Station, NULL, 0);
|
||||
MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
|
||||
This_Station, NULL, 0);
|
||||
RetryCount = 0;
|
||||
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
|
||||
}
|
||||
@@ -959,8 +958,8 @@ static bool MSTP_Master_Node_FSM(
|
||||
/* RetrySendToken */
|
||||
RetryCount++;
|
||||
/* Transmit a Token frame to NS */
|
||||
MSTP_Send_Frame(FRAME_TYPE_TOKEN,
|
||||
Next_Station, This_Station, NULL, 0);
|
||||
MSTP_Send_Frame(FRAME_TYPE_TOKEN, Next_Station,
|
||||
This_Station, NULL, 0);
|
||||
EventCount = 0;
|
||||
/* re-enter the current state to listen for NS */
|
||||
/* to begin using the token. */
|
||||
@@ -969,8 +968,8 @@ static bool MSTP_Master_Node_FSM(
|
||||
/* Assume that NS has failed. */
|
||||
Poll_Station = next_next_station;
|
||||
/* Transmit a Poll For Master frame to PS. */
|
||||
MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER,
|
||||
Poll_Station, This_Station, NULL, 0);
|
||||
MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
|
||||
This_Station, NULL, 0);
|
||||
/* no known successor node */
|
||||
Next_Station = This_Station;
|
||||
RetryCount = 0;
|
||||
@@ -1003,8 +1002,8 @@ static bool MSTP_Master_Node_FSM(
|
||||
/* on the network and is empowered to create a token. */
|
||||
Poll_Station = next_this_station;
|
||||
/* Transmit a Poll For Master frame to PS. */
|
||||
MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER,
|
||||
Poll_Station, This_Station, NULL, 0);
|
||||
MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
|
||||
This_Station, NULL, 0);
|
||||
/* indicate that the next station is unknown */
|
||||
Next_Station = This_Station;
|
||||
RetryCount = 0;
|
||||
@@ -1027,8 +1026,8 @@ static bool MSTP_Master_Node_FSM(
|
||||
Next_Station = SourceAddress;
|
||||
EventCount = 0;
|
||||
/* Transmit a Token frame to NS */
|
||||
MSTP_Send_Frame(FRAME_TYPE_TOKEN,
|
||||
Next_Station, This_Station, NULL, 0);
|
||||
MSTP_Send_Frame(FRAME_TYPE_TOKEN, Next_Station,
|
||||
This_Station, NULL, 0);
|
||||
Poll_Station = This_Station;
|
||||
TokenCount = 0;
|
||||
RetryCount = 0;
|
||||
@@ -1060,8 +1059,8 @@ static bool MSTP_Master_Node_FSM(
|
||||
/* poll for a master at address PS. */
|
||||
EventCount = 0;
|
||||
/* transmit a Token frame to NS */
|
||||
MSTP_Send_Frame(FRAME_TYPE_TOKEN,
|
||||
Next_Station, This_Station, NULL, 0);
|
||||
MSTP_Send_Frame(FRAME_TYPE_TOKEN, Next_Station,
|
||||
This_Station, NULL, 0);
|
||||
RetryCount = 0;
|
||||
Master_State = MSTP_MASTER_STATE_PASS_TOKEN;
|
||||
} else {
|
||||
@@ -1092,10 +1091,10 @@ static bool MSTP_Master_Node_FSM(
|
||||
case MSTP_MASTER_STATE_ANSWER_DATA_REQUEST:
|
||||
/* Note: we could wait for up to Treply_delay */
|
||||
if (MSTP_Flag.TransmitPacketPending) {
|
||||
matched = dlmstp_compare_data_expecting_reply(&InputBuffer[0],
|
||||
DataLength,
|
||||
SourceAddress,
|
||||
&TransmitPacket[0], TransmitPacketLen, TransmitPacketDest);
|
||||
matched =
|
||||
dlmstp_compare_data_expecting_reply(&InputBuffer[0],
|
||||
DataLength, SourceAddress, &TransmitPacket[0],
|
||||
TransmitPacketLen, TransmitPacketDest);
|
||||
}
|
||||
if (MSTP_Flag.TransmitPacketPending && matched) {
|
||||
/* Reply */
|
||||
@@ -1111,9 +1110,7 @@ static bool MSTP_Master_Node_FSM(
|
||||
} else {
|
||||
frame_type = FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY;
|
||||
}
|
||||
MSTP_Send_Frame(frame_type,
|
||||
TransmitPacketDest,
|
||||
This_Station,
|
||||
MSTP_Send_Frame(frame_type, TransmitPacketDest, This_Station,
|
||||
(uint8_t *) & TransmitPacket[0], TransmitPacketLen);
|
||||
MSTP_Flag.TransmitPacketPending = false;
|
||||
Master_State = MSTP_MASTER_STATE_IDLE;
|
||||
@@ -1127,8 +1124,8 @@ static bool MSTP_Master_Node_FSM(
|
||||
/* Any reply shall wait until this node receives the token. */
|
||||
/* Call MSTP_Send_Frame to transmit a Reply Postponed frame, */
|
||||
/* and enter the IDLE state. */
|
||||
MSTP_Send_Frame(FRAME_TYPE_REPLY_POSTPONED,
|
||||
SourceAddress, This_Station, NULL, 0);
|
||||
MSTP_Send_Frame(FRAME_TYPE_REPLY_POSTPONED, SourceAddress,
|
||||
This_Station, NULL, 0);
|
||||
Master_State = MSTP_MASTER_STATE_IDLE;
|
||||
}
|
||||
/* clear our flag we were holding for comparison */
|
||||
|
||||
Reference in New Issue
Block a user