internal RecognitionResultUpdatedEventArgs(RecognizedResult result, IntPtr cmdList, IntPtr recognizedText)
        {
            _result = result;
            SafeCommandListHandle handle = new SafeCommandListHandle(cmdList);
            VoiceCommandsGroup    _list  = new VoiceCommandsGroup(handle);

            _command        = _list.Commands;
            _recognizedText = Marshal.PtrToStringAnsi(recognizedText);
        }
Пример #2
0
        internal RecognitionResult(ResultEvent evt, IntPtr cmdList, IntPtr result)
        {
            _resultEvent = evt;
            SafeCommandListHandle handle = new SafeCommandListHandle(cmdList);

            handle._ownership = false;
            _list             = new VoiceCommandList(handle);
            _result           = Marshal.PtrToStringAnsi(result);
        }
Пример #3
0
        /// <summary>
        /// The public constructor.
        /// </summary>
        /// <since_tizen> 6 </since_tizen>
        /// <exception cref="InvalidOperationException">This exception can be due to out of memory.</exception>
        /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
        /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
        public VoiceCommandsGroup()
        {
            SafeCommandListHandle handle;
            ErrorCode             error = VcCmdListCreate(out handle);

            if (error != ErrorCode.None)
            {
                Log.Error(LogTag, "Create Failed with error " + error);
                throw ExceptionFactory.CreateException(error);
            }
            _handle = handle;
            _commands.CollectionChanged += OnCollectionChanged;
        }
Пример #4
0
        /// <summary>
        /// The public constructor.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <privilege>
        /// http://tizen.org/privilege/recorder
        /// </privilege>
        /// <privlevel>
        /// public
        /// </privlevel>
        /// <feature>
        /// http://tizen.org/feature/speech.control
        /// http://tizen.org/feature/microphone
        /// </feature>
        /// <exception cref="OutOfMemoryException">This exception can be due to out of memory.</exception>
        /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
        /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
        /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
        public VoiceCommandList()
        {
            SafeCommandListHandle handle;
            ErrorCode             error = VcCmdListCreate(out handle);

            if (error != ErrorCode.None)
            {
                Log.Error(LogTag, "Create Failed with error " + error);
                throw ExceptionFactory.CreateException(error);
            }
            _handle = handle;
            _list   = new List <VoiceCommand>();
            _index  = 0;
        }
Пример #5
0
        internal VoiceCommandsGroup(SafeCommandListHandle handle)
        {
            _handle = handle;

            VcCmdListCb _callback = (IntPtr vcCommand, IntPtr userData) =>
            {
                SafeCommandHandle cmdHandle = new SafeCommandHandle(vcCommand);
                _commands.Add(new VoiceCommand(cmdHandle));
                return(true);
            };
            ErrorCode error = VcCmdListForeachCommands(_handle, _callback, IntPtr.Zero);

            if (error != ErrorCode.None)
            {
                Log.Error(LogTag, "GetAllCommands Failed with error " + error);
                throw ExceptionFactory.CreateException(error);
            }
            _commands.CollectionChanged += OnCollectionChanged;
        }
Пример #6
0
        internal VoiceCommandList(SafeCommandListHandle handle)
        {
            _handle = handle;
            _index  = 0;

            _list     = new List <VoiceCommand>();
            _callback = (IntPtr vcCommand, IntPtr userData) =>
            {
                SafeCommandHandle cmdHandle = new SafeCommandHandle(vcCommand);
                cmdHandle._ownership = false;
                _list.Add(new VoiceCommand(cmdHandle));
                return(true);
            };
            ErrorCode error = VcCmdListForeachCommands(_handle, _callback, IntPtr.Zero);

            if (error != ErrorCode.None)
            {
                Log.Error(LogTag, "GetAllCommands Failed with error " + error);
                throw ExceptionFactory.CreateException(error);
            }
        }
Пример #7
0
        /// <summary>
        /// Gets the system command list.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <returns>
        /// The command list, else null in case of no system commands.
        /// </returns>
        /// <privilege>
        /// http://tizen.org/privilege/recorder
        /// </privilege>
        /// <privlevel>
        /// public.
        /// </privlevel>
        /// <feature>
        /// http://tizen.org/feature/speech.control
        /// http://tizen.org/feature/microphone
        /// </feature>
        /// <remarks>
        /// In the system command list, there are system commands predefined by product manufacturers.
        /// Those commands have the highest priority. Therefore, the user cannot set any commands similar to system commands.
        /// </remarks>
        /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
        /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
        /// <exception cref="NotSupportedException">This exception can be due to not supported.</exception>
        /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
        /// <pre>
        /// The state must be ready.
        /// </pre>
        public static VoiceCommandList GetSystemCommandList()
        {
            IntPtr    handle = IntPtr.Zero;
            ErrorCode error  = VcGetSystemCommandList(out handle);

            if (error != ErrorCode.None)
            {
                Log.Error(LogTag, "GetSystemCommandList Failed with error " + error);
                throw ExceptionFactory.CreateException(error);
            }

            if (handle == IntPtr.Zero)
            {
                Log.Error(LogTag, "GetSystemCommandList handle is null");
                return(null);
            }

            SafeCommandListHandle list = new SafeCommandListHandle(handle);

            return(new VoiceCommandList(list));
        }
Пример #8
0
 internal static extern Interop.VoiceControlWidget.ErrorCode VcCmdListGetCount(SafeCommandListHandle cmdList, out int count);
Пример #9
0
 internal static extern ErrorCode VcMgrSetCommandList(SafeCommandListHandle vcCmdList);
Пример #10
0
 internal static extern Interop.VoiceControlWidget.ErrorCode VcCmdListPrev(SafeCommandListHandle cmdList);
Пример #11
0
 internal static extern Interop.VoiceControl.ErrorCode VcCmdListNext(SafeCommandListHandle cmdList);
Пример #12
0
 internal static extern Interop.VoiceControl.ErrorCode VcCmdListAdd(SafeCommandListHandle cmdList, SafeCommandHandle vcCommand);
Пример #13
0
 internal static extern Interop.VoiceControl.ErrorCode VcCmdListCreate(out SafeCommandListHandle cmdList);
Пример #14
0
 internal static extern Interop.VoiceControlManager.ErrorCode VcCmdListLast(SafeCommandListHandle cmdList);
Пример #15
0
 internal static extern Interop.VoiceControlWidget.ErrorCode VcCmdListRemove(SafeCommandListHandle cmdList, SafeCommandHandle vcCommand);
Пример #16
0
 internal static extern Interop.VoiceControlWidget.ErrorCode VcCmdListForeachCommands(SafeCommandListHandle cmdList, VcCmdListCb callback, IntPtr userData);
Пример #17
0
 internal static extern ErrorCode VcSetCommandList(SafeCommandListHandle cmdList, VoiceCommandType type);
Пример #18
0
 internal static extern Interop.VoiceControlWidget.ErrorCode VcCmdListGetCurrent(SafeCommandListHandle cmdList, out SafeCommandHandle vcCommand);
Пример #19
0
 internal static extern ErrorCode VcMgrSetSelectedResults(SafeCommandListHandle vcCmdList);