Skip to content

Commit

Permalink
chore!: upgrade coap dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed May 30, 2023
1 parent 8dd87ea commit 7296663
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion example/coaps_readproperty.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final Map<Uri, PskCredentials> _pskCredentialsStore = {
PskCredentials? _pskCredentialsCallback(
Uri uri,
Form? form,
Uint8List? identityHint,
String? identityHint,
) {
final key = Uri(scheme: uri.scheme, host: uri.host);

Expand Down
18 changes: 6 additions & 12 deletions lib/src/binding_coap/coap_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'dart:typed_data';
import 'package:coap/coap.dart' as coap;
import 'package:coap/config/coap_config_default.dart';
import 'package:dcaf/dcaf.dart';
import 'package:typed_data/typed_buffers.dart';

import '../core/content.dart';
import '../core/credentials/ace_credentials.dart';
Expand Down Expand Up @@ -98,14 +97,13 @@ final class CoapClient implements ProtocolClient {
coap.BlockSize? block1Size,
coap.BlockSize? block2Size,
}) async {
final payload = Uint8Buffer();
if (content != null) {
payload.addAll((await content.byteBuffer).asUint8List());
}
final payload = (await content?.byteBuffer)?.asUint8List();

final request = coap.CoapRequest(requestMethod)
..payload = payload
..uriPath = uri.path
final request = coap.CoapRequest(
uri,
requestMethod,
payload: payload,
)
..accept = accept
..contentFormat = format;

Expand All @@ -117,10 +115,6 @@ final class CoapClient implements ProtocolClient {
request.block2 = coap.Block2Option.fromParts(0, block2Size);
}

if (uri.query.isNotEmpty) {
request.uriQuery = uri.query;
}

return request;
}

Expand Down
4 changes: 1 addition & 3 deletions lib/src/core/security_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
//
// SPDX-License-Identifier: BSD-3-Clause

import 'dart:typed_data';

import 'package:dcaf/dcaf.dart';

import '../definitions/form.dart';
Expand All @@ -31,7 +29,7 @@ import 'credentials/psk_credentials.dart';
typedef ClientPskCallback = PskCredentials? Function(
Uri uri,
Form? form,
Uint8List? identityHint,
String? identityHint,
);

/// Function signature for an asynchronous callback for providing client
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dev_dependencies:

dependencies:
cbor: ^5.1.2
coap: ^8.0.0
coap: ^9.0.0
collection: ^1.16.0
curie: ^0.1.0
dcaf: ^0.1.0
Expand Down

0 comments on commit 7296663

Please sign in to comment.