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
Returns an Observable which emits live-updates to the available context's at the currently connected remote device.
An Observable which emits the current connection state.
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)).
Returns an instance of the SOCommFileApi which is associated with this BaseSOCommOutsideAPI, and should be used to transmit larger payloads.
Functions
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.
For documentation, please refer to the description in connect, which should be favoured over this method.
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.
Retrieves the identifier of this device with which this smartphone / application is known at the remote device.
Returns the wifi credentials of the current wifi connection, if currently connected via wifi. Will otherwise return Maybe.empty.
Registers a new SOContext to the API.
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.