Ejemplo n.º 1
0
        /// <summary>
        /// Activates/deactivates the status of the calling line identity service.
        /// </summary>
        /// <since_tizen> 4 </since_tizen>
        /// <param name="type">The Cli service type.</param>
        /// <param name="status">The Cli Status.</param>
        /// <returns>A task indicating whether setting of CLI status is done or not.</returns>
        /// <feature>http://tizen.org/feature/network.telephony</feature>
        /// <privlevel>platform</privlevel>
        /// <privilege>http://tizen.org/privilege/telephony.admin</privilege>
        /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
        /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
        /// <exception cref="ArgumentException">Thrown when it is failed due to invalid parameter.</exception>
        /// <exception cref="InvalidOperationException">Thrown when it is failed due to invalid operation.</exception>
        public Task <bool> SsSetCliStatus(SsCliType type, SsCliStatus status)
        {
            TaskCompletionSource <bool> task = new TaskCompletionSource <bool>();
            IntPtr id = (IntPtr)_requestId++;

            _callbackMap[id] = (handle, result, data, key) =>
            {
                Task taskResult = new Task(() =>
                {
                    if (result != (int)SsCause.Success)
                    {
                        Log.Error(TapiUtility.LogTag, "Error occurs in setting SS CLI status: " + (SsCause)result);
                        task.SetException(new InvalidOperationException("Error occurs in setting SS CLI status, " + (SsCause)result));
                        return;
                    }

                    task.SetResult(true);
                });
                taskResult.Start();
                taskResult.Wait();
                _callbackMap.Remove(key);
            };

            int ret = Interop.Tapi.Ss.SsSetCliStatus(_handle, type, status, _callbackMap[id], id);

            if (ret != (int)TapiError.Success)
            {
                Log.Error(TapiUtility.LogTag, "Failed to set SS CLI status, Error: " + (TapiError)ret);
                TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
            }

            return(task.Task);
        }
Ejemplo n.º 2
0
 internal static extern int SsSetCliStatus(IntPtr handle, SsCliType type, SsCliStatus status, TapiResponseCallback cb, IntPtr userData);