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 /// <param name="handle">
32 /// SlotHandle received in the Manager.Init API
34 /// <exception cref="ArgumentNullException">
35 /// This exception occurs if handle provided is null
37 public Modem(SlotHandle handle)
41 throw new ArgumentNullException();
44 _handle = handle._handle;
48 /// Enumeration for Modem Power Status.
50 public enum PowerStatus
75 /// Gets the IMEI (International Mobile Station Equipment Identity) of a mobile phone.
76 /// 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.
79 /// http://tizen.org/privilege/telephony
82 /// The International Mobile Station Equipment Identity
83 /// empty string if unable to complete the operation
90 TelephonyError error = Interop.Modem.GetImei(_handle, out imei);
91 if (error != TelephonyError.None)
93 Tizen.Log.Error(Interop.Telephony.LogTag, "GetImei Failed with error " + error);
102 /// Gets the power status of the modem.
105 /// http://tizen.org/privilege/telephony
108 /// The Modem power status (0=on,1=off,2=reset,3=low)
110 public PowerStatus CurrentPowerStatus
115 TelephonyError error = Interop.Modem.GetPowerStatus(_handle, out status);
116 if (error != TelephonyError.None)
118 Tizen.Log.Error(Interop.Telephony.LogTag, "GetImei Failed with error " + error);
119 return PowerStatus.Unknown;
128 /// Gets the MEID (Mobile Equipment Identifier) of a mobile phone. (for CDMA)
131 /// http://tizen.org/privilege/telephony
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);