Skip to content

Commit e4e388e

Browse files
xaionaro@dx.centerxaionaro@dx.center
authored andcommitted
docs: rewrite general-patterns.md to lead with typed wrappers
Restructure the guide to reflect the project's goal of idiomatic, strongly typed Go code: - Lead with typed wrappers as the default (NewManager, typed methods, data class accessors) - Add section on named constants with "never magic numbers" guidance - Show return type mapping (Java -> Go) with automatic conversions - Move raw JNI to a short fallback section at the end - Remove magic constant 512 from bluetooth.md GATT example - Fix constant comparisons to use named constants throughout
1 parent 6fa850c commit e4e388e

2 files changed

Lines changed: 263 additions & 332 deletions

File tree

docs/bluetooth.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,10 @@ func gattClient(vm *jni.VM, ctx *app.Context, device *bluetooth.Device) error {
543543
// Enable notifications for a characteristic
544544
ok, err = gatt.SetCharacteristicNotification(characteristicObj, true)
545545
546-
// Request MTU change (triggers onMtuChanged callback)
547-
ok, err = gatt.RequestMtu(512)
546+
// Request MTU change (triggers onMtuChanged callback).
547+
// 517 is the maximum ATT MTU for BLE (Android caps at 517).
548+
const maxBleMtu = 517
549+
ok, err = gatt.RequestMtu(int32(maxBleMtu))
548550
549551
// Read remote RSSI (triggers onReadRemoteRssi callback)
550552
ok, err = gatt.ReadRemoteRssi()

0 commit comments

Comments
 (0)