Skip to main content

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:

FieldDefaultMeaning
freqHz470250000Four default frequency entries in Hz
rateMode7Radio rate mode
bcnId0Beacon ID
addtl1Address-related setting
workMode21Work 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/APIDefaults or parametersBehavior/result
AndroidHostProfilemanufacturer, brand, modelcurrent() reads host; matches(keyword) checks manufacturer/brand case-insensitively
BleWirelessDefaultsfreqHz=470250000, rateMode=7, bcnId=0, addtl=1, workMode=21Five BLE defaults; replace frequency with approved value
UartDefaultsaddtl=1Generic UART default
VendorAtConfigvendor, signature, commandsVendor selection; commands execute in order
Resultok, applied, signature, reason, commands=[]UART outcome; ok=true/applied=false may mean no work required
initializeBleWirelessDefaults(radioTransport, defaults)Auth succeeded; backgroundADDTL/FREQ/RATE/BCNID/WORKMODE; true and ready only if all return OK
selectUartVendorConfig(hostProfile, tecnoUartPaEnabled=false)PureUlefone/TECNO config or null; sends nothing
initializeUartVendorConfigAfterAuth(...)UART Auth/non-null DID; timeoutMs=3000Applies vendor commands, returns Result
initializeUartDefaultsAfterAuth(...)UART Auth/non-null DID; timeoutMs=2000Applies ADDTL, returns Result
RadioAtCommandTransport(radioTransport)Common transport existsDelegates 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.

Open the API Reference