pl.wendigo.chrome.domain.deviceorientation.DeviceOrientationDomain.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chrome-reactive-kotlin Show documentation
Show all versions of chrome-reactive-kotlin Show documentation
Chrome Reactive - low level, remote chrome debugger protocol client (DevTools)
package pl.wendigo.chrome.domain.deviceorientation
/**
* DeviceOrientationDomain represents remote debugger protocol domain.
*/
class DeviceOrientationDomain internal constructor(private val connectionRemote : pl.wendigo.chrome.DebuggerProtocol) {
/**
* Overrides the Device Orientation.
*/
fun setDeviceOrientationOverride(input : SetDeviceOrientationOverrideRequest) : io.reactivex.Single {
return connectionRemote.runAndCaptureResponse("DeviceOrientation.setDeviceOrientationOverride", input, pl.wendigo.chrome.ResponseFrame::class.java).map {
it.value()
}
}
/**
* Clears the overridden Device Orientation.
*/
fun clearDeviceOrientationOverride() : io.reactivex.Single {
return connectionRemote.runAndCaptureResponse("DeviceOrientation.clearDeviceOrientationOverride", null, pl.wendigo.chrome.ResponseFrame::class.java).map {
it.value()
}
}
/**
* Returns flowable capturing all DeviceOrientation domains events.
*/
fun events() : io.reactivex.Flowable {
return connectionRemote.captureAllEvents().map { it.value() }.filter {
it.protocolDomain() == "DeviceOrientation"
}
}
}
/**
* Represents request frame that can be used with DeviceOrientation.setDeviceOrientationOverride method call.
*
* Overrides the Device Orientation.
*/
data class SetDeviceOrientationOverrideRequest (
/**
* Mock alpha
*/
val alpha : Double,
/**
* Mock beta
*/
val beta : Double,
/**
* Mock gamma
*/
val gamma : Double
)