示例#1
0
        /// <summary>
        /// Gets the status of the calling line identity service.
        /// </summary>
        /// <since_tizen> 4 </since_tizen>
        /// <param name="type">The Cli service type.</param>
        /// <returns>A task containing SS CLI response information.</returns>
        /// <feature>http://tizen.org/feature/network.telephony</feature>
        /// <privilege>http://tizen.org/privilege/telephony</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 <SsCliResponse> SsGetCliStatus(SsCliType type)
        {
            TaskCompletionSource <SsCliResponse> task = new TaskCompletionSource <SsCliResponse>();
            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 getting SS CLI status: " + (SsCause)result);
                        task.SetException(new InvalidOperationException("Error occurs in getting SS CLI status, " + (SsCause)result));
                        return;
                    }

                    SsCliResponseStruct response = Marshal.PtrToStructure <SsCliResponseStruct>(data);
                    task.SetResult(SsStructConversions.ConvertSsCliResponseStruct(response));
                });
                taskResult.Start();
                taskResult.Wait();
                _callbackMap.Remove(key);
            };

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

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

            return(task.Task);
        }
示例#2
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);
        }
示例#3
0
 internal static extern int SsGetCliStatus(IntPtr handle, SsCliType type, TapiResponseCallback cb, IntPtr userData);