Android Device Init SDK
Current code location
The current repository does not yet contain a standalone DeviceInitializer.kt. BLE default writes still live mainly inside XTalkBleClient.authenticateAndInitializeDefaults(...), while UART defaults and post-auth hardware setup are spread across AppTransport.kt and XTalkMeshUiApp.kt. This page describes the intended initialization boundary.
Current implementation location
BLE defaults
apps/android-ui/app/src/main/java/com/xtalk/mesh/uimock/ble/XTalkBleClient.ktAT+ADDTLAT+FREQAT+RATEAT+BCNIDAT+WORKMODE
UART defaults
apps/android-ui/app/src/main/java/com/xtalk/mesh/uimock/transport/AppTransport.ktrestoreTextPttDefaults(...)setRateMode(...)setFrequencyHz(...)
UART post-auth initialization
apps/android-ui/app/src/main/java/com/xtalk/mesh/uimock/XTalkMeshUiApp.ktAT+ADDTL=1AT+RFSW=1,6,1,1
What the Init SDK should own
- BLE post-auth default parameter writes
AT+ADDTLAT+FREQAT+RATEAT+BCNIDAT+WORKMODE
- UART post-auth default parameter initialization
- UART post-auth vendor hardware configuration
- a result object that tells the business layer whether it can continue
What the Init SDK should not own
- BLE scan/connect
AT+CHALLENGEauthentication- DID read
- UART open
- mesh business logic
- UI prompts and button state
Current-state summary
BLE
BLE default initialization is still not separated from authentication:
XTalkBleClient.authenticateAndInitializeDefaults(...)- authenticates first
- writes default parameters next
So BLE initialization is still mixed into the transport implementation.
UART
UART defaults and vendor configuration are also not unified yet:
AppTransport.restoreTextPttDefaults(...)handlesWORKMODE / ADDTL / RATEXTalkMeshUiApp.ktexecutesAT+RFSW=1,6,1,1after authentication
So the current repository still relies on page-level orchestration of post-auth AT commands.
Recommended extracted API
object DeviceInitializer {
data class BleWirelessDefaults(
val freqHz: Long,
val rateMode: Int = 7,
val bcnId: Int = 0,
val addtl: Int = 1,
val workMode: Int = 21,
)
fun initializeBleWirelessDefaults(defaults: BleWirelessDefaults): Boolean
fun initializeUartDefaultsAfterAuth(
transport: AtCommandTransport,
deviceLongId: Long?,
defaults: UartDefaults,
): Result
fun initializeUartVendorConfigAfterAuth(
transport: AtCommandTransport,
deviceLongId: Long?,
tecnoUartPaEnabled: Boolean = false,
): Result
}
Recommended result shape:
data class Result(
val ok: Boolean,
val applied: Boolean,
val signature: String?,
val reason: String,
val commands: List<String> = emptyList(),
)
Recommended boundary
- Auth SDK should own “authentication succeeded”
- Init SDK should own “device parameters are now switched into the expected working state”
- frequency, rate, BCN, and vendor setup should not be pushed back into auth APIs
Recommended call order
BLE
XTalkBleClient.connect(...)- Auth SDK
DeviceInitializer.initializeBleWirelessDefaults(...)- business send/receive
UART
XTalkUartClient.open(...)- Auth SDK
DeviceInitializer.initializeUartDefaultsAfterAuth(...)DeviceInitializer.initializeUartVendorConfigAfterAuth(...)- business send/receive
Target module location
Recommended extraction target:
- Gradle module:
apps/android-ui/device-init-sdk - package:
com.xtalk.mesh.sdk.deviceinit
These do not exist in the repository yet.