Skip to content

Commit f14877a

Browse files
committed
Add the possibility to use a different socket (Ethernet) for download
1 parent b504877 commit f14877a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Arduino_Portenta_OTA.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
#include <LittleFileSystem.h>
3838
#include <Arduino_DebugUtils.h>
3939

40+
#include "WiFi.h" /* WiFi from ArduinoCore-mbed */
41+
#include <SocketHelpers.h>
42+
4043
/******************************************************************************
4144
* DEFINE
4245
******************************************************************************/
@@ -95,7 +98,7 @@ class Arduino_Portenta_OTA
9598
/* This functionality is intended for usage with the Arduino IoT Cloud for
9699
* performing OTA firmware updates using the Arduino IoT Cloud servers.
97100
*/
98-
int download(const char * url, bool const is_https);
101+
int download(const char * url, bool const is_https, MbedSocketClass * socket = static_cast<MbedSocketClass*>(&WiFi));
99102
int decompress();
100103
void setFeedWatchdogFunc(ArduinoPortentaOtaWatchdogResetFuncPointer func);
101104
void feedWatchdog();

src/decompress/utility.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
#include "lzss.h"
2424

25-
#include "WiFi.h" /* WiFi from ArduinoCore-mbed */
2625
#include "Arduino_Portenta_OTA.h"
2726

2827
/**************************************************************************************
@@ -90,9 +89,9 @@ uint32_t crc_update(uint32_t crc, const void * data, size_t data_len)
9089
MAIN
9190
**************************************************************************************/
9291

93-
int Arduino_Portenta_OTA::download(const char * url, bool const is_https)
92+
int Arduino_Portenta_OTA::download(const char * url, bool const is_https, MbedSocketClass * socket)
9493
{
95-
return WiFi.download((char *)url, UPDATE_FILE_NAME_LZSS, is_https);
94+
return socket->download((char *)url, UPDATE_FILE_NAME_LZSS, is_https);
9695
}
9796

9897
int Arduino_Portenta_OTA::decompress()

0 commit comments

Comments
 (0)