Android BLE Connection SDK
Current code location
XTalkBleClient still lives in apps/android-ui/app/src/main/java/com/xtalk/mesh/uimock/ble/XTalkBleClient.kt. It has not been extracted into a standalone :ble-sdk module yet. This page documents the BLE SDK boundary and maps it back to the current implementation.
Current implementation location
- BLE entry:
apps/android-ui/app/src/main/java/com/xtalk/mesh/uimock/ble/XTalkBleClient.kt - BLE constants:
apps/android-ui/app/src/main/java/com/xtalk/mesh/uimock/ble/XTalkBleConstants.kt - BLE name filtering:
apps/android-ui/app/src/main/java/com/xtalk/mesh/uimock/ble/BleDeviceNames.kt - Current app:
apps/android-ui/app
SDK boundary
XTalkBleClient should own:
- initialization of the underlying xTalk BLE capability
- scan, connect, disconnect
- GATT setup
- BLE AT command transport and response collection
- binary frame send/receive
- connection and readiness state queries
XTalkBleClient should not own:
AT+CHALLENGEauthentication orchestration- DID business semantics
- post-auth BLE default initialization
- UART
- page/UI state
APIs already present in the current repository
XTalkBleClient.ensureInitialized()XTalkBleClient.startScan(...)XTalkBleClient.connect(...)XTalkBleClient.disconnect(...)XTalkBleClient.runAtCommand(...)XTalkBleClient.sendBinaryFrame(...)XTalkBleClient.isWirelessReady()XTalkBleClient.isReadyForSend()XTalkBleClient.awaitConnected(...)XTalkBleClient.awaitDisconnected(...)
Important current-state caveat
The file still contains a legacy combined entry:
XTalkBleClient.authenticateAndInitializeDefaults(...)
This API currently performs all of the following:
AT+CHALLENGE- challenge verification
- DID wait/read
AT+ADDTL / AT+FREQ / AT+RATE / AT+BCNID / AT+WORKMODE
From an SDK-boundary perspective, this should be split back into:
- authentication logic in
Device Auth SDK - post-auth default writes in
Device Init SDK
What the current code confirms
AT+CHALLENGEandAT+EFUSESN?/AT+SN?handling are still insideXTalkBleClient.kt- default parameter writes are also still inside
XTalkBleClient.kt - the current repository is therefore still in a mixed “BLE transport + auth/init” phase
Recommended flow after extraction
XTalkBleClient.ensureInitialized()
XTalkBleClient.connect(device, timeoutMs = 8_000L)
DeviceAuthenticator.authenticateBleAndReadDidExclusive(
timeoutMs = 30_000L,
)
DeviceInitializer.initializeBleWirelessDefaults(
DeviceInitializer.BleWirelessDefaults(freqHz = 483_600_000L),
)
XTalkBleClient.sendBinaryFrame(payload)
How to read the current repository
In the current codebase:
- “connected” does not mean “ready to send business frames”
isWirelessReady()/isReadyForSend()is closer to the actual business state- authentication and initialization have not been fully removed from
XTalkBleClient
Target module location
Recommended extraction target:
- Gradle module:
apps/android-ui/ble-sdk - package:
com.xtalk.mesh.sdk.ble
These are target locations, not current repository facts.