indented.
This commit is contained in:
@@ -144,13 +144,12 @@ uint16_t dlmstp_receive(
|
||||
if (Receive_Packet.pdu_len) {
|
||||
MSTP_Packets++;
|
||||
if (src) {
|
||||
memmove(src,
|
||||
&Receive_Packet.address,
|
||||
memmove(src, &Receive_Packet.address,
|
||||
sizeof(Receive_Packet.address));
|
||||
}
|
||||
if (pdu) {
|
||||
memmove(pdu,
|
||||
&Receive_Packet.pdu, sizeof(Receive_Packet.pdu));
|
||||
memmove(pdu, &Receive_Packet.pdu,
|
||||
sizeof(Receive_Packet.pdu));
|
||||
}
|
||||
pdu_len = Receive_Packet.pdu_len;
|
||||
}
|
||||
@@ -301,11 +300,9 @@ uint16_t MSTP_Get_Send(
|
||||
}
|
||||
/* convert the PDU into the MSTP Frame */
|
||||
pdu_len = MSTP_Create_Frame(&mstp_port->OutputBuffer[0], /* <-- loading this */
|
||||
mstp_port->OutputBufferSize,
|
||||
Transmit_Packet.frame_type,
|
||||
destination,
|
||||
mstp_port->This_Station,
|
||||
&Transmit_Packet.pdu[0], Transmit_Packet.pdu_len);
|
||||
mstp_port->OutputBufferSize, Transmit_Packet.frame_type, destination,
|
||||
mstp_port->This_Station, &Transmit_Packet.pdu[0],
|
||||
Transmit_Packet.pdu_len);
|
||||
Transmit_Packet.ready = false;
|
||||
|
||||
return pdu_len;
|
||||
@@ -336,8 +333,9 @@ 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;
|
||||
}
|
||||
@@ -353,8 +351,8 @@ bool dlmstp_compare_data_expecting_reply(
|
||||
request.service_choice = request_pdu[offset + 3];
|
||||
/* decode the reply data */
|
||||
bacnet_address_copy(&reply.address, dest_address);
|
||||
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;
|
||||
}
|
||||
@@ -443,19 +441,18 @@ uint16_t MSTP_Get_Reply(
|
||||
return 0;
|
||||
}
|
||||
/* is this the reply to the DER? */
|
||||
matched = dlmstp_compare_data_expecting_reply(&mstp_port->InputBuffer[0],
|
||||
mstp_port->DataLength,
|
||||
mstp_port->SourceAddress,
|
||||
&Transmit_Packet.pdu[0],
|
||||
Transmit_Packet.pdu_len, &Transmit_Packet.address);
|
||||
matched =
|
||||
dlmstp_compare_data_expecting_reply(&mstp_port->InputBuffer[0],
|
||||
mstp_port->DataLength, mstp_port->SourceAddress,
|
||||
&Transmit_Packet.pdu[0], Transmit_Packet.pdu_len,
|
||||
&Transmit_Packet.address);
|
||||
if (!matched)
|
||||
return 0;
|
||||
/* convert the PDU into the MSTP Frame */
|
||||
pdu_len = MSTP_Create_Frame(&mstp_port->OutputBuffer[0], /* <-- loading this */
|
||||
mstp_port->OutputBufferSize,
|
||||
Transmit_Packet.frame_type,
|
||||
destination, mstp_port->This_Station,
|
||||
&Transmit_Packet.pdu[0], Transmit_Packet.pdu_len);
|
||||
mstp_port->OutputBufferSize, Transmit_Packet.frame_type, destination,
|
||||
mstp_port->This_Station, &Transmit_Packet.pdu[0],
|
||||
Transmit_Packet.pdu_len);
|
||||
Transmit_Packet.ready = false;
|
||||
|
||||
return pdu_len;
|
||||
@@ -721,8 +718,7 @@ int main(
|
||||
for (;;) {
|
||||
pdu_len = dlmstp_receive(NULL, NULL, 0, INFINITE);
|
||||
#if 0
|
||||
MSTP_Create_And_Send_Frame(&MSTP_Port,
|
||||
FRAME_TYPE_TEST_REQUEST,
|
||||
MSTP_Create_And_Send_Frame(&MSTP_Port, FRAME_TYPE_TEST_REQUEST,
|
||||
MSTP_Port.SourceAddress, MSTP_Port.This_Station, NULL, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user