Esempio n. 1
0
        /// <summary>
        /// Sets a callback delegate for requesting 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">callback function
        /// Called when Stt engine provides the engine service user with the private data.
        /// This callback function is called when the engine service user gets the private data from Stt engine.
        /// Out 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 SetPrivateDataRequestedDelegate(OutAction <string> callback)
        {
            if (null == callback)
            {
                Log.Error(LogTag, "callback is null");
                throw ExceptionFactory.CreateException(ErrorCode.InvalidParameter);
            }

            _privateDataRequestedCallback = callback;
            _privateDataRequestedCb       = (string key, out string data) =>
            {
                return(_privateDataRequestedCallback.Invoke(key, out data));
            };
            Error error = STTESetPrivateDataRequestedCb(_privateDataRequestedCb);

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