package com.dynamsoft.reactnativelib import com.dynamsoft.reactnativelib.dce.CameraEnhancerModuleImpl import com.facebook.react.bridge.Promise import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactContextBaseJavaModule import com.facebook.react.bridge.ReactMethod import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.WritableMap class DCEModule(reactApplicationContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactApplicationContext) { val impl = CameraEnhancerModuleImpl(reactApplicationContext) override fun getName(): String = impl.getName() @ReactMethod(isBlockingSynchronousMethod = true) fun createInstance(): String { return impl.createInstance() } @ReactMethod(isBlockingSynchronousMethod = true) fun destroyInstance(id: String): Boolean { return impl.destroyInstance(id) } @ReactMethod fun requestCameraPermission() { impl.requestCameraPermission() } @ReactMethod fun open() { impl.open() } @ReactMethod fun close() { impl.close() } @ReactMethod fun setCameraView(viewId: Double) { impl.setCameraView(viewId.toInt()) } @ReactMethod fun selectCamera(position: Double) { impl.selectCamera(position.toInt()) } @ReactMethod fun getCameraPosition(promise: Promise) { impl.getCameraPosition(promise) } @ReactMethod fun setFocus(floatX: Double, floatY: Double, focusMode: Double) { impl.setFocus(floatX.toFloat(), floatY.toFloat(), focusMode.toInt()) } @ReactMethod fun getFocusMode(promise: Promise) { impl.getFocusMode(promise) } @ReactMethod fun setZoomFactor(factor: Double) { impl.setZoomFactor(factor.toFloat()) } @ReactMethod fun getZoomFactor(promise: Promise) { impl.getZoomFactor(promise) } @ReactMethod fun enableEnhancedFeatures(features: Double) { impl.enableEnhancedFeatures(features.toInt()) } @ReactMethod fun disableEnhancedFeatures(features: Double) { impl.disableEnhancedFeatures(features.toInt()) } @ReactMethod fun setScanRegion(region: ReadableMap?) { impl.setScanRegion(region) } @ReactMethod fun getScanRegion(promise: Promise) { impl.getScanRegion(promise) } @ReactMethod fun turnOnTorch() { impl.turnOnTorch() } @ReactMethod fun turnOffTorch() { impl.turnOffTorch() } @ReactMethod fun setResolution(resolution: Int) { impl.setResolution(resolution) } @ReactMethod fun getResolution(promise: Promise) { impl.getResolution(promise) } @ReactMethod fun beep() { impl.beep() } @ReactMethod fun vibrate() { impl.vibrate() } @ReactMethod(isBlockingSynchronousMethod = true) fun convertPointToViewCoordinates(point: ReadableMap) = impl.convertPointToViewCoordinates(point) @ReactMethod(isBlockingSynchronousMethod = true) fun convertRectToViewCoordinates(dsRect: ReadableMap) = impl.convertRectToViewCoordinates(dsRect) }