Skip to content

Commit 7847be3

Browse files
committed
Renaming OTAStorage_Nina to OTAStorage_SNU
1 parent 1037740 commit 7847be3

File tree

4 files changed

+34
-22
lines changed

4 files changed

+34
-22
lines changed

Diff for: src/ArduinoIoTCloudTCP.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
#include "tls/utility/CryptoUtil.h"
3030
#endif
3131

32-
#include "utility/ota/OTAStorage_SSU.h"
32+
#include "utility/ota/OTAStorage_SNU.h"
3333
#include "utility/ota/OTAStorage_SFU.h"
34+
#include "utility/ota/OTAStorage_SSU.h"
3435

3536
#include "cbor/CBOREncoder.h"
3637

@@ -44,6 +45,8 @@ TimeService time_service;
4445
static OTAStorage_SSU ota_storage_ssu;
4546
#elif OTA_STORAGE_SFU
4647
static OTAStorage_SFU ota_storage_sfu;
48+
#elif OTA_STORAGE_SNU
49+
static OTAStorage_SNU ota_storage_snu;
4750
#endif
4851

4952
/******************************************************************************
@@ -148,6 +151,8 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)
148151
setOTAStorage(ota_storage_ssu);
149152
#elif OTA_STORAGE_SFU
150153
setOTAStorage(ota_storage_sfu);
154+
#elif OTA_STORAGE_SNU
155+
setOTAStorage(ota_storage_snu);
151156
#endif
152157

153158
return 1;

Diff for: src/ArduinoIoTCloud_Config.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
#define OTA_STORAGE_SFU (0)
2727
#endif
2828

29+
#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT)
30+
#define OTA_STORAGE_SNU (1)
31+
#else
32+
#define OTA_STORAGE_SNU (0)
33+
#endif
34+
2935
#ifdef ARDUINO_SAMD_MKRGSM1400
3036
#define OTA_STORAGE_SSU (1)
3137
#else
@@ -36,7 +42,7 @@
3642
* AUTOMATIC CONFIGURED DEFINES
3743
******************************************************************************/
3844

39-
#if OTA_STORAGE_SFU || OTA_STORAGE_SSU || OTA_STORAGE_NINA
45+
#if OTA_STORAGE_SFU || OTA_STORAGE_SSU || OTA_STORAGE_SNU
4046
#define OTA_ENABLED (1)
4147
#else
4248
#define OTA_ENABLED (0)

Diff for: src/utility/ota/OTAStorage_Nina.cpp renamed to src/utility/ota/OTAStorage_SNU.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
******************************************************************************/
2121

2222
#include <ArduinoIoTCloud_Config.h>
23-
#if OTA_STORAGE_NINA
23+
#if OTA_STORAGE_SNU
2424

25-
#include "OTAStorage_Nina.h"
25+
#include "OTAStorage_SNU.h"
2626

2727
/******************************************************************************
2828
* CTOR/DTOR
2929
******************************************************************************/
3030

31-
OTAStorage_Nina::OTAStorage_Nina()
31+
OTAStorage_SNU::OTAStorage_SNU()
3232
: _file{nullptr}
3333
{
3434

@@ -38,13 +38,13 @@ OTAStorage_Nina::OTAStorage_Nina()
3838
* PUBLIC MEMBER FUNCTIONS
3939
******************************************************************************/
4040

41-
bool OTAStorage_Nina::init()
41+
bool OTAStorage_SNU::init()
4242
{
4343
/* Nothing to do */
4444
return true;
4545
}
4646

47-
bool OTAStorage_Nina::open(char const * file_name)
47+
bool OTAStorage_SNU::open(char const * file_name)
4848
{
4949
/* It is necessary to prepend "/fs/" when opening a file on the nina
5050
* for the rename operation "/fs/"" does not need to be prepended.
@@ -65,7 +65,7 @@ bool OTAStorage_Nina::open(char const * file_name)
6565
return true;
6666
}
6767

68-
size_t OTAStorage_Nina::write(uint8_t const * const buf, size_t const num_bytes)
68+
size_t OTAStorage_SNU::write(uint8_t const * const buf, size_t const num_bytes)
6969
{
7070
/* We have to write in chunks because otherwise we exceed the size of
7171
* the SPI buffer within the nina module.
@@ -84,13 +84,13 @@ size_t OTAStorage_Nina::write(uint8_t const * const buf, size_t const num_bytes)
8484
return bytes_written;
8585
}
8686

87-
void OTAStorage_Nina::close()
87+
void OTAStorage_SNU::close()
8888
{
8989
/* There is no close API within WiFiNiNa */
9090
delete _file;
9191
}
9292

93-
void OTAStorage_Nina::remove(char const * file_name)
93+
void OTAStorage_SNU::remove(char const * file_name)
9494
{
9595
/* Prepend "/fs/" */
9696
char nina_file_name[32] = {0};
@@ -101,14 +101,14 @@ void OTAStorage_Nina::remove(char const * file_name)
101101
WiFiStorage.remove(nina_file_name);
102102
}
103103

104-
bool OTAStorage_Nina::rename(char const * old_file_name, char const * new_file_name)
104+
bool OTAStorage_SNU::rename(char const * old_file_name, char const * new_file_name)
105105
{
106106
return (WiFiStorage.rename(old_file_name, new_file_name) == 0);
107107
}
108108

109-
void OTAStorage_Nina::deinit()
109+
void OTAStorage_SNU::deinit()
110110
{
111111
/* Nothing to do */
112112
}
113113

114-
#endif /* OTA_STORAGE_NINA */
114+
#endif /* OTA_STORAGE_SNU */

Diff for: src/utility/ota/OTAStorage_Nina.h renamed to src/utility/ota/OTAStorage_SNU.h

+10-9
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@
1515
a commercial license, send an email to [email protected].
1616
*/
1717

18-
#ifndef ARDUINO_OTA_STORAGE_NINA_H_
19-
#define ARDUINO_OTA_STORAGE_NINA_H_
18+
#ifndef ARDUINO_OTA_STORAGE_SNU_H_
19+
#define ARDUINO_OTA_STORAGE_SNU_H_
2020

2121
/******************************************************************************
2222
* INCLUDE
2323
******************************************************************************/
2424

2525
#include <ArduinoIoTCloud_Config.h>
26-
#if OTA_STORAGE_NINA
26+
#if OTA_STORAGE_SNU
27+
28+
#include <SNU.h>
2729

2830
#include "OTAStorage.h"
2931

@@ -33,15 +35,14 @@
3335
* CLASS DECLARATION
3436
******************************************************************************/
3537

36-
class OTAStorage_Nina : public OTAStorage
38+
class OTAStorage_SNU : public OTAStorage
3739
{
3840
public:
3941

40-
OTAStorage_Nina();
41-
virtual ~OTAStorage_Nina() { }
42+
OTAStorage_SNU();
43+
virtual ~OTAStorage_SNU() { }
4244

4345

44-
virtual Type type () override { return Type::Nina; }
4546
virtual bool init () override;
4647
virtual bool open (char const * file_name) override;
4748
virtual size_t write (uint8_t const * const buf, size_t const num_bytes) override;
@@ -57,6 +58,6 @@ class OTAStorage_Nina : public OTAStorage
5758

5859
};
5960

60-
#endif /* OTA_STORAGE_NINA */
61+
#endif /* OTA_STORAGE_SNU */
6162

62-
#endif /* ARDUINO_OTA_STORAGE_NINA_H_ */
63+
#endif /* ARDUINO_OTA_STORAGE_SNU_H_ */

0 commit comments

Comments
 (0)