SidewalkConnection
Represents a BLE connection with a Sidewalk device.
This class is created when the Sidewalk Mobile SDK is able to create a secure connection with a Sidewalk device.
The connection might be terminated by Sidewalk device if no traffic for an amount of time to prevent BLE resources occupation. The time is configurable by Sidewalk device.
Before releasing SidewalkConnection object, you should make sure the ongoing operation like startCoverageTest
is properly cancelled by calling cancel() on the corresponding SidewalkCancellable object and waiting for the
corresponding completion closure to be invoked. Otherwise, cancel() operation may be interrupted since the connection with
Sidewalk device is disconnected.
Note
This object automatically disconnects when deinitialized.-
Availability of the Sidewalk connection.
Return true if the connection is available to write/subscribe messages, false otherwise.
-
Subscribe to
SidewalkMessages received from the Sidewalk connection and get notification from the completion callback on connection termination.Monitors the Sidewalk device over BLE, calls
onMessageReceivedforSidewalkMessages destined to the mobile service, and callscompletionwhen the connection terminates to inform error on failure case.Note
This object automatically calls cancel() when deinitialized. -
Writes a
SidewalkMessageto a Sidewalk device.Writes a
SidewalkMessageover the secure BLE connection.Note
This object automatically calls cancel() when deinitialized. -
Start coverage test on the device in the connection.
When coverage test is started, Sidewalk device will start ping-pong tests, and send corresponding logs to mobile. During the progress, Sidewalk Mobile SDK will provide update via
onProgressUpdatedclosure with event. When coverage test is ended, Sidewalk Mobile SDK will collect report from Sidewalk device, and send the result viacompletionclosure.To stop the coverage test properly after this method is called, you should call
cancel()on the returnedSidewalkCancellable, and hold theSidewalkConnectionobject until thecompletionclosure passed in this method is invoked.Note
This object automatically calls
cancel()when deinitialized. -
Disconnects from the
SidewalkDevice.This is also called automatically by the SDK when the
SidewalkConnectionclass is de-initialized.
SidewalkConnection Class Reference