OtaArchive_init(&gOtaArcive); UART_PRINT( "[ota] calling HttpClient_Connect..."); otaSockId = HttpClient_Connect("", SERVER_IP_ADDR, 8000, false, false); UART_PRINT( "%d \r\n", otaSockId); status = HttpClient_SendReq(otaSockId, (uint8_t*)otaBuffer, "GET", "serverNameTest", " /ota.tar", "", "hdrName", "hdrVal"); UART_PRINT( "[ota] HttpClient_SendReq=%d \r\n", status); bytesReceived = HttpClient_RecvSkipHdr(otaSockId, (uint8_t*)otaBuffer, OTA_BUFF_SIZE, &contentLen); UART_PRINT( "[ota] HttpClient_RecvSkipHdr byteReceived=%d contentLen=%d\r\n", bytesReceived, contentLen); bytesReceived = 0; bytesProcessed = 0; while( contentLen > 0 ) { bytesReceived = HttpClient_RecvAppend(otaSockId, (uint8_t*)otaBuffer, OTA_BUFF_SIZE, bytesReceived, bytesProcessed); UART_PRINT( "[ota] HttpClient_RecvAppend byteReceived=%d \r\n", bytesReceived); status = OtaArchive_process(&gOtaArcive, (uint8_t*)otaBuffer, bytesReceived, &bytesProcessed); UART_PRINT( "[ota] OtaArchive_process=%d preocessed=%d contLen=%d\r\n", status, bytesProcessed, contentLen); usleep(100ul * 1000ul); contentLen -= bytesReceived; }
Calling this code to fetch a local file from a python temporary webserver (file download tested with chrome and firefox). Results in the following log:
OtaArchive_Init: OTA archive version = OTA_ARCHIVE_2.0.0.4 [ota] calling HttpClient_Connect...HttpClient_Connect: IP_ADDR=10.0.0.100 0 [ota] HttpClient_SendReq=62 [ota] HttpClient_RecvSkipHdr byteReceived=0 contentLen=235520 [ota] HttpClient_RecvAppend byteReceived=1440 OtaArchive_RunParse: set state=ARCHIVE_STATE_PARSE_HDR [ota] OtaArchive_process=0 preocessed=0 contLen=235520 [wifi] SimpleLinkFatalErrorEventHandler 2 HttpClient_RecvAppend: ERROR HttpClient_Recv, status=-2005 [ota] HttpClient_RecvAppend byteReceived=-2005 OtaArchive_RunParseTar: parsing archive file header [ota] OtaArchive_process=2 preocessed=0 contLen=234080 HttpClient_RecvAppend: ERROR RecvLen=-2005, RecvOffset=0 [ota] HttpClient_RecvAppend byteReceived=-20311 OtaArchive_RunParseTar: parsing archive file header [ota] OtaArchive_process=2 preocessed=0 contLen=236085 HttpClient_RecvAppend: ERROR RecvLen=-20311, RecvOffset=0 [ota] HttpClient_RecvAppend byteReceived=-20311 OtaArchive_RunParseTar: parsing archive file header [ota] OtaArchive_process=2 preocessed=0 contLen=256396 HttpClient_RecvAppend: ERROR RecvLen=-20311, RecvOffset=0 [ota] HttpClient_RecvAppend byteReceived=-20311
Why do I get "SL_DEVICE_EVENT_FATAL_SYNC_LOSS" ?