package jsyphon import java.io.File import java.util.* class JSyphonClient // public API { private var ptr: Long = 0 companion object { init { System.load(File("orx-syphon/src/main/kotlin/jsyphon/libJSyphon.jnilib").absolutePath) } } fun init() { ptr = init(null) } fun setApplicationName(appName: String?) { setApplicationName(ptr, appName) } fun setServerName(serverName: String?) { setServerName(ptr, serverName) } val isValid: Boolean get() = isValid(ptr) fun newFrameImageForContext(): JSyphonImage { val dict = newFrameDataForContext() val name = dict["name"] as Long? val width = dict["width"] as Double? val height = dict["height"] as Double? return JSyphonImage(name!!.toInt(), width!!.toInt(), height!!.toInt()) } // Native method declarations external fun init(options: HashMap?): Long external fun setApplicationName(ptr: Long, appName: String?) external fun setServerName(ptr: Long, serverName: String?) external fun isValid(ptr: Long): Boolean @JvmOverloads external fun serverDescription(ptr: Long = this.ptr): HashMap? @JvmOverloads external fun hasNewFrame(ptr: Long = this.ptr): Boolean @JvmOverloads external fun newFrameDataForContext(ptr: Long = this.ptr): HashMap @JvmOverloads external fun stop(ptr: Long = this.ptr) // public JSyphonImage newFrameImageForContext() { // HashMap dict = newFrameDataForContext(); // Long name = (Long)dict.get("name"); // Double width = (Double)dict.get("width"); // Double height = (Double)dict.get("height"); // return new JSyphonImage(name.intValue(), width.intValue(), height.intValue()); // } }