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

refactor!: rework CoapCode and CoapMessageType as enhanced enums #114

Merged
merged 4 commits into from
Aug 6, 2022

Conversation

JKRhb
Copy link
Contributor

@JKRhb JKRhb commented Jul 16, 2022

This PR refactors the CoapCode and CoapMessageType classes as enhanced enums (also see #80), making the code more concise and readable. The changes also make it easier to add more CoapCodes in the future. The PR itself adds a few missing CoapCodes from the IANA registry, including the new method codes FETCH, PATCH, and iPATCH.

CC @JosefWN

@JKRhb JKRhb force-pushed the coap-code branch 2 times, most recently from 99f2618 to 94081ed Compare July 16, 2022 13:28
lib/src/coap_client.dart Outdated Show resolved Hide resolved
lib/src/coap_client.dart Outdated Show resolved Hide resolved
@JKRhb
Copy link
Contributor Author

JKRhb commented Jul 18, 2022

I incorporated the suggestions and squashed the commits :)

@@ -128,24 +123,7 @@ class CoapReliabilityLayer extends CoapAbstractLayer {
final CoapResponse? response,
) {
final mt = response!.type;
if (mt == CoapMessageType.unknown) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Haven't read all of the code and a little sleepy. When would this happen, if the server sent an invalid response and/or if the response was corrupted in flight? I take it with your change we won't acknowledge that message then, meaning that the server will resend the response? Sounds reasonable

@JosefWN
Copy link
Contributor

JosefWN commented Jul 18, 2022

LGTM!

@shamblett shamblett merged commit da52a94 into shamblett:master Aug 6, 2022
@JKRhb JKRhb mentioned this pull request Aug 7, 2022
@JKRhb JKRhb deleted the coap-code branch August 12, 2022 22:29
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.

3 participants