Skip to content

Add start, end, progress, and error callbacks for ESP8266HTTPUpdate #6796

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

Merged
merged 2 commits into from
Nov 19, 2019

Conversation

earlephilhower
Copy link
Collaborator

Replaces abandoned #1817

Add an optional std::function callback (so it supports lambdas and
normal functions) with an optional data parameter (for passing in a
this or other state info).

Update example with its use.

From @baruch's original pull request:
The callback is called when the upgrade actually starts rather than just
the initial query so that the user can know that it will not take longer
and can also prepare for the upgrade by shutting down other works.

Copy link
Collaborator

@devyte devyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer "using" syntax over "typedef" for complex types. Approving anyways.

@earlephilhower
Copy link
Collaborator Author

I'm going to merge this with an update for #2694, too, which has add'l CBs.

@earlephilhower earlephilhower changed the title Add a start callback for ESP8266HTTPUpdate Add start, end, progress, and error callbacks for ESP8266HTTPUpdate Nov 17, 2019
@earlephilhower
Copy link
Collaborator Author

Now implements the 4 CBs in@karlp's #2694.

Replaces abandoned esp8266#1817 and esp8266#2694

Add optional std::function callback (so it supports lambdas and normal
functions) via ::onStart, ::onEnd, ::onProgress, and ::onError methods.

Update example with their use.

From @baruch's original pull request:
The callback is called when the upgrade actually starts rather than just
the initial query so that the user can know that it will not take longer
and can also prepare for the upgrade by shutting down other works.

From @karlp's original pull request:
Incomplete: I've not updated any documentation yet. If this style looks
good, I'll happily go and update the documentation (likewise for the
examples)
@earlephilhower
Copy link
Collaborator Author

Fixes #4183

@devyte devyte added this to the 2.6.2 milestone Nov 19, 2019
@devyte devyte merged commit 800794d into esp8266:master Nov 19, 2019
@earlephilhower earlephilhower deleted the starthttpupdater branch November 19, 2019 21:19
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.

2 participants