Skip to main content

DataMockUtils

class DataMockUtils

Description: mock data service class

class DataMockUtils private constructor() {
/**
* test data for app
*/
private val testDataForAppMap: MutableMap<String, Any> = mutableMapOf()

/**
* key listener list
*/
private val listenerList = ConcurrentHashMap<AutelKey<Any>, CommonCallbacks.KeyListener<Any>>()

/**
* timer task
*/
private var timerTask: TimerTask? = null

/**
* timer object for timer task
*/
private var timer: Timer? = null

/**
* scope defined
*/
private var scope: CoroutineScope? = null
}

method createTimerTask

private fun createTimerTask(): TimerTask

Description: Creating timer task object

Input parameters: None。

Output parameters: Timertask object return after creating it。

Related parameters: None。

method addListen

fun <Result> addListen(key: AutelKey<Result>, callback: CommonCallbacks.KeyListener<Result>)

Description: Listener for timer task with call back

Input parameters: key: autel key result callback: call back for key listener result

Output parameters: None。

Related parameters: None。

method removeListen

fun <Result> removeListen(key: AutelKey<Result>)

Description: Removing listener with key result

Input parameters: key: key passes to remove listener for that particular key result

Output parameters: None。

Related parameters: None。

method cancelTimer

fun cancelTimer()

Description: Stop timer task

Input parameters: None。

Output parameters: None。

Related parameters: None。

method removeAllListen

fun removeAllListen()

Description: Remove all listener for key result

Input parameters: None。

Output parameters: None。

Related parameters: None。

method mockGetValue

fun <Result> mockGetValue(
key: AutelKey<Result>,
callback: CommonCallbacks.CompletionCallbackWithParam<Result>
)

Description: Getting value of key result of info

Input parameters: key: key result callback: call back for result pass

Output parameters: None。

Related parameters: None。

method mockGetListValue

fun mockGetListValue(
keyList: List<AutelKey<*>>,
callback: CommonCallbacks.CompletionCallbackWithParam<List<*>>
)

Description: Getting value of key result of info

Input parameters: keyList: key result list callback: call back for result pass with key list

Output parameters: None。

Related parameters: None。

method mockSetValue

fun <Param> mockSetValue(
key: AutelKey<Param>,
param: Param,
callback: CommonCallbacks.CompletionCallback?
)

Description: Setting value of key result of info

Input parameters: key: key result param: setting value in key name callback: call back for result pass

Output parameters: None。

Related parameters: None。

method mockSetListValue

fun <Any> mockSetListValue(
keyList: List<AutelKey<Any>>,
params: List<Any>,
callback: CommonCallbacks.CompletionCallbackWithParam<List<*>>?
)

Description: Setting value of key result of info

Input parameters: key: key result list param: param setting values in keys name callback: call back for results pass

Output parameters: None。

Related parameters: None。

method mockActionValue

fun <Result> mockActionValue(
key: AutelKey.ActionKey<*, Result>,
callback: CommonCallbacks.CompletionCallbackWithParam<Result>?
)

Description: Getting value of key result of info

Input parameters: key: key action result callback: call back for result pass

Output parameters: None。

Related parameters: None。