ServerConnectionViewModel

class ServerConnectionViewModel(application: Application) : AndroidViewModel

ViewModel that provides two way data bindings for ServerConnectionModel Use this class to retrieve/manipulate data stored in ServerConnectionModel

See also

MVVM Architecture For more information about how this software architectural pattern works.

Constructors

ServerConnectionViewModel
Link copied to clipboard
fun ServerConnectionViewModel(application: Application)

An instance of the current Application

Types

Factory
Link copied to clipboard
internal class Factory(application: Application) : ViewModelProvider.Factory

Factory to initiate this ServerConnectionViewModel

Functions

getConnectedServerName
Link copied to clipboard
fun getConnectedServerName(): String

Getter method that returns the hostname of the currently connected server (or "" if not connected)

getConnectionStatus
Link copied to clipboard
fun getConnectionStatus(): Boolean

Getter that returns the value of isConnectedToServer

getServerUrl
Link copied to clipboard
fun getServerUrl(): String

Getter that returns the value of serverUrl

getServerUrlList
Link copied to clipboard
fun getServerUrlList(): List<Pair<String, String>>

Getter that returns the value of serverUrlList

getServerUrlListLiveData
Link copied to clipboard
fun getServerUrlListLiveData(): MutableLiveData<List<Pair<String, String>>>

Getter that returns serverUrlList as MutableLiveData

getServerUrlLiveData
Link copied to clipboard
fun getServerUrlLiveData(): MutableLiveData<String>

Getter that returns serverUrl as MutableLiveData

setServerUrl
Link copied to clipboard
fun setServerUrl(hostname: String)

Set the currently connected server by hostname

start
Link copied to clipboard
private fun start()

Starts the discover/heartbeat cycle of ServerConnectionModel

Properties

isConnectedToServer
Link copied to clipboard
val isConnectedToServer: MutableLiveData<Boolean>
isDiscovering
Link copied to clipboard
private val isDiscovering: MutableLiveData<Boolean>
isSendingHeartbeat
Link copied to clipboard
private val isSendingHeartbeat: MutableLiveData<Boolean>
serverUrl
Link copied to clipboard
private val serverUrl: MutableLiveData<String>
serverUrlList
Link copied to clipboard
private val serverUrlList: MutableLiveData<List<Pair<String, String>>>