Android Device Initialization SDK
SDK Version: 1.0.0
Package:com.xtalk.mesh.sdk.deviceinit
The Init SDK applies device defaults after authentication succeeds. It does not scan, connect, perform challenge authentication, or read the DID.
BLE defaults
val initialized = withContext(Dispatchers.IO) {
DeviceInitializer.initializeBleWirelessDefaults(
radioTransport = radioTransport,
defaults = DeviceInitializer.BleWirelessDefaults(
freqHz = meshFrequencyHz,
rateMode = 7,
bcnId = 0,
addtl = 1,
workMode = 21,
),
)
}
Defaults:
| Field | Default | Meaning |
|---|---|---|
freqHz | 470250000 | Four default frequency entries in Hz |
rateMode | 7 | Radio rate mode |
bcnId | 0 | Beacon ID |
addtl | 1 | Address-related setting |
workMode | 21 | Work mode |
Use the frequency configuration approved for the customer project and region; do not treat the example as a universal production frequency. A true result means that every default command received OK and BLE is ready for sending.
UART defaults
val initTransport = object : DeviceInitializer.AtCommandTransport {
override val label: String = "uart"
override fun runAtCommand(
command: String,
timeoutMs: Long,
log: Boolean,
): List<String> = myUart.runAtCommand(command, timeoutMs, log)
}
val defaults = DeviceInitializer.initializeUartDefaultsAfterAuth(
transport = initTransport,
deviceLongId = auth.deviceLongId,
defaults = DeviceInitializer.UartDefaults(addtl = 1),
)
deviceLongId must come from a successful authentication result. Without a DID, the SDK returns missing_did and sends no command.
UART vendor configuration
val vendor = DeviceInitializer.initializeUartVendorConfigAfterAuth(
transport = initTransport,
deviceLongId = auth.deviceLongId,
hostProfile = DeviceInitializer.AndroidHostProfile.current(),
tecnoUartPaEnabled = false,
timeoutMs = 3_000L,
)
SDK 1.0.0 includes host matching for Ulefone and TECNO. With no matching configuration, the result is ok = true, applied = false, reason = "no_vendor_config"; no action is required and this is not an error.
Failure handling
- Do not start business sends after initialization fails.
- Confirm that the connection remains valid, then retry once or reconnect.
- Do not run Auth, Init, OTA, and custom AT operations concurrently.
- Run Auth → Init again after a device restart or reconnection.
Complete model and operation contract
| Type/API | Defaults or parameters | Behavior/result |
|---|---|---|
AndroidHostProfile | manufacturer, brand, model | current() reads host; matches(keyword) checks manufacturer/brand case-insensitively |
BleWirelessDefaults | freqHz=470250000, rateMode=7, bcnId=0, addtl=1, workMode=21 | Five BLE defaults; replace frequency with approved value |
UartDefaults | addtl=1 | Generic UART default |
VendorAtConfig | vendor, signature, commands | Vendor selection; commands execute in order |
Result | ok, applied, signature, reason, commands=[] | UART outcome; ok=true/applied=false may mean no work required |
initializeBleWirelessDefaults(radioTransport, defaults) | Auth succeeded; background | ADDTL/FREQ/RATE/BCNID/WORKMODE; true and ready only if all return OK |
selectUartVendorConfig(hostProfile, tecnoUartPaEnabled=false) | Pure | Ulefone/TECNO config or null; sends nothing |
initializeUartVendorConfigAfterAuth(...) | UART Auth/non-null DID; timeoutMs=3000 | Applies vendor commands, returns Result |
initializeUartDefaultsAfterAuth(...) | UART Auth/non-null DID; timeoutMs=2000 | Applies ADDTL, returns Result |
RadioAtCommandTransport(radioTransport) | Common transport exists | Delegates to RadioTransport.runAtCommand |
UART reasons: ok applied; no_vendor_config no work; missing_did sends nothing; command_no_ok has no success terminal; command_failed is exception/timeout. Continue only for ok == true; applied records whether commands were sent.
Any BLE command failure clears ready. Retry the complete sequence once only while still CONNECTED; then reconnect and repeat Auth → Init. missing_did requires Auth. Init has no independent cancel; wait for the current deadline and skip remaining commands when cancelling the workflow.