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 b3acc5b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 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 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 b3acc5b

Please sign in to comment.