connect

@CheckReturnValue
abstract fun connect(wifiSSID: String, wifiPassword: String): Completable

Connect to a remote device identified by the given wifiSSID. Please note, that this is currently only to be used in special use-cases, please refer to the SOCommOutsideAPI for default usage.

This also authenticates the device at the remote device, if an apiKey has been set in the SOCommOutsideAPIBuilder. If the authentication fails, an ErrorRespondedException will be emitted.

When calling this method, the following permissions are checked to be already granted. You need to check / request those permissions beforehand. This method will emit a com.swarovskioptik.comm.sdk.exception.PermissionNotGrantedException if permissions have not been granted.

The API requires the following runtime permission to be already granted here:

  • android.Manifest.permission.ACCESS_FINE_LOCATION: Needed to be able to scan / check WIFI networks. This SDK will never use this permission to query location-specific data, or use the data for location retrieval. But as it is potentially possible to gain information about a users location by scanning wifi networks, we need to request this permission. Please note, that this is a runtime-permission, which needs to be explicitly granted by the user at runtime, and can be revoked at any time.

The API furthermore requires some permissions, which are enough to be present in the AndroidManifest file (which the SDK adds to the application manifest file, so you should not need to take any actions here). Those are:

Moreover, bluetooth must be enabled before calling this method. Otherwise, a BluetoothNotEnabledException will be emitted (or, if no bluetooth adapter could be found, a BluetoothNotAvailableException will be emitted).

Note, that subsequent calls to connect, while another Completable from connect is still running, will result in an error.

Scheduler: The returned Completable will operate on the IO Scheduler.

Return

a Completable which completes once the connection has been established successfully.

Parameters

wifiSSID

The SSID of the Wifi network the remote device has created.

wifiPassword

The PSK of the Wifi network the remote device has created.

See also


@CheckReturnValue
abstract fun connect(wifiSSID: String, wifiPassword: String, brokerHost: String): Completable

Deprecated

Declaring the broker host address manually is discouraged. You can safely ignore/suppress this deprecation warning if you are intending to use a custom port, though.

Replace with

connect(wifiSSID, wifiPassword)

For documentation, please refer to the description in connect, which should be favoured over this method.

Use this method only (instead of the connect) if you need to specify the brokerHost yourself.

Return

a Completable which completes once the connection has been established successfully.

Parameters

wifiSSID

The SSID of the Wifi network the remote device has created.

wifiPassword

The PSK of the Wifi network the remote device has created.

brokerHost

the IP address of the MQTT broker the remote device is running.

See also