Skip to content

Commit

Permalink
feat: add signaling codes (RFC 8323)
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Jul 18, 2022
1 parent f931455 commit ac161f6
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion lib/src/coap_code.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,32 @@ enum CoapCode {
/// 5.08 Hop Limit Reached
///
/// Defined in [RFC 8768](https://datatracker.ietf.org/doc/html/rfc8768).
hopLimitReached(5, 08, 'Hop Limit Reached');
hopLimitReached(5, 08, 'Hop Limit Reached'),

/// 7.01 CSM
///
/// Defined in [RFC 8323](https://datatracker.ietf.org/doc/html/rfc8323).
csm(7, 01, 'CSM'),

/// 7.02 Ping
///
/// Defined in [RFC 8323](https://datatracker.ietf.org/doc/html/rfc8323).
ping(7, 02, 'Ping'),

/// 7.03 Pong
///
/// Defined in [RFC 8323](https://datatracker.ietf.org/doc/html/rfc8323).
pong(7, 03, 'Pong'),

/// 7.04 Release
///
/// Defined in [RFC 8323](https://datatracker.ietf.org/doc/html/rfc8323).
release(7, 04, 'Release'),

/// 7.05 Abort
///
/// Defined in [RFC 8323](https://datatracker.ietf.org/doc/html/rfc8323).
abort(7, 05, 'Abort');

const CoapCode(
this.codeClass,
Expand Down Expand Up @@ -237,4 +262,7 @@ enum CoapCode {

/// Checks whether this [CoapCode] represents a server error response code.
bool get isServerError => codeClass == 5;

/// Checks whether this [CoapCode] indicates a signaling message.
bool get isSignaling => codeClass == 7;
}

0 comments on commit ac161f6

Please sign in to comment.