File tree Expand file tree Collapse file tree 5 files changed +30
-12
lines changed Expand file tree Collapse file tree 5 files changed +30
-12
lines changed Original file line number Diff line number Diff line change 99/// runtime used for consuming, exposing, and discovering Things.
1010library core;
1111
12+ // TODO(JKRhb): Reorganize top-level core package into smaller packages.
1213export "src/core/definitions.dart" ;
1314export "src/core/exceptions.dart" ;
15+ export "src/core/extensions.dart" ;
1416export "src/core/implementation.dart" ;
1517export "src/core/protocol_interfaces.dart" ;
1618export "src/core/scripting_api.dart" ;
Original file line number Diff line number Diff line change @@ -506,7 +506,7 @@ final class CoapClient extends ProtocolClient {
506506 final streamController = StreamController <DiscoveryContent >();
507507
508508 // TODO: Replace once https://github.com/shamblett/coap/pull/129 is merged
509- if (uri.isMulticastAddress ) {
509+ if (uri.hasMulticastAddress ) {
510510 multicastResponseHandler = coap.CoapMulticastResponseHandler (
511511 (data) {
512512 streamController.add (data.determineDiscoveryContent (uri.scheme));
@@ -526,7 +526,7 @@ final class CoapClient extends ProtocolClient {
526526 multicastResponseHandler: multicastResponseHandler,
527527 );
528528
529- if (uri.isMulticastAddress ) {
529+ if (uri.hasMulticastAddress ) {
530530 yield * streamController.stream;
531531 } else {
532532 yield content;
Original file line number Diff line number Diff line change 44//
55// SPDX-License-Identifier: BSD-3-Clause
66
7- import "dart:io" ;
87import "dart:typed_data" ;
98
109import "package:cbor/cbor.dart" ;
@@ -16,15 +15,6 @@ import "../../core.dart" hide PskCredentials;
1615import "coap_binding_exception.dart" ;
1716import "coap_definitions.dart" ;
1817
19- /// Extension which makes it easier to handle [Uri] s containing
20- /// [InternetAddress] es.
21- extension InternetAddressMethods on Uri {
22- /// Checks whether the host of this [Uri] is a multicast [InternetAddress] .
23- bool get isMulticastAddress {
24- return InternetAddress .tryParse (host)? .isMulticast ?? false ;
25- }
26- }
27-
2818/// CoAP-specific extensions for the [AugmentedForm] class.
2919extension CoapFormExtension on AugmentedForm {
3020 T ? _obtainVocabularyTerm <T >(String vocabularyTerm) {
Original file line number Diff line number Diff line change 1+ // Copyright 2024 Contributors to the Eclipse Foundation. All rights reserved.
2+ // Use of this source code is governed by a BSD-style
3+ // license that can be found in the LICENSE file.
4+ //
5+ // SPDX-License-Identifier: BSD-3-Clause
6+
7+ /// Sub-library for extensions used by `dart_wot` .
8+ library extensions;
9+
10+ export "extensions/uri_extensions.dart" ;
Original file line number Diff line number Diff line change 1+ // Copyright 2024 Contributors to the Eclipse Foundation. All rights reserved.
2+ // Use of this source code is governed by a BSD-style
3+ // license that can be found in the LICENSE file.
4+ //
5+ // SPDX-License-Identifier: BSD-3-Clause
6+
7+ import "dart:io" ;
8+
9+ /// Extension that makes it easier to handle [Uri] s which potentially contain
10+ /// [InternetAddress] es.
11+ extension InternetAddressMethodExtension on Uri {
12+ /// Checks whether the host of this [Uri] is a multicast [InternetAddress] .
13+ bool get hasMulticastAddress {
14+ return InternetAddress .tryParse (host)? .isMulticast ?? false ;
15+ }
16+ }
You can’t perform that action at this time.
0 commit comments