File tree 8 files changed +24
-24
lines changed
8 files changed +24
-24
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ OTAState OTALogic::handle_Idle()
141
141
142
142
OTAState OTALogic::handle_StartDownload ()
143
143
{
144
- if (_ota_storage->open (" UPDATE.BIN.TMP " )) {
144
+ if (_ota_storage->open ()) {
145
145
return OTAState::WaitForHeader;
146
146
} else {
147
147
_ota_error = OTAError::StorageOpenFailed;
@@ -232,15 +232,15 @@ OTAState OTALogic::handle_Verify()
232
232
if (_ota_bin_data.crc32 == _ota_bin_data.hdr_crc32 ) {
233
233
return OTAState::Rename;
234
234
} else {
235
- _ota_storage->remove (" UPDATE.BIN.TMP " );
235
+ _ota_storage->remove ();
236
236
_ota_error = OTAError::ChecksumMismatch;
237
237
return OTAState::Error;
238
238
}
239
239
}
240
240
241
241
OTAState OTALogic::handle_Rename ()
242
242
{
243
- if (_ota_storage->rename (" UPDATE.BIN.TMP " , " UPDATE.BIN " )) {
243
+ if (_ota_storage->rename ()) {
244
244
_ota_storage->deinit ();
245
245
return OTAState::Reset;
246
246
}
Original file line number Diff line number Diff line change @@ -38,11 +38,11 @@ class OTAStorage
38
38
39
39
40
40
virtual bool init () = 0;
41
- virtual bool open (char const * file_name ) = 0;
41
+ virtual bool open () = 0;
42
42
virtual size_t write (uint8_t const * const buf, size_t const num_bytes) = 0;
43
43
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;
46
46
virtual void deinit () = 0;
47
47
48
48
};
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ bool OTAStorage_SFU::init()
63
63
return true ;
64
64
}
65
65
66
- bool OTAStorage_SFU::open (char const * /* file_name */ )
66
+ bool OTAStorage_SFU::open ()
67
67
{
68
68
filesystem.clearerr ();
69
69
_file = new File (filesystem.open (SFU_TEMP_UPDATE_FILENAME, CREATE | WRITE_ONLY| TRUNCATE));
@@ -86,12 +86,12 @@ void OTAStorage_SFU::close()
86
86
delete _file;
87
87
}
88
88
89
- void OTAStorage_SFU::remove (char const * /* file_name */ )
89
+ void OTAStorage_SFU::remove ()
90
90
{
91
91
filesystem.remove (SFU_TEMP_UPDATE_FILENAME);
92
92
}
93
93
94
- bool OTAStorage_SFU::rename (char const * /* old_file_name */ , char const * new_file_name )
94
+ bool OTAStorage_SFU::rename ()
95
95
{
96
96
return (SPIFFS_OK == filesystem.rename (SFU_TEMP_UPDATE_FILENAME, SFU_UPDATE_FILENAME));
97
97
}
Original file line number Diff line number Diff line change @@ -44,11 +44,11 @@ class OTAStorage_SFU : public OTAStorage
44
44
45
45
46
46
virtual bool init () override ;
47
- virtual bool open (char const * file_name ) override ;
47
+ virtual bool open () override ;
48
48
virtual size_t write (uint8_t const * const buf, size_t const num_bytes) override ;
49
49
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 ;
52
52
virtual void deinit () override ;
53
53
54
54
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ bool OTAStorage_SNU::init()
47
47
return true ;
48
48
}
49
49
50
- bool OTAStorage_SNU::open (char const * /* file_name */ )
50
+ bool OTAStorage_SNU::open ()
51
51
{
52
52
/* There's no need to explicitly open the file
53
53
* because when writing to it the file will always
@@ -83,12 +83,12 @@ void OTAStorage_SNU::close()
83
83
/* Files are closed after each file operation on the nina side. */
84
84
}
85
85
86
- void OTAStorage_SNU::remove (char const * /* file_name */ )
86
+ void OTAStorage_SNU::remove ()
87
87
{
88
88
WiFiStorage.remove (SNU_TEMP_UPDATE_FILENAME);
89
89
}
90
90
91
- bool OTAStorage_SNU::rename (char const * /* old_file_name */ , char const * /* new_file_name */ )
91
+ bool OTAStorage_SNU::rename ()
92
92
{
93
93
return WiFiStorage.rename (SNU_TEMP_UPDATE_FILENAME, SNU_UPDATE_FILENAME);
94
94
}
Original file line number Diff line number Diff line change @@ -41,11 +41,11 @@ class OTAStorage_SNU : public OTAStorage
41
41
42
42
43
43
virtual bool init () override ;
44
- virtual bool open (char const * file_name ) override ;
44
+ virtual bool open () override ;
45
45
virtual size_t write (uint8_t const * const buf, size_t const num_bytes) override ;
46
46
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 ;
49
49
virtual void deinit () override ;
50
50
51
51
};
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ bool OTAStorage_SSU::init()
49
49
return false ;
50
50
}
51
51
52
- bool OTAStorage_SSU::open (char const * /* file_name */ )
52
+ bool OTAStorage_SSU::open ()
53
53
{
54
54
return true ;
55
55
}
@@ -65,12 +65,12 @@ void OTAStorage_SSU::close()
65
65
/* Nothing to do */
66
66
}
67
67
68
- void OTAStorage_SSU::remove (char const * /* file_name */ )
68
+ void OTAStorage_SSU::remove ()
69
69
{
70
70
_fileUtils.deleteFile (SSU_UPDATE_FILENAME);
71
71
}
72
72
73
- bool OTAStorage_SSU::rename (char const * /* old_file_name */ , char const * /* new_file_name */ )
73
+ bool OTAStorage_SSU::rename ()
74
74
{
75
75
/* Create a file 'UPDATE.OK' which is used by the SSU
76
76
* 2nd stage bootloader to recognise that the update
Original file line number Diff line number Diff line change @@ -43,11 +43,11 @@ class OTAStorage_SSU : public OTAStorage
43
43
44
44
45
45
virtual bool init () override ;
46
- virtual bool open (char const * file_name ) override ;
46
+ virtual bool open () override ;
47
47
virtual size_t write (uint8_t const * const buf, size_t const num_bytes) override ;
48
48
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 ;
51
51
virtual void deinit () override ;
52
52
53
53
private:
You can’t perform that action at this time.
0 commit comments