Example #1
0
 /// <summary>
 /// A constructor for instantiating SsBarringInfo class with the necessary parameters.
 /// </summary>
 /// <param name="classType">Call type.</param>
 /// <param name="mode">Barring mode.</param>
 /// <param name="type">Barring type.</param>
 /// <param name="password">Password (3GPP(GSM/UMTS/LTE) Specific).</param>
 public SsBarringInfo(SsClass classType, SsBarringMode mode, SsBarringType type, string password)
 {
     _class    = classType;
     _mode     = mode;
     _type     = type;
     _password = password;
 }
Example #2
0
        /// <summary>
        /// Gets call barring status.
        /// </summary>
        /// <since_tizen> 4 </since_tizen>
        /// <param name="ssClass">The type of call.</param>
        /// <param name="type">The barring type.</param>
        /// <returns>A task containing information about barring response.</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 <SsBarringResponse> SsGetBarringStatus(SsClass ssClass, SsBarringType type)
        {
            TaskCompletionSource <SsBarringResponse> task = new TaskCompletionSource <SsBarringResponse>();
            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 barring status: " + (SsCause)result);
                        task.SetException(new InvalidOperationException("Error occurs in getting barring status, " + (SsCause)result));
                        return;
                    }

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

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

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

            return(task.Task);
        }
Example #3
0
 internal static extern int SsGetBarringStatus(IntPtr handle, SsClass ssClass, SsBarringType type, TapiResponseCallback cb, IntPtr userData);