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.
19 namespace Tizen.CallManager
22 /// A class which manages the use of Call Manager APIs.
24 public static class CallManager
27 /// Initializes the call manager.
29 /// <returns>An instance of CmClientHandle class to use call manager APIs.</returns>
30 /// <feature>http://tizen.org/feature/network.telephony</feature>
31 /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
32 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
33 public static CmClientHandle InitCm()
35 int ret = Interop.CallManager.InitCm(out IntPtr handle);
36 if (ret != (int)CmError.None)
38 Log.Error(CmUtility.LogTag, "Failed to initialize call manager, Error: " + (CmError)ret);
39 CmUtility.ThrowCmException(ret);
42 return new CmClientHandle(handle);
46 /// Deinitializes the Call Manager handle.
48 /// <param name="handle">The Call Manager handle to be deinitialized.</param>
49 /// <exception cref="ArgumentNullException">Thrown when CmClientHandle is passed as null.</exception>
50 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
51 public static void DeinitCm(CmClientHandle handle)
55 throw new ArgumentNullException("Call manager client handle is null");
58 int ret = Interop.CallManager.DeinitCm(handle._handle);
59 if (ret != (int)CmError.None)
61 Log.Error(CmUtility.LogTag, "Failed to deinitialize call manager, Error: " + (CmError)ret);
62 CmUtility.ThrowCmException(ret, handle._handle);
65 handle._handle = IntPtr.Zero;
69 /// Sets LCD state for the device display.
71 /// <param name="state">LCD state to be set.</param>
72 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
73 public static void SetLcdState(LcdControlState state)
75 int ret = Interop.CallManager.SetLcdState(state);
76 if (ret != (int)CmError.None)
78 Log.Error(CmUtility.LogTag, "Failed to set LCD state, Error: " + (CmError)ret);
79 CmUtility.ThrowCmException(ret);