|
| 1 | +/* |
| 2 | + This file is part of ArduinoIoTCloud. |
| 3 | +
|
| 4 | + Copyright 2020 ARDUINO SA (http://www.arduino.cc/) |
| 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 [email protected]. |
| 16 | +*/ |
| 17 | + |
| 18 | +/****************************************************************************** |
| 19 | + INCLUDE |
| 20 | + ******************************************************************************/ |
| 21 | + |
| 22 | +#include "OTAStorage_MKRGSM.h" |
| 23 | + |
| 24 | +#include <Arduino_DebugUtils.h> |
| 25 | + |
| 26 | +/****************************************************************************** |
| 27 | + CTOR/DTOR |
| 28 | + ******************************************************************************/ |
| 29 | + |
| 30 | +OTAStorage_MKRGSM::OTAStorage_MKRGSM() |
| 31 | +{ |
| 32 | +} |
| 33 | + |
| 34 | +// GSMFileUtils _fileUtils; |
| 35 | +// String filename = "UPDATE.BIN"; |
| 36 | +constexpr char * filename { "UPDATE.BIN" }; |
| 37 | +/****************************************************************************** |
| 38 | + PUBLIC MEMBER FUNCTIONS |
| 39 | + ******************************************************************************/ |
| 40 | + |
| 41 | +bool OTAStorage_MKRGSM::init() |
| 42 | +{ |
| 43 | + return _fileUtils.begin(); |
| 44 | +} |
| 45 | + |
| 46 | +bool OTAStorage_MKRGSM::open() |
| 47 | +{ |
| 48 | + auto size = _fileUtils.listFile(filename); |
| 49 | + _fileUtils.deleteFile(filename); |
| 50 | + return true; |
| 51 | +} |
| 52 | + |
| 53 | +size_t OTAStorage_MKRGSM::write(uint8_t const* const buf, size_t const num_bytes) |
| 54 | +{ |
| 55 | + // Serial.print("size: "); |
| 56 | + // Serial.println(num_bytes); |
| 57 | + _fileUtils.appendFile(filename, (const char*)buf, num_bytes); |
| 58 | + |
| 59 | + return num_bytes; |
| 60 | +} |
| 61 | + |
| 62 | +void OTAStorage_MKRGSM::close() |
| 63 | +{ |
| 64 | +} |
| 65 | + |
| 66 | +void OTAStorage_MKRGSM::remove() |
| 67 | +{ |
| 68 | + _fileUtils.deleteFile(filename); |
| 69 | +} |
| 70 | + |
| 71 | +void OTAStorage_MKRGSM::deinit() |
| 72 | +{ |
| 73 | +} |
0 commit comments