Skip to content

Update WebServer.h - #49

Merged
unwiredben merged 1 commit into
sirleech:masterfrom
cat101:patch-3
Feb 4, 2014
Merged

unwiredben merged 1 commit into
sirleech:masterfrom
cat101:patch-3

Conversation

@cat101

@cat101 cat101 commented Feb 3, 2014

Copy link
Copy Markdown
Contributor

Hi again. Here is a summary of the changes

  • The recent patches did not compile. On Arduino 1.0.5 MAX_SOCK_NUM was missing so I included ethernet.h
  • I added back write(const uint8_t *buffer, size_t size) which was removed with the addition of buffering
  • I added printf for convenience
  • I made reset & flushBuf public.
    I'll continue to use the current version and report any bugs. I think that it may be a good time to up the version number

Thanks

Hi again. Here is a summary of the changes
- The recent patches did not compile. On Arduino 1.0.5 MAX_SOCK_NUM was missing so I included ethernet.h
- I added back write(const uint8_t *buffer, size_t size) which was removed with the addition of buffering
- I added printf for convenience
- I made reset & flushBuf public. 
I'll continue to use the current version and report any bugs. I think that it may be a good time to up the version number

Thanks
@ribbons

ribbons commented Feb 3, 2014

Copy link
Copy Markdown
Contributor

As my recent commits have caused a couple of your issues (my apologies), here are my comments from a quick skim of the code:

  • The signature of write added back in this commit doesn't implement buffering correctly.
  • The same signature of write added back in this commit has been added to the Print class in a recent commit to Arduino 1.5. It would be best to use the same code as this for consistency (ideally conditionally compiled against the version number so that our code doesn't duplicate the Print version when available).

Am away from my PC at the moment so I can't dig out the relevant commit but can do this evening if that would be useful?

@ribbons

ribbons commented Feb 3, 2014

Copy link
Copy Markdown
Contributor

Now I'm back at the PC I don't have to rely on my flaky memory...

The write(const uint8_t *buffer, size_t size) method has been implemented in the base Print class since at least 2011 according to https://github.com/arduino/Arduino/blob/d2a38e4b5a4260a70b79276667d7e64ce6547010/hardware/arduino/cores/arduino/Print.cpp so I would have thought that we shouldn't need to implement it ourselves - am I getting the wrong end of the stick? (The recent commit I was referring to above concerned signed chars not unsigned so please ignore that point).

@cat101

cat101 commented Feb 4, 2014

Copy link
Copy Markdown
Contributor Author

I saw that Print had the method implemented but it was not compiling for me
so I went ahead an implemented it myself since anyways the default
implementation copies every character and I wanted to push entire buffers
(I'm doing file transfers).

Now that you asked about why is not picking up the base implementation I
found this:

http://forum.arduino.cc/index.php/topic,107400.0.html

Basically if you want the compiler to look for overloaded virtual functions
you need to add "using Print::write;" (it works for me). Interesting....I
think I have never run into this case.

Matias

On Mon, Feb 3, 2014 at 5:37 PM, Matt Robinson [email protected]:

Now I'm back at the PC I don't have to rely on my flaky memory...

The write(const uint8_t *buffer, size_t size) method has been implemented
in the base Print class since at least 2011 according to
https://github.com/arduino/Arduino/blob/d2a38e4b5a4260a70b79276667d7e64ce6547010/hardware/arduino/cores/arduino/Print.cppso I would have thought that we shouldn't need to implement it ourselves -
am I getting the wrong end of the stick? (The recent commit I was referring
to above concerned signed chars not unsigned so please ignore that point).

Reply to this email directly or view it on GitHubhttps://github.com//pull/49#issuecomment-33997054
.

@ribbons

ribbons commented Feb 4, 2014

Copy link
Copy Markdown
Contributor

Well, you learn something every day... Is there a noticeable improvement in the file transfer speed using your implementation vs the default?

@cat101

cat101 commented Feb 4, 2014

Copy link
Copy Markdown
Contributor Author

I did not run any performance test on it yet. My approach was more pragmatical. I saw that the ethernet client had support for block transfers so I used it. I think that on my particular set up it won't matter too much since the network card is using SPI anyways (it will just save some instructions).

Thanks

unwiredben added a commit that referenced this pull request Feb 4, 2014
@unwiredben
unwiredben merged commit 0e61993 into sirleech:master Feb 4, 2014
@lasselukkari

Copy link
Copy Markdown

Just an idea: instead of Print the server could implement the Stream interface and then you could directly parse the request body with the aJson library.

Thanks for all the hard work you guys have put into this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants