SOCommOutsideWifiOnlyAPI

The SDK interface to connect & communicate with a remote device over wifi-connection only.

Please note, that this API is used for special use-cases only. Refer to SOCommOutsideAPI for default usage.

Use the SOCommOutsideAPIBuilder class to create instances of the SDK:

SOCommOutsideAPIBuilder(androidContext())
.apiKey("YOUR-API-KEY") //theoretically optional, however, you won't be able to do much on the remote device without a valid API KEY.
.debugLogs { message -> Log.d("SOComm", message) } //optional, should only be enabled in debug builds, and might just flood your logcat.
.warningLogs { message -> Log.w("SOComm", message) } //optional, will log only warnings, you need to decide whether you want to log warnings to somewhere (even in your production code)
.errorLogs { message -> Log.e("SOComm", message) } //optional, will log only errors, you need to decide whether you want to log errors to somewhere (even in your production code)
.buildWifiOnly()

Keep in mind that the API needs some permissions to be granted, and the connect method will fail if those permissions are not granted. See the JavaDoc of connect for more details.

Properties

Link copied to clipboard
@get:CheckReturnValue
abstract override val availableContexts: Observable<Set<SOContext>>

Returns an Observable which emits live-updates to the available context's at the currently connected remote device.

Link copied to clipboard
@get:CheckReturnValue
abstract override val connectionState: Observable<SOCommOutsideAPI.ConnectionState>

An Observable which emits the current connection state.

Link copied to clipboard
@get:CheckReturnValue
abstract override val contextsInUse: Observable<Set<SOContext>>

Returns an Observable which emits live-updates to the contexts which are currently in use (which is modified by calling use / release, or by contexts disappearing from the remote device (check availableContexts on that for further information)).

Link copied to clipboard
abstract override val fileApi: SOCommFileApi

Returns an instance of the SOCommFileApi which is associated with this BaseSOCommOutsideAPI, and should be used to transmit larger payloads.

Functions

Link copied to clipboard
@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.

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

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

Link copied to clipboard
@CheckReturnValue
abstract override fun disconnect(): Completable

Disconnects from a remote device (or cancels the connection attempt started using connect, if the SDK is still trying to connect to a remote device.

Link copied to clipboard
@CheckReturnValue
abstract override fun getClientIdentifier(): Maybe<ClientIdentifier>

Retrieves the identifier of this device with which this smartphone / application is known at the remote device.

Link copied to clipboard
@CheckReturnValue
abstract override fun getWifiCredentials(): Maybe<WifiCredentials>

Returns the wifi credentials of the current wifi connection, if currently connected via wifi. Will otherwise return Maybe.empty.

Link copied to clipboard
@CheckReturnValue
abstract override fun <T> publishTopic(topic: TopicIn<T>, value: T): Completable

Publishes a payload to the given topic.

Link copied to clipboard
@CheckReturnValue
abstract override fun registerDynamicContext(dynamicContext: SOContext): Completable

Registers a new SOContext to the API.

Link copied to clipboard
@CheckReturnValue
abstract override fun release(context: SOContext): Completable

Releases a given context, if it has been in use by calling use anytime prior. This will cancel subscriptions to the topics within this context, which means that any Observables returned by subscribeTopic that are not present in any other currently used SOContext will not emit any items anymore and will be disposed.

Link copied to clipboard
@CheckReturnValue
abstract override fun <T> subscribeTopic(topic: TopicOut<T>): Observable<T>

Subscribes to a given topic.

Link copied to clipboard
@CheckReturnValue
abstract override fun use(context: SOContext): Completable

Registers to use a given context and completes once the context has been used successfully.