예제 #1
0
        /// <summary>
        /// Provides an option to get the call forwarding status of different calls from the Network.
        /// </summary>
        /// <since_tizen> 4 </since_tizen>
        /// <param name="ssClass">The Forward call type.</param>
        /// <param name="condition">The forward condition.</param>
        /// <returns>A task containing SS forward 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 <SsForwardResponse> SsGetForwardStatus(SsClass ssClass, SsForwardCondition condition)
        {
            TaskCompletionSource <SsForwardResponse> task = new TaskCompletionSource <SsForwardResponse>();
            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 forward status: " + (SsCause)result);
                        task.SetException(new InvalidOperationException("Error occurs in getting SS forward status, " + (SsCause)result));
                        return;
                    }

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

            int ret = Interop.Tapi.Ss.SsGetForwardStatus(_handle, ssClass, condition, _callbackMap[id], id);

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

            return(task.Task);
        }
예제 #2
0
 /// <summary>
 /// A constructor for instantiating SsForwardInfo class with the necessary parameters.
 /// </summary>
 /// <param name="classType">SS Class.</param>
 /// <param name="mode">Forward Mode.</param>
 /// <param name="condition">Forward Condition.</param>
 /// <param name="time">No reply wait time 5-30 secs in intervals of 5(3GPP(GSM/UMTS/LTE) Specific).</param>
 /// <param name="ton">Type of number.</param>
 /// <param name="npi">Numbering plan identity.</param>
 /// <param name="number">Phone number.</param>
 public SsForwardInfo(SsClass classType, SsForwardMode mode, SsForwardCondition condition, SsNoReplyTime time, SsForwardTypeOfNumber ton, SsForwardNumberingPlanIdentity npi, string number)
 {
     _class        = classType;
     _mode         = mode;
     _condition    = condition;
     _noReplyTimer = time;
     _ton          = ton;
     _npi          = npi;
     _phoneNumber  = number;
 }
예제 #3
0
 internal static extern int SsGetForwardStatus(IntPtr handle, SsClass ssClass, SsForwardCondition condition, TapiResponseCallback cb, IntPtr userData);