|
@@ -145,10 +145,16 @@ static shellmatta_retCode_t ymodem_stateMachine(shellmatta_handle_t handle, uint
|
|
break;
|
|
break;
|
|
|
|
|
|
case YMODEM_EOT:
|
|
case YMODEM_EOT:
|
|
- inst->ymodem.transmissionCompleteCallback();
|
|
|
|
|
|
+ /** -# check if the received data matches the file size */
|
|
|
|
+ if((inst->ymodem.totalBytesReceived < inst->ymodem.fileSize) ||
|
|
|
|
+ ((inst->ymodem.totalBytesReceived - inst->ymodem.fileSize) >= YMODEM_PACKET_SIZE_1K))
|
|
|
|
+ {
|
|
|
|
+ ret = SHELLMATTA_ERROR;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ inst->ymodem.transmissionCompleteCallback(ret);
|
|
|
|
|
|
- // todo check for a complete telegram having been received
|
|
|
|
- // ...add a wait state to answer some more EOTs after time
|
|
|
|
|
|
+ // todo add a wait state to answer some more EOTs after time
|
|
|
|
|
|
/** -# ACK the successful file reception */
|
|
/** -# ACK the successful file reception */
|
|
shellmatta_ymodem_control(handle, YMODEM_ACK);
|
|
shellmatta_ymodem_control(handle, YMODEM_ACK);
|