Results

The API documentation for the current version (13.0.1) is available here.

Obtaining the Measurement Results

After the upload of your scanned frames is completed (that is, the TireTreadScanView's callback onScanProcessCompleted was invoked), your measurement results may still take a few seconds to become available. To fetch the results, call the function getTreadDepthReportResult(measurementUuid):

  • Android

  • iOS

class MeasurementResultActivity(
    private val backgroundDispatcher: CoroutineDispatcher = Dispatchers.IO
) : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_measurement_result)

        var measurementUuid: String = ""

        val bundle = intent.extras
        bundle?.also {
            measurementUuid = it.getString("measurement_uuid") ?: ""
        }

        // Display some "loading" information

        // Run the fetchResults in a background thread
        lifecycleScope.launch(backgroundDispatcher) {
            fetchResults(measurementUuid)
        }
    }

    private fun fetchResults(measurementUuid: String) {
        Log.d("MY_APP", "Checking for results for UUID - $measurementUuid - ...")

        AnylineTireTreadSdk.getTreadDepthReportResult(
            measurementUuid,
            onResponse = { response: Response<TreadDepthResult> ->
                when(response){
                    is Response.Success -> {
                        Log.d("MY_APP", "${response.data.measurementInfo.measurementUuid} result is available")
                        runOnUiThread {
                            displayMeasurementResult(response.data)
                        }
                    }
                    is Response.Error -> {
                        // Handle failure
                        Log.e("MY_APP", "$measurementUuid failed")
                        Log.e("MY_APP", "Error Code: ${response.errorCode}")
                        Log.e("MY_APP", "Error Message: ${response.errorMessage}")
                        runOnUiThread {
                            displayError(response.errorMessage ?: "Error!")
                        }
                    }
                    is Response.Exception -> {
                        Log.e("MY_APP", response.exception.message)
                    }
                }
            }
        )
    }
}
// Run the fetchResults in a background thread
private func fetchTreadDepthResult() {
    AnylineTireTreadSdk.shared.getTreadDepthReportResult(
        measurementUuid: self.uuid,
        timeoutSeconds: 60) { [weak self] response in
            guard let self = self else { return }

            switch(response) {
                case let response as ResponseSuccess<TreadDepthResult>:
                    // Handle success
                    break
                case let response as ResponseError<TreadDepthResult>:
                    // Handle error
                    break
                case let response as ResponseException<TreadDepthResult>:
                    // Handle exception
                    break
                default:
                    // This state cannot be reached
                    break
            }
    }
}

Data availability is only ensured for 24 hours.

The callback will return a successful response in form of a ResponseSuccess<TreadDepthResult> object containing the result of the measurement.

In case of an error or exception, the callback returns ResponseError<TreadDepthResult> for the former and ResponseException<TreadDepthResult> for the latter containing information about what went wrong during the scan.

A timeoutSeconds parameter can be passed to the function, limiting for how long the result fetching can run before interrupted (in case of bad network connection, etc.).

TreadDepthResult

The TreadDepthResult represents the result of a tread depth measurement. It contains three properties:

  • global: An instance of TreadResultRegion representing the global result.

    • This value represents the global tread depth of the entire tire.

    • This value is calculated from all individual measurements.

  • regions: A list of TreadResultRegion instances representing the results for each of the identified tire regions.

    • This value represents the tread depth of the identified tire regions (for more details, check the PDF Report); It does not represent measurements of single grooves.

    • The regions are always provided considering the direction from Left to Right side of the scanned tire.

  • minimumValue: An instance of TreadResultRegion with the minimum value among the regions, or the global value in case no regional results is available.

  • measurementInfo: An instance of MeasurementInfo providing additional information about the measurement.

    • This property holds the Measurement UUID, the measurement’s status (MeasurementStatus) and - if provided before the scan process - the additional context of your measurement.

    • The possible values for the Measurement Status are WaitingForImages, Processing, ResultReady, ResultAndReportReady,Completed, Aborted, Failed, and Unknown.

    • The results are only available when the measurement’s status is ResultReady, ResultAndReportReady, or Completed.

  • TreadDepthResult can be easily converted to JSON format via the toJson() extension function.

Analytics

The Anyline Tire Tread SDK provides not only the final measurement results, but also analytics results from your tire. Check the Analytics section for more information.

User Corrected Values and Comments

User Comments

To send a comment on a measurement, use the sendCommentFeedback function of the AnylineTireTreadSdk.

As usual with the TireTreadSDK, the UUID for the scan must be passed as a parameter. The comment is passed as a string:

  • Android

  • iOS

AnylineTireTreadSdk.sendCommentFeedback(measurementUuid, commentText) { response: Response<MeasurementInfo> ->
    when(response) {
        is Response.Success -> {
            Toast.makeText(
                this,
                resources.getString("Send comment: Success"),
                Toast.LENGTH_SHORT
            ).show()
        }
        else -> {
            Toast.makeText(
                this,
                resources.getString("Send comment: Failure"),
                Toast.LENGTH_SHORT
            ).show()
        }
    }
}
DispatchQueue.global().async {
    AnylineTireTreadSdk.shared.sendCommentFeedback(uuid: measurementUuid,
        comment: commentText) { [weak self] response in
        switch(response) {
            case let response as ResponseSuccess<MeasurementInfo>:
                // Handle success
                break
            case let response as ResponseError<MeasurementInfo>:
                // Handle error
                break
            case let response as ResponseException<MeasurementInfo>:
                // Handle exception
                break
            default:
                // This state cannot be reached
                break
        }
    }
}

User-Corrected Regional Values

To send user-corrected regional values, use the sendTreadDepthResultFeedback function from the AnylineTireTreadSdk. The result feedback should be provided as a list of TreadResultRegion, ordered from left to right.

You can only provide feedback for the regions returned by the SDK in the TreadDepthResult object.

The values of all regions need be added to the list before sending the feedback.

The TreadResultRegion objects can be initialized with millimeter, inch, or inch32nds units:

  • Android

  • iOS

// initialize the corrected results either with Millimeter, Inch, or Inch32nds
val myCorrectedResults = listOf(
    TreadResultRegion.initMm(true, 0.8),
    TreadResultRegion.initInch(true, 0.031496),
    TreadResultRegion.initInch32nds(true, 1)
)

AnylineTireTreadSdk.sendTreadDepthResultFeedback(measurementUuid, myCorrectedResults) { response: Response<MeasurementInfo> ->
    when(response){
        is Response.Success -> {
            Log.d("MY_APP", "Success")
        }
        is Response.Error -> {
            // Handle failure
            Log.e("MY_APP", "Error Code: ${response.errorCode}")
            Log.e("MY_APP", "Error Message: ${response.errorMessage}")
        }
        is Response.Exception -> {
            Log.e("MY_APP", response.exception.message.toString())
        }
    }
}
// initialize the corrected results either with Millimeter, Inch, or Inch32nds
let myCorrectedResults = [
    TreadResultRegion.companion.doInitMm(isAvailable: true, value: 0.8),
    TreadResultRegion.companion.doInitInch(isAvailable: true, value: 0.031496),
    TreadResultRegion.companion.doInitInch32nds(isAvailable: true, value: 1)
]

DispatchQueue.global().async {
    AnylineTireTreadSdk.shared.sendTreadDepthResultFeedback(resultUuid: measurementUuid,
        treadResultRegions: myCorrectedResults) { [weak self] response in
        switch(response) {
            case let response as ResponseSuccess<MeasurementInfo>:
                // Handle success
                break
            case let response as ResponseError<MeasurementInfo>:
                // Handle error
                break
            case let response as ResponseException<MeasurementInfo>:
                // Handle exception
                break
            default:
                // This state cannot be reached
                break
        }
    }
}

Converting to and from JSON

To convert an TreadResultRegion to a JSON string use the toJson function.

  • Android

  • iOS

val region = TreadResultRegion.initMm(true, 1.2)
val regionJson = region.toJson()
let region = TreadResultRegion.companion.doInitMm(isAvailable: true, value: 5.0)
let regionJson = region.toJson()

To convert an TreadResultRegion from a JSON string use the fromJson function.

  • Android

  • iOS

val regionJson = """
    {
        "available":true,
        "value_mm":3.16,
        "value_inch":0.12,
        "value_inch_32nds":4
    }
"""
val region = TreadResultRegion.fromJson(regionJson)
let regionJson = """
    {
        "available":true,
        "value_mm":3.160535117056856,
        "value_inch":0.12443051641956127,
        "value_inch_32nds":4
    }
"""
let region = TreadResultRegion.companion.fromJson(json: regionJson)