Skip to content

Basic Chat sends messages larger than the BLE write limit without chunking #18

Description

@dajiaohuang

Summary

The console sends the entire text-field string in one writeValue call, even though CBUUIDs defines MaxCharacters as 20. Messages longer than the negotiated BLE write length can fail or be truncated, while the UI immediately clears the field and appends a Sent entry.

Evidence

At the current master commit, Basic Chat MVC/Controllers/ConsoleViewController.swift:88-93 converts the full String to UTF-8 and calls writeValue once. Basic Chat MVC/Model/CBUUIDs.swift:16 defines MaxCharacters = 20, but the constant is not used and there is no maximum-length validation, chunking, queue or write-completion error path.

Steps to reproduce

  1. Connect a peripheral implementing the Nordic UART Service with a 20-byte write limit.
  2. Enter a message longer than 20 UTF-8 bytes.
  3. Press Return.

Expected behavior

The app should either split the UTF-8 payload into supported chunks and preserve ordering, or reject the input before clearing it and explain the limit.

Actual behavior

The whole payload is passed to CoreBluetooth in one write and the input is cleared immediately; delivery failure is not surfaced.

Environment

Repository master at commit 8280b26.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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