diff options
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 3357cfc06..5a77a013d 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -6,6 +6,7 @@ */ #include "include.h" #include "Communication/CommunicationTask.h" +#include "Communication/connection.h" #include <DataDef.h> #include <Communication/PMR/IO/FileUploadRequest.pb-c.h> @@ -37,6 +38,9 @@ #include "third_party/fatfs/src/ffconf.h" +#include "StateMachines/Printing/PrintingSTM.h" + + ErrorCode FileError_to_ErrorCode[FR_INVALID_PARAMETER+1] = {ERROR_CODE__NONE,ERROR_CODE__FILE_REQUEST_DISK_ERR,ERROR_CODE__FILE_REQUEST_INT_ERR,ERROR_CODE__FILE_REQUEST_NOT_READY,ERROR_CODE__FILE_REQUEST_NO_FILE, ERROR_CODE__FILE_REQUEST_NO_PATH,ERROR_CODE__FILE_REQUEST_INVALID_NAME,ERROR_CODE__FILE_REQUEST_DENIED,ERROR_CODE__FILE_REQUEST_EXIST,ERROR_CODE__FILE_REQUEST_INVALID_OBJECT, ERROR_CODE__FILE_REQUEST_WRITE_PROTECTED,ERROR_CODE__FILE_REQUEST_INVALID_DRIVE,ERROR_CODE__FILE_REQUEST_NOT_ENABLED,ERROR_CODE__FILE_REQUEST_NO_FILESYSTEM, @@ -95,6 +99,8 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) if (Fresult == FR_OK) { FileLength = request->length; + FileReceivedLength = 0; + REPORT_MSG (FileLength,"file upload request"); response.has_maxchunklength = true; response.maxchunklength = MAX_CHUNK_LENGTH; strcpy(FileHandleChar, "1234"); @@ -147,7 +153,8 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) // memcpy (&ReceivedFileHandle,request->uploadid,sizeof(ReceivedFileHandle)); //if (ReceivedFileHandle == FileHandle) //{ - Fresult = f_write(ReceivedFileHandle,request->buffer.data,request->buffer.len,&WrittenBytes ); + KeepAliveOneSecondCounter = 0; + Fresult = f_write(ReceivedFileHandle,request->buffer.data,request->buffer.len,&WrittenBytes ); if(Fresult != FR_OK) { LOG_ERROR (Fresult,"f_write error"); @@ -156,6 +163,7 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) else { FileReceivedLength += WrittenBytes; + //REPORT_MSG (FileReceivedLength,"file upload chunk"); if (FileReceivedLength == FileLength) { REPORT_MSG (FileReceivedLength,"file upload ended successfully"); @@ -185,7 +193,7 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) status = ERROR_CODE__FILE_NOT_FOUND; }*/ - responseContainer = createContainer(MESSAGE_TYPE__FileChunkUploadResponse, requestContainer->token, false, &response, &file_chunk_upload_response__pack, &file_chunk_upload_response__get_packed_size); + responseContainer = createContainer(MESSAGE_TYPE__FileChunkUploadResponse, requestContainer->token, FileDone, &response, &file_chunk_upload_response__pack, &file_chunk_upload_response__get_packed_size); if (Fresult!= OK) { responseContainer.error = getErrorCode(Fresult); |
