diff --git a/app/build.gradle b/app/build.gradle index a3c29914a..3f17cc931 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -60,8 +60,8 @@ dependencies { implementation "com.tencent.bugly:nativecrashreport:$bugly_native_version" // For debug online -// implementation project(':libausbc') + implementation project(':libausbc') // demo - implementation 'com.github.jiangdongguo.AndroidUSBCamera:libausbc:3.2.4' +// implementation 'com.github.jiangdongguo.AndroidUSBCamera:libausbc:3.2.4' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 31ec03c1a..29d49576f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,14 +7,15 @@ + + + - - - - - - - - + \ No newline at end of file diff --git a/libausbc/src/main/java/com/jiangdg/ausbc/MultiCameraClient.kt b/libausbc/src/main/java/com/jiangdg/ausbc/MultiCameraClient.kt index 4c7604048..93f62912e 100644 --- a/libausbc/src/main/java/com/jiangdg/ausbc/MultiCameraClient.kt +++ b/libausbc/src/main/java/com/jiangdg/ausbc/MultiCameraClient.kt @@ -552,6 +552,143 @@ class MultiCameraClient(ctx: Context, callback: IDeviceConnectCallBack?) { mMediaMuxer = null } + /** + * Set auto focus + * + * @param enable true enable auto focus + */ + fun setAutoFocus(enable: Boolean) { + mUvcCamera?.autoFocus = enable + } + + /** + * Set auto white balance + * + * @param autoWhiteBalance true enable auto white balance + */ + fun setAutoWhiteBalance(autoWhiteBalance: Boolean) { + mUvcCamera?.autoWhiteBlance = autoWhiteBalance + } + + /** + * Set zoom + * + * @param zoom zoom value, 0 means reset + */ + fun setZoom(zoom: Int) { + mUvcCamera?.zoom = zoom + } + + /** + * Get zoom + */ + fun getZoom() = mUvcCamera?.zoom + + /** + * Set gain + * + * @param gain gain value, 0 means reset + */ + fun setGain(gain: Int) { + mUvcCamera?.gain = gain + } + + /** + * Get gain + */ + fun getGain() = mUvcCamera?.gain + + /** + * Set gamma + * + * @param gamma gamma value, 0 means reset + */ + fun setGamma(gamma: Int) { + mUvcCamera?.gamma = gamma + } + + /** + * Get gamma + */ + fun getGamma() = mUvcCamera?.gamma + + /** + * Set brightness + * + * @param brightness brightness value, 0 means reset + */ + fun setBrightness(brightness: Int) { + mUvcCamera?.brightness = brightness + } + + /** + * Get brightness + */ + fun getBrightness() = mUvcCamera?.brightness + + /** + * Set contrast + * + * @param contrast contrast value, 0 means reset + */ + fun setContrast(contrast: Int) { + mUvcCamera?.contrast = contrast + } + + /** + * Get contrast + */ + fun getContrast() = mUvcCamera?.contrast + + /** + * Set sharpness + * + * @param sharpness sharpness value, 0 means reset + */ + fun setSharpness(sharpness: Int) { + mUvcCamera?.sharpness = sharpness + } + + /** + * Get sharpness + */ + fun getSharpness() = mUvcCamera?.sharpness + + /** + * Set saturation + * + * @param saturation saturation value, 0 means reset + */ + fun setSaturation(saturation: Int) { + mUvcCamera?.saturation = saturation + } + + /** + * Get saturation + */ + fun getSaturation() = mUvcCamera?.saturation + + /** + * Set hue + * + * @param hue hue value, 0 means reset + */ + fun setHue(hue: Int) { + mUvcCamera?.hue = hue + } + + /** + * Get hue + */ + fun getHue() = mUvcCamera?.hue + + /** + * Get real preview size + * + * @return see [PreviewSize] + */ + fun getPreviewSize() = mPreviewSize + /** * Set usb control block, when the uvc device was granted permission * diff --git a/libausbc/src/main/java/com/jiangdg/ausbc/base/MultiCameraActivity.kt b/libausbc/src/main/java/com/jiangdg/ausbc/base/MultiCameraActivity.kt index 614239293..dd4390be9 100644 --- a/libausbc/src/main/java/com/jiangdg/ausbc/base/MultiCameraActivity.kt +++ b/libausbc/src/main/java/com/jiangdg/ausbc/base/MultiCameraActivity.kt @@ -101,4 +101,9 @@ abstract class MultiCameraActivity: BaseActivity() { * Get all usb device list */ protected fun getDeviceList() = mCameraClient?.getDeviceList() + + /** + * Get camera client + */ + protected fun getCameraClient() = mCameraClient } \ No newline at end of file diff --git a/libausbc/src/main/java/com/jiangdg/ausbc/base/MultiCameraFragment.kt b/libausbc/src/main/java/com/jiangdg/ausbc/base/MultiCameraFragment.kt index 6edd74306..2e7e6484b 100644 --- a/libausbc/src/main/java/com/jiangdg/ausbc/base/MultiCameraFragment.kt +++ b/libausbc/src/main/java/com/jiangdg/ausbc/base/MultiCameraFragment.kt @@ -112,6 +112,11 @@ abstract class MultiCameraFragment: BaseFragment() { */ protected fun getDeviceList() = mCameraClient?.getDeviceList() + /** + * Get camera client + */ + protected fun getCameraClient() = mCameraClient + /** * Request permission * diff --git a/libausbc/src/main/java/com/jiangdg/ausbc/camera/CameraUvcStrategy.kt b/libausbc/src/main/java/com/jiangdg/ausbc/camera/CameraUvcStrategy.kt index 77e3084f7..ba1616dd0 100644 --- a/libausbc/src/main/java/com/jiangdg/ausbc/camera/CameraUvcStrategy.kt +++ b/libausbc/src/main/java/com/jiangdg/ausbc/camera/CameraUvcStrategy.kt @@ -586,6 +586,136 @@ class CameraUvcStrategy(ctx: Context) : ICameraStrategy(ctx) { } } + /** + * Set auto focus + * + * @param enable true enable auto focus + */ + fun setAutoFocus(enable: Boolean) { + mUVCCamera?.autoFocus = enable + } + + /** + * Set auto white balance + * + * @param autoWhiteBalance true enable auto white balance + */ + fun setAutoWhiteBalance(autoWhiteBalance: Boolean) { + mUVCCamera?.autoWhiteBlance = autoWhiteBalance + } + + /** + * Set zoom + * + * @param zoom zoom value, 0 means reset + */ + fun setZoom(zoom: Int) { + mUVCCamera?.zoom = zoom + } + + /** + * Get zoom + */ + fun getZoom() = mUVCCamera?.zoom + + /** + * Set gain + * + * @param gain gain value, 0 means reset + */ + fun setGain(gain: Int) { + mUVCCamera?.gain = gain + } + + /** + * Get gain + */ + fun getGain() = mUVCCamera?.gain + + /** + * Set gamma + * + * @param gamma gamma value, 0 means reset + */ + fun setGamma(gamma: Int) { + mUVCCamera?.gamma = gamma + } + + /** + * Get gamma + */ + fun getGamma() = mUVCCamera?.gamma + + /** + * Set brightness + * + * @param brightness brightness value, 0 means reset + */ + fun setBrightness(brightness: Int) { + mUVCCamera?.brightness = brightness + } + + /** + * Get brightness + */ + fun getBrightness() = mUVCCamera?.brightness + + /** + * Set contrast + * + * @param contrast contrast value, 0 means reset + */ + fun setContrast(contrast: Int) { + mUVCCamera?.contrast = contrast + } + + /** + * Get contrast + */ + fun getContrast() = mUVCCamera?.contrast + + /** + * Set sharpness + * + * @param sharpness sharpness value, 0 means reset + */ + fun setSharpness(sharpness: Int) { + mUVCCamera?.sharpness = sharpness + } + + /** + * Get sharpness + */ + fun getSharpness() = mUVCCamera?.sharpness + + /** + * Set saturation + * + * @param saturation saturation value, 0 means reset + */ + fun setSaturation(saturation: Int) { + mUVCCamera?.saturation = saturation + } + + /** + * Get saturation + */ + fun getSaturation() = mUVCCamera?.saturation + + /** + * Set hue + * + * @param hue hue value, 0 means reset + */ + fun setHue(hue: Int) { + mUVCCamera?.hue = hue + } + + /** + * Get hue + */ + fun getHue() = mUVCCamera?.hue + private fun getUsbDeviceListInternal(): MutableList? { return mUsbMonitor?.getDeviceList(arrayListOf())?.let { devList -> Logger.i(TAG, " find some device list, = $devList") diff --git a/settings.gradle b/settings.gradle index fa7133e78..ccd1174f3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,8 +1,8 @@ include ':app' // For debug online -//include ':libausbc' -//include ':libuvc' -//include ':libpush' -//include ':libnative' -//include ':libuvccommon' \ No newline at end of file +include ':libausbc' +include ':libuvc' +include ':libpush' +include ':libnative' +include ':libuvccommon' \ No newline at end of file