Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add an HttpStatusCodes_Ardunio.(h/cpp) #15

Open
EmperorArthur opened this issue Mar 3, 2021 · 1 comment
Open

Feature Request: Add an HttpStatusCodes_Ardunio.(h/cpp) #15

EmperorArthur opened this issue Mar 3, 2021 · 1 comment

Comments

@EmperorArthur
Copy link

Hello,

This code is extremely useful and thank you for creating it.

If possible, would you be able to produce an Arduino version of the library, and place it on PlatformIO?

Arduino faces some challenges which are not prevalent on other platforms. Primarily RAM and Flash constraints. In the microcontroller world, C strings are always stored in RAM, so special functions must be called to store it in program memory. Similarly, not inlining the function saves Flash memory.

My approach to converting the library was to have a header with:

#include <WString.h>
...
String reasonPhrase(int code);
...

And a cpp file with:

#include "HttpStatusCodes_Arduino.h"

String reasonPhrase(int code) {
...
case 100: return F("Continue");
...
}

I just did a replace of "std::String(" with "F(".

Why No Pull Request

I would have to get my bosses approval to submit a pull request, but can say exactly what I did, as it isn't a company secret or anything. Isn't IP law fun...

@EmperorArthur
Copy link
Author

Update. I have received permission to share the code I have written. Expect a pull request shortly.

@j-ulrich j-ulrich linked a pull request Mar 10, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants