Skip to content

Commit

Permalink
Remove deprecated FileStream::attach(const String&) usage from samples
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Feb 8, 2019
1 parent d3bde16 commit 47e0c61
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sming/SmingCore/Data/Stream/FileStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class FileStream : public ReadWriteStream
void attach(file_t file, size_t size);

/* @deprecated: use open() method */
bool attach(const String& fileName, FileOpenFlags openFlags = eFO_ReadOnly)
bool attach(const String& fileName, FileOpenFlags openFlags = eFO_ReadOnly) __attribute__((deprecated))
{
return open(fileName, openFlags);
}
Expand Down
2 changes: 1 addition & 1 deletion Sming/SmingCore/Network/HttpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bool HttpClient::downloadFile(const String& url, const String& saveFileName,
file = saveFileName;

FileStream* fileStream = new FileStream();
fileStream->attach(file, eFO_CreateNewAlways | eFO_WriteOnly);
fileStream->open(file, eFO_CreateNewAlways | eFO_WriteOnly);

return send(request(url)->setResponseStream(fileStream)->setMethod(HTTP_GET)->onRequestComplete(requestComplete));
}
Expand Down
2 changes: 1 addition & 1 deletion samples/Basic_Serial/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void handleCommand(const String& command)
if(command.equalsIgnoreCase(_F("cat"))) {
String filename = F("Readme.md");
FileStream* fileStream = new FileStream;
if(fileStream && fileStream->attach(filename, eFO_ReadOnly)) {
if(fileStream && fileStream->open(filename, eFO_ReadOnly)) {
Serial.printf(_F("Sending \"%s\" (%u bytes)\r\n"), filename.c_str(), fileStream->available());
auto demo = new SerialStreamTransmitDemo;
demo->begin(Serial1);
Expand Down
2 changes: 1 addition & 1 deletion samples/HttpClient/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void connectOk(IPAddress ip, IPAddress mask, IPAddress gateway)

// Or if you want to directly save the response body to a file then the following can be done
// FileStream* responseBodyFile = new FileStream();
// responseBodyFile->attach("file.name", eFO_CreateNewAlways | eFO_WriteOnly);
// responseBodyFile->open("file.name", eFO_CreateNewAlways | eFO_WriteOnly);
// putRequest->setResponseStream(responseBodyFile); // << the complete body will be stored on your file system
// see the implementation of `bool HttpClient::downloadFile(const String& url, const String& saveFileName, ...` for details.

Expand Down

0 comments on commit 47e0c61

Please sign in to comment.