Skip to content

Distinguish empty GATT values from read failures - #6

Open
vkolotov wants to merge 1 commit into
sgothel:masterfrom
vkolotov:vkolotov/gatt-empty-read-value-upstream
Open

Distinguish empty GATT values from read failures#6
vkolotov wants to merge 1 commit into
sgothel:masterfrom
vkolotov:vkolotov/gatt-empty-read-value-upstream

Conversation

@vkolotov

@vkolotov vkolotov commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • treat a valid zero-length ATT Read Response as a successful read
  • return null from the Java characteristic JNI only when the native read fails
  • document the distinction between an empty value and a failed read

Rationale

BTGattHandler::readValue() previously returned offset > 0. That made a standards-valid empty attribute indistinguishable from a failed ATT operation and caused clients to invalidate otherwise healthy GATT state.

Validation

  • built the Direct-BT fat JAR and JNI libraries successfully
  • verified failed reads still take the failure path
  • verified a zero-length characteristic can be read without invalidating the connection

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant