Add IoTivity BLE OCF framing codec - #72
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
IoTivity's BLE adapter carries reliable-transport CoAP PDUs in complete GATT characteristic values. This adds the pure BLE framing layer sequenced after the TCP codec in #28 and #70:
mtuis documented as IoTivity's complete characteristic-value frame size, not the raw ATT MTU. A default ATT MTU of 23 normally means a 20-byte value.The adaptive reassembler derives the peer frame size from each start frame. That matches IoTivity's sender, which fills an incomplete first frame to the usable frame size, while avoiding dependence on a platform-specific negotiated-MTU API.
The header has no fragment sequence number, so a full-size continuation duplicated or reordered with identical metadata cannot be distinguished at this layer. The documentation calls that out directly; the codec does reject duplicate starts, orphan continuations, detectable missing or shortened fragments, and port/security changes.
Source and device contract
The wire format is tied to Samsung's public IoTivity sources (
cafragmentation.h,cafragmentation.c, and the BLE adapter send loop), linked from the README.This is also the framing contract used by our working integration. It has successfully carried
/oic/resand a protected-resource GET through a Home Assistant Bluetooth proxy to a Samsung refrigerator; the protected read returned the expected4.03without a credential. The same API is used by our bounded BLE/DTLS and ownership-transaction callers, while all connection, GATT, authentication, and transaction policy stays outside this package.Validation
cbor2==5.6.0,pyOpenSSL==23.1.0, andpytest==8.0.0