associateDevice

abstract suspend fun associateDevice(address: String, nodeNum: Int, deviceId: String?, isSessionActive: () -> Boolean)(source)

Associates the connection identified by address with the physical device learned from its radio handshake, so the same device reached over a different transport (BLE / TCP / USB) shares one database. Implementations must reject an address that is no longer active, preventing a stale identity emission from claiming or merging the newly selected transport's database. The first transport to report the device claims its active DB; a later transport folds its own data in and switches to the claimed DB. Idempotent once a device/transport pair has been unified.

deviceId is the factory-burned hardware id from MyNodeInfo (null/blank when the platform or firmware doesn't report one, or when lockdown zeroes it). It is the preferred claim key because it survives the node-number changes firmware 2.8 introduced (my_node_num = crc32(public_key) renumbers on upgrade, erase, and re-key); nodeNum remains the fallback claim for hardware without a device id and for claims made by older app versions.

The caller must hold a transport-session lifecycle lease for the full call. isSessionActive must represent that lease, not merely whether new work may still be admitted, so association rollover cannot overlap the destination transaction commit.