2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using static Interop.Telephony;
20 namespace Tizen.Telephony
23 /// This Class provides API's to get the information about calls.
25 public class CallHandle
27 private IntPtr _callHandle;
30 /// Enumeration for the call status.
32 public enum CallStatus
65 /// Enumeration for the call type.
88 /// Enumeration for the call direction.
90 public enum CallDirection
93 /// MO(Mobile Originated) call
97 /// MT(Mobile Terminated) call
107 /// Gets the call handle ID.
110 /// The id of the call handle
111 /// 0 if unable to complete the operation
118 TelephonyError error = Interop.Call.GetHandleId(_callHandle, out handleId);
119 if (error != TelephonyError.None)
121 Tizen.Log.Error(Interop.Telephony.LogTag, "GetHandleId Failed with Error " + error);
130 /// Gets the call number.
133 /// The number of the call
134 /// empty string if unable to complete the operation
141 TelephonyError error = Interop.Call.GetNumber(_callHandle, out number);
142 if (error != TelephonyError.None)
144 Tizen.Log.Error(Interop.Telephony.LogTag, "GetNumber Failed with Error " + error);
153 /// Gets the call type.
156 /// The type of the call
163 TelephonyError error = Interop.Call.GetType(_callHandle, out callType);
164 if (error != TelephonyError.None)
166 Tizen.Log.Error(Interop.Telephony.LogTag, "GetType Failed with Error " + error);
167 return CallType.Unavailable;
175 /// Gets the call status.
178 /// The status of the call
180 public CallStatus Status
184 CallStatus callStatus;
185 TelephonyError error = Interop.Call.GetStatus(_callHandle, out callStatus);
186 if (error != TelephonyError.None)
188 Tizen.Log.Error(Interop.Telephony.LogTag, "GetStatus Failed with Error " + error);
189 return CallStatus.Unavailable;
197 /// Gets whether the call is MO(Mobile Originated) call or MT(Mobile Terminated).
200 /// The direction of the call
202 /// <exception cref="InvalidOperationException">
203 /// This Exception can occur due to:
204 /// 1. Operation Not Supported
206 public CallDirection Direction
210 CallDirection callDirection;
211 TelephonyError error = Interop.Call.GetDirection(_callHandle, out callDirection);
212 if (error != TelephonyError.None)
214 Tizen.Log.Error(Interop.Telephony.LogTag, "GetDirection Failed with Error " + error);
215 return CallDirection.Unavailable;
218 return callDirection;
224 /// Gets whether the call is conference call or not.
227 /// The value whether the call is conference call or not. (true: Conference call, false: Single call)
229 public bool ConferenceStatus
234 TelephonyError error = Interop.Call.GetConferenceStatus(_callHandle, out callConfStatus);
235 if (error != TelephonyError.None)
237 Tizen.Log.Error(Interop.Telephony.LogTag, "GetConferenceStatus Failed with Error " + error);
241 return callConfStatus;
246 internal CallHandle(IntPtr handle)
248 _callHandle = handle;