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;
19 namespace Tizen.Telephony
22 /// This Class provides API's to obtain information from the modem.
26 internal IntPtr _handle;
29 /// Modem Class Constructor
31 /// <since_tizen> 3 </since_tizen>
32 /// <param name="handle">
33 /// SlotHandle received in the Manager.Init API
35 /// <feature>http://tizen.org/feature/network.telephony</feature>
36 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
37 /// <exception cref="ArgumentNullException">
38 /// This exception occurs if handle provided is null
40 public Modem(SlotHandle handle)
44 throw new ArgumentNullException();
47 _handle = handle._handle;
51 /// Enumeration for Modem Power Status.
53 public enum PowerStatus
78 /// Gets the IMEI (International Mobile Station Equipment Identity) of a mobile phone.
79 /// The IMEI number is used by a GSM network to identify valid devices and therefore can be used for stopping a stolen phone from accessing that network.
81 /// <since_tizen> 3 </since_tizen>
82 /// <privilege>http://tizen.org/privilege/telephony</privilege>
84 /// The International Mobile Station Equipment Identity
85 /// empty string if unable to complete the operation
92 TelephonyError error = Interop.Modem.GetImei(_handle, out imei);
93 if (error != TelephonyError.None)
95 Tizen.Log.Error(Interop.Telephony.LogTag, "GetImei Failed with error " + error);
104 /// Gets the power status of the modem.
106 /// <since_tizen> 3 </since_tizen>
107 /// <privilege>http://tizen.org/privilege/telephony</privilege>
109 /// The Modem power status (0=on,1=off,2=reset,3=low)
111 public PowerStatus CurrentPowerStatus
116 TelephonyError error = Interop.Modem.GetPowerStatus(_handle, out status);
117 if (error != TelephonyError.None)
119 Tizen.Log.Error(Interop.Telephony.LogTag, "GetImei Failed with error " + error);
120 return PowerStatus.Unknown;
129 /// Gets the MEID (Mobile Equipment Identifier) of a mobile phone. (for CDMA)
131 /// <since_tizen> 3 </since_tizen>
132 /// <privilege>http://tizen.org/privilege/telephony</privilege>
134 /// The Mobile Equipment Identifier
135 /// empty string if unable to complete the operation
142 TelephonyError error = Interop.Modem.GetMeid(_handle, out meid);
143 if (error != TelephonyError.None)
145 Tizen.Log.Error(Interop.Telephony.LogTag, "GetMeid Failed with error " + error);