Exemple #1
0
        /**
         * 获取指定的UVC设备的信息(现在是vid和pid)作为UVC设备
         * @param deviceName UVC设备识别字符串
         */
        private UVCDevice GetDevice(string deviceName)
        {
            AndroidDebug.Logd(TAG, "获取指定的UVC设备的信息1:" + deviceName);

            if (!String.IsNullOrEmpty(deviceName))
            {
                using (AndroidJavaClass clazz = new AndroidJavaClass(FQCN_PLUGIN))
                {
                    AndroidDebug.Logd(TAG, "获取指定的UVC设备的信息2:" + AndroidUtils.GetCurrentActivity());
                    AndroidDebug.Logd(TAG, "获取指定的UVC设备的信息2:" + clazz.CallStatic <string>("getInfo", AndroidUtils.GetCurrentActivity(), deviceName));
                    return(UVCDevice.Parse(deviceName,
                                           clazz.CallStatic <string>("getInfo",
                                                                     AndroidUtils.GetCurrentActivity(), deviceName)));
                }
            }
            else
            {
                throw new ArgumentException("device name is empty/null");
            }
        }
        /**
         * 指定したUVC機器の情報(今はvidとpid)をUVCDeviceとして取得する
         * @param deviceName UVC機器識別文字列
         */
        private UVCDevice GetDevice(string deviceName)
        {
#if (!NDEBUG && DEBUG && ENABLE_LOG)
            Console.WriteLine($"{TAG}GetDevice:{deviceName}");
#endif

            if (!String.IsNullOrEmpty(deviceName))
            {
                using (AndroidJavaClass clazz = new AndroidJavaClass(FQCN_PLUGIN))
                {
                    return(UVCDevice.Parse(deviceName,
                                           clazz.CallStatic <string>("getInfo",
                                                                     AndroidUtils.GetCurrentActivity(), deviceName)));
                }
            }
            else
            {
                throw new ArgumentException("device name is empty/null");
            }
        }