From 0420ab04e7b01f084c15d5865e6e1ce4a2058a0e Mon Sep 17 00:00:00 2001 From: Alexis Couvreur Date: Tue, 25 Aug 2026 22:56:59 -0400 Subject: [PATCH] docs: document L2CAP support and add a build workflow --- .github/workflows/build.yml | 22 ++++++++++++++++++++++ README.md | 13 +++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4bcc9ab --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,22 @@ +name: build + +on: + push: + branches: [master] + pull_request: + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-go@v7 + with: + go-version: stable + + - name: build + run: go build ./... + + - name: vet + run: go vet ./... diff --git a/README.md b/README.md index 97b117f..6b2b109 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,19 @@ Function and type names in cbgo are intended to match the corresponding CoreBlue * Named arguments in CoreBluetooth functions are eliminated. * Properties are implemented as a pair of functions (`PropertyName` and `SetPropertyName`). +## L2CAP + +Connection-oriented channels are supported in both roles. A central opens a +channel to a peripheral and is handed the result through its peripheral +delegate; a peripheral publishes a PSM and is handed incoming channels through +its peripheral manager delegate. + +Reads and writes on an open channel never block. They return a count of zero +when the channel currently has no data to give or no space to take more, and +report the end of the stream once the far end goes away. Register an event +handler on the channel to be told when either of those conditions changes, +rather than polling for it. + ## Issues There are definitely memory leaks. ARC is not compatible with cgo, so objective C memory has to be managed manually. I didn't see a set of consistent guidelines for object ownership in the CoreBluetooth documentation, so cbgo errs on the side of leaking. Hopefully this is only an issue for very long running processes! Any fixes here are much appreciated.