Package com.pda.screenshotmatcher2.network

Functions used by the app to make network requests.

Types

CaptureCallback
Link copied to clipboard
interface CaptureCallback

Public Interface implemented by callback objects that want to be notified about the match status of a capture request.

CaptureRequestCallback
Link copied to clipboard
private interface CaptureRequestCallback : CaptureCallback

Private Interface implemented by callback objects that want to be notified about the match status of a capture request AND whether a permission needs to be requested.

PermissionRequestCallback
Link copied to clipboard
private interface PermissionRequestCallback

Private interface implemented by callback objects that want to be notified about the status of a permission request.

Routes
Link copied to clipboard
private object Routes

Object that stores all available routes to the server

Functions

captureJsonObjectRequest
Link copied to clipboard
private fun captureJsonObjectRequest(serverURL: String, json: JSONObject, cb: CaptureRequestCallback): JsonObjectRequest

Create a JSONObjectRequest that sends a match request to the server.

discoverServersOnNetwork
Link copied to clipboard
fun discoverServersOnNetwork(context: Context, port: Int = 49050, message: String = "screenshot matcher client LF server", onGet: (servers: List<Pair<String, String>>) -> Unit): List<Pair<String, String>>

Discovers and returns available servers on the network.

getBroadcastAddress
Link copied to clipboard
private fun getBroadcastAddress(context: Context): InetAddress?

Gets the broadcast address of the network.

logMatchResponse
Link copied to clipboard
private fun logMatchResponse(response: JSONObject)

Log a match response to the StudyLogger

requestFullScreenshot
Link copied to clipboard
fun requestFullScreenshot(matchID: String, serverURL: String, context: Context, onDownload: (bitmap: Bitmap?) -> Unit)

Request a full screenshot for a match from the server.

requestPermission
Link copied to clipboard
private fun requestPermission(serverURL: String, context: Context, matchID: String, cb: PermissionRequestCallback)

Request a permission token from the server.

sendCaptureRequest
Link copied to clipboard
fun sendCaptureRequest(bitmap: Bitmap, serverURL: String, context: Context, matchingOptions: HashMap<Any?, Any?>? = null, permissionToken: String? = "", matchID: String? = "", captureCallback: CaptureCallback)

Send a match request to the server.

sendFeedbackToServer
Link copied to clipboard
fun sendFeedbackToServer(fragment: Fragment, context: Context, serverUrl: String, uid: String, hasResult: Boolean, hasScreenshot: Boolean, comment: String)

Send feedback to a feedback server.

sendHeartbeatRequest
Link copied to clipboard
fun sendHeartbeatRequest(serverURL: String?, context: Context, onFail: () -> Unit)

Send a heartbeat to the server.

sendLog
Link copied to clipboard
fun sendLog(serverURL: String, context: Context)

Send a log from StudyLogger to the logging server

Properties

MAX_SERVERS
Link copied to clipboard
const val MAX_SERVERS: Int = 5

The maximum number of servers that can be discovered.

PROTOCOL
Link copied to clipboard
const val PROTOCOL: String

The protocol used for the connection between the app and the server.

queue
Link copied to clipboard
var queue: RequestQueue? = null

The request queue used to send requests to the server.