Skip to content

Error when calling EdgeRecorderManager.setFilePrefix with a long string #81

@maxbrzr

Description

@maxbrzr

When calling

await Future.wait([
      (leftWearable as EdgeRecorderManager).setFilePrefix("left_$prefix"),
      (rightWearable as EdgeRecorderManager).setFilePrefix("right_$prefix"),
    ]);

with a long prefix such as "jjjjjjjjjjjjjjjjjjj_3_cheese-construction-noise-right_250929_11_26", i get an Error

E/flutter ( 8412): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PlatformException(13, Failed to write: (GATT_INVALID_ATTRIBUTE_LENGTH), null, null)
E/flutter ( 8412): #0      UniversalBlePlatformChannel.writeValue (package:universal_ble/src/universal_ble_pigeon/universal_ble.g.dart:565:7)
E/flutter ( 8412): <asynchronous suspension>
E/flutter ( 8412): #1      Future.timeout.<anonymous closure> (dart:async/future_impl.dart:1061:7)
E/flutter ( 8412): <asynchronous suspension>
E/flutter ( 8412): #2      _QueuedFuture.execute (package:universal_ble/src/queue.dart:65:18)
E/flutter ( 8412): <asynchronous suspension>

ChatGPT says

"It’s a Bluetooth Low Energy (BLE) error, specifically GATT_INVALID_ATTRIBUTE_LENGTH.
Here’s what’s going on:
• GATT_INVALID_ATTRIBUTE_LENGTH means you’re trying to write data to a BLE characteristic, but the payload is larger than what the characteristic can handle in a single write.
• Most BLE characteristics have a maximum write size of 20 bytes (sometimes 23 with overhead), unless the peripheral supports a higher MTU."

and to either fix it by "Split the data into chunks" or "Request a higher MTU if device supports it"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions