Skip to content

Commit f350152

Browse files
committed
Removing file parameters as anyway every SxU has it's own special semantics
1 parent bb6a70c commit f350152

8 files changed

+24
-24
lines changed

src/utility/ota/OTALogic.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ OTAState OTALogic::handle_Idle()
141141

142142
OTAState OTALogic::handle_StartDownload()
143143
{
144-
if(_ota_storage->open("UPDATE.BIN.TMP")) {
144+
if(_ota_storage->open()) {
145145
return OTAState::WaitForHeader;
146146
} else {
147147
_ota_error = OTAError::StorageOpenFailed;
@@ -232,15 +232,15 @@ OTAState OTALogic::handle_Verify()
232232
if(_ota_bin_data.crc32 == _ota_bin_data.hdr_crc32) {
233233
return OTAState::Rename;
234234
} else {
235-
_ota_storage->remove("UPDATE.BIN.TMP");
235+
_ota_storage->remove();
236236
_ota_error = OTAError::ChecksumMismatch;
237237
return OTAState::Error;
238238
}
239239
}
240240

241241
OTAState OTALogic::handle_Rename()
242242
{
243-
if(_ota_storage->rename("UPDATE.BIN.TMP", "UPDATE.BIN")) {
243+
if(_ota_storage->rename()) {
244244
_ota_storage->deinit();
245245
return OTAState::Reset;
246246
}

src/utility/ota/OTAStorage.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ class OTAStorage
3838

3939

4040
virtual bool init () = 0;
41-
virtual bool open (char const * file_name) = 0;
41+
virtual bool open () = 0;
4242
virtual size_t write (uint8_t const * const buf, size_t const num_bytes) = 0;
4343
virtual void close () = 0;
44-
virtual void remove(char const * file_name) = 0;
45-
virtual bool rename(char const * old_file_name, char const * new_file_name) = 0;
44+
virtual void remove() = 0;
45+
virtual bool rename() = 0;
4646
virtual void deinit() = 0;
4747

4848
};

src/utility/ota/OTAStorage_SFU.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ bool OTAStorage_SFU::init()
6363
return true;
6464
}
6565

66-
bool OTAStorage_SFU::open(char const * /* file_name */)
66+
bool OTAStorage_SFU::open()
6767
{
6868
filesystem.clearerr();
6969
_file = new File(filesystem.open(SFU_TEMP_UPDATE_FILENAME, CREATE | WRITE_ONLY| TRUNCATE));
@@ -86,12 +86,12 @@ void OTAStorage_SFU::close()
8686
delete _file;
8787
}
8888

89-
void OTAStorage_SFU::remove(char const * /* file_name */)
89+
void OTAStorage_SFU::remove()
9090
{
9191
filesystem.remove(SFU_TEMP_UPDATE_FILENAME);
9292
}
9393

94-
bool OTAStorage_SFU::rename(char const * /* old_file_name */, char const * new_file_name)
94+
bool OTAStorage_SFU::rename()
9595
{
9696
return (SPIFFS_OK == filesystem.rename(SFU_TEMP_UPDATE_FILENAME, SFU_UPDATE_FILENAME));
9797
}

src/utility/ota/OTAStorage_SFU.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ class OTAStorage_SFU : public OTAStorage
4444

4545

4646
virtual bool init () override;
47-
virtual bool open (char const * file_name) override;
47+
virtual bool open () override;
4848
virtual size_t write (uint8_t const * const buf, size_t const num_bytes) override;
4949
virtual void close () override;
50-
virtual void remove(char const * file_name) override;
51-
virtual bool rename(char const * old_file_name, char const * new_file_name) override;
50+
virtual void remove() override;
51+
virtual bool rename() override;
5252
virtual void deinit() override;
5353

5454

src/utility/ota/OTAStorage_SNU.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ bool OTAStorage_SNU::init()
4747
return true;
4848
}
4949

50-
bool OTAStorage_SNU::open(char const * /* file_name */)
50+
bool OTAStorage_SNU::open()
5151
{
5252
/* There's no need to explicitly open the file
5353
* because when writing to it the file will always
@@ -83,12 +83,12 @@ void OTAStorage_SNU::close()
8383
/* Files are closed after each file operation on the nina side. */
8484
}
8585

86-
void OTAStorage_SNU::remove(char const * /* file_name */)
86+
void OTAStorage_SNU::remove()
8787
{
8888
WiFiStorage.remove(SNU_TEMP_UPDATE_FILENAME);
8989
}
9090

91-
bool OTAStorage_SNU::rename(char const * /* old_file_name */, char const * /* new_file_name */)
91+
bool OTAStorage_SNU::rename()
9292
{
9393
return WiFiStorage.rename(SNU_TEMP_UPDATE_FILENAME, SNU_UPDATE_FILENAME);
9494
}

src/utility/ota/OTAStorage_SNU.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ class OTAStorage_SNU : public OTAStorage
4141

4242

4343
virtual bool init () override;
44-
virtual bool open (char const * file_name) override;
44+
virtual bool open () override;
4545
virtual size_t write (uint8_t const * const buf, size_t const num_bytes) override;
4646
virtual void close () override;
47-
virtual void remove(char const * file_name) override;
48-
virtual bool rename(char const * old_file_name, char const * new_file_name) override;
47+
virtual void remove() override;
48+
virtual bool rename() override;
4949
virtual void deinit() override;
5050

5151
};

src/utility/ota/OTAStorage_SSU.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ bool OTAStorage_SSU::init()
4949
return false;
5050
}
5151

52-
bool OTAStorage_SSU::open(char const * /* file_name */)
52+
bool OTAStorage_SSU::open()
5353
{
5454
return true;
5555
}
@@ -65,12 +65,12 @@ void OTAStorage_SSU::close()
6565
/* Nothing to do */
6666
}
6767

68-
void OTAStorage_SSU::remove(char const * /* file_name */)
68+
void OTAStorage_SSU::remove()
6969
{
7070
_fileUtils.deleteFile(SSU_UPDATE_FILENAME);
7171
}
7272

73-
bool OTAStorage_SSU::rename(char const * /* old_file_name */, char const * /* new_file_name */)
73+
bool OTAStorage_SSU::rename()
7474
{
7575
/* Create a file 'UPDATE.OK' which is used by the SSU
7676
* 2nd stage bootloader to recognise that the update

src/utility/ota/OTAStorage_SSU.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ class OTAStorage_SSU : public OTAStorage
4343

4444

4545
virtual bool init () override;
46-
virtual bool open (char const * file_name) override;
46+
virtual bool open () override;
4747
virtual size_t write (uint8_t const * const buf, size_t const num_bytes) override;
4848
virtual void close () override;
49-
virtual void remove(char const * file_name) override;
50-
virtual bool rename(char const * old_file_name, char const * new_file_name) override;
49+
virtual void remove() override;
50+
virtual bool rename() override;
5151
virtual void deinit() override;
5252

5353
private:

0 commit comments

Comments
 (0)