register Device
Register a device with the Amazon Sidewalk network. If a SidewalkConnection has been established with the device before registration, use registerDevice(SidewalkConnection) instead.
You can register a device by given SidewalkDevice.truncatedSmsn received from scan; Amazon Sidewalk Mobile SDK would scan peripherals with given descriptor, and register the device if one found.
val device = sidewalk.scan()
.filter { it is SidewalkResult.Success }
.map { (it as SidewalkResult.Success).value }
.first()
sidewalk.registerDevice(device.truncatedSmsn)Process returns directly if the device is already registered to your account; otherwise the Amazon Sidewalk device will disconnect after registration regardless of result.
Call secureConnectDevice to acquire a new SidewalkConnection if connection features are still required.
Connects to the Amazon Sidewalk device over Bluetooth Low-Energy (BLE). Attempts to register it for use on the Amazon Sidewalk network. Only one registration call can be in operation at a time.
Return
The result when registration complete. Returns SidewalkResult.Success if the Amazon Sidewalk device is registered successfully; otherwise SidewalkResult.Failure with the failure cause.
Parameters
The Sidewalk Manufacturing Serial Number (SMSN) of the device to attempt to connect to. The SMSN is a 5-Byte hex string, for instance, "F123456789". String with invalid length or character will cause the process to fail directly.
Register a device with the Amazon Sidewalk network through the BLE secure connection. Process returns directly if the device is already registered to your account; otherwise the Amazon Sidewalk device will disconnect after registration regardless of the result.
val device = sidewalk.scan()
.filter { it is SidewalkResult.Success }
.map { (it as SidewalkResult.Success).value }
.first()
val connection = sidewalk.secureConnect(device)
sidewalk.register(connection)Process returns directly if the device is already registered to your account; otherwise the Amazon Sidewalk device will disconnect after registration regardless of result.
Call secureConnectDevice to acquire a new SidewalkConnection if connection features are still required.
Attempts to register the connected Amazon Sidewalk device for use on the Amazon Sidewalk network. Only one registration call can be in operation at a time.
Return
The result when registration complete. Returns SidewalkResult.Success if the Amazon Sidewalk device is registered successfully; otherwise SidewalkResult.Failure with the failure cause.
Parameters
A secure BLE connection with the Amazon Sidewalk device