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); }
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); }
/// <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; }
/// <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; }
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; }
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); } }
/// <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)); }
internal static extern Interop.VoiceControlWidget.ErrorCode VcCmdListGetCount(SafeCommandListHandle cmdList, out int count);
internal static extern ErrorCode VcMgrSetCommandList(SafeCommandListHandle vcCmdList);
internal static extern Interop.VoiceControlWidget.ErrorCode VcCmdListPrev(SafeCommandListHandle cmdList);
internal static extern Interop.VoiceControl.ErrorCode VcCmdListNext(SafeCommandListHandle cmdList);
internal static extern Interop.VoiceControl.ErrorCode VcCmdListAdd(SafeCommandListHandle cmdList, SafeCommandHandle vcCommand);
internal static extern Interop.VoiceControl.ErrorCode VcCmdListCreate(out SafeCommandListHandle cmdList);
internal static extern Interop.VoiceControlManager.ErrorCode VcCmdListLast(SafeCommandListHandle cmdList);
internal static extern Interop.VoiceControlWidget.ErrorCode VcCmdListRemove(SafeCommandListHandle cmdList, SafeCommandHandle vcCommand);
internal static extern Interop.VoiceControlWidget.ErrorCode VcCmdListForeachCommands(SafeCommandListHandle cmdList, VcCmdListCb callback, IntPtr userData);
internal static extern ErrorCode VcSetCommandList(SafeCommandListHandle cmdList, VoiceCommandType type);
internal static extern Interop.VoiceControlWidget.ErrorCode VcCmdListGetCurrent(SafeCommandListHandle cmdList, out SafeCommandHandle vcCommand);
internal static extern ErrorCode VcMgrSetSelectedResults(SafeCommandListHandle vcCmdList);