示例#1
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);
        }
示例#2
0
        /// <summary>
        /// Sets the command list.
        /// </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>
        /// <remarks>
        /// The command type is valid for CommandType 'Foreground' or 'Background'.
        /// The matched commands of the command list should be set and they should include type and command text at least.
        /// </remarks>
        /// <param name="list">Command list</param>
        /// <param name="type">Command type</param>
        /// <exception cref="InvalidOperationException">This exception can be due to an invalid state.</exception>
        /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</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 void SetCommandList(VoiceCommandList list, CommandType type)
        {
            if ((type == CommandType.Foreground) || (type == CommandType.Background))
            {
                ErrorCode error = VcSetCommandList(list._handle, (VoiceCommandType)type);
                if (error != ErrorCode.None)
                {
                    Log.Error(LogTag, "SetCommandList Failed with error " + error);
                    throw ExceptionFactory.CreateException(error);
                }
            }

            else
            {
                throw ExceptionFactory.CreateException(ErrorCode.InvalidParameter);
            }
        }