1
1
/*
2
- This file is part of ArduinoIoTCloud.
2
+ This file is part of the ArduinoIoTCloud library .
3
3
4
- Copyright 2020 ARDUINO SA (http://www.arduino.cc/)
4
+ Copyright (c) 2024 Arduino SA
5
5
6
- This software is released under the GNU General Public License version 3,
7
- which covers the main part of arduino-cli.
8
- The terms of this license can be found at:
9
- https://www.gnu.org/licenses/gpl-3.0.en.html
10
-
11
- You can be released from the requirements of the above licenses by purchasing
12
- a commercial license. Buying such a license is mandatory if you want to modify or
13
- otherwise use the software for commercial activities involving the Arduino
14
- software without disclosing the source code of your own applications. To purchase
15
- a commercial license, send an email to license@arduino.cc.
6
+ This Source Code Form is subject to the terms of the Mozilla Public
7
+ License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
16
9
*/
17
10
18
- #ifndef ARDUINO_OTA_LOGIC_H_
19
- #define ARDUINO_OTA_LOGIC_H_
11
+ #pragma once
12
+ #include " AIoTC_Config.h"
13
+ #if OTA_ENABLED
20
14
21
- /* *****************************************************************************
22
- * INCLUDE
23
- ***************************************************************************** */
15
+ # ifdef ARDUINO_ARCH_SAMD
16
+ # include " OTASamd.h "
17
+ using OTACloudProcess = SAMDOTACloudProcess;
24
18
25
- #include < AIoTC_Config.h>
19
+ #elif defined(ARDUINO_NANO_RP2040_CONNECT)
20
+ #include " OTANanoRP2040.h"
21
+ using OTACloudProcess = NANO_RP2040OTACloudProcess;
26
22
27
- #if OTA_ENABLED
28
- #include < Arduino.h >
29
- # include < Arduino_ConnectionHandler.h >
23
+ #elif defined(BOARD_STM32H7)
24
+ #include " OTAPortentaH7.h "
25
+ using OTACloudProcess = STM32H7OTACloudProcess;
30
26
31
- /* *****************************************************************************
32
- * DEFINES
33
- ***************************************************************************** */
27
+ # elif defined(ARDUINO_ARCH_ESP32)
28
+ # include " OTAEsp32.h "
29
+ using OTACloudProcess = ESP32OTACloudProcess;
34
30
35
- #define RP2040_OTA_ERROR_BASE (-100 )
36
31
37
- /* *****************************************************************************
38
- * TYPEDEF
39
- ******************************************************************************/
32
+ #if defined (ARDUINO_NANO_ESP32)
33
+ constexpr uint32_t OtaMagicNumber = 0x23410070 ;
34
+ #else
35
+ constexpr uint32_t OtaMagicNumber = 0x45535033 ;
36
+ #endif
37
+
38
+ #elif defined(ARDUINO_UNOR4_WIFI)
39
+ #include " OTAUnoR4.h"
40
+ using OTACloudProcess = UNOR4OTACloudProcess;
41
+
42
+ #else
43
+ #error "This Board doesn't support OTA"
44
+ #endif
45
+
46
+ #define RP2040_OTA_ERROR_BASE (-100 )
40
47
41
48
enum class OTAError : int
42
49
{
@@ -54,20 +61,4 @@ enum class OTAError : int
54
61
RP2040_ErrorUnmount = RP2040_OTA_ERROR_BASE - 9 ,
55
62
};
56
63
57
- /* *****************************************************************************
58
- * CLASS DECLARATION
59
- ******************************************************************************/
60
-
61
- class OTA
62
- {
63
- public:
64
-
65
- static int onRequest (String url, NetworkAdapter iface);
66
- static String getImageSHA256 ();
67
- static bool isCapable ();
68
-
69
- };
70
-
71
- #endif /* OTA_ENABLED */
72
-
73
- #endif /* ARDUINO_OTA_LOGIC_H_ */
64
+ #endif // OTA_ENABLED
0 commit comments