AppServer

class AppServer(appContext: Context, httpClient: OkHttpClient, mLogger: MNetLogger, name: String, port: Int = 0, val localVirtualAddr: InetAddress, receiveDir: File, json: Json, db: MeshDatabase, val di: DI, userRepository: UserRepository) : NanoHTTPD, Closeable, DIAware

Constructors

Link copied to clipboard
constructor(appContext: Context, httpClient: OkHttpClient, mLogger: MNetLogger, name: String, port: Int = 0, localVirtualAddr: InetAddress, receiveDir: File, json: Json, db: MeshDatabase, di: DI, userRepository: UserRepository)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
@Serializable
data class IncomingTransferInfo(val id: Int, val requestReceivedTime: Long = System.currentTimeMillis(), val fromHost: InetAddress, val deviceName: String = "Unknown Device", val name: String, val status: AppServer.Status = Status.PENDING, val size: Int, val transferred: Int = 0, val transferTime: Int = 1, val file: File? = null)
Link copied to clipboard
data class OutgoingTransferInfo(val id: Int, val name: String, val uri: Uri, val toHost: InetAddress, val status: AppServer.Status = Status.PENDING, val size: Int, val transferred: Int = 0)
Link copied to clipboard

Properties

Link copied to clipboard
open override val di: DI
Link copied to clipboard
open val diContext: DIContext<*>
Link copied to clipboard
open val diTrigger: DITrigger?
Link copied to clipboard
open val hostname: String?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var serverSocketFactory: NanoHTTPD.ServerSocketFactory?
Link copied to clipboard
open var tempFileManagerFactory: NanoHTTPD.TempFileManagerFactory?

Functions

Link copied to clipboard
fun acceptIncomingTransfer(transfer: AppServer.IncomingTransferInfo, destFile: File, fromPort: Int = DEFAULT_PORT)
Link copied to clipboard
fun addOutgoingTransfer(uri: Uri, toNode: InetAddress, toPort: Int = DEFAULT_PORT): AppServer.OutgoingTransferInfo
Link copied to clipboard
fun checkDeviceReachable(remoteAddr: InetAddress, port: Int = DEFAULT_PORT): Boolean

Checks if a device is reachable at the application level This performs a lightweight check without doing a full user info exchange

Link copied to clipboard
open override fun close()
Link copied to clipboard
Link copied to clipboard
open fun makeSecure(sslServerSocketFactory: SSLServerSocketFactory?, sslProtocols: Array<out String?>?)
Link copied to clipboard
Link copied to clipboard
suspend fun onDeclineIncomingTransfer(transfer: AppServer.IncomingTransferInfo, fromPort: Int = DEFAULT_PORT)
Link copied to clipboard
Link copied to clipboard
fun pushUserInfoTo(remoteAddr: InetAddress, port: Int = DEFAULT_PORT)
Link copied to clipboard
fun removeOutgoingTransfer(transferId: Int)
Link copied to clipboard
fun requestRemoteUserInfo(remoteAddr: InetAddress, port: Int = DEFAULT_PORT)
Link copied to clipboard
fun restart()
Link copied to clipboard
suspend fun sendChatMessageWithStatus(address: InetAddress, time: Long, message: String, f: URI?): Boolean

Send a chat message and return delivery status

Link copied to clipboard
suspend fun sendDeviceName(wifiAddress: InetAddress, port: Int = DEFAULT_PORT)
Link copied to clipboard
open override fun serve(session: NanoHTTPD.IHTTPSession): NanoHTTPD.Response
open fun serve(uri: String?, method: NanoHTTPD.Method?, headers: Map<String?, String?>?, parms: Map<String?, String?>?, files: Map<String?, String?>?): NanoHTTPD.Response?
Link copied to clipboard
open fun setAsyncRunner(asyncRunner: NanoHTTPD.AsyncRunner?)
Link copied to clipboard
open fun start()
open fun start(timeout: Int)
open fun start(timeout: Int, daemon: Boolean)
Link copied to clipboard
open fun stop()
Link copied to clipboard
fun updateUserConnectionStatus(userUuid: String, isOnline: Boolean, userAddress: String?)
Link copied to clipboard
fun updateUserOnlineStatus(userUuid: String, isOnline: Boolean, userAddress: String?)
Link copied to clipboard