示例#1
0
        /// <summary>
        /// Sets a callback function for setting the private data.
        /// </summary>
        /// <privilege>
        /// http://tizen.org/privilege/recorder
        /// </privilege>
        /// <feature>
        /// http://tizen.org/feature/speech.recognition
        /// http://tizen.org/feature/microphone
        /// </feature>
        /// <param name="callback">
        /// Called when Stt engine receives the private data from the engine service user.
        /// This callback function is called when the engine service user sends the private data to Stt engine.
        /// In Parameters:
        /// a = Key -- The key field of private data
        /// b = data -- The data field of private data
        /// Following Error Codes can be returned
        /// 1. None
        /// 2. InvalidParameter
        /// 3. OperationFailed
        /// </param>
        /// <exception cref="ArgumentException">Thrown in case of Invalid Parameter</exception>
        /// <exception cref="UnauthorizedAccessException">Thrown in case of Permission denied</exception>
        /// <exception cref="NotSupportedException">Thrown in case of Not supported</exception>
        /// <exception cref="InvalidOperationException">thrown in case of Operation failure</exception>
        /// <precondition>
        /// Main function should be invoked before this function is called.
        /// </precondition>
        /// <since_tizen> 4 </since_tizen>
        public void SetPrivateDataSetDelegate(Action <string> callback)
        {
            if (null == callback)
            {
                Log.Error(LogTag, "callback is null");
                throw ExceptionFactory.CreateException(ErrorCode.InvalidParameter);
            }

            _privateDatacallback = callback;
            _privateDataSetCb    = (string key, string data) =>
            {
                return(_privateDatacallback.Invoke(key, data));
            };
            Error error = STTESetPrivateDataSetCb(_privateDataSetCb);

            if (error != Error.None)
            {
                Log.Error(LogTag, "SetPrivateDataSetDelegate Failed with error " + error);
                throw ExceptionFactory.CreateException((ErrorCode)error);
            }
        }
示例#2
0
 internal static extern Error STTESetPrivateDataSetCb(PrivateDataSetCb callbackFunc);