feat(connector): add database logging for simulator test

This commit is contained in:
Anthony Berg
2024-05-02 18:01:35 +01:00
parent c615149624
commit 9482ba3d97
5 changed files with 195 additions and 54 deletions

View File

@@ -45,20 +45,32 @@ class XPC {
return result
}
/**
* Gets the state of a specific Dataref
*
* @param dref Dataref name to get the value for
* @return Value of the Dataref
*/
fun getState(dref: String): FloatArray {
val result = xpc.getDREF(dref)
return result
}
/**
* Sets a dataref in X-Plane to the set goal
*
* @param dref Dataref name in X-Plane to change the value for
* @param goal The value that should be set for the dataref in X-Plane
*
* @return `true` if successfully set, `false` otherwise
* @return The state of the Dataref in the simulator
*/
@Throws(SocketException::class, IOException::class)
fun runChecklist(dref: String, goal: Int) : Boolean {
fun runChecklist(dref: String, goal: Int) : FloatArray {
xpc.sendDREF(dref, goal.toFloat())
val result = xpc.getDREF(dref)
return goal.toFloat() == result[0]
return result
}
}