|
@@ -317,10 +317,13 @@ shellmatta_retCode_t shellmatta_transport_process(shellmatta_transport_layer_t
|
|
|
break;
|
|
|
|
|
|
case SHELLMATTA_TRANSPORT_PACKET_SEQ_CNT_REQUEST:
|
|
|
- /** -# send out packet with no payload */
|
|
|
- intPacket.header.packetType = SHELLMATTA_TRANSPORT_PACKET_SEQ_CNT_RESPOND;
|
|
|
- intPacket.header.payloadLength = 0u;
|
|
|
- (void)shellmatta_transport_send(transportLayer, (shellmatta_transport_packet_t *)&intPacket);
|
|
|
+ if(transportLayer->inPacket.header.payloadLength == 0u)
|
|
|
+ {
|
|
|
+ /** -# send out packet with no payload */
|
|
|
+ intPacket.header.packetType = SHELLMATTA_TRANSPORT_PACKET_SEQ_CNT_RESPOND;
|
|
|
+ intPacket.header.payloadLength = 0u;
|
|
|
+ (void)shellmatta_transport_send(transportLayer, (shellmatta_transport_packet_t *)&intPacket);
|
|
|
+ }
|
|
|
break;
|
|
|
|
|
|
case SHELLMATTA_TRANSPORT_PACKET_SEQ_CNT_RESPOND:
|
|
@@ -328,14 +331,18 @@ shellmatta_retCode_t shellmatta_transport_process(shellmatta_transport_layer_t
|
|
|
break;
|
|
|
|
|
|
case SHELLMATTA_TRANSPORT_PACKET_MAX_BUFFERSIZE_REQUEST:
|
|
|
- /** -# store the hosts buffersize */
|
|
|
- transportLayer->hostBufferSize = (uint8_t)transportLayer->inPacket.payload[0];
|
|
|
-
|
|
|
- /** -# respont with our own buffer size */
|
|
|
- intPacket.header.packetType = SHELLMATTA_TRANSPORT_PACKET_MAX_BUFFERSIZE_RESPOND;
|
|
|
- intPacket.header.payloadLength = 1u;
|
|
|
- intPacket.payload[0] = SHELLMATTA_TRANPORT_PAYLOAD_MAXLENGTH;
|
|
|
- (void)shellmatta_transport_send(transportLayer, (shellmatta_transport_packet_t *)&intPacket);
|
|
|
+
|
|
|
+ if(transportLayer->inPacket.header.payloadLength == 1u)
|
|
|
+ {
|
|
|
+ /** -# store the hosts buffersize */
|
|
|
+ transportLayer->hostBufferSize = (uint8_t)transportLayer->inPacket.payload[0];
|
|
|
+
|
|
|
+ /** -# respont with our own buffer size */
|
|
|
+ intPacket.header.packetType = SHELLMATTA_TRANSPORT_PACKET_MAX_BUFFERSIZE_RESPOND;
|
|
|
+ intPacket.header.payloadLength = 1u;
|
|
|
+ intPacket.payload[0] = SHELLMATTA_TRANPORT_PAYLOAD_MAXLENGTH;
|
|
|
+ (void)shellmatta_transport_send(transportLayer, (shellmatta_transport_packet_t *)&intPacket);
|
|
|
+ }
|
|
|
break;
|
|
|
|
|
|
case SHELLMATTA_TRANSPORT_PACKET_MAX_BUFFERSIZE_RESPOND:
|
|
@@ -344,7 +351,8 @@ shellmatta_retCode_t shellmatta_transport_process(shellmatta_transport_layer_t
|
|
|
|
|
|
case SHELLMATTA_TRANSPORT_PACKET_SEARCH_DEVICE_REQUEST:
|
|
|
/** -# check if our own uuid is inside the passed range */
|
|
|
- if(true == shellmatta_transport_search(transportLayer, &transportLayer->inPacket))
|
|
|
+ if((transportLayer->inPacket.header.payloadLength == SHELLMATTA_TRANPORT_UUID_LENGTH * 2u) &&
|
|
|
+ (true == shellmatta_transport_search(transportLayer, &transportLayer->inPacket)))
|
|
|
{
|
|
|
intPacket.header.packetType = SHELLMATTA_TRANSPORT_PACKET_SEARCH_DEVICE_RESPOND;
|
|
|
intPacket.header.payloadLength = SHELLMATTA_TRANPORT_UUID_LENGTH;
|
|
@@ -389,8 +397,7 @@ shellmatta_retCode_t shellmatta_transport_process(shellmatta_transport_layer_t
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
- /** -# undo sequence counter increment on wrong packet type */
|
|
|
- transportLayer->sequenceH2S--;
|
|
|
+ /** -# ignore unknown packets */
|
|
|
break;
|
|
|
}
|
|
|
}
|