[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_init_info")]
internal static extern int SimGetInitInfo(IntPtr handle, out SimCardStatus status, out int cardChanged);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_type")]
- internal static extern int SimGetType(IntPtr handle, out SimType type);
+ internal static extern int SimGetType(IntPtr handle, out SimCardType type);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_imsi")]
internal static extern int SimGetImsi(IntPtr handle, out SimImsiInfoStruct imsiInfo);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_ecc")]
- internal static extern int SimGetEcc(IntPtr handle, out SimEccInfoStruct eccInfo);
+ internal static extern int SimGetEcc(IntPtr handle, out SimEccInfoListStruct eccInfo);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_iccid")]
internal static extern int SimGetIccId(IntPtr handle, TapiResponseCallback cb, IntPtr userData);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_language")]
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_callforwarding_info")]
internal static extern int SimGetCallForwardingInfo(IntPtr handle, TapiResponseCallback cb, IntPtr userData);
[DllImport(Libraries.Tapi, EntryPoint = "tel_set_sim_callforwarding_info")]
- internal static extern int SimSetCallForwardingInfo(IntPtr handle, SimCallForwardRequestStruct request, TapiResponseCallback cb, IntPtr userData);
+ internal static extern int SimSetCallForwardingInfo(IntPtr handle, ref SimCallForwardRequestStruct request, TapiResponseCallback cb, IntPtr userData);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_messagewaiting_info")]
internal static extern int SimGetMessageWaitingInfo(IntPtr handle, TapiResponseCallback cb, IntPtr userData);
[DllImport(Libraries.Tapi, EntryPoint = "tel_set_sim_messagewaiting_info")]
- internal static extern int SimSetMessageWaitingInfo(IntPtr handle, SimMessageWaitingRequestStruct request, TapiResponseCallback cb, IntPtr userData);
+ internal static extern int SimSetMessageWaitingInfo(IntPtr handle, ref SimMessageWaitingRequestStruct request, TapiResponseCallback cb, IntPtr userData);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_mailbox_info")]
internal static extern int SimGetMailboxInfo(IntPtr handle, TapiResponseCallback cb, IntPtr userData);
[DllImport(Libraries.Tapi, EntryPoint = "tel_set_sim_mailbox_info")]
- internal static extern int SimSetMailboxInfo(IntPtr handle, SimMailboxNumberStruct mailbox, TapiResponseCallback cb, IntPtr userData);
+ internal static extern int SimSetMailboxInfo(IntPtr handle, ref SimMailboxNumberStruct mailbox, TapiResponseCallback cb, IntPtr userData);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_cphs_info")]
internal static extern int SimGetCphsInfo(IntPtr handle, TapiResponseCallback cb, IntPtr userData);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_service_table")]
[DllImport(Libraries.Tapi, EntryPoint = "tel_req_sim_atr")]
internal static extern int SimRequestAtr(IntPtr handle, TapiResponseCallback cb, IntPtr userData);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_application_list")]
- internal static extern int SimGetApplicationList(IntPtr handle, out byte appList);
+ internal static extern int SimGetApplicationList(IntPtr handle, out IntPtr appList);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_impi")]
internal static extern int SimGetImpi(IntPtr handle, TapiResponseCallback cb, IntPtr userData);
[DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_impu")]
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Threading.Tasks;
+using System.Runtime.InteropServices;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tizen.Tapi
+{
+ /// <summary>
+ /// A class which manages SIM card services.
+ /// </summary>
+ public class Sim
+ {
+ private IntPtr _handle = IntPtr.Zero;
+ private Dictionary<IntPtr, Interop.Tapi.TapiResponseCallback> _callbackMap = new Dictionary<IntPtr, Interop.Tapi.TapiResponseCallback>();
+ private int _requestId = 0;
+ private Sim()
+ {
+ }
+
+ /// <summary>
+ /// A constructor to instantiate Sim class using the Tapi handle.
+ /// </summary>
+ /// <param name="handle">An instance of TapiHandle obtained from InitTapi in TapiManager API.</param>
+ /// <exception cref="ArgumentNullException">Thrown when handle is passed as null.</exception>
+ public Sim(TapiHandle handle)
+ {
+ if (handle == null)
+ {
+ throw new ArgumentNullException("Handle is null");
+ }
+
+ _handle = handle._handle;
+ }
+
+ /// <summary>
+ /// Gets SIM card initialization status and SIM card identification.
+ /// </summary>
+ /// <value>An instance of SimInitInfo class in case of success. Null in case of failure.</value>
+ public SimInitInfo InitInfo
+ {
+ get
+ {
+ SimCardStatus status;
+ int isCardChanged;
+ int ret = Interop.Tapi.Sim.SimGetInitInfo(_handle, out status, out isCardChanged);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM init info, Error: " + (TapiError)ret);
+ return null;
+ }
+
+ SimInitInfo initInfo = new SimInitInfo();
+ initInfo.SimStatus = status;
+ if (isCardChanged == 1)
+ {
+ initInfo.IsChanged = true;
+ }
+
+ else if (isCardChanged == 0)
+ {
+ initInfo.IsChanged = false;
+ }
+
+ return initInfo;
+ }
+ }
+
+ /// <summary>
+ /// Gets the card type (SIM/USIM).
+ /// </summary>
+ public SimCardType SimType
+ {
+ get
+ {
+ SimCardType type;
+ int ret = Interop.Tapi.Sim.SimGetType(_handle, out type);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM card type, Error: " + (TapiError)ret);
+ return default(SimCardType);
+ }
+
+ return type;
+ }
+ }
+
+ /// <summary>
+ /// Gets SIM IMSI information.
+ /// </summary>
+ public SimImsiInfo Imsi
+ {
+ get
+ {
+ SimImsiInfoStruct imsi;
+ int ret = Interop.Tapi.Sim.SimGetImsi(_handle, out imsi);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM IMSI info, Error: " + (TapiError)ret);
+ return null;
+ }
+
+ return SimStructConversions.ConvertSimImsiInfoStruct(imsi);
+ }
+ }
+
+ /// <summary>
+ /// Gets ECC(SIM) or UECC(USIM) data.
+ /// </summary>
+ public SimEccInfoList Ecc
+ {
+ get
+ {
+ SimEccInfoListStruct eccInfo;
+ int ret = Interop.Tapi.Sim.SimGetEcc(_handle, out eccInfo);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM ECC info, Error: " + (TapiError)ret);
+ return null;
+ }
+
+ return SimStructConversions.ConvertSimEccInfoListStruct(eccInfo);
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of application on UICC.
+ /// </summary>
+ /// <returns>A byte containing the masking value for SimAppType.</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 byte SimGetApplicationList()
+ {
+ IntPtr appList;
+ int ret = Interop.Tapi.Sim.SimGetApplicationList(_handle, out appList);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get list of applications, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return Marshal.ReadByte(appList);
+ }
+
+ /// <summary>
+ /// Gets the unique identification number of the (U)ICC.
+ /// </summary>
+ /// <returns>A task containing ICCID information.</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<SimIccIdInfo> SimGetIccId()
+ {
+ TaskCompletionSource<SimIccIdInfo> task = new TaskCompletionSource<SimIccIdInfo>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting ICCID info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting ICCID info, " + (SimAccessResult)result));
+ }
+
+ SimIccIdInfoStruct info = Marshal.PtrToStructure<SimIccIdInfoStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimIccIdInfoStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetIccId(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM ICCID info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets language preference(indication) information.
+ /// </summary>
+ /// <returns>A task containing information about SIM language preference.</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<SimLanguagePreference> SimGetLanguagePreference()
+ {
+ TaskCompletionSource<SimLanguagePreference> task = new TaskCompletionSource<SimLanguagePreference>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting language preference: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting language preference, " + (SimAccessResult)result));
+ }
+
+ task.SetResult((SimLanguagePreference)Marshal.ReadInt32(data));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetLanguage(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM language preference, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Updates language preference information to the SIM card.
+ /// </summary>
+ /// <param name="language">The language preference information.</param>
+ /// <returns>A task indicating whether setting of language preference is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</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<bool> SimSetLanguagePreference(SimLanguagePreference language)
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in setting language preference: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in setting language preference, " + (SimAccessResult)result));
+ }
+
+ task.SetResult(true);
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimSetLanguage(_handle, language, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to set SIM language preference, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets SIM call forwarding indication related data(EF-CFIS and CPHS case).
+ /// </summary>
+ /// <returns>A task containing call forward response information.</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<SimCallForwardResponse> SimGetCallForwardInfo()
+ {
+ TaskCompletionSource<SimCallForwardResponse> task = new TaskCompletionSource<SimCallForwardResponse>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting call forward info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting call forward info, " + (SimAccessResult)result));
+ }
+
+ SimCallForwardResponseStruct info = Marshal.PtrToStructure<SimCallForwardResponseStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimCallForwardResponseStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetCallForwardingInfo(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM call forward info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Sets SIM call forwarding indication related data(EF-CFIS and CPHS case).
+ /// </summary>
+ /// <param name="request">The data requesting for call forwarding.</param>
+ /// <returns>A task indicating whether setting call forward info is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</privilege>
+ /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when call forward request is passed as null.</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<bool> SimSetCallForwardInfo(SimCallForwardRequest request)
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in setting call forward info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in setting call forward info, " + (SimAccessResult)result));
+ }
+
+ task.SetResult(true);
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ if (request == null)
+ {
+ throw new ArgumentNullException("SIM call forward request is null");
+ }
+
+ SimCallForwardRequestStruct requestStruct = SimClassConversions.ConvertSimCallForwardRequest(request);
+ int ret = Interop.Tapi.Sim.SimSetCallForwardingInfo(_handle, ref requestStruct, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to set SIM call forward info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets SIM message waiting indication related data(EF-MWIS and CPHS case).
+ /// </summary>
+ /// <returns>A task containing message waiting response information.</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<SimMessageWaitingResponse> SimGetMessageWaitingInfo()
+ {
+ TaskCompletionSource<SimMessageWaitingResponse> task = new TaskCompletionSource<SimMessageWaitingResponse>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting message waiting info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting message waiting info, " + (SimAccessResult)result));
+ }
+
+ SimMessageWaitingResponseStruct info = Marshal.PtrToStructure<SimMessageWaitingResponseStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimMessageWaitingRespStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetMessageWaitingInfo(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM message waiting info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Sets SIM message waiting indication related data(EF-MWIS and CPHS case).
+ /// </summary>
+ /// <param name="request">The data requesting for message waiting.</param>
+ /// <returns>A task indicating whether setting message waiting info is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</privilege>
+ /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when message waiting request is passed as null.</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<bool> SimSetMessageWaitingInfo(SimMessageWaitingRequest request)
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in setting message waiting info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in setting message waiting info, " + (SimAccessResult)result));
+ }
+
+ task.SetResult(true);
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ if (request == null)
+ {
+ throw new ArgumentNullException("SIM message waiting request is null");
+ }
+
+ SimMessageWaitingRequestStruct requestStruct = SimClassConversions.ConvertSimMessageWaitingRequest(request);
+ int ret = Interop.Tapi.Sim.SimSetMessageWaitingInfo(_handle, ref requestStruct, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to set SIM message waiting info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets SIM mailbox related data(EF-MBDN, MBDI, and CPHS case).
+ /// </summary>
+ /// <returns>A task containing SimMailboxList information.</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<SimMailboxList> SimGetMailboxInfo()
+ {
+ TaskCompletionSource<SimMailboxList> task = new TaskCompletionSource<SimMailboxList>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting mailbox info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting mailbox info, " + (SimAccessResult)result));
+ }
+
+ SimMailboxListStruct info = Marshal.PtrToStructure<SimMailboxListStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimMailboxListStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetMailboxInfo(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM mailbox info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Sets SIM mailbox related data(EF-MBDN, MBDI and CPHS case).
+ /// </summary>
+ /// <param name="mailboxNumber">The data requesting for mailbox info.</param>
+ /// <returns>A task indicating whether setting mailbox info is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</privilege>
+ /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when mailbox number is passed as null.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system runs out of memory.</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<bool> SimSetMailboxInfo(SimMailboxNumber mailboxNumber)
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in setting mailbox info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in setting mailbox info, " + (SimAccessResult)result));
+ }
+
+ task.SetResult(true);
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ if (mailboxNumber == null)
+ {
+ throw new ArgumentNullException("SIM mailbox number is null");
+ }
+
+ SimMailboxNumberStruct mbStruct = SimClassConversions.ConvertSimMailboxNumber(mailboxNumber);
+ int ret = Interop.Tapi.Sim.SimSetMailboxInfo(_handle, ref mbStruct, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to set SIM mailbox info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets SIM CPHS specific data.
+ /// </summary>
+ /// <returns>A task containing SimCphs information.</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<SimCphsInfo> SimGetCphsInfo()
+ {
+ TaskCompletionSource<SimCphsInfo> task = new TaskCompletionSource<SimCphsInfo>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting CPHS info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting CPHS info, " + (SimAccessResult)result));
+ }
+
+ SimCphsInfoStruct info = Marshal.PtrToStructure<SimCphsInfoStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimCphsInfoStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetCphsInfo(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM CPHS info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets the SIM Service Table.
+ /// </summary>
+ /// <returns>A task containing SIM service table information.</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<SimServiceTable> SimGetServiceTable()
+ {
+ TaskCompletionSource<SimServiceTable> task = new TaskCompletionSource<SimServiceTable>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting service table: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting service table, " + (SimAccessResult)result));
+ }
+
+ SimServiceTableStruct info = Marshal.PtrToStructure<SimServiceTableStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimServiceTableStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetServiceTable(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM service table, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets SIM MSISDN data.
+ /// </summary>
+ /// <returns>A task containing SimMsisdnList information.</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<SimMsisdnList> SimGetMsisdn()
+ {
+ TaskCompletionSource<SimMsisdnList> task = new TaskCompletionSource<SimMsisdnList>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting MSISDN info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting MSISDN info, " + (SimAccessResult)result));
+ }
+
+ SimMsisdnListStruct info = Marshal.PtrToStructure<SimMsisdnListStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimMsisdnListStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetMsisdn(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM MSISDN data, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets SIM OPLMNWACT(Operator controlled PLMN Selector with Access Technology) data.
+ /// </summary>
+ /// <returns>A task containing SimOplmnwactList information.</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<SimOplmnwactList> SimGetOplmnwact()
+ {
+ TaskCompletionSource<SimOplmnwactList> task = new TaskCompletionSource<SimOplmnwactList>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting OPLMNWACT info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting OPLMNWACT info, " + (SimAccessResult)result));
+ }
+
+ SimOplmnwactListStruct info = Marshal.PtrToStructure<SimOplmnwactListStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimOplmnwactListStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetOplmnwact(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM OPLMNWACT info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets SIM SPN data.
+ /// </summary>
+ /// <returns>A task containing SimSpn information.</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<SimSpn> SimGetSpn()
+ {
+ TaskCompletionSource<SimSpn> task = new TaskCompletionSource<SimSpn>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting SPN info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting SPN info, " + (SimAccessResult)result));
+ }
+
+ SimSpnStruct info = Marshal.PtrToStructure<SimSpnStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimSpnStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetSpn(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM SPN info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets SIM CPHS NETNAME data.
+ /// </summary>
+ /// <returns>A task containing SimCphsNetName information.</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<SimCphsNetName> SimGetCphsNetName()
+ {
+ TaskCompletionSource<SimCphsNetName> task = new TaskCompletionSource<SimCphsNetName>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting CPHS netname info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting CPHS netname info, " + (SimAccessResult)result));
+ }
+
+ SimCphsNetNameStruct info = Marshal.PtrToStructure<SimCphsNetNameStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimCphsNetNameStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetCphsNetName(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM CPHS netname info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Executes an authentication procedure by using SIM.
+ /// </summary>
+ /// <param name="authenticationData">The authentication code to be validated by the ISIM, 3G, and GSM application in the SIM card.</param>
+ /// <returns>A task containing SimAuthenticationResponse information.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</privilege>
+ /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when authentication data is passed as null.</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<SimAuthenticationResponse> SimExecuteAuthentication(SimAuthenticationData authenticationData)
+ {
+ TaskCompletionSource<SimAuthenticationResponse> task = new TaskCompletionSource<SimAuthenticationResponse>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in executing authentication procedure: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in executing authentication procedure, " + (SimAccessResult)result));
+ }
+
+ SimAuthenticationResponseStruct info = Marshal.PtrToStructure<SimAuthenticationResponseStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimAuthenticationResponseStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ if (authenticationData == null)
+ {
+ throw new ArgumentNullException("SIM authentication data is null");
+ }
+
+ SimAuthenticationDataStruct authStruct = SimClassConversions.ConvertSimAuthenticationDataStruct(authenticationData);
+ int ret = Interop.Tapi.Sim.SimExecuteAuthentication(_handle, ref authStruct, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to execute authentication procedure, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Performs PIN1/PIN2/SIM LOCK verification.
+ /// </summary>
+ /// <param name="pinData">The PIN code.</param>
+ /// <returns>A task containing SimPinResult information.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</privilege>
+ /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when pin data is passed as null.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system runs out of memory.</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<SimPinResult> SimVerifyPins(SimPinData pinData)
+ {
+ TaskCompletionSource<SimPinResult> task = new TaskCompletionSource<SimPinResult>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in verifying SIM pins: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in verifying SIM pins, " + (SimAccessResult)result));
+ }
+
+ SimPinResultStruct info = Marshal.PtrToStructure<SimPinResultStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimPinResultStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ if (pinData == null)
+ {
+ throw new ArgumentNullException("SIM PIN data is null");
+ }
+
+ SimPinDataStruct pinStruct = SimClassConversions.ConvertSimPinData(pinData);
+ int ret = Interop.Tapi.Sim.SimVerifyPins(_handle, ref pinStruct, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to verify SIM PIN, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Performs PIN1/PIN2 unblocking operation based on PUK information.
+ /// </summary>
+ /// <param name="pukData">The unblocking PIN password.</param>
+ /// <param name="newPinData">The PIN password to use after the unblocking operation.</param>
+ /// <returns>A task containing SimPinResult information.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</privilege>
+ /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when either of pukData or newPinData is passed as null.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system runs out of memory.</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<SimPinResult> SimVerifyPuks(SimPinData pukData, SimPinData newPinData)
+ {
+ TaskCompletionSource<SimPinResult> task = new TaskCompletionSource<SimPinResult>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in verifying SIM puks: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in verifying SIM puks, " + (SimAccessResult)result));
+ }
+
+ SimPinResultStruct info = Marshal.PtrToStructure<SimPinResultStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimPinResultStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ if (pukData == null || newPinData == null)
+ {
+ throw new ArgumentNullException("SIM PIN/PUK data is null");
+ }
+
+ SimPinDataStruct pukStruct = SimClassConversions.ConvertSimPinData(pukData);
+ SimPinDataStruct pinStruct = SimClassConversions.ConvertSimPinData(newPinData);
+ int ret = Interop.Tapi.Sim.SimVerifyPuks(_handle, ref pukStruct, ref pinStruct, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to verify SIM puks, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Changes the PIN1/PIN2 code based on the PIN type passed along with old PIN data and new PIN data.
+ /// </summary>
+ /// <param name="oldPin">The old PIN code entered by the user.</param>
+ /// <param name="newPin">The new PIN code entered by the user.</param>
+ /// <returns>A task containing SimPinResult information.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</privilege>
+ /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when either of oldPin or newPin is passed as null.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system runs out of memory.</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<SimPinResult> SimChangePins(SimPinData oldPin, SimPinData newPin)
+ {
+ TaskCompletionSource<SimPinResult> task = new TaskCompletionSource<SimPinResult>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in changing SIM pins: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in changing SIM pins, " + (SimAccessResult)result));
+ }
+
+ SimPinResultStruct info = Marshal.PtrToStructure<SimPinResultStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimPinResultStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ if (oldPin == null || newPin == null)
+ {
+ throw new ArgumentNullException("Old/new PIN data is null");
+ }
+
+ SimPinDataStruct oldPinStruct = SimClassConversions.ConvertSimPinData(oldPin);
+ SimPinDataStruct newPinStruct = SimClassConversions.ConvertSimPinData(newPin);
+ int ret = Interop.Tapi.Sim.SimChangePins(_handle, ref oldPinStruct, ref newPinStruct, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to change SIM pins, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Disables the SIM facility.
+ /// </summary>
+ /// <param name="facility">An object which contains the facility type and password.</param>
+ /// <returns>A task containing SIM facility result information.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</privilege>
+ /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when SIM facility info is passed as null.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system runs out of memory.</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<SimFacilityResult> SimDisableFacility(SimFacility facility)
+ {
+ TaskCompletionSource<SimFacilityResult> task = new TaskCompletionSource<SimFacilityResult>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in disabling SIM facility: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in disabling SIM facility, " + (SimAccessResult)result));
+ }
+
+ SimFacilityResultStruct info = Marshal.PtrToStructure<SimFacilityResultStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimFacilityResultStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ if (facility == null)
+ {
+ throw new ArgumentNullException("SIM facility info is null");
+ }
+
+ SimFacilityStruct facilityStruct = SimClassConversions.ConvertSimFacility(facility);
+ int ret = Interop.Tapi.Sim.SimDisableFacility(_handle, ref facilityStruct, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to disable SIM facility, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Enables the SIM facility.
+ /// </summary>
+ /// <param name="facility">An object which contains the facility type and password.</param>
+ /// <returns>A task containing SIM facility result information.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</privilege>
+ /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when SIM facility info is passed as null.</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when the system runs out of memory.</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<SimFacilityResult> SimEnableFacility(SimFacility facility)
+ {
+ TaskCompletionSource<SimFacilityResult> task = new TaskCompletionSource<SimFacilityResult>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in enabling SIM facility: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in enabling SIM facility, " + (SimAccessResult)result));
+ }
+
+ SimFacilityResultStruct info = Marshal.PtrToStructure<SimFacilityResultStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimFacilityResultStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ if (facility == null)
+ {
+ throw new ArgumentNullException("SIM facility info is null");
+ }
+
+ SimFacilityStruct facilityStruct = SimClassConversions.ConvertSimFacility(facility);
+ int ret = Interop.Tapi.Sim.SimEnableFacility(_handle, ref facilityStruct, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to enable SIM facility, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets the SIM facility.
+ /// </summary>
+ /// <param name="lockType">The type of security lock.</param>
+ /// <returns>A task containing SIM facility information.</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<SimFacilityInfo> SimGetFacility(SimLockType lockType)
+ {
+ TaskCompletionSource<SimFacilityInfo> task = new TaskCompletionSource<SimFacilityInfo>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM facility: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting SIM facility, " + (SimAccessResult)result));
+ }
+
+ SimFacilityInfoStruct info = Marshal.PtrToStructure<SimFacilityInfoStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimFacilityInfoStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetFacility(_handle, lockType, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM facility, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets SIM lock type info.
+ /// </summary>
+ /// <param name="lockType">The type of security lock.</param>
+ /// <returns>A task containing SIM lock information.</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<SimLockInfo> SimGetLockInfo(SimLockType lockType)
+ {
+ TaskCompletionSource<SimLockInfo> task = new TaskCompletionSource<SimLockInfo>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM lock info: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting SIM lock info, " + (SimAccessResult)result));
+ }
+
+ SimLockInfoStruct info = Marshal.PtrToStructure<SimLockInfoStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimLockInfoStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetLockInfo(_handle, lockType, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM lock info, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Sets the SIM power state.
+ /// </summary>
+ /// <param name="state">The state of SIM to be set.</param>
+ /// <returns>A task indicating whether setting SIM power state is done or not.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</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<bool> SimSetPowerState(SimPowerState state)
+ {
+ TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimPowerSetResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in setting SIM power state: " + (SimPowerSetResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in setting SIM power state, " + (SimPowerSetResult)result));
+ }
+
+ task.SetResult(true);
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimSetPowerState(_handle, state, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to set SIM power state, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Provides a common interface for accessing SIM data.
+ /// </summary>
+ /// <param name="apdu">The APDU data.</param>
+ /// <returns>A task containing SIM APDU response information.</returns>
+ /// <feature>http://tizen.org/feature/network.telephony</feature>
+ /// <privlevel>platform</privlevel>
+ /// <privilege>http://tizen.org/privilege/telephony.admin</privilege>
+ /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
+ /// <exception cref="ArgumentNullException">Thrown when SIM APDU is passed as null.</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<SimApduResponse> SimRequestApdu(SimApdu apdu)
+ {
+ TaskCompletionSource<SimApduResponse> task = new TaskCompletionSource<SimApduResponse>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in requesting SIM APDU: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in requesting SIM APDU, " + (SimAccessResult)result));
+ }
+
+ SimApduResponseStruct info = Marshal.PtrToStructure<SimApduResponseStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimApduResponseStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ if (apdu == null)
+ {
+ throw new ArgumentNullException("SIM APDU is null");
+ }
+
+ SimApduStruct apduStruct = SimClassConversions.ConvertSimApdu(apdu);
+ int ret = Interop.Tapi.Sim.SimRequestApdu(_handle, ref apduStruct, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to request SIM APDU, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Provides a common interface to get the SIM ATR(Answer To Reset) value.
+ /// </summary>
+ /// <returns>A task containing SIM ATR response information.</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<SimAtrResponse> SimRequestAtr()
+ {
+ TaskCompletionSource<SimAtrResponse> task = new TaskCompletionSource<SimAtrResponse>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in requesting SIM ATR: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in requesting SIM ATR, " + (SimAccessResult)result));
+ }
+
+ SimAtrResponseStruct info = Marshal.PtrToStructure<SimAtrResponseStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimAtrResponseStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimRequestAtr(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to request SIM ATR, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets the IMPI(IMS private user identity). (ISIM only).
+ /// </summary>
+ /// <returns>A task containing IMPI string.</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<string> SimGetImpi()
+ {
+ TaskCompletionSource<string> task = new TaskCompletionSource<string>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM IMPI: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting SIM IMPI, " + (SimAccessResult)result));
+ }
+
+ task.SetResult(Marshal.PtrToStringAnsi(data));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetImpi(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM IMPI, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets the IMPU(IMS public user identity). (ISIM only).
+ /// </summary>
+ /// <returns>A task containing SIM IMPU list information.</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<SimImpuList> SimGetImpu()
+ {
+ TaskCompletionSource<SimImpuList> task = new TaskCompletionSource<SimImpuList>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM IMPU: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting SIM IMPU, " + (SimAccessResult)result));
+ }
+
+ SimImpuListStruct info = Marshal.PtrToStructure<SimImpuListStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimImpuListStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetImpu(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM IMPU, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets the Domain(Home Network Domain Name). (ISIM only)
+ /// </summary>
+ /// <returns>A task containing domain string.</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<string> SimGetDomain()
+ {
+ TaskCompletionSource<string> task = new TaskCompletionSource<string>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM domain: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting SIM domain, " + (SimAccessResult)result));
+ }
+
+ task.SetResult(Marshal.PtrToStringAnsi(data));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetDomain(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM domain, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets the P-CSCF(Proxy Call Session Control Function). (ISIM only)
+ /// </summary>
+ /// <returns>A task containing SIM PCSCF list information.</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<SimPcscfList> SimGetPcscf()
+ {
+ TaskCompletionSource<SimPcscfList> task = new TaskCompletionSource<SimPcscfList>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM PCSCF: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting SIM PCSCF, " + (SimAccessResult)result));
+ }
+
+ SimPcscfListStruct info = Marshal.PtrToStructure<SimPcscfListStruct>(data);
+ task.SetResult(SimStructConversions.ConvertSimPcscfListStruct(info));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetPcscf(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get SIM PCSCF, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+
+ /// <summary>
+ /// Gets the ISIM service table. (ISIM only).
+ /// </summary>
+ /// <returns>A task containing a byte array in which mask value of SimIsimService enum will be stored.</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<byte[]> SimGetIsimServiceTable()
+ {
+ TaskCompletionSource<byte[]> task = new TaskCompletionSource<byte[]>();
+ IntPtr id = (IntPtr)_requestId++;
+ _callbackMap[id] = (handle, result, data, key) =>
+ {
+ Task taskResult = new Task(() =>
+ {
+ if (result != (int)SimAccessResult.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Error occurs in getting ISIM service table: " + (SimAccessResult)result);
+ task.SetException(new InvalidOperationException("Error occurs in getting ISIM service table, " + (SimAccessResult)result));
+ }
+
+ task.SetResult(Encoding.ASCII.GetBytes(Marshal.PtrToStringAnsi(data)));
+ });
+ taskResult.Start();
+ taskResult.Wait();
+ _callbackMap.Remove(key);
+ };
+
+ int ret = Interop.Tapi.Sim.SimGetIsimServiceTable(_handle, _callbackMap[id], id);
+ if (ret != (int)TapiError.Success)
+ {
+ Log.Error(TapiUtility.LogTag, "Failed to get ISIM service table, Error: " + (TapiError)ret);
+ TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
+ }
+
+ return task.Task;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System.Collections.Generic;
+
+namespace Tizen.Tapi
+{
+ /// <summary>
+ /// A class which defines SIM card initialization information.
+ /// </summary>
+ public class SimInitInfo
+ {
+ internal SimCardStatus SimStatus;
+ internal bool IsChanged;
+ internal SimInitInfo()
+ {
+ }
+
+ /// <summary>
+ /// The SIM initialization status from the Telephony server boot up time.
+ /// </summary>
+ public SimCardStatus Status
+ {
+ get
+ {
+ return SimStatus;
+ }
+ }
+
+ /// <summary>
+ /// The SIM card identification value. It will be true when the current inserted SIM card differs from the previous SIM. False otherwise.
+ /// </summary>
+ public bool IsCardChanged
+ {
+ get
+ {
+ return IsChanged;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines data for IMSI information.
+ /// </summary>
+ public class SimImsiInfo
+ {
+ internal string CountryCode;
+ internal string NetworkCode;
+ internal string StationId;
+ internal SimImsiInfo()
+ {
+ }
+
+ /// <summary>
+ /// Mobile Country Code.
+ /// </summary>
+ public string Mcc
+ {
+ get
+ {
+ return CountryCode;
+ }
+ }
+
+ /// <summary>
+ /// Mobile Network Code.
+ /// </summary>
+ public string Mnc
+ {
+ get
+ {
+ return NetworkCode;
+ }
+ }
+
+ /// <summary>
+ /// Mobile Station Identification Number.
+ /// </summary>
+ public string Msin
+ {
+ get
+ {
+ return StationId;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines data for ECC information of GSM/USIM/CDMA SIM.
+ /// </summary>
+ public class SimEccInfo
+ {
+ internal string NameInfo;
+ internal string NumberInfo;
+ internal SimEccEmergencyServiceType TypeInfo;
+ internal SimEccInfo()
+ {
+ }
+
+ /// <summary>
+ /// Name. Applicable only for USIM(3G) SIM.
+ /// </summary>
+ public string Name
+ {
+ get
+ {
+ return NameInfo;
+ }
+ }
+
+ /// <summary>
+ /// Number.
+ /// </summary>
+ public string Number
+ {
+ get
+ {
+ return NumberInfo;
+ }
+ }
+
+ /// <summary>
+ /// Emergency service type. Applicable only for USIM(3G) SIM.
+ /// </summary>
+ public SimEccEmergencyServiceType Category
+ {
+ get
+ {
+ return TypeInfo;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines ECC information list.
+ /// </summary>
+ public class SimEccInfoList
+ {
+ internal int EccCount;
+ internal IEnumerable<SimEccInfo> List;
+ internal SimEccInfoList()
+ {
+ }
+
+ /// <summary>
+ /// ECC count.
+ /// </summary>
+ public int Count
+ {
+ get
+ {
+ return EccCount;
+ }
+ }
+
+ /// <summary>
+ /// List of ECC.
+ /// </summary>
+ public IEnumerable<SimEccInfo> EccList
+ {
+ get
+ {
+ return List;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines ICCID(Integrated Circuit Card Identifier).
+ /// </summary>
+ public class SimIccIdInfo
+ {
+ internal int Length;
+ internal string Number;
+ internal SimIccIdInfo()
+ {
+ }
+
+ /// <summary>
+ /// Integrated Circuit Card number length.
+ /// </summary>
+ public int IccLength
+ {
+ get
+ {
+ return Length;
+ }
+ }
+
+ /// <summary>
+ /// Integrated Circuit Card number.
+ /// </summary>
+ public string IccNumber
+ {
+ get
+ {
+ return Number;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines call forwarding indication status data.
+ /// </summary>
+ public class SimCfis
+ {
+ private int _recIndex;
+ private byte _mspNum;
+ private byte _cfuStatus;
+ private SimTypeOfNumber _ton;
+ private SimNumberPlanIdentity _npi;
+ private string _cfuNum;
+ private byte _cc2Id;
+ private byte _ext7Id;
+
+ /// <summary>
+ /// Record index.
+ /// </summary>
+ public int RecIndex
+ {
+ get
+ {
+ return _recIndex;
+ }
+
+ set
+ {
+ _recIndex = value;
+ }
+ }
+
+ /// <summary>
+ /// MSP number.
+ /// </summary>
+ public byte MspNum
+ {
+ get
+ {
+ return _mspNum;
+ }
+
+ set
+ {
+ _mspNum = value;
+ }
+ }
+
+ /// <summary>
+ /// Call forwarding unconditional indication status.
+ /// </summary>
+ public byte CfuStatus
+ {
+ get
+ {
+ return _cfuStatus;
+ }
+
+ set
+ {
+ _cfuStatus = value;
+ }
+ }
+
+ /// <summary>
+ /// SIM Type of number.
+ /// </summary>
+ public SimTypeOfNumber Ton
+ {
+ get
+ {
+ return _ton;
+ }
+
+ set
+ {
+ _ton = value;
+ }
+ }
+
+ /// <summary>
+ /// SIM numbering plan identity.
+ /// </summary>
+ public SimNumberPlanIdentity Npi
+ {
+ get
+ {
+ return _npi;
+ }
+
+ set
+ {
+ _npi = value;
+ }
+ }
+
+ /// <summary>
+ /// Dialing Number/SSC String.
+ /// </summary>
+ public string CfuNum
+ {
+ get
+ {
+ return _cfuNum;
+ }
+
+ set
+ {
+ _cfuNum = value;
+ }
+ }
+
+ /// <summary>
+ /// Capability/Configuration 2 Record Identifier.
+ /// </summary>
+ public byte Cc2Id
+ {
+ get
+ {
+ return _cc2Id;
+ }
+
+ set
+ {
+ _cc2Id = value;
+ }
+ }
+
+ /// <summary>
+ /// Extension 7 Record Identifier.
+ /// </summary>
+ public byte Ext7Id
+ {
+ get
+ {
+ return _ext7Id;
+ }
+
+ set
+ {
+ _ext7Id = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines call forwarding indication status list.
+ /// </summary>
+ public class SimCfisList
+ {
+ internal int Count;
+ internal IEnumerable<SimCfis> List;
+ internal SimCfisList()
+ {
+ }
+
+ /// <summary>
+ /// Profile count.
+ /// </summary>
+ public int ProfileCount
+ {
+ get
+ {
+ return Count;
+ }
+ }
+
+ /// <summary>
+ /// List of CFIS.
+ /// </summary>
+ public IEnumerable<SimCfis> CfisList
+ {
+ get
+ {
+ return List;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines CPHS call forwarding status data.
+ /// </summary>
+ public class SimCphsCf
+ {
+ private int _line1;
+ private int _line2;
+ private int _fax;
+ private int _data;
+
+ /// <summary>
+ /// CallForwardUnconditionalLine 1.
+ /// </summary>
+ public int Line1
+ {
+ get
+ {
+ return _line1;
+ }
+
+ set
+ {
+ _line1 = value;
+ }
+ }
+
+ /// <summary>
+ /// CallForwardUnconditionalLine 2.
+ /// </summary>
+ public int Line2
+ {
+ get
+ {
+ return _line2;
+ }
+
+ set
+ {
+ _line2 = value;
+ }
+ }
+
+ /// <summary>
+ /// CallForwardUnconditional Fax.
+ /// </summary>
+ public int Fax
+ {
+ get
+ {
+ return _fax;
+ }
+
+ set
+ {
+ _fax = value;
+ }
+ }
+
+ /// <summary>
+ /// CallForwardUnconditional data.
+ /// </summary>
+ public int Data
+ {
+ get
+ {
+ return _data;
+ }
+
+ set
+ {
+ _data = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines call forwarding response.
+ /// </summary>
+ public class SimCallForwardResponse
+ {
+ internal bool IsCphsCf;
+ internal SimCfisList List;
+ internal SimCphsCf CphsCfInfo;
+ internal SimCallForwardResponse()
+ {
+ }
+
+ /// <summary>
+ /// CPHS or not.
+ /// </summary>
+ public bool IsCphs
+ {
+ get
+ {
+ return IsCphsCf;
+ }
+ }
+
+ /// <summary>
+ /// List of CFIS.
+ /// </summary>
+ public SimCfisList CfList
+ {
+ get
+ {
+ return List;
+ }
+ }
+
+ /// <summary>
+ /// CPHS CF.
+ /// </summary>
+ public SimCphsCf CphsCf
+ {
+ get
+ {
+ return CphsCfInfo;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines call forwarding request.
+ /// </summary>
+ public class SimCallForwardRequest
+ {
+ private bool _isCphs;
+ private SimCfis _cfis;
+ private SimCphsCf _cphsCf;
+
+ /// <summary>
+ /// CPHS or not.
+ /// </summary>
+ public bool IsCphs
+ {
+ get
+ {
+ return _isCphs;
+ }
+
+ set
+ {
+ _isCphs = value;
+ }
+ }
+
+ /// <summary>
+ /// CFIS.
+ /// </summary>
+ /// <remarks>
+ /// This should be filled only if IsCphs is false.
+ /// </remarks>
+ public SimCfis Cfis
+ {
+ get
+ {
+ return _cfis;
+ }
+
+ set
+ {
+ _cfis = value;
+ }
+ }
+
+ /// <summary>
+ /// CPHS CF.
+ /// </summary>
+ /// <remarks>
+ /// This should be filled only if IsCphs is true.
+ /// </remarks>
+ public SimCphsCf CphsCf
+ {
+ get
+ {
+ return _cphsCf;
+ }
+
+ set
+ {
+ _cphsCf = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines message waiting indication status data.
+ /// </summary>
+ public class SimMwis
+ {
+ private int _recIndex;
+ private byte _indicatorStatus;
+ private int _voiceCount;
+ private int _faxCount;
+ private int _emailCount;
+ private int _otherCount;
+ private int _videoCount;
+
+ /// <summary>
+ /// Record index.
+ /// </summary>
+ public int RecIndex
+ {
+ get
+ {
+ return _recIndex;
+ }
+
+ set
+ {
+ _recIndex = value;
+ }
+ }
+
+ /// <summary>
+ /// Indicator type.
+ /// </summary>
+ public byte IndicatorStatus
+ {
+ get
+ {
+ return _indicatorStatus;
+ }
+
+ set
+ {
+ _indicatorStatus = value;
+ }
+ }
+
+ /// <summary>
+ /// VoiceMail count.
+ /// </summary>
+ public int VoiceCount
+ {
+ get
+ {
+ return _voiceCount;
+ }
+
+ set
+ {
+ _voiceCount = value;
+ }
+ }
+
+ /// <summary>
+ /// Fax count.
+ /// </summary>
+ public int FaxCount
+ {
+ get
+ {
+ return _faxCount;
+ }
+
+ set
+ {
+ _faxCount = value;
+ }
+ }
+
+ /// <summary>
+ /// Email count.
+ /// </summary>
+ public int EmailCount
+ {
+ get
+ {
+ return _emailCount;
+ }
+
+ set
+ {
+ _emailCount = value;
+ }
+ }
+
+ /// <summary>
+ /// Other count.
+ /// </summary>
+ public int OtherCount
+ {
+ get
+ {
+ return _otherCount;
+ }
+
+ set
+ {
+ _otherCount = value;
+ }
+ }
+
+ /// <summary>
+ /// VideoMail count.
+ /// </summary>
+ public int VideoCount
+ {
+ get
+ {
+ return _videoCount;
+ }
+
+ set
+ {
+ _videoCount = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines message waiting indication status list.
+ /// </summary>
+ public class SimMwisList
+ {
+ internal int Count;
+ internal IEnumerable<SimMwis> List;
+ internal SimMwisList()
+ {
+ }
+
+ /// <summary>
+ /// Profile count.
+ /// </summary>
+ public int ProfileCount
+ {
+ get
+ {
+ return Count;
+ }
+ }
+
+ /// <summary>
+ /// List of MWIS.
+ /// </summary>
+ public IEnumerable<SimMwis> MwList
+ {
+ get
+ {
+ return List;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines CPHS message waiting status data.
+ /// </summary>
+ public class SimCphsMw
+ {
+ private bool _isVoice1;
+ private bool _isVoice2;
+ private bool _isFax;
+ private bool _isData;
+
+ /// <summary>
+ /// VoiceMsgLine1 message waiting flag.
+ /// </summary>
+ public bool IsVoice1
+ {
+ get
+ {
+ return _isVoice1;
+ }
+
+ set
+ {
+ _isVoice1 = value;
+ }
+ }
+
+ /// <summary>
+ /// VoiceMsgLine2 message waiting flag.
+ /// </summary>
+ public bool IsVoice2
+ {
+ get
+ {
+ return _isVoice2;
+ }
+
+ set
+ {
+ _isVoice2 = value;
+ }
+ }
+
+ /// <summary>
+ /// FAX message waiting flag.
+ /// </summary>
+ public bool IsFax
+ {
+ get
+ {
+ return _isFax;
+ }
+
+ set
+ {
+ _isFax = value;
+ }
+ }
+
+ /// <summary>
+ /// Data message waiting flag.
+ /// </summary>
+ public bool IsData
+ {
+ get
+ {
+ return _isData;
+ }
+
+ set
+ {
+ _isData = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines message waiting reponse.
+ /// </summary>
+ public class SimMessageWaitingResponse
+ {
+ internal bool IsCphsMw;
+ internal SimMwisList List;
+ internal SimCphsMw CphsMwInfo;
+ internal SimMessageWaitingResponse()
+ {
+ }
+
+ /// <summary>
+ /// CPHS or not.
+ /// </summary>
+ public bool IsCphs
+ {
+ get
+ {
+ return IsCphsMw;
+ }
+ }
+
+ /// <summary>
+ /// List of MWIS.
+ /// </summary>
+ public SimMwisList MwList
+ {
+ get
+ {
+ return List;
+ }
+ }
+
+ /// <summary>
+ /// CPHS MW.
+ /// </summary>
+ public SimCphsMw CphsMw
+ {
+ get
+ {
+ return CphsMwInfo;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines message waiting request.
+ /// </summary>
+ public class SimMessageWaitingRequest
+ {
+ private bool _isCphs;
+ private SimMwis _mwis;
+ private SimCphsMw _cphsMw;
+
+ /// <summary>
+ /// CPHS or not.
+ /// </summary>
+ public bool IsCphs
+ {
+ get
+ {
+ return _isCphs;
+ }
+
+ set
+ {
+ _isCphs = value;
+ }
+ }
+
+ /// <summary>
+ /// MWIS.
+ /// </summary>
+ /// <remarks>
+ /// This should be filled only if IsCphs is false.
+ /// </remarks>
+ public SimMwis Mwis
+ {
+ get
+ {
+ return _mwis;
+ }
+
+ set
+ {
+ _mwis = value;
+ }
+ }
+
+ /// <summary>
+ /// CPHS MW.
+ /// </summary>
+ /// <remarks>
+ /// This should be filled only if IsCphs is true.
+ /// </remarks>
+ public SimCphsMw CphsMw
+ {
+ get
+ {
+ return _cphsMw;
+ }
+
+ set
+ {
+ _cphsMw = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines mailbox dialing number data.
+ /// </summary>
+ public class SimMailboxNumber
+ {
+ private bool _isCphs;
+ private int _recIndex;
+ private int _profileNumber;
+ private SimMailboxType _mbType;
+ private int _alphaMaxLength;
+ private string _alphaId;
+ private SimTypeOfNumber _ton;
+ private SimNumberPlanIdentity _npi;
+ private string _number;
+ private byte _ccId;
+ private byte _ext1Id;
+
+ /// <summary>
+ /// CPHS or not.
+ /// </summary>
+ public bool IsCphs
+ {
+ get
+ {
+ return _isCphs;
+ }
+
+ set
+ {
+ _isCphs = value;
+ }
+ }
+
+ /// <summary>
+ /// Index which stands for the location where the record is saved in SIM.
+ /// </summary>
+ public int RecIndex
+ {
+ get
+ {
+ return _recIndex;
+ }
+
+ set
+ {
+ _recIndex = value;
+ }
+ }
+
+ /// <summary>
+ /// SIM profile index.
+ /// </summary>
+ public int ProfileNumber
+ {
+ get
+ {
+ return _profileNumber;
+ }
+
+ set
+ {
+ _profileNumber = value;
+ }
+ }
+
+ /// <summary>
+ /// Mailbox type.
+ /// </summary>
+ public SimMailboxType MbType
+ {
+ get
+ {
+ return _mbType;
+ }
+
+ set
+ {
+ _mbType = value;
+ }
+ }
+
+ /// <summary>
+ /// Alpha max length in SIM.
+ /// </summary>
+ public int AlphaMaxLength
+ {
+ get
+ {
+ return _alphaMaxLength;
+ }
+
+ set
+ {
+ _alphaMaxLength = value;
+ }
+ }
+
+ /// <summary>
+ /// Alpha Identifier.
+ /// </summary>
+ public string AlphaId
+ {
+ get
+ {
+ return _alphaId;
+ }
+
+ set
+ {
+ _alphaId = value;
+ }
+ }
+
+ /// <summary>
+ /// Type Of Number.
+ /// </summary>
+ public SimTypeOfNumber Ton
+ {
+ get
+ {
+ return _ton;
+ }
+
+ set
+ {
+ _ton = value;
+ }
+ }
+
+ /// <summary>
+ /// Number Plan Identity.
+ /// </summary>
+ public SimNumberPlanIdentity Npi
+ {
+ get
+ {
+ return _npi;
+ }
+
+ set
+ {
+ _npi = value;
+ }
+ }
+
+ /// <summary>
+ /// Dialing Number/SSC String.
+ /// </summary>
+ public string Number
+ {
+ get
+ {
+ return _number;
+ }
+
+ set
+ {
+ _number = value;
+ }
+ }
+
+ /// <summary>
+ /// Capability/Configuration Identifier.
+ /// </summary>
+ public byte CcId
+ {
+ get
+ {
+ return _ccId;
+ }
+
+ set
+ {
+ _ccId = value;
+ }
+ }
+
+ /// <summary>
+ /// Extension 1 Record Identifier.
+ /// </summary>
+ public byte Ext1Id
+ {
+ get
+ {
+ return _ext1Id;
+ }
+
+ set
+ {
+ _ext1Id = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines mailbox dialing number list.
+ /// </summary>
+ public class SimMailboxList
+ {
+ internal int MbCount;
+ internal IEnumerable<SimMailboxNumber> MbList;
+ internal SimMailboxList()
+ {
+ }
+
+ /// <summary>
+ /// Mailbox count.
+ /// </summary>
+ public int Count
+ {
+ get
+ {
+ return MbCount;
+ }
+ }
+
+ /// <summary>
+ /// List of mailbox.
+ /// </summary>
+ public IEnumerable<SimMailboxNumber> List
+ {
+ get
+ {
+ return MbList;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines available optional CPHS SIM files.
+ /// </summary>
+ public class SimCphsServiceTable
+ {
+ internal int CustomerSvcProfile;
+ internal int SvcStringTable;
+ internal int MbNumbers;
+ internal int OperatorNameShort;
+ internal int InformationNum;
+ internal SimCphsServiceTable()
+ {
+ }
+
+ /// <summary>
+ /// Customer Service Profile (CSP).
+ /// </summary>
+ public int CustomerServiceProfile
+ {
+ get
+ {
+ return CustomerSvcProfile;
+ }
+ }
+
+ /// <summary>
+ /// Service String Table (SST).
+ /// </summary>
+ public int ServiceStringTable
+ {
+ get
+ {
+ return SvcStringTable;
+ }
+ }
+
+ /// <summary>
+ /// MailBoxNumbers.
+ /// </summary>
+ public int MailboxNumbers
+ {
+ get
+ {
+ return MbNumbers;
+ }
+ }
+
+ /// <summary>
+ /// Short form of operator name.
+ /// </summary>
+ public int OperatorNameShortForm
+ {
+ get
+ {
+ return OperatorNameShort;
+ }
+ }
+
+ /// <summary>
+ /// Information numbers.
+ /// </summary>
+ public int InformationNumbers
+ {
+ get
+ {
+ return InformationNum;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines CPHS information data.
+ /// </summary>
+ public class SimCphsInfo
+ {
+ internal SimCphsPhaseType Phase;
+ internal SimCphsServiceTable CphsSvcTable;
+ internal SimCphsInfo()
+ {
+ }
+
+ /// <summary>
+ /// CPHS phase type.
+ /// </summary>
+ public SimCphsPhaseType CphsPhase
+ {
+ get
+ {
+ return Phase;
+ }
+ }
+
+ /// <summary>
+ /// CPHS service table.
+ /// </summary>
+ public SimCphsServiceTable CphsServiceTable
+ {
+ get
+ {
+ return CphsSvcTable;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines CSIM service table.
+ /// </summary>
+ public class SimCst
+ {
+ internal SimCdmaServiceTable CdmaSvc;
+ internal byte[] Cdma;
+ internal byte[] Csim;
+ internal SimCst()
+ {
+ }
+
+ /// <summary>
+ /// Cdma service table;
+ /// </summary>
+ public SimCdmaServiceTable CdmaSvcTable
+ {
+ get
+ {
+ return CdmaSvc;
+ }
+ }
+
+ /// <summary>
+ /// Cdma service. Gives mask value of SimCdmaService enum.
+ /// </summary>
+ /// <remarks>
+ /// This will be filled only if CdmaSvcTable is Cdma.
+ /// </remarks>
+ public byte[] CdmaService
+ {
+ get
+ {
+ return Cdma;
+ }
+ }
+
+ /// <summary>
+ /// Csim service. Gives mask value of SimCsimService enum.
+ /// </summary>
+ /// <remarks>
+ /// This will be filled only if CdmaSvcTable is Csim.
+ /// </remarks>
+ public byte[] CsimService
+ {
+ get
+ {
+ return Csim;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines SIM service table.
+ /// </summary>
+ public class SimServiceTable
+ {
+ internal SimCardType Type;
+ internal byte[] Sst;
+ internal byte[] Ust;
+ internal SimCst Cst;
+ internal SimServiceTable()
+ {
+ }
+
+ /// <summary>
+ /// SIM card type.
+ /// </summary>
+ public SimCardType SimType
+ {
+ get
+ {
+ return Type;
+ }
+ }
+
+ /// <summary>
+ /// SIM service table. Gives mask value of SimSstService enum.
+ /// </summary>
+ /// <remarks>
+ /// This will be filled only if SimType is Gsm.
+ /// </remarks>
+ public byte[] SstService
+ {
+ get
+ {
+ return Sst;
+ }
+ }
+
+ /// <summary>
+ /// USIM service table. Gives mask value of SimUstService enum.
+ /// </summary>
+ /// <remarks>
+ /// This will be filled only if SimType is Usim.
+ /// </remarks>
+ public byte[] UstService
+ {
+ get
+ {
+ return Ust;
+ }
+ }
+
+ /// <summary>
+ /// CSIM service table.
+ /// </summary>
+ /// <remarks>
+ /// This will be filled only if SimType is Ruim.
+ /// </remarks>
+ public SimCst CstService
+ {
+ get
+ {
+ return Cst;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines MSISDN information of the GSM/CDMA SIM.
+ /// </summary>
+ public class SimSubscriberInfo
+ {
+ internal string MsisdnNum;
+ internal string MsisdnName;
+ internal SimSubscriberInfo()
+ {
+ }
+
+ /// <summary>
+ /// MSISDN number. If it does not exist, a null string will be returned
+ /// </summary>
+ public string Number
+ {
+ get
+ {
+ return MsisdnNum;
+ }
+ }
+
+ /// <summary>
+ /// MSISDN name. If it does not exist, a null string will be returned. Not applicable for CDMA.
+ /// </summary>
+ public string Name
+ {
+ get
+ {
+ return MsisdnName;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines MSISDN list.
+ /// </summary>
+ public class SimMsisdnList
+ {
+ internal int MsisdnCount;
+ internal IEnumerable<SimSubscriberInfo> SubscriberList;
+ internal SimMsisdnList()
+ {
+ }
+
+ /// <summary>
+ /// Count.
+ /// </summary>
+ public int Count
+ {
+ get
+ {
+ return MsisdnCount;
+ }
+ }
+
+ /// <summary>
+ /// List of subscriber info.
+ /// </summary>
+ public IEnumerable<SimSubscriberInfo> List
+ {
+ get
+ {
+ return SubscriberList;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines OPLMNwACT data.
+ /// </summary>
+ public class SimOplmnwact
+ {
+ internal string PlmnString;
+ internal bool UmtsFlag;
+ internal bool GsmFlag;
+ internal SimOplmnwact()
+ {
+ }
+
+ /// <summary>
+ /// PLMN.
+ /// </summary>
+ public string Plmn
+ {
+ get
+ {
+ return PlmnString;
+ }
+ }
+
+ /// <summary>
+ /// UMTS or not.
+ /// </summary>
+ public bool IsUmts
+ {
+ get
+ {
+ return UmtsFlag;
+ }
+ }
+
+ /// <summary>
+ /// GSM or not.
+ /// </summary>
+ public bool IsGsm
+ {
+ get
+ {
+ return GsmFlag;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines OPLMNwACT list.
+ /// </summary>
+ public class SimOplmnwactList
+ {
+ internal int OplmnCount;
+ internal IEnumerable<SimOplmnwact> OplmnList;
+ internal SimOplmnwactList()
+ {
+ }
+
+ /// <summary>
+ /// Count.
+ /// </summary>
+ public int Count
+ {
+ get
+ {
+ return OplmnCount;
+ }
+ }
+
+ /// <summary>
+ /// List of OPLMNWACT.
+ /// </summary>
+ public IEnumerable<SimOplmnwact> List
+ {
+ get
+ {
+ return OplmnList;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines SPN(Service Provider Name).
+ /// </summary>
+ public class SimSpn
+ {
+ internal byte Condition;
+ internal string SpName;
+ internal SimSpn()
+ {
+ }
+
+ /// <summary>
+ /// Display condition.
+ /// </summary>
+ public byte DisplayCondition
+ {
+ get
+ {
+ return Condition;
+ }
+ }
+
+ /// <summary>
+ /// Service Provider Name.
+ /// </summary>
+ public string Spn
+ {
+ get
+ {
+ return SpName;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines CPHS network name.
+ /// </summary>
+ public class SimCphsNetName
+ {
+ internal string Full;
+ internal string Short;
+ internal SimCphsNetName()
+ {
+ }
+
+ /// <summary>
+ /// Full name.
+ /// </summary>
+ public string FullName
+ {
+ get
+ {
+ return Full;
+ }
+ }
+
+ /// <summary>
+ /// Short name.
+ /// </summary>
+ public string ShortName
+ {
+ get
+ {
+ return Short;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines authentication request data.
+ /// </summary>
+ public class SimAuthenticationData
+ {
+ private SimAuthenticationType _authType;
+ private int _randLength;
+ private int _autnLength;
+ private byte[] _randData;
+ private byte[] _autnData;
+ private SimAuthenticationData()
+ {
+ }
+
+ /// <summary>
+ /// A constructor to instantiate SimAuthenticationData class with necessary parameters.
+ /// </summary>
+ /// <param name="authType">Authentication type.</param>
+ /// <param name="randLength">The length of RAND.</param>
+ /// <param name="autnLength">The length of AUTN. It is not used in case of GSM AUTH.</param>
+ /// <param name="randData">RAND data.</param>
+ /// <param name="autnData">AUTN data. It is not used in case of GSM AUTH.</param>
+ public SimAuthenticationData(SimAuthenticationType authType, int randLength, int autnLength, byte[] randData, byte[] autnData)
+ {
+ _authType = authType;
+ _randLength = randLength;
+ _autnLength = autnLength;
+ _randData = randData;
+ _autnData = autnData;
+ }
+
+ internal SimAuthenticationType AuthType
+ {
+ get
+ {
+ return _authType;
+ }
+ }
+
+ internal int RandLength
+ {
+ get
+ {
+ return _randLength;
+ }
+ }
+
+ internal int AutnLength
+ {
+ get
+ {
+ return _autnLength;
+ }
+ }
+
+ internal byte[] RandData
+ {
+ get
+ {
+ return _randData;
+ }
+ }
+
+ internal byte[] AutnData
+ {
+ get
+ {
+ return _autnData;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines authentication result data.
+ /// </summary>
+ public class SimAuthenticationResponse
+ {
+ internal SimAuthenticationType Type;
+ internal SimAuthenticationResult Result;
+ internal int RespLength;
+ internal string RespData;
+ internal int AuthKeyLen;
+ internal string Key;
+ internal int CipherLen;
+ internal string Cipher;
+ internal int IntegrityLen;
+ internal string Integrity;
+ internal SimAuthenticationResponse()
+ {
+ }
+
+ /// <summary>
+ /// Authentication type.
+ /// </summary>
+ public SimAuthenticationType AuthType
+ {
+ get
+ {
+ return Type;
+ }
+ }
+
+ /// <summary>
+ /// Authentication result.
+ /// </summary>
+ public SimAuthenticationResult AuthResult
+ {
+ get
+ {
+ return Result;
+ }
+ }
+
+ /// <summary>
+ /// Response length.
+ /// </summary>
+ public int ResponseLength
+ {
+ get
+ {
+ return RespLength;
+ }
+ }
+
+ /// <summary>
+ /// Response data.
+ /// </summary>
+ public string ResponseData
+ {
+ get
+ {
+ return RespData;
+ }
+ }
+
+ /// <summary>
+ /// The length of the authentication key.
+ /// </summary>
+ public int AuthKeyLength
+ {
+ get
+ {
+ return AuthKeyLen;
+ }
+ }
+
+ /// <summary>
+ /// The data of the authentication key.
+ /// </summary>
+ public string AuthKey
+ {
+ get
+ {
+ return Key;
+ }
+ }
+
+ /// <summary>
+ /// The length of the cipher key.
+ /// </summary>
+ public int CipherLength
+ {
+ get
+ {
+ return CipherLen;
+ }
+ }
+
+ /// <summary>
+ /// Cipher key.
+ /// </summary>
+ public string CipherData
+ {
+ get
+ {
+ return Cipher;
+ }
+ }
+
+ /// <summary>
+ /// The length of the integrity key.
+ /// </summary>
+ public int IntegrityLength
+ {
+ get
+ {
+ return IntegrityLen;
+ }
+ }
+
+ /// <summary>
+ /// Integrity key.
+ /// </summary>
+ public string IntegrityData
+ {
+ get
+ {
+ return Integrity;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines information about SIM PIN data.
+ /// </summary>
+ public class SimPinData
+ {
+ private SimPinType _type;
+ private string _pin;
+ private uint _pinLength;
+ private SimPinData()
+ {
+ }
+
+ /// <summary>
+ /// A constructor to instantiate SimPinData class which necessary parameters.
+ /// </summary>
+ /// <param name="type">PIN type.</param>
+ /// <param name="pin">PIN code.</param>
+ /// <param name="pinLength">PIN code length.</param>
+ public SimPinData(SimPinType type, string pin, uint pinLength)
+ {
+ _type = type;
+ _pin = pin;
+ _pinLength = pinLength;
+ }
+
+ internal SimPinType Type
+ {
+ get
+ {
+ return _type;
+ }
+ }
+
+ internal string Pin
+ {
+ get
+ {
+ return _pin;
+ }
+ }
+
+ internal uint PinLength
+ {
+ get
+ {
+ return _pinLength;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines PIN information.
+ /// </summary>
+ public class SimPinResult
+ {
+ internal SimPinType PinType;
+ internal int Retry;
+ internal SimPinResult()
+ {
+ }
+
+ /// <summary>
+ /// Specifies the PIN or PUK type.
+ /// </summary>
+ public SimPinType Type
+ {
+ get
+ {
+ return PinType;
+ }
+ }
+
+ /// <summary>
+ /// Number of attempts remaining for PIN/PUK verification.
+ /// </summary>
+ public int RetryCount
+ {
+ get
+ {
+ return Retry;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which is used to used to enable/disable facility.
+ /// </summary>
+ public class SimFacility
+ {
+ private SimLockType _lockType;
+ private string _password;
+ private int _passwordLength;
+ private SimFacility()
+ {
+ }
+
+ /// <summary>
+ /// A constructor to instantiate SimFacility class with necessary parameters.
+ /// </summary>
+ /// <param name="lockType">Facility type.</param>
+ /// <param name="password">Password.</param>
+ /// <param name="passwordLength">Password length.</param>
+ public SimFacility(SimLockType lockType, string password, int passwordLength)
+ {
+ _lockType = lockType;
+ _password = password;
+ _passwordLength = passwordLength;
+ }
+
+ internal SimLockType LockType
+ {
+ get
+ {
+ return _lockType;
+ }
+ }
+
+ internal string Password
+ {
+ get
+ {
+ return _password;
+ }
+ }
+
+ internal int PasswordLength
+ {
+ get
+ {
+ return _passwordLength;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines facility result data.
+ /// </summary>
+ public class SimFacilityResult
+ {
+ internal SimLockType LockType;
+ internal int Count;
+ internal SimFacilityResult()
+ {
+ }
+
+ /// <summary>
+ /// Specifies the PIN or PUK type.
+ /// </summary>
+ public SimLockType Type
+ {
+ get
+ {
+ return LockType;
+ }
+ }
+
+ /// <summary>
+ /// Number of attempts remaining for PIN/PUK verification.
+ /// </summary>
+ public int RetryCount
+ {
+ get
+ {
+ return Count;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines facility info data.
+ /// </summary>
+ public class SimFacilityInfo
+ {
+ internal SimLockType LockType;
+ internal SimFacilityStatus FacilityStatus;
+ internal SimFacilityInfo()
+ {
+ }
+
+ /// <summary>
+ /// Lock type.
+ /// </summary>
+ public SimLockType Type
+ {
+ get
+ {
+ return LockType;
+ }
+ }
+
+ /// <summary>
+ /// Facility status.
+ /// </summary>
+ public SimFacilityStatus Status
+ {
+ get
+ {
+ return FacilityStatus;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines information about lock type.
+ /// </summary>
+ public class SimLockInfo
+ {
+ internal SimLockType LockType;
+ internal SimLockStatus LockStatus;
+ internal int Count;
+ internal SimLockInfo()
+ {
+ }
+
+ /// <summary>
+ /// Lock type.
+ /// </summary>
+ public SimLockType Type
+ {
+ get
+ {
+ return LockType;
+ }
+ }
+
+ /// <summary>
+ /// Lock status.
+ /// </summary>
+ public SimLockStatus Status
+ {
+ get
+ {
+ return LockStatus;
+ }
+ }
+
+ /// <summary>
+ /// Retry counts.
+ /// </summary>
+ public int RetryCount
+ {
+ get
+ {
+ return Count;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines APDU information.
+ /// </summary>
+ public class SimApdu
+ {
+ private ushort _apduLength;
+ private byte[] _apdu;
+ private SimApdu()
+ {
+ }
+
+ /// <summary>
+ /// A constructor to instantiate SimApdu class with necessary parameters.
+ /// </summary>
+ /// <param name="apduLength">Length of APDU.</param>
+ /// <param name="apdu">APDU.</param>
+ public SimApdu(ushort apduLength, byte[] apdu)
+ {
+ _apduLength = apduLength;
+ _apdu = apdu;
+ }
+
+ internal ushort ApduLength
+ {
+ get
+ {
+ return _apduLength;
+ }
+ }
+
+ internal byte[] Apdu
+ {
+ get
+ {
+ return _apdu;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines the response of sending APDU.
+ /// </summary>
+ public class SimApduResponse
+ {
+ internal ushort ApduLen;
+ internal byte[] ApduResp;
+ internal SimApduResponse()
+ {
+ }
+
+ /// <summary>
+ /// Length of response APDU.
+ /// </summary>
+ public ushort ApduLength
+ {
+ get
+ {
+ return ApduLen;
+ }
+ }
+
+ /// <summary>
+ /// Response APDU.
+ /// </summary>
+ public byte[] ApduResponse
+ {
+ get
+ {
+ return ApduResp;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines the response of sending ATR.
+ /// </summary>
+ public class SimAtrResponse
+ {
+ internal ushort AtrRespLen;
+ internal byte[] AtrResp;
+ internal SimAtrResponse()
+ {
+ }
+
+ /// <summary>
+ /// Length of response ATR.
+ /// </summary>
+ public ushort AtrRespLength
+ {
+ get
+ {
+ return AtrRespLen;
+ }
+ }
+
+ /// <summary>
+ /// Response ATR.
+ /// </summary>
+ public byte[] AtrResponse
+ {
+ get
+ {
+ return AtrResp;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines ISIM IMPU list data.
+ /// </summary>
+ public class SimImpuList
+ {
+ internal uint DataCount;
+ internal IEnumerable<string> ImpuList;
+ internal SimImpuList()
+ {
+ }
+
+ /// <summary>
+ /// ISIM IMPU data count.
+ /// </summary>
+ public uint Count
+ {
+ get
+ {
+ return DataCount;
+ }
+ }
+
+ /// <summary>
+ /// ISIM IMPU list.
+ /// </summary>
+ public IEnumerable<string> List
+ {
+ get
+ {
+ return ImpuList;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines ISIM P-CSCF data.
+ /// </summary>
+ public class SimPcscf
+ {
+ internal SimPcscfType PcscfType;
+ internal string PcscfData;
+ internal SimPcscf()
+ {
+ }
+
+ /// <summary>
+ /// ISIM P-CSCF type.
+ /// </summary>
+ public SimPcscfType Type
+ {
+ get
+ {
+ return PcscfType;
+ }
+ }
+
+ /// <summary>
+ /// ISIM P-CSCF data.
+ /// </summary>
+ public string Pcscf
+ {
+ get
+ {
+ return PcscfData;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A class which defines ISIM P-CSCF list data.
+ /// </summary>
+ public class SimPcscfList
+ {
+ internal uint DataCount;
+ internal IEnumerable<SimPcscf> PcscfList;
+ internal SimPcscfList()
+ {
+ }
+
+ /// <summary>
+ /// ISIM P-CSCF data count.
+ /// </summary>
+ public uint Count
+ {
+ get
+ {
+ return DataCount;
+ }
+ }
+
+ /// <summary>
+ /// ISIM P-CSCF list.
+ /// </summary>
+ public IEnumerable<SimPcscf> List
+ {
+ get
+ {
+ return PcscfList;
+ }
+ }
+ }
+}
/// <summary>
/// Enumeration for the SIM card type.
/// </summary>
- public enum SimType
+ public enum SimCardType
{
/// <summary>
/// Unknown card.
}
/// <summary>
- /// Enumeration for the sim number type.
+ /// Enumeration for the SIM number type.
/// </summary>
public enum SimTypeOfNumber
{
/// </summary>
ReservedForExt
}
+
+ /// <summary>
+ /// Enumeration for the emergency service type.
+ /// </summary>
+ public enum SimEccEmergencyServiceType
+ {
+ /// <summary>
+ /// Police.
+ /// </summary>
+ Police = 0x01,
+ /// <summary>
+ /// Ambulance.
+ /// </summary>
+ Ambulance = 0x02,
+ /// <summary>
+ /// Fire brigade.
+ /// </summary>
+ FireBrigade = 0x04,
+ /// <summary>
+ /// Marine guard.
+ /// </summary>
+ MarineGuard = 0x08,
+ /// <summary>
+ /// Mountain rescue.
+ /// </summary>
+ MountainRescue = 0x10,
+ /// <summary>
+ /// Spare.
+ /// </summary>
+ Spare = 0x00
+ }
+
+ /// <summary>
+ /// Enumeration for the SIM app type.
+ /// </summary>
+ public enum SimAppType
+ {
+ /// <summary>
+ /// SIM application.
+ /// </summary>
+ Sim = 0x01,
+ /// <summary>
+ /// USIM application.
+ /// </summary>
+ Usim = 0x02,
+ /// <summary>
+ /// CSIM application.
+ /// </summary>
+ Csim = 0x04,
+ /// <summary>
+ /// ISIM application.
+ /// </summary>
+ Isim = 0x08
+ }
+
+ /// <summary>
+ /// Enumeration for the SIM access result from the lower layers.
+ /// </summary>
+ public enum SimAccessResult
+ {
+ /// <summary>
+ /// Access to file is successful.
+ /// </summary>
+ Success,
+ /// <summary>
+ /// SIM card error.
+ /// </summary>
+ CardError,
+ /// <summary>
+ /// File not found.
+ /// </summary>
+ FileNotFound,
+ /// <summary>
+ /// Access condition is not fulfilled.
+ /// </summary>
+ ConditionNotSatisfied,
+ /// <summary>
+ /// Access failed.
+ /// </summary>
+ Failed
+ }
+
+ /// <summary>
+ /// Enumeration for the mailbox type.
+ /// </summary>
+ public enum SimMailboxType
+ {
+ /// <summary>
+ /// Voicemail.
+ /// </summary>
+ Voice = 0x01,
+ /// <summary>
+ /// Fax.
+ /// </summary>
+ Fax = 0x02,
+ /// <summary>
+ /// Email.
+ /// </summary>
+ Email = 0x03,
+ /// <summary>
+ /// Other.
+ /// </summary>
+ Other = 0x04,
+ /// <summary>
+ /// Videomail.
+ /// </summary>
+ Video = 0x05,
+ /// <summary>
+ /// Data.
+ /// </summary>
+ Data = 0x06
+ }
+
+ /// <summary>
+ /// Enumeration for the current CPHS phase of the SIM card.
+ /// </summary>
+ public enum SimCphsPhaseType
+ {
+ /// <summary>
+ /// Phase 1.
+ /// </summary>
+ Phase1 = 0x01,
+ /// <summary>
+ /// Phase 2.
+ /// </summary>
+ Phase2 = 0x02,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu = 0xff
+ }
+
+ /// <summary>
+ /// Enumeration for CDMA service table.
+ /// </summary>
+ public enum SimCdmaServiceTable
+ {
+ /// <summary>
+ /// CDMA service table.
+ /// </summary>
+ Cdma = 0,
+ /// <summary>
+ /// CSIM service table.
+ /// </summary>
+ Csim,
+ /// <summary>
+ /// MAX value.
+ /// </summary>
+ Max
+ }
+
+ /// <summary>
+ /// Enumeration for the SIM Authentication type.
+ /// </summary>
+ public enum SimAuthenticationType
+ {
+ /// <summary>
+ /// IMS Authentication.
+ /// </summary>
+ Ims = 0x00,
+ /// <summary>
+ /// GSM Authentication.
+ /// </summary>
+ Gsm,
+ /// <summary>
+ /// 3G Authentication.
+ /// </summary>
+ Auth3G,
+ /// <summary>
+ /// CDMA CAVE Authentication.
+ /// </summary>
+ RuimCave,
+ /// <summary>
+ /// CDMA CHAP Authentication.
+ /// </summary>
+ RuimChap,
+ /// <summary>
+ /// CDMA MNHA Authentication.
+ /// </summary>
+ RuimMnha,
+ /// <summary>
+ /// CDMA MIPRRQ Authentication.
+ /// </summary>
+ RuimMiprrq,
+ /// <summary>
+ /// CDMA MNAAA Authentication.
+ /// </summary>
+ RuimMnaaa,
+ /// <summary>
+ /// CDMA HRPD Authentication.
+ /// </summary>
+ RuimHrpd,
+ /// <summary>
+ /// MAX value.
+ /// </summary>
+ Max
+ }
+
+ /// <summary>
+ /// Enumeration for the SIM Authentication result.
+ /// </summary>
+ public enum SimAuthenticationResult
+ {
+ /// <summary>
+ /// Status - no error.
+ /// </summary>
+ NoError = 0x00,
+ /// <summary>
+ /// Status - can't perform authentication.
+ /// </summary>
+ CannotPerform,
+ /// <summary>
+ /// Status - skip authentication response.
+ /// </summary>
+ SkipResponse,
+ /// <summary>
+ /// Status - MAK(Multiple Activation Key) code failure.
+ /// </summary>
+ MakCodeFailure,
+ /// <summary>
+ /// Status - SQN(SeQuenceNumber) failure.
+ /// </summary>
+ SqnFailure,
+ /// <summary>
+ /// Status - synch failure.
+ /// </summary>
+ SynchFailure,
+ /// <summary>
+ /// Status - unsupported context.
+ /// </summary>
+ UnsupportedContext,
+ /// <summary>
+ /// Status - default error.
+ /// </summary>
+ Error,
+ /// <summary>
+ /// MAX value.
+ /// </summary>
+ Max
+ }
+
+ /// <summary>
+ /// Enumeration for the PIN type.
+ /// </summary>
+ public enum SimPinType
+ {
+ /// <summary>
+ /// PIN 1 code.
+ /// </summary>
+ Pin1 = 0x00,
+ /// <summary>
+ /// PIN 2 code.
+ /// </summary>
+ Pin2 = 0x01,
+ /// <summary>
+ /// PUK 1 code.
+ /// </summary>
+ Puk1 = 0x02,
+ /// <summary>
+ /// PUK 2 code.
+ /// </summary>
+ Puk2 = 0x03,
+ /// <summary>
+ /// Universal PIN - Unused now.
+ /// </summary>
+ Upin = 0x04,
+ /// <summary>
+ /// Administrator - Unused now.
+ /// </summary>
+ Adm = 0x05,
+ /// <summary>
+ /// SIM Lock code.
+ /// </summary>
+ Sim = 0x06
+ }
+
+ /// <summary>
+ /// Enumeration for the PIN status.
+ /// </summary>
+ public enum SimFacilityStatus
+ {
+ /// <summary>
+ /// Facility disabled.
+ /// </summary>
+ Disabled = 0x00,
+ /// <summary>
+ /// Facility enabled.
+ /// </summary>
+ Enabled = 0x01,
+ /// <summary>
+ /// Facility unknown.
+ /// </summary>
+ Unknown = 0xFF
+ }
+
+ /// <summary>
+ /// Enumeration for the security lock key information.
+ /// </summary>
+ public enum SimLockStatus
+ {
+ /// <summary>
+ /// Key not needed.
+ /// </summary>
+ NotNeeded = 0x00,
+ /// <summary>
+ /// PIN required.
+ /// </summary>
+ Pin = 0x01,
+ /// <summary>
+ /// PUK required.
+ /// </summary>
+ Puk = 0x02,
+ /// <summary>
+ /// PIN2 required.
+ /// </summary>
+ Pin2 = 0x03,
+ /// <summary>
+ /// PUK2 required.
+ /// </summary>
+ Puk2 = 0x04,
+ /// <summary>
+ /// Permanent block SIM.
+ /// </summary>
+ PermanentBlocked = 0x05
+ }
+
+ /// <summary>
+ /// Enumeration for P-CSCF type.
+ /// </summary>
+ public enum SimPcscfType
+ {
+ /// <summary>
+ /// Fully Qualified Domain Name.
+ /// </summary>
+ Fqdn,
+ /// <summary>
+ /// IPv4.
+ /// </summary>
+ IPv4,
+ /// <summary>
+ /// IPv6.
+ /// </summary>
+ IPv6
+ }
+
+ /// <summary>
+ /// Enumeration for the SIM power set result from the lower layers.
+ /// </summary>
+ public enum SimPowerSetResult
+ {
+ /// <summary>
+ /// Power Set is successful.
+ /// </summary>
+ Success,
+ /// <summary>
+ /// Power Set failure.
+ /// </summary>
+ Failure
+ }
+
+ /// <summary>
+ /// Enumeration for the list of IST services in the ISIM Service Table (ISIM).
+ /// </summary>
+ public enum SimIsimService
+ {
+ /// <summary>
+ /// P-CSCF address.
+ /// </summary>
+ PcscfAddr = 0,
+ /// <summary>
+ /// Generic Bootstrapping Architecture.
+ /// </summary>
+ Gba,
+ /// <summary>
+ /// HTTP Digest.
+ /// </summary>
+ HttpDigest,
+ /// <summary>
+ /// GBA-based Local Key Establishment Mechanism.
+ /// </summary>
+ GbaLocalKey,
+ /// <summary>
+ /// Support of P-CSCF discovery for IMS Local Break Out.
+ /// </summary>
+ PcscfLocalBreakOut,
+ /// <summary>
+ /// Short Message Storage.
+ /// </summary>
+ Sms,
+ /// <summary>
+ /// Short Message Status Reports.
+ /// </summary>
+ Smsr,
+ /// <summary>
+ /// Support for SM-over-IP including data download via SMS-PP as defined in TS 31.111 [31]
+ /// </summary>
+ SmOverIP,
+ /// <summary>
+ /// Communication Control for IMS by ISIM.
+ /// </summary>
+ CommunicationControl = 8,
+ /// <summary>
+ /// Support of UICC access to IMS.
+ /// </summary>
+ AccessToIms,
+ /// <summary>
+ /// URI support by UICC.
+ /// </summary>
+ UriSupport
+ }
+
+ /// <summary>
+ /// Enumeration for the list of SST services in the SIM Service Table (GSM).
+ /// </summary>
+ public enum SimSstService
+ {
+ /// <summary>
+ /// CHV1 disable function.
+ /// </summary>
+ Chv1DisableFunc = 0,
+ /// <summary>
+ /// Abbreviated Dialing number.
+ /// </summary>
+ Adn,
+ /// <summary>
+ /// Fixed Dialing number.
+ /// </summary>
+ Fdn,
+ /// <summary>
+ /// Short message storage.
+ /// </summary>
+ Sms,
+ /// <summary>
+ /// Advice of charge.
+ /// </summary>
+ Aoc,
+ /// <summary>
+ /// Capability configuration parameters.
+ /// </summary>
+ Ccp,
+ /// <summary>
+ /// PLMN selector.
+ /// </summary>
+ PlmnSelector,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu1,
+ /// <summary>
+ /// MSISDN.
+ /// </summary>
+ Msisdn = 8,
+ /// <summary>
+ /// Extension 1.
+ /// </summary>
+ Ext1,
+ /// <summary>
+ /// Extension 2.
+ /// </summary>
+ Ext2,
+ /// <summary>
+ /// SMS parameters.
+ /// </summary>
+ SmsParams,
+ /// <summary>
+ /// Last number dialed.
+ /// </summary>
+ Lnd,
+ /// <summary>
+ /// Cell broadcast message identifier.
+ /// </summary>
+ CellBroadcastMsgId,
+ /// <summary>
+ /// Group identifier level 1.
+ /// </summary>
+ GidLv1,
+ /// <summary>
+ /// Group identifier level 2.
+ /// </summary>
+ GidLv2,
+ /// <summary>
+ /// Service provider name.
+ /// </summary>
+ Spn = 16,
+ /// <summary>
+ /// Service Dialing number.
+ /// </summary>
+ Sdn,
+ /// <summary>
+ /// Extension3.
+ /// </summary>
+ Ext3,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ RFu2,
+ /// <summary>
+ /// VGCS group identifier (EF-VGCS, EF-VGCSS).
+ /// </summary>
+ VgcsGidList,
+ /// <summary>
+ /// VBS group identifier (EF-VBS, EF-VBSS).
+ /// </summary>
+ VbsGidList,
+ /// <summary>
+ /// Enhanced multi-level precedence and pre-emption service.
+ /// </summary>
+ EnhancedMultiLvPrecedencePreemptionSrvc,
+ /// <summary>
+ /// Automatic answer for EMLPP.
+ /// </summary>
+ AutoAnswerForEmlpp,
+ /// <summary>
+ /// Data download via SMS-CB.
+ /// </summary>
+ DataDownloadViaSmsCb = 24,
+ /// <summary>
+ /// Data download via SMS-PP.
+ /// </summary>
+ DataDownloadViaSmsPp,
+ /// <summary>
+ /// Menu selection.
+ /// </summary>
+ MenuSelection,
+ /// <summary>
+ /// Call control.
+ /// </summary>
+ CallCtrl,
+ /// <summary>
+ /// Proactive SIM command.
+ /// </summary>
+ ProactiveSim,
+ /// <summary>
+ /// Cell broadcast message identifier ranges.
+ /// </summary>
+ CellBroadcastMsgIdRanges,
+ /// <summary>
+ /// Barred Dialing numbers.
+ /// </summary>
+ Bdn,
+ /// <summary>
+ /// Extension 4.
+ /// </summary>
+ Ext4,
+ /// <summary>
+ /// De-personalization control keys.
+ /// </summary>
+ DepersonalizationCtrlKeys = 32,
+ /// <summary>
+ /// Co-operative network list.
+ /// </summary>
+ CooperativeNetworkList,
+ /// <summary>
+ /// Short message status reports.
+ /// </summary>
+ SmsStatusReports,
+ /// <summary>
+ /// Network's indication of alerting in the MS (NIA).
+ /// </summary>
+ Nia,
+ /// <summary>
+ /// Mobile-originated short message control by SIM.
+ /// </summary>
+ MoSmsCtrlBySim,
+ /// <summary>
+ /// GPRS.
+ /// </summary>
+ Gprs,
+ /// <summary>
+ /// Image.
+ /// </summary>
+ Img,
+ /// <summary>
+ /// Support of local service area.
+ /// </summary>
+ Solsa,
+ /// <summary>
+ /// USSD string data object supported in call control.
+ /// </summary>
+ UssdStrDataObjectSupportedInCallCtrl = 40,
+ /// <summary>
+ /// Run at COMMAND command.
+ /// </summary>
+ RunAtCmdCmd,
+ /// <summary>
+ /// User controlled PLMN selector with Access technology.
+ /// </summary>
+ UserCtrledPlmnSelectorWact,
+ /// <summary>
+ /// Operator controlled PLMN selector with Access technology.
+ /// </summary>
+ OperatorCtrledPlmnSelectorWact,
+ /// <summary>
+ /// HPLMN selector with access technology.
+ /// </summary>
+ HplmnSelectorWact,
+ /// <summary>
+ /// CPBCCH information.
+ /// </summary>
+ CpbcchInfo,
+ /// <summary>
+ /// Investigation scan.
+ /// </summary>
+ InvestigationScan,
+ /// <summary>
+ /// Extended capability configuration parameters.
+ /// </summary>
+ ExtendedCapaConfParams,
+ /// <summary>
+ /// MExE.
+ /// </summary>
+ Mexe = 48,
+ /// <summary>
+ /// RPLMN last used access technology.
+ /// </summary>
+ RplmnLastUsedAccessTech,
+ /// <summary>
+ /// PLMN Network Name.
+ /// </summary>
+ PlmnNetworkName,
+ /// <summary>
+ /// Operator PLMN List.
+ /// </summary>
+ OperatorPlmnList,
+ /// <summary>
+ /// Mailbox Dialling Numbers.
+ /// </summary>
+ Mbdn,
+ /// <summary>
+ /// Message Waiting Indication Status.
+ /// </summary>
+ Mwis,
+ /// <summary>
+ /// Call Forwarding Indication Status.
+ /// </summary>
+ Cfis,
+ /// <summary>
+ /// Service Provider Display Information.
+ /// </summary>
+ Spdi
+ }
+
+ /// <summary>
+ /// Enumeration for the list of UST services in the SIM Service Table (USIM).
+ /// </summary>
+ public enum SimUstService
+ {
+ /// <summary>
+ /// Local phone book.
+ /// </summary>
+ LocalPb = 0,
+ /// <summary>
+ /// Fixed Dialing number.
+ /// </summary>
+ Fdn,
+ /// <summary>
+ /// Extension 2.
+ /// </summary>
+ Ext2,
+ /// <summary>
+ /// Service Dialing number.
+ /// </summary>
+ Sdn,
+ /// <summary>
+ /// Extension 3.
+ /// </summary>
+ Ext3,
+ /// <summary>
+ /// Barred Dialing numbers.
+ /// </summary>
+ Bdn,
+ /// <summary>
+ /// Extension 4.
+ /// </summary>
+ Ext4,
+ /// <summary>
+ /// Outgoing call information.
+ /// </summary>
+ OutgoingCallInfo,
+ /// <summary>
+ /// Incoming call information.
+ /// </summary>
+ IncomingCallInfo = 8,
+ /// <summary>
+ /// Short message storage.
+ /// </summary>
+ Sms,
+ /// <summary>
+ /// Short message status reports.
+ /// </summary>
+ SmsStatusReports,
+ /// <summary>
+ /// SMS parameters.
+ /// </summary>
+ SmsParams,
+ /// <summary>
+ /// Advice of charge.
+ /// </summary>
+ Aoc,
+ /// <summary>
+ /// Capability configuration parameters.
+ /// </summary>
+ Ccp,
+ /// <summary>
+ /// Cell broadcast message identifier.
+ /// </summary>
+ CellBroadcastMsgId,
+ /// <summary>
+ /// Cell broadcast message identifier ranges.
+ /// </summary>
+ CellBroadcastMsgIdRanges,
+ /// <summary>
+ /// Group identifier level 1.
+ /// </summary>
+ GidLv1 = 16,
+ /// <summary>
+ /// Group identifier level 2.
+ /// </summary>
+ GidLv2,
+ /// <summary>
+ /// Service provider name.
+ /// </summary>
+ Spn,
+ /// <summary>
+ /// User controlled PLMN selector with Access technology.
+ /// </summary>
+ UserCtrledPlmnSelectorWact,
+ /// <summary>
+ /// MSISDN.
+ /// </summary>
+ Msisdn,
+ /// <summary>
+ /// Image.
+ /// </summary>
+ Img,
+ /// <summary>
+ /// Support of local service area.
+ /// </summary>
+ Solsa,
+ /// <summary>
+ /// Enhanced multi-level precedence and pre-emption service.
+ /// </summary>
+ EnhancedMultiLvPrecedencePreemptionSrvc,
+ /// <summary>
+ /// Automatic answer for EMLPP.
+ /// </summary>
+ AutoAnswerForEmlpp = 24,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu1,
+ /// <summary>
+ /// GSM access.
+ /// </summary>
+ GsmAccess,
+ /// <summary>
+ /// Data download via SMS-PP.
+ /// </summary>
+ DataDownloadViaSmsPp,
+ /// <summary>
+ /// Data download via SMS-CB.
+ /// </summary>
+ DataDownloadViaSmsCb,
+ /// <summary>
+ /// Call control by USIM.
+ /// </summary>
+ CallCtrl,
+ /// <summary>
+ /// Mobile-originated short message control by USIM.
+ /// </summary>
+ MoSmsCtrl,
+ /// <summary>
+ /// Run at COMMAND command.
+ /// </summary>
+ RunAtCmdCmd,
+ /// <summary>
+ /// Shall be set to 1.
+ /// </summary>
+ ShallBeSetToOne = 32,
+ /// <summary>
+ /// Enabled service table.
+ /// </summary>
+ EnabledSrvcTable,
+ /// <summary>
+ /// APN control list.
+ /// </summary>
+ Acl,
+ /// <summary>
+ /// De-personalization control keys.
+ /// </summary>
+ DepersonalizationCtrlKeys,
+ /// <summary>
+ /// Co-operative network list.
+ /// </summary>
+ CooperativeNetworkList,
+ /// <summary>
+ /// GSM security context.
+ /// </summary>
+ GsmSecContext,
+ /// <summary>
+ /// CPBCCH information.
+ /// </summary>
+ CpbcchInfo,
+ /// <summary>
+ /// Investigation scan.
+ /// </summary>
+ InvestigationScan,
+ /// <summary>
+ /// MExE.
+ /// </summary>
+ Mexe = 40,
+ /// <summary>
+ /// Operator controlled PLMN selector with Access technology.
+ /// </summary>
+ OperatorCtrledPlmnSelectorWact,
+ /// <summary>
+ /// HPLMN selector with access technology.
+ /// </summary>
+ HplmnSelectorWact,
+ /// <summary>
+ /// Extension 5.
+ /// </summary>
+ Ext5,
+ /// <summary>
+ /// PLMN Network Name.
+ /// </summary>
+ PlmnNetworkName,
+ /// <summary>
+ /// Operator PLMN List.
+ /// </summary>
+ OperatorPlmnList,
+ /// <summary>
+ /// Mailbox Dialling Numbers.
+ /// </summary>
+ Mbdn,
+ /// <summary>
+ /// Message Waiting Indication Status.
+ /// </summary>
+ Mwis,
+ /// <summary>
+ /// Call Forwarding Indication Status.
+ /// </summary>
+ Cfis = 48,
+ /// <summary>
+ /// RPLMN last used access technology.
+ /// </summary>
+ RplmnLastUsedAccessTech,
+ /// <summary>
+ /// Service Provider Display Information.
+ /// </summary>
+ Spdi,
+ /// <summary>
+ /// Multi media messaging service.
+ /// </summary>
+ Mms,
+ /// <summary>
+ /// Extension 8.
+ /// </summary>
+ Ext8,
+ /// <summary>
+ /// Call control on GPRS by USIM.
+ /// </summary>
+ CallCtrlOnGprs,
+ /// <summary>
+ /// MMS user connectivity parameters.
+ /// </summary>
+ MmsUserConnectivityParams,
+ /// <summary>
+ /// Network's indication of alerting in the MS (NIA).
+ /// </summary>
+ Nia,
+ /// <summary>
+ /// VGCS group identifier List (EF-VGCS, EF-VGCSS).
+ /// </summary>
+ VgcsGidList = 56,
+ /// <summary>
+ /// VBS group identifier List (EF-VBS, EF-VBSS).
+ /// </summary>
+ VbsGidList,
+ /// <summary>
+ /// Pseudonym.
+ /// </summary>
+ Pseudonym,
+ /// <summary>
+ /// User controlled PLMN selector for I-WLAN access.
+ /// </summary>
+ UserCtrledPlmnSelectorIwlan,
+ /// <summary>
+ /// Operator controlled PLMN selector for I-WLAN access.
+ /// </summary>
+ OperatorCtrledPlmnSelectorIwlan,
+ /// <summary>
+ /// User controlled WSID list.
+ /// </summary>
+ UserCtrledWsidList,
+ /// <summary>
+ /// Opertor controlled Wsid list.
+ /// </summary>
+ OperatorCtrledWsidList,
+ /// <summary>
+ /// VGCS security.
+ /// </summary>
+ VgcsSec
+ }
+
+ /// <summary>
+ /// Enumeration for the list of CST services in the CDMA Service Table.
+ /// </summary>
+ public enum SimCdmaService
+ {
+ /// <summary>
+ /// CHV Disable Option.
+ /// </summary>
+ ChvDisable = 0,
+ /// <summary>
+ /// Abbreviated Dialing number.
+ /// </summary>
+ Adn,
+ /// <summary>
+ /// Fixed Dialing number.
+ /// </summary>
+ Fdn,
+ /// <summary>
+ /// Short message storage.
+ /// </summary>
+ Sms,
+ /// <summary>
+ /// HRPD.
+ /// </summary>
+ Hrpd,
+ /// <summary>
+ /// Enhanced Phone Book.
+ /// </summary>
+ Epb,
+ /// <summary>
+ /// Multimedia domain.
+ /// </summary>
+ Mmd,
+ /// <summary>
+ /// SF_EUIMID- based EUIMID.
+ /// </summary>
+ Euimid,
+ /// <summary>
+ /// MEID.
+ /// </summary>
+ Meid = 8,
+ /// <summary>
+ /// Extension 1.
+ /// </summary>
+ Ext1,
+ /// <summary>
+ /// Extension 2.
+ /// </summary>
+ Ext2,
+ /// <summary>
+ /// SMS parameters.
+ /// </summary>
+ Smsp,
+ /// <summary>
+ /// Last number dialled.
+ /// </summary>
+ Lnd,
+ /// <summary>
+ /// Service Category Program for BC-SMS.
+ /// </summary>
+ Scp,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu1,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu2,
+ /// <summary>
+ /// CDMA Home Service Provider Name.
+ /// </summary>
+ Hspn = 16,
+ /// <summary>
+ /// Service Dialing number.
+ /// </summary>
+ Sdn,
+ /// <summary>
+ /// Extension 3.
+ /// </summary>
+ Ext3,
+ /// <summary>
+ /// 3GPD-SIP.
+ /// </summary>
+ St3GpdSip,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu3,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu4,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu5,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu6,
+ /// <summary>
+ /// Data download by SMS broadcast.
+ /// </summary>
+ Ddsmsb = 24,
+ /// <summary>
+ /// Data download by SMS PP.
+ /// </summary>
+ Ddsmspp,
+ /// <summary>
+ /// Menu Selection.
+ /// </summary>
+ Menu,
+ /// <summary>
+ /// Call Control.
+ /// </summary>
+ Callc,
+ /// <summary>
+ /// Proactive RUIM.
+ /// </summary>
+ Proactive,
+ /// <summary>
+ /// AKA.
+ /// </summary>
+ Aka,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu7,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu8,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu9 = 32,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu10,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu11,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu12,
+ /// <summary>
+ /// RFU.
+ /// </summary>
+ Rfu13,
+ /// <summary>
+ /// 3GPD- MIP.
+ /// </summary>
+ St3GpdMip,
+ /// <summary>
+ /// BCMCS.
+ /// </summary>
+ Bcmcs,
+ /// <summary>
+ /// Multimedia messaging service.
+ /// </summary>
+ Mms,
+ /// <summary>
+ /// Extension 8.
+ /// </summary>
+ Ext8 = 40,
+ /// <summary>
+ /// MMS User Connectivity Parameters.
+ /// </summary>
+ Mmsucp,
+ /// <summary>
+ /// Application Authentication.
+ /// </summary>
+ Aa,
+ /// <summary>
+ /// Group Identifier Level 1.
+ /// </summary>
+ Gil1,
+ /// <summary>
+ /// Group Identifier Level 2.
+ /// </summary>
+ Gil2,
+ /// <summary>
+ /// Depersonalisation control keys.
+ /// </summary>
+ Deperso,
+ /// <summary>
+ /// Co-operative Network List.
+ /// </summary>
+ Cnl
+ }
+
+ /// <summary>
+ /// Enumeration for the list of CST services in the CSIM Service Table (CSIM).
+ /// </summary>
+ public enum SimCsimService
+ {
+ /// <summary>
+ /// Local Phone book.
+ /// </summary>
+ LocalPhonebook = 0,
+ /// <summary>
+ /// Fixed Dialing Numbers (FDN).
+ /// </summary>
+ Fdn,
+ /// <summary>
+ /// Extension 2.
+ /// </summary>
+ Ext2,
+ /// <summary>
+ /// Service Dialing Numbers (SDN).
+ /// </summary>
+ Sdn,
+ /// <summary>
+ /// Extension 3.
+ /// </summary>
+ Ext3,
+ /// <summary>
+ /// Short Message Storage (SMS).
+ /// </summary>
+ Sms,
+ /// <summary>
+ /// Short Message Parameters.
+ /// </summary>
+ Smsp,
+ /// <summary>
+ /// HRPD.
+ /// </summary>
+ Hrpd,
+ /// <summary>
+ /// Service Category Program for BC-SMS.
+ /// </summary>
+ Scp = 8,
+ /// <summary>
+ /// CDMA Home Service Provider Name.
+ /// </summary>
+ Hspn,
+ /// <summary>
+ /// Data Download via SMS Broadcast.
+ /// </summary>
+ DdSmsb,
+ /// <summary>
+ /// Data Download via SMS-PP.
+ /// </summary>
+ DdSmsPp,
+ /// <summary>
+ /// Call Control.
+ /// </summary>
+ Callc,
+ /// <summary>
+ /// 3GPD-SIP.
+ /// </summary>
+ St3GpdSip,
+ /// <summary>
+ /// 3GPD-MIP.
+ /// </summary>
+ St3GpdMip,
+ /// <summary>
+ /// AKA.
+ /// </summary>
+ Aka,
+ /// <summary>
+ /// IP-based Location Services (LCS).
+ /// </summary>
+ IPLcs = 16,
+ /// <summary>
+ /// BCMCS.
+ /// </summary>
+ Bcmcs,
+ /// <summary>
+ /// Multimedia Messaging Service (MMS).
+ /// </summary>
+ Mms,
+ /// <summary>
+ /// Extension 8.
+ /// </summary>
+ Ext8,
+ /// <summary>
+ /// MMS User Connectivity Parameters.
+ /// </summary>
+ Mmsucp,
+ /// <summary>
+ /// Application Authentication.
+ /// </summary>
+ Aa,
+ /// <summary>
+ /// Group Identifier Level 1.
+ /// </summary>
+ Gil1,
+ /// <summary>
+ /// Group Identifier Level 2.
+ /// </summary>
+ Gil2,
+ /// <summary>
+ /// De-Personalization Control Keys.
+ /// </summary>
+ Deperso = 24,
+ /// <summary>
+ /// Cooperative Network List.
+ /// </summary>
+ Cnl,
+ /// <summary>
+ /// Outgoing Call Information (OCI).
+ /// </summary>
+ Oci,
+ /// <summary>
+ /// Incoming Call Information (ICI).
+ /// </summary>
+ Ici,
+ /// <summary>
+ /// Extension 5.
+ /// </summary>
+ Ext5,
+ /// <summary>
+ /// Multimedia Storage.
+ /// </summary>
+ MmStorage,
+ /// <summary>
+ /// Image (EFIMG).
+ /// </summary>
+ Img,
+ /// <summary>
+ /// Enabled Services Table.
+ /// </summary>
+ Est,
+ /// <summary>
+ /// Capability Configuration Parameters (CCP).
+ /// </summary>
+ Ccp = 32,
+ /// <summary>
+ /// SF_EUIMID-based EUIMID.
+ /// </summary>
+ Euimidl,
+ /// <summary>
+ /// Messaging and 3GPD Extensions.
+ /// </summary>
+ St3GpdExt,
+ /// <summary>
+ /// Root Certificates.
+ /// </summary>
+ RootCerti,
+ /// <summary>
+ /// WAP Browser.
+ /// </summary>
+ Wap,
+ /// <summary>
+ /// Java.
+ /// </summary>
+ Java,
+ /// <summary>
+ /// Reserved for CDG.
+ /// </summary>
+ RsvdCdg1,
+ /// <summary>
+ /// Reserved for CDG.
+ /// </summary>
+ RsvdCdg2,
+ /// <summary>
+ /// IPv6.
+ /// </summary>
+ IPv6 = 40
+ }
}
* limitations under the License.
*/
+using System;
using System.Runtime.InteropServices;
+using System.Collections.Generic;
+using System.Text;
namespace Tizen.Tapi
{
[StructLayout(LayoutKind.Sequential)]
internal struct SimImsiInfoStruct
{
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
+ internal string Mcc;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
+ internal string Mnc;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)]
+ internal string Msin;
}
[StructLayout(LayoutKind.Sequential)]
internal struct SimEccInfoStruct
{
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)]
+ internal string Name;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 7)]
+ internal string Number;
+ internal SimEccEmergencyServiceType Type;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimEccInfoListStruct
+ {
+ internal int Count;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.LPStruct)]
+ internal SimEccInfoStruct[] ListInfo;
+ }
+
+ [StructLayout(LayoutKind.Explicit)]
+ internal struct CfDataStruct
+ {
+ [FieldOffset(0)]
+ internal SimCfisStruct Cfis;
+ [FieldOffset(0)]
+ internal SimCphsCfStruct CphsCf;
}
[StructLayout(LayoutKind.Sequential)]
internal struct SimCallForwardRequestStruct
{
+ internal int IsCphs;
+ internal CfDataStruct CfData;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimCfisStruct
+ {
+ internal int RecIndex;
+ internal byte MspNum;
+ internal byte CfuStatus;
+ internal SimTypeOfNumber Ton;
+ internal SimNumberPlanIdentity Npi;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 21)]
+ internal string CfuNum;
+ internal byte Cc2Id;
+ internal byte Ext7Id;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimCfisListStruct
+ {
+ internal int ProfileCount;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.LPStruct)]
+ internal SimCfisStruct[] CfisList;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimCphsCfStruct
+ {
+ internal int Line1;
+ internal int Line2;
+ internal int Fax;
+ internal int Data;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimCallForwardResponseStruct
+ {
+ internal int IsCphs;
+ internal SimCfisListStruct CfList;
+ internal SimCphsCfStruct CphsCf;
+ }
+
+ [StructLayout(LayoutKind.Explicit)]
+ internal struct MwData
+ {
+ [FieldOffset(0)]
+ internal SimMwisStruct Mwis;
+ [FieldOffset(0)]
+ internal SimCphsMwStruct CphsMw;
}
[StructLayout(LayoutKind.Sequential)]
internal struct SimMessageWaitingRequestStruct
{
+ internal int IsCphs;
+ internal MwData Mw;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimMwisStruct
+ {
+ internal int RecIndex;
+ internal byte IndicatorStatus;
+ internal int VoiceCount;
+ internal int FaxCount;
+ internal int EmailCount;
+ internal int OtherCount;
+ internal int VideoCount;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimMwisListStruct
+ {
+ internal int ProfileCount;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.LPStruct)]
+ internal SimMwisStruct[] MwList;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimCphsMwStruct
+ {
+ internal int Voice1;
+ internal int Voice2;
+ internal int Fax;
+ internal int Data;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimMessageWaitingResponseStruct
+ {
+ internal int IsCphs;
+ internal SimMwisListStruct MwList;
+ internal SimCphsMwStruct CphsMw;
}
[StructLayout(LayoutKind.Sequential)]
internal struct SimMailboxNumberStruct
{
+ internal int IsCphs;
+ internal int RecIndex;
+ internal int ProfileNum;
+ internal SimMailboxType MbType;
+ internal int AlphaMaxLen;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)]
+ internal string AlphaId;
+ internal SimTypeOfNumber Ton;
+ internal SimNumberPlanIdentity Npi;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 21)]
+ internal string Number;
+ internal byte CcId;
+ internal byte Ext1Id;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimMailboxListStruct
+ {
+ internal int Count;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.LPStruct)]
+ internal SimMailboxNumberStruct[] List;
}
[StructLayout(LayoutKind.Sequential)]
internal struct SimAuthenticationDataStruct
{
+ internal SimAuthenticationType AuthType;
+ internal int RandLength;
+ internal int AutnLength;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
+ internal string RandData;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
+ internal string AutnData;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimAuthenticationResponseStruct
+ {
+ internal SimAuthenticationType AuthType;
+ internal SimAuthenticationResult AuthResult;
+ internal int RespLength;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
+ internal string RespData;
+ internal int AuthKeyLength;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
+ internal string AuthKey;
+ internal int CipherLength;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
+ internal string CipherData;
+ internal int IntegrityLength;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
+ internal string IntegrityData;
}
[StructLayout(LayoutKind.Sequential)]
internal struct SimPinDataStruct
{
+ internal SimPinType Type;
+ [MarshalAs(UnmanagedType.LPStr)]
+ internal string Pin;
+ internal uint PinLength;
}
[StructLayout(LayoutKind.Sequential)]
internal struct SimFacilityStruct
{
+ internal SimLockType LockType;
+ [MarshalAs(UnmanagedType.LPStr)]
+ internal string Password;
+ internal int PasswordLength;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimFacilityResultStruct
+ {
+ internal SimLockType Type;
+ internal int RetryCount;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimFacilityInfoStruct
+ {
+ internal SimLockType Type;
+ internal SimFacilityStatus Status;
}
[StructLayout(LayoutKind.Sequential)]
internal struct SimApduStruct
{
+ internal ushort ApduLen;
+ [MarshalAs(UnmanagedType.LPStr)]
+ internal string Apdu;
+ }
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimApduResponseStruct
+ {
+ internal ushort RespLen;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 5120)]
+ internal string ApduResp;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimIccIdInfoStruct
+ {
+ internal int IccLength;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
+ internal string IccNumber;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimCphsServiceTableStruct
+ {
+ internal int CustomerServiceProfile;
+ internal int ServiceStringTable;
+ internal int MailboxNumbers;
+ internal int OperatorNameShortForm;
+ internal int InformationNumbers;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimCphsInfoStruct
+ {
+ internal SimCphsPhaseType CphsPhase;
+ internal SimCphsServiceTableStruct CphsServiceTable;
+ }
+
+ [StructLayout(LayoutKind.Explicit)]
+ internal struct CstServiceStrct
+ {
+ [FieldOffset(0)]
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 47)]
+ internal string CdmaService;
+ [FieldOffset(0)]
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 41)]
+ internal string CsimService;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimCstStrct
+ {
+ internal SimCdmaServiceTable CdmaSvcTable;
+ internal CstServiceStrct Cst;
+ }
+
+ [StructLayout(LayoutKind.Explicit)]
+ internal struct ServiceTable
+ {
+ [FieldOffset(0)]
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 56)]
+ internal string SimSstService;
+ [FieldOffset(0)]
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
+ internal string SimUstService;
+ [FieldOffset(0)]
+ internal SimCstStrct Cst;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimServiceTableStruct
+ {
+ internal SimCardType SimType;
+ internal ServiceTable Table;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimSubscriberInfoStruct
+ {
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 27)]
+ internal string Number;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)]
+ internal string Name;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimMsisdnListStruct
+ {
+ internal int Count;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.LPStruct)]
+ internal SimSubscriberInfoStruct[] List;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimOplmnwactStruct
+ {
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 7)]
+ internal string Plmn;
+ internal int IsUmts;
+ internal int IsGsm;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimOplmnwactListStruct
+ {
+ internal int Count;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 100, ArraySubType = UnmanagedType.LPStruct)]
+ internal SimOplmnwactStruct[] List;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimSpnStruct
+ {
+ internal byte DisplayCondition;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 41)]
+ internal string Spn;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimCphsNetNameStruct
+ {
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 41)]
+ internal string FullName;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)]
+ internal string ShortName;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimPinResultStruct
+ {
+ internal SimPinType Type;
+ internal int RetryCount;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimLockInfoStruct
+ {
+ internal SimLockType Type;
+ internal SimLockStatus Status;
+ internal int RetryCount;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimAtrResponseStruct
+ {
+ internal ushort AtrRespLen;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 5120)]
+ internal string AtrResp;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimImpuListStruct
+ {
+ internal uint Count;
+ internal IntPtr List;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimPcscfStruct
+ {
+ internal SimPcscfType Type;
+ [MarshalAs(UnmanagedType.LPStr)]
+ internal string Pcscf;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SimPcscfListStruct
+ {
+ internal uint Count;
+ internal IntPtr List;
+ }
+
+ internal static class SimStructConversions
+ {
+ internal static SimImsiInfo ConvertSimImsiInfoStruct(SimImsiInfoStruct imsiStruct)
+ {
+ SimImsiInfo imsi = new SimImsiInfo();
+ imsi.CountryCode = imsiStruct.Mcc;
+ imsi.NetworkCode = imsiStruct.Mnc;
+ imsi.StationId = imsiStruct.Msin;
+ return imsi;
+ }
+
+ internal static SimEccInfo ConvertSimEccInfoStruct(SimEccInfoStruct eccStruct)
+ {
+ SimEccInfo ecc = new SimEccInfo();
+ ecc.NameInfo = eccStruct.Name;
+ ecc.NumberInfo = eccStruct.Number;
+ ecc.TypeInfo = eccStruct.Type;
+ return ecc;
+ }
+
+ internal static SimEccInfoList ConvertSimEccInfoListStruct(SimEccInfoListStruct listStruct)
+ {
+ SimEccInfoList eccList = new SimEccInfoList();
+ eccList.EccCount = listStruct.Count;
+ List<SimEccInfo> eccInfoList = new List<SimEccInfo>();
+ foreach (SimEccInfoStruct info in listStruct.ListInfo)
+ {
+ eccInfoList.Add(ConvertSimEccInfoStruct(info));
+ }
+
+ eccList.List = eccInfoList;
+ return eccList;
+ }
+
+ internal static SimIccIdInfo ConvertSimIccIdInfoStruct(SimIccIdInfoStruct iccStruct)
+ {
+ SimIccIdInfo iccId = new SimIccIdInfo();
+ iccId.Length = iccStruct.IccLength;
+ iccId.Number = iccStruct.IccNumber;
+ return iccId;
+ }
+
+ internal static SimCfis ConvertSimCfisStruct(SimCfisStruct cfisStruct)
+ {
+ SimCfis cfis = new SimCfis();
+ cfis.RecIndex = cfisStruct.RecIndex;
+ cfis.MspNum = cfisStruct.MspNum;
+ cfis.CfuStatus = cfisStruct.CfuStatus;
+ cfis.Ton = cfisStruct.Ton;
+ cfis.Npi = cfisStruct.Npi;
+ cfis.CfuNum = cfisStruct.CfuNum;
+ cfis.Cc2Id = cfisStruct.Cc2Id;
+ cfis.Ext7Id = cfisStruct.Ext7Id;
+ return cfis;
+ }
+
+ internal static SimCfisList ConvertSimCfisListStruct(SimCfisListStruct listStruct)
+ {
+ SimCfisList cfisList = new SimCfisList();
+ cfisList.Count = listStruct.ProfileCount;
+ List<SimCfis> cfis = new List<SimCfis>();
+ foreach (SimCfisStruct cfStruct in listStruct.CfisList)
+ {
+ cfis.Add(ConvertSimCfisStruct(cfStruct));
+ }
+
+ cfisList.List = cfis;
+ return cfisList;
+ }
+
+ internal static SimCphsCf ConvertSimCphsCfStruct(SimCphsCfStruct cphsCfStruct)
+ {
+ SimCphsCf cphs = new SimCphsCf();
+ cphs.Line1 = cphsCfStruct.Line1;
+ cphs.Line2 = cphsCfStruct.Line2;
+ cphs.Fax = cphsCfStruct.Fax;
+ cphs.Data = cphsCfStruct.Data;
+ return cphs;
+ }
+
+ internal static SimCallForwardResponse ConvertSimCallForwardResponseStruct(SimCallForwardResponseStruct respStruct)
+ {
+ SimCallForwardResponse resp = new SimCallForwardResponse();
+ if (respStruct.IsCphs == 1)
+ {
+ resp.IsCphsCf = true;
+ }
+
+ else if (respStruct.IsCphs == 0)
+ {
+ resp.IsCphsCf = false;
+ }
+
+ resp.List = ConvertSimCfisListStruct(respStruct.CfList);
+ resp.CphsCfInfo = ConvertSimCphsCfStruct(respStruct.CphsCf);
+ return resp;
+ }
+
+ internal static SimMwis ConvertSimMwisStruct(SimMwisStruct mwisStruct)
+ {
+ SimMwis mwis = new SimMwis();
+ mwis.RecIndex = mwisStruct.RecIndex;
+ mwis.IndicatorStatus = mwisStruct.IndicatorStatus;
+ mwis.VoiceCount = mwisStruct.VoiceCount;
+ mwis.FaxCount = mwisStruct.FaxCount;
+ mwis.EmailCount = mwisStruct.EmailCount;
+ mwis.OtherCount = mwisStruct.OtherCount;
+ mwis.VideoCount = mwisStruct.VideoCount;
+ return mwis;
+ }
+
+ internal static SimMwisList ConvertSimMwisListStruct(SimMwisListStruct mwStruct)
+ {
+ SimMwisList mwList = new SimMwisList();
+ mwList.Count = mwStruct.ProfileCount;
+ List<SimMwis> mwisList = new List<SimMwis>();
+ foreach (SimMwisStruct mwisStruct in mwStruct.MwList)
+ {
+ mwisList.Add(ConvertSimMwisStruct(mwisStruct));
+ }
+
+ mwList.List = mwisList;
+ return mwList;
+ }
+
+ internal static SimCphsMw ConvertSimCphsMwStruct(SimCphsMwStruct cphsStruct)
+ {
+ SimCphsMw cphsMw = new SimCphsMw();
+ if (cphsStruct.Voice1 == 1)
+ {
+ cphsMw.IsVoice1 = true;
+ }
+
+ else
+ {
+ cphsMw.IsVoice1 = false;
+ }
+
+ if (cphsStruct.Voice2 == 1)
+ {
+ cphsMw.IsVoice2 = true;
+ }
+
+ else
+ {
+ cphsMw.IsVoice2 = false;
+ }
+
+ if (cphsStruct.Fax == 1)
+ {
+ cphsMw.IsFax = true;
+ }
+
+ else
+ {
+ cphsMw.IsFax = false;
+ }
+
+ if (cphsStruct.Data == 1)
+ {
+ cphsMw.IsData = true;
+ }
+
+ else
+ {
+ cphsMw.IsData = false;
+ }
+
+ return cphsMw;
+ }
+
+ internal static SimMessageWaitingResponse ConvertSimMessageWaitingRespStruct(SimMessageWaitingResponseStruct responseStruct)
+ {
+ SimMessageWaitingResponse waitingResp = new SimMessageWaitingResponse();
+ if (responseStruct.IsCphs == 1)
+ {
+ waitingResp.IsCphsMw = true;
+ }
+
+ else
+ {
+ waitingResp.IsCphsMw = false;
+ }
+
+ waitingResp.List = ConvertSimMwisListStruct(responseStruct.MwList);
+ waitingResp.CphsMwInfo = ConvertSimCphsMwStruct(responseStruct.CphsMw);
+ return waitingResp;
+ }
+
+ internal static SimMailboxNumber ConvertSimMailboxNumberStruct(SimMailboxNumberStruct mbStruct)
+ {
+ SimMailboxNumber mbNumber = new SimMailboxNumber();
+ if (mbStruct.IsCphs == 1)
+ {
+ mbNumber.IsCphs = true;
+ }
+
+ else if (mbStruct.IsCphs == 0)
+ {
+ mbNumber.IsCphs = false;
+ }
+
+ mbNumber.RecIndex = mbStruct.RecIndex;
+ mbNumber.ProfileNumber = mbStruct.ProfileNum;
+ mbNumber.MbType = mbStruct.MbType;
+ mbNumber.AlphaMaxLength = mbStruct.AlphaMaxLen;
+ mbNumber.AlphaId = mbStruct.AlphaId;
+ mbNumber.Ton = mbStruct.Ton;
+ mbNumber.Npi = mbStruct.Npi;
+ mbNumber.Number = mbStruct.Number;
+ mbNumber.CcId = mbStruct.CcId;
+ mbNumber.Ext1Id = mbStruct.Ext1Id;
+ return mbNumber;
+ }
+
+ internal static SimMailboxList ConvertSimMailboxListStruct(SimMailboxListStruct mbListStruct)
+ {
+ SimMailboxList mbList = new SimMailboxList();
+ mbList.MbCount = mbListStruct.Count;
+ List<SimMailboxNumber> mbNumList = new List<SimMailboxNumber>();
+ foreach (SimMailboxNumberStruct mbStruct in mbListStruct.List)
+ {
+ mbNumList.Add(ConvertSimMailboxNumberStruct(mbStruct));
+ }
+
+ mbList.MbList = mbNumList;
+ return mbList;
+ }
+
+ internal static SimCphsServiceTable ConvertSimCphsServiceTableStruct(SimCphsServiceTableStruct svcStruct)
+ {
+ SimCphsServiceTable svcTable = new SimCphsServiceTable();
+ svcTable.CustomerSvcProfile = svcStruct.CustomerServiceProfile;
+ svcTable.SvcStringTable = svcStruct.ServiceStringTable;
+ svcTable.MbNumbers = svcStruct.MailboxNumbers;
+ svcTable.OperatorNameShort = svcStruct.OperatorNameShortForm;
+ svcTable.InformationNum = svcStruct.InformationNumbers;
+ return svcTable;
+ }
+
+ internal static SimCphsInfo ConvertSimCphsInfoStruct(SimCphsInfoStruct cphsStruct)
+ {
+ SimCphsInfo cphsInfo = new SimCphsInfo();
+ cphsInfo.Phase = cphsStruct.CphsPhase;
+ cphsInfo.CphsSvcTable = ConvertSimCphsServiceTableStruct(cphsStruct.CphsServiceTable);
+ return cphsInfo;
+ }
+
+ internal static SimCst ConvertSimCstStruct(SimCstStrct cstStruct)
+ {
+ SimCst cst = new SimCst();
+ cst.CdmaSvc = cstStruct.CdmaSvcTable;
+ if (cstStruct.CdmaSvcTable == SimCdmaServiceTable.Cdma)
+ {
+ cst.Cdma = Encoding.ASCII.GetBytes(cstStruct.Cst.CdmaService);
+ }
+
+ else if (cstStruct.CdmaSvcTable == SimCdmaServiceTable.Csim)
+ {
+ cst.Csim = Encoding.ASCII.GetBytes(cstStruct.Cst.CsimService);
+ }
+
+ return cst;
+ }
+
+ internal static SimServiceTable ConvertSimServiceTableStruct(SimServiceTableStruct svcTableStruct)
+ {
+ SimServiceTable svcTable = new SimServiceTable();
+ svcTable.Type = svcTableStruct.SimType;
+ if (svcTableStruct.SimType == SimCardType.Gsm)
+ {
+ svcTable.Sst = Encoding.ASCII.GetBytes(svcTableStruct.Table.SimSstService);
+ }
+
+ else if (svcTableStruct.SimType == SimCardType.Usim)
+ {
+ svcTable.Ust = Encoding.ASCII.GetBytes(svcTableStruct.Table.SimUstService);
+ }
+
+ else if (svcTableStruct.SimType == SimCardType.Ruim)
+ {
+ svcTable.Cst = ConvertSimCstStruct(svcTableStruct.Table.Cst);
+ }
+
+ return svcTable;
+ }
+
+ internal static SimSubscriberInfo ConvertSimSubscriberInfoStruct(SimSubscriberInfoStruct infoStruct)
+ {
+ SimSubscriberInfo subscriber = new SimSubscriberInfo();
+ subscriber.MsisdnNum = infoStruct.Number;
+ subscriber.MsisdnName = infoStruct.Name;
+ return subscriber;
+ }
+
+ internal static SimMsisdnList ConvertSimMsisdnListStruct(SimMsisdnListStruct msisdnStruct)
+ {
+ SimMsisdnList list = new SimMsisdnList();
+ list.MsisdnCount = msisdnStruct.Count;
+ List<SimSubscriberInfo> subsList = new List<SimSubscriberInfo>();
+ foreach (SimSubscriberInfoStruct subsStruct in msisdnStruct.List)
+ {
+ subsList.Add(ConvertSimSubscriberInfoStruct(subsStruct));
+ }
+
+ list.SubscriberList = subsList;
+ return list;
+ }
+
+ internal static SimOplmnwact ConvertSimOplmnwactStruct(SimOplmnwactStruct oplmnStruct)
+ {
+ SimOplmnwact oplmn = new SimOplmnwact();
+ oplmn.PlmnString = oplmnStruct.Plmn;
+ if (oplmnStruct.IsUmts == 1)
+ {
+ oplmn.UmtsFlag = true;
+ }
+
+ else if (oplmnStruct.IsUmts == 0)
+ {
+ oplmn.UmtsFlag = false;
+ }
+
+ if (oplmnStruct.IsGsm == 1)
+ {
+ oplmn.GsmFlag = true;
+ }
+
+ else if (oplmnStruct.IsGsm == 0)
+ {
+ oplmn.GsmFlag = false;
+ }
+
+ return oplmn;
+ }
+
+ internal static SimOplmnwactList ConvertSimOplmnwactListStruct(SimOplmnwactListStruct listStruct)
+ {
+ SimOplmnwactList oplmnList = new SimOplmnwactList();
+ oplmnList.OplmnCount = listStruct.Count;
+ List<SimOplmnwact> wactList = new List<SimOplmnwact>();
+ foreach (SimOplmnwactStruct wactStruct in listStruct.List)
+ {
+ wactList.Add(ConvertSimOplmnwactStruct(wactStruct));
+ }
+
+ oplmnList.OplmnList = wactList;
+ return oplmnList;
+ }
+
+ internal static SimSpn ConvertSimSpnStruct(SimSpnStruct spnStruct)
+ {
+ SimSpn spn = new SimSpn();
+ spn.Condition = spnStruct.DisplayCondition;
+ spn.SpName = spnStruct.Spn;
+ return spn;
+ }
+
+ internal static SimCphsNetName ConvertSimCphsNetNameStruct(SimCphsNetNameStruct cphsStruct)
+ {
+ SimCphsNetName cphsName = new SimCphsNetName();
+ cphsName.Full = cphsStruct.FullName;
+ cphsName.Short = cphsStruct.ShortName;
+ return cphsName;
+ }
+
+ internal static SimAuthenticationResponse ConvertSimAuthenticationResponseStruct(SimAuthenticationResponseStruct respStruct)
+ {
+ SimAuthenticationResponse response = new SimAuthenticationResponse();
+ response.Type = respStruct.AuthType;
+ response.Result = respStruct.AuthResult;
+ response.RespLength = respStruct.RespLength;
+ response.RespData = respStruct.RespData;
+ response.AuthKeyLen = respStruct.AuthKeyLength;
+ response.Key = respStruct.AuthKey;
+ response.CipherLen = respStruct.CipherLength;
+ response.Cipher = respStruct.CipherData;
+ response.IntegrityLen = respStruct.IntegrityLength;
+ response.Integrity = respStruct.IntegrityData;
+ return response;
+ }
+
+ internal static SimPinResult ConvertSimPinResultStruct(SimPinResultStruct resultStruct)
+ {
+ SimPinResult pinResult = new SimPinResult();
+ pinResult.PinType = resultStruct.Type;
+ pinResult.Retry = resultStruct.RetryCount;
+ return pinResult;
+ }
+
+ internal static SimFacilityResult ConvertSimFacilityResultStruct(SimFacilityResultStruct resultStruct)
+ {
+ SimFacilityResult facilityResult = new SimFacilityResult();
+ facilityResult.LockType = resultStruct.Type;
+ facilityResult.Count = resultStruct.RetryCount;
+ return facilityResult;
+ }
+
+ internal static SimFacilityInfo ConvertSimFacilityInfoStruct(SimFacilityInfoStruct infoStruct)
+ {
+ SimFacilityInfo facilityInfo = new SimFacilityInfo();
+ facilityInfo.LockType = infoStruct.Type;
+ facilityInfo.FacilityStatus = infoStruct.Status;
+ return facilityInfo;
+ }
+
+ internal static SimLockInfo ConvertSimLockInfoStruct(SimLockInfoStruct infoStruct)
+ {
+ SimLockInfo lockInfo = new SimLockInfo();
+ lockInfo.LockType = infoStruct.Type;
+ lockInfo.LockStatus = infoStruct.Status;
+ lockInfo.Count = infoStruct.RetryCount;
+ return lockInfo;
+ }
+
+ internal static SimApduResponse ConvertSimApduResponseStruct(SimApduResponseStruct respStruct)
+ {
+ SimApduResponse response = new SimApduResponse();
+ response.ApduLen = respStruct.RespLen;
+ response.ApduResp = Encoding.ASCII.GetBytes(respStruct.ApduResp);
+ return response;
+ }
+
+ internal static SimAtrResponse ConvertSimAtrResponseStruct(SimAtrResponseStruct respStruct)
+ {
+ SimAtrResponse atrResp = new SimAtrResponse();
+ atrResp.AtrRespLen = respStruct.AtrRespLen;
+ atrResp.AtrResp = Encoding.ASCII.GetBytes(respStruct.AtrResp);
+ return atrResp;
+ }
+
+ internal static SimImpuList ConvertSimImpuListStruct(SimImpuListStruct listStruct)
+ {
+ SimImpuList impuList = new SimImpuList();
+ impuList.DataCount = listStruct.Count;
+ IntPtr[] ptrList = new IntPtr[listStruct.Count];
+ Marshal.Copy(listStruct.List, ptrList, 0, (int)listStruct.Count);
+ List<string> list = new List<string>();
+ for (int i = 0; i < listStruct.Count; i++)
+ {
+ list.Add(Marshal.PtrToStringAnsi(ptrList[i]));
+ }
+
+ impuList.ImpuList = list;
+ return impuList;
+ }
+
+ internal static SimPcscf ConvertSimPcscfStruct(SimPcscfStruct pcscfStruct)
+ {
+ SimPcscf pcscf = new SimPcscf();
+ pcscf.PcscfType = pcscfStruct.Type;
+ pcscf.PcscfData = pcscfStruct.Pcscf;
+ return pcscf;
+ }
+
+ internal static SimPcscfList ConvertSimPcscfListStruct(SimPcscfListStruct listStruct)
+ {
+ SimPcscfList pcscfList = new SimPcscfList();
+ pcscfList.DataCount = listStruct.Count;
+ IntPtr[] ptrList = new IntPtr[listStruct.Count];
+ Marshal.Copy(listStruct.List, ptrList, 0, (int)listStruct.Count);
+ List<SimPcscf> list = new List<SimPcscf>();
+ for (int i = 0; i < listStruct.Count; i++)
+ {
+ list.Add(ConvertSimPcscfStruct(Marshal.PtrToStructure<SimPcscfStruct>(ptrList[i])));
+ }
+
+ pcscfList.PcscfList = list;
+ return pcscfList;
+ }
+ }
+
+ internal static class SimClassConversions
+ {
+ internal static SimCallForwardRequestStruct ConvertSimCallForwardRequest(SimCallForwardRequest request)
+ {
+ SimCallForwardRequestStruct cfStruct = new SimCallForwardRequestStruct();
+ if (request.IsCphs == true)
+ {
+ cfStruct.IsCphs = 1;
+ }
+
+ else if (request.IsCphs == false)
+ {
+ cfStruct.IsCphs = 0;
+ }
+
+ if (request.IsCphs == true)
+ {
+ cfStruct.CfData.CphsCf.Line1 = request.CphsCf.Line1;
+ cfStruct.CfData.CphsCf.Line2 = request.CphsCf.Line2;
+ cfStruct.CfData.CphsCf.Fax = request.CphsCf.Fax;
+ cfStruct.CfData.CphsCf.Data = request.CphsCf.Data;
+ }
+
+ else
+ {
+ cfStruct.CfData.Cfis.RecIndex = request.Cfis.RecIndex;
+ cfStruct.CfData.Cfis.MspNum = request.Cfis.MspNum;
+ cfStruct.CfData.Cfis.CfuStatus = request.Cfis.CfuStatus;
+ cfStruct.CfData.Cfis.Ton = request.Cfis.Ton;
+ cfStruct.CfData.Cfis.Npi = request.Cfis.Npi;
+ cfStruct.CfData.Cfis.CfuNum = request.Cfis.CfuNum;
+ cfStruct.CfData.Cfis.Cc2Id = request.Cfis.Cc2Id;
+ cfStruct.CfData.Cfis.Ext7Id = request.Cfis.Ext7Id;
+ }
+
+ return cfStruct;
+ }
+
+ internal static SimMwisStruct ConvertSimMwis(SimMwis mwis)
+ {
+ SimMwisStruct mwisStruct = new SimMwisStruct();
+ mwisStruct.RecIndex = mwis.RecIndex;
+ mwisStruct.IndicatorStatus = mwis.IndicatorStatus;
+ mwisStruct.VoiceCount = mwis.VoiceCount;
+ mwisStruct.FaxCount = mwis.FaxCount;
+ mwisStruct.EmailCount = mwis.EmailCount;
+ mwisStruct.OtherCount = mwis.OtherCount;
+ mwisStruct.VideoCount = mwis.VideoCount;
+ return mwisStruct;
+ }
+
+ internal static SimCphsMwStruct ConvertSimCphsMw(SimCphsMw cphsMw)
+ {
+ SimCphsMwStruct cphsStruct = new SimCphsMwStruct();
+ if (cphsMw.IsVoice1 == true)
+ {
+ cphsStruct.Voice1 = 1;
+ }
+
+ else
+ {
+ cphsStruct.Voice1 = 0;
+ }
+
+ if (cphsMw.IsVoice2 == true)
+ {
+ cphsStruct.Voice2 = 1;
+ }
+
+ else
+ {
+ cphsStruct.Voice2 = 0;
+ }
+
+ if (cphsMw.IsFax == true)
+ {
+ cphsStruct.Fax = 1;
+ }
+
+ else
+ {
+ cphsStruct.Fax = 0;
+ }
+
+ if (cphsMw.IsData == true)
+ {
+ cphsStruct.Data = 1;
+ }
+
+ else
+ {
+ cphsStruct.Data = 0;
+ }
+
+ return cphsStruct;
+ }
+
+ internal static SimMessageWaitingRequestStruct ConvertSimMessageWaitingRequest(SimMessageWaitingRequest request)
+ {
+ SimMessageWaitingRequestStruct requestStruct = new SimMessageWaitingRequestStruct();
+ if (request.IsCphs == true)
+ {
+ requestStruct.IsCphs = 1;
+ }
+
+ else
+ {
+ requestStruct.IsCphs = 0;
+ }
+
+ if (request.IsCphs == true)
+ {
+ requestStruct.Mw.CphsMw = ConvertSimCphsMw(request.CphsMw);
+ }
+
+ else
+ {
+ requestStruct.Mw.Mwis = ConvertSimMwis(request.Mwis);
+ }
+
+ return requestStruct;
+ }
+
+ internal static SimMailboxNumberStruct ConvertSimMailboxNumber(SimMailboxNumber mbNumber)
+ {
+ SimMailboxNumberStruct mbStruct = new SimMailboxNumberStruct();
+ if (mbNumber.IsCphs)
+ {
+ mbStruct.IsCphs = 1;
+ }
+
+ else
+ {
+ mbStruct.IsCphs = 0;
+ }
+
+ mbStruct.RecIndex = mbNumber.RecIndex;
+ mbStruct.ProfileNum = mbNumber.ProfileNumber;
+ mbStruct.MbType = mbNumber.MbType;
+ mbStruct.AlphaMaxLen = mbNumber.AlphaMaxLength;
+ mbStruct.AlphaId = mbNumber.AlphaId;
+ mbStruct.Ton = mbNumber.Ton;
+ mbStruct.Npi = mbNumber.Npi;
+ mbStruct.Number = mbNumber.Number;
+ mbStruct.CcId = mbNumber.CcId;
+ mbStruct.Ext1Id = mbNumber.Ext1Id;
+ return mbStruct;
+ }
+
+ internal static SimPinDataStruct ConvertSimPinData(SimPinData data)
+ {
+ SimPinDataStruct pinStruct = new SimPinDataStruct();
+ pinStruct.Type = data.Type;
+ pinStruct.Pin = data.Pin;
+ pinStruct.PinLength = data.PinLength;
+ return pinStruct;
+ }
+
+ internal static SimFacilityStruct ConvertSimFacility(SimFacility facility)
+ {
+ SimFacilityStruct facilityStruct = new SimFacilityStruct();
+ facilityStruct.LockType = facility.LockType;
+ facilityStruct.Password = facility.Password;
+ facilityStruct.PasswordLength = facility.PasswordLength;
+ return facilityStruct;
+ }
+
+ internal static SimApduStruct ConvertSimApdu(SimApdu apdu)
+ {
+ SimApduStruct apduStruct = new SimApduStruct();
+ apduStruct.ApduLen = apdu.ApduLength;
+ apduStruct.Apdu = Encoding.UTF8.GetString(apdu.Apdu);
+ return apduStruct;
+ }
+
+ internal static SimAuthenticationDataStruct ConvertSimAuthenticationDataStruct(SimAuthenticationData authData)
+ {
+ SimAuthenticationDataStruct authStruct = new SimAuthenticationDataStruct();
+ authStruct.AuthType = authData.AuthType;
+ authStruct.RandLength = authData.RandLength;
+ authStruct.AutnLength = authData.AutnLength;
+ authStruct.RandData = Encoding.UTF8.GetString(authData.RandData);
+ authStruct.AutnData = Encoding.UTF8.GetString(authData.AutnData);
+ return authStruct;
+ }
}
}