[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 IntPtr appList);
+ internal static extern int SimGetApplicationList(IntPtr handle, out byte 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")]
/// <exception cref="InvalidOperationException">Thrown when it is failed due to invalid operation.</exception>
public byte SimGetApplicationList()
{
- IntPtr appList;
+ byte appList;
int ret = Interop.Tapi.Sim.SimGetApplicationList(_handle, out appList);
if (ret != (int)TapiError.Success)
{
TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
}
- return Marshal.ReadByte(appList);
+ return appList;
}
/// <summary>
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting ICCID info: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting ICCID info, " + (SimAccessResult)result));
+ return;
}
SimIccIdInfoStruct info = Marshal.PtrToStructure<SimIccIdInfoStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting language preference: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting language preference, " + (SimAccessResult)result));
+ return;
}
task.SetResult((SimLanguagePreference)Marshal.ReadInt32(data));
{
Log.Error(TapiUtility.LogTag, "Error occurs in setting language preference: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in setting language preference, " + (SimAccessResult)result));
+ return;
}
task.SetResult(true);
{
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));
+ return;
}
SimCallForwardResponseStruct info = Marshal.PtrToStructure<SimCallForwardResponseStruct>(data);
{
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));
+ return;
}
task.SetResult(true);
{
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));
+ return;
}
SimMessageWaitingResponseStruct info = Marshal.PtrToStructure<SimMessageWaitingResponseStruct>(data);
{
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));
+ return;
}
task.SetResult(true);
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting mailbox info: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting mailbox info, " + (SimAccessResult)result));
+ return;
}
SimMailboxListStruct info = Marshal.PtrToStructure<SimMailboxListStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in setting mailbox info: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in setting mailbox info, " + (SimAccessResult)result));
+ return;
}
task.SetResult(true);
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting CPHS info: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting CPHS info, " + (SimAccessResult)result));
+ return;
}
SimCphsInfoStruct info = Marshal.PtrToStructure<SimCphsInfoStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting service table: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting service table, " + (SimAccessResult)result));
+ return;
}
SimServiceTableStruct info = Marshal.PtrToStructure<SimServiceTableStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting MSISDN info: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting MSISDN info, " + (SimAccessResult)result));
+ return;
}
SimMsisdnListStruct info = Marshal.PtrToStructure<SimMsisdnListStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting OPLMNWACT info: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting OPLMNWACT info, " + (SimAccessResult)result));
+ return;
}
SimOplmnwactListStruct info = Marshal.PtrToStructure<SimOplmnwactListStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting SPN info: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting SPN info, " + (SimAccessResult)result));
+ return;
}
SimSpnStruct info = Marshal.PtrToStructure<SimSpnStruct>(data);
{
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));
+ return;
}
SimCphsNetNameStruct info = Marshal.PtrToStructure<SimCphsNetNameStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in executing authentication procedure: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in executing authentication procedure, " + (SimAccessResult)result));
+ return;
}
SimAuthenticationResponseStruct info = Marshal.PtrToStructure<SimAuthenticationResponseStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in verifying SIM pins: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in verifying SIM pins, " + (SimAccessResult)result));
+ return;
}
SimPinResultStruct info = Marshal.PtrToStructure<SimPinResultStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in verifying SIM puks: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in verifying SIM puks, " + (SimAccessResult)result));
+ return;
}
SimPinResultStruct info = Marshal.PtrToStructure<SimPinResultStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in changing SIM pins: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in changing SIM pins, " + (SimAccessResult)result));
+ return;
}
SimPinResultStruct info = Marshal.PtrToStructure<SimPinResultStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in disabling SIM facility: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in disabling SIM facility, " + (SimAccessResult)result));
+ return;
}
SimFacilityResultStruct info = Marshal.PtrToStructure<SimFacilityResultStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in enabling SIM facility: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in enabling SIM facility, " + (SimAccessResult)result));
+ return;
}
SimFacilityResultStruct info = Marshal.PtrToStructure<SimFacilityResultStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM facility: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting SIM facility, " + (SimAccessResult)result));
+ return;
}
SimFacilityInfoStruct info = Marshal.PtrToStructure<SimFacilityInfoStruct>(data);
{
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));
+ return;
}
SimLockInfoStruct info = Marshal.PtrToStructure<SimLockInfoStruct>(data);
{
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));
+ return;
}
task.SetResult(true);
{
Log.Error(TapiUtility.LogTag, "Error occurs in requesting SIM APDU: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in requesting SIM APDU, " + (SimAccessResult)result));
+ return;
}
SimApduResponseStruct info = Marshal.PtrToStructure<SimApduResponseStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in requesting SIM ATR: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in requesting SIM ATR, " + (SimAccessResult)result));
+ return;
}
SimAtrResponseStruct info = Marshal.PtrToStructure<SimAtrResponseStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM IMPI: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting SIM IMPI, " + (SimAccessResult)result));
+ return;
}
task.SetResult(Marshal.PtrToStringAnsi(data));
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM IMPU: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting SIM IMPU, " + (SimAccessResult)result));
+ return;
}
SimImpuListStruct info = Marshal.PtrToStructure<SimImpuListStruct>(data);
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM domain: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting SIM domain, " + (SimAccessResult)result));
+ return;
}
task.SetResult(Marshal.PtrToStringAnsi(data));
{
Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM PCSCF: " + (SimAccessResult)result);
task.SetException(new InvalidOperationException("Error occurs in getting SIM PCSCF, " + (SimAccessResult)result));
+ return;
}
SimPcscfListStruct info = Marshal.PtrToStructure<SimPcscfListStruct>(data);
{
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));
+ return;
}
task.SetResult(Encoding.ASCII.GetBytes(Marshal.PtrToStringAnsi(data)));
/// </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)
+ public SimApdu(byte[] apdu)
{
- _apduLength = apduLength;
_apdu = apdu;
}
- internal ushort ApduLength
- {
- get
- {
- return _apduLength;
- }
- }
-
internal byte[] Apdu
{
get
[MarshalAs(UnmanagedType.LPStr)]
internal string Apdu;
}
+
[StructLayout(LayoutKind.Sequential)]
internal struct SimApduResponseStruct
{
internal ushort RespLen;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 5120)]
- internal string ApduResp;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5120)]
+ internal byte[] ApduResp;
}
[StructLayout(LayoutKind.Sequential)]
internal struct SimAtrResponseStruct
{
internal ushort AtrRespLen;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 5120)]
- internal string AtrResp;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5120)]
+ internal byte[] AtrResp;
}
[StructLayout(LayoutKind.Sequential)]
{
SimApduResponse response = new SimApduResponse();
response.ApduLen = respStruct.RespLen;
- response.ApduResp = Encoding.ASCII.GetBytes(respStruct.ApduResp);
+ response.ApduResp = respStruct.ApduResp;
return response;
}
{
SimAtrResponse atrResp = new SimAtrResponse();
atrResp.AtrRespLen = respStruct.AtrRespLen;
- atrResp.AtrResp = Encoding.ASCII.GetBytes(respStruct.AtrResp);
+ atrResp.AtrResp = respStruct.AtrResp;
return atrResp;
}
internal static SimApduStruct ConvertSimApdu(SimApdu apdu)
{
SimApduStruct apduStruct = new SimApduStruct();
- apduStruct.ApduLen = apdu.ApduLength;
+ apduStruct.ApduLen = (ushort)apdu.Apdu.Length;
apduStruct.Apdu = Encoding.UTF8.GetString(apdu.Apdu);
return apduStruct;
}
};
nwBtn.Clicked += NwBtn_Clicked;
+ var simBtn = new Button
+ {
+ Text = "Sim",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ simBtn.Clicked += simBtn_Clicked;
+
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
Children = {
- commonBtn, modemBtn, nwBtn
+ commonBtn, modemBtn, nwBtn, simBtn
}
};
}
+ private async void simBtn_Clicked(object sender, EventArgs e)
+ {
+ await Navigation.PushAsync(new SimPage());
+ }
+
private async void NwBtn_Clicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new NetworkPage());
--- /dev/null
+using System;
+using Xamarin.Forms;
+using Tizen;
+using Tizen.Tapi;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace XamarinForTizen.Tizen
+{
+ public class SimPage : ContentPage
+ {
+ Sim sim = null;
+ public SimPage()
+ {
+ try
+ {
+ sim = new Sim(Globals.handleModem0);
+ }
+
+ catch(Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim constructor throws exception = " + ex.ToString());
+ }
+
+ var SimInitInfoBtn = new Button
+ {
+ Text = "SimInitInfo",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ SimInitInfoBtn.Clicked += SimInitInfoBtn_Clicked;
+
+ var SimPropertiesBtn = new Button
+ {
+ Text = "Get sim properties(Type, Imsi, Ecc)",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ SimPropertiesBtn.Clicked += SimPropertiesBtn_Clicked;
+
+ var appListBtn = new Button
+ {
+ Text = "Get sim application list",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ appListBtn.Clicked += appListBtn_Clicked;
+
+ var iccIdBtn = new Button
+ {
+ Text = "Get sim ICCID",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ iccIdBtn.Clicked += iccIdBtn_Clicked;
+
+ var langPrefBtn = new Button
+ {
+ Text = "Set & get sim language preference",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ langPrefBtn.Clicked += langPrefBtn_Clicked;
+
+ var msisdnBtn = new Button
+ {
+ Text = "Get sim MSISDN",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ msisdnBtn.Clicked += msisdnBtn_Clicked;
+
+ var oplmnwactBtn = new Button
+ {
+ Text = "Get sim OPLMNWACT",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ oplmnwactBtn.Clicked += oplmnwactBtn_Clicked;
+
+ var spnBtn = new Button
+ {
+ Text = "Get sim SPN",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ spnBtn.Clicked += spnBtn_Clicked;
+
+ var autnBtn = new Button
+ {
+ Text = "Sim authentication",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ autnBtn.Clicked += autnBtn_Clicked;
+
+ var powerBtn = new Button
+ {
+ Text = "Sim change power state",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ powerBtn.Clicked += powerBtn_Clicked;
+
+ var apduBtn = new Button
+ {
+ Text = "Sim APDU",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ apduBtn.Clicked += apduBtn_Clicked;
+
+ var atrBtn = new Button
+ {
+ Text = "Sim ATR",
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+ atrBtn.Clicked += atrBtn_Clicked;
+
+ Content = new StackLayout
+ {
+ VerticalOptions = LayoutOptions.Center,
+ Children = {
+ SimInitInfoBtn, SimPropertiesBtn, appListBtn, iccIdBtn, langPrefBtn, msisdnBtn, oplmnwactBtn,
+ spnBtn, autnBtn, powerBtn, apduBtn, atrBtn
+ }
+ };
+ }
+
+ private async void atrBtn_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ Log.Debug(Globals.LogTag, "Sim request ATR call start");
+ SimAtrResponse resp = await sim.SimRequestAtr();
+ Log.Debug(Globals.LogTag, "Atr response length: " + resp.AtrRespLength);
+ for (int i = 0; i < resp.AtrRespLength; i++)
+ {
+ Log.Debug(Globals.LogTag, "[" + i + "]'s byte: [0x" + resp.AtrResponse[i] + "]");
+ }
+
+ Log.Debug(Globals.LogTag, "Sim request ATR call success");
+ }
+
+ catch (Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim request ATR exception: " + ex.ToString());
+ }
+ }
+
+ private async void apduBtn_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ Log.Debug(Globals.LogTag, "Sim request APDU call start");
+ SimApdu apdu = new SimApdu(Encoding.ASCII.GetBytes("0070000000"));
+ SimApduResponse resp = await sim.SimRequestApdu(apdu);
+ Log.Debug(Globals.LogTag, "Apdu response length: " + resp.ApduLength);
+ for (int i = 0; i < resp.ApduLength; i++)
+ {
+ Log.Debug(Globals.LogTag, "[" + i + "]'s byte: [0x" + resp.ApduResponse[i] + "]");
+ }
+
+ Log.Debug(Globals.LogTag, "Sim request APDU call success");
+ }
+
+ catch (Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim request APDU exception: " + ex.ToString());
+ }
+ }
+
+ private async void powerBtn_Clicked(object sender, EventArgs e)
+ {
+ TapiHandle handle = Globals.handleModem0;
+ try
+ {
+ Log.Debug(Globals.LogTag, "Sim set power state call start");
+ handle.NotificationChanged += Handle_NotiPowerStateChanged;
+ handle.RegisterNotiEvent(Notification.SimStatus);
+ bool state = await sim.SimSetPowerState(SimPowerState.Off);
+ if (state)
+ {
+ await sim.SimSetPowerState(SimPowerState.On);
+ }
+
+ Log.Debug(Globals.LogTag, "Sim set power state call success");
+ }
+
+ catch (Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim set power state exception: " + ex.ToString());
+ }
+
+ finally
+ {
+ handle.DeregisterNotiEvent(Notification.SimStatus);
+ handle.NotificationChanged -= Handle_NotiPowerStateChanged;
+ }
+ }
+
+ private void Handle_NotiPowerStateChanged(object sender, NotificationChangedEventArgs e)
+ {
+ Log.Debug(Globals.LogTag, "Sim status noti event received, Status: " + e.Data + " Noti value: " + e.Id);
+ }
+
+ private async void autnBtn_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ SimAuthenticationData authData = new SimAuthenticationData(SimAuthenticationType.Auth3G, 4, 4, Encoding.ASCII.GetBytes("qwerty"), Encoding.ASCII.GetBytes("asdf"));
+ Log.Debug(Globals.LogTag, "Sim execute authentication call start");
+ SimAuthenticationResponse authResp = await sim.SimExecuteAuthentication(authData);
+ Log.Debug(Globals.LogTag, "Response auth type: " + authResp.AuthType);
+ Log.Debug(Globals.LogTag, "Response auth result: " + authResp.AuthResult);
+ Log.Debug(Globals.LogTag, "Response data: " + authResp.ResponseData);
+ Log.Debug(Globals.LogTag, "Auth key: " + authResp.AuthKey);
+ Log.Debug(Globals.LogTag, "Cipher data: " + authResp.CipherData);
+ Log.Debug(Globals.LogTag, "Integrity data: " + authResp.IntegrityData);
+ Log.Debug(Globals.LogTag, "Sim execute authentication call success");
+ }
+
+ catch (Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim get SPN exception: " + ex.ToString());
+ }
+ }
+
+ private async void spnBtn_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ Log.Debug(Globals.LogTag, "Sim get SPN call start");
+ SimSpn spn = await sim.SimGetSpn();
+ Log.Debug(Globals.LogTag, "SPN display condition: " + spn.DisplayCondition);
+ Log.Debug(Globals.LogTag, "SPN name: " + spn.Spn);
+ Log.Debug(Globals.LogTag, "Sim get SPN call success");
+ }
+
+ catch (Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim get SPN exception: " + ex.ToString());
+ }
+ }
+
+ private async void oplmnwactBtn_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ Log.Debug(Globals.LogTag, "Sim get oplmnwact call start");
+ SimOplmnwactList oplmnwact = await sim.SimGetOplmnwact();
+ Log.Debug(Globals.LogTag, "Sim OPLMNWACT count: " + oplmnwact.Count);
+ List<SimOplmnwact> oplmnList = oplmnwact.List.ToList();
+ for (int i = 0; i < oplmnwact.Count; i++)
+ {
+ Log.Debug(Globals.LogTag, "Oplmn.list[" + i + "].Plmn: " + oplmnList[i].Plmn);
+ Log.Debug(Globals.LogTag, "Oplmn.list[" + i + "].IsUmt: " + oplmnList[i].IsUmts);
+ Log.Debug(Globals.LogTag, "Oplmn.list[" + i + "].IsGsm: " + oplmnList[i].IsGsm);
+ }
+
+ Log.Debug(Globals.LogTag, "Sim get oplmnwact call success");
+ }
+
+ catch (Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim get oplmnwact exception: " + ex.ToString());
+ }
+ }
+
+ private async void msisdnBtn_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ Log.Debug(Globals.LogTag, "Sim get msisdn call start");
+ SimMsisdnList msisdn = await sim.SimGetMsisdn();
+ Log.Debug(Globals.LogTag, "Sim MSISDN count: " + msisdn.Count);
+ List<SimSubscriberInfo> subs = msisdn.List.ToList();
+ for (int i = 0; i < msisdn.Count; i++)
+ {
+ Log.Debug(Globals.LogTag, "Msisdn.list[" + i + "].Number: " + subs[i].Number);
+ Log.Debug(Globals.LogTag, "Msisdn.list[" + i + "].Name: " +subs[i].Name);
+ }
+
+ Log.Debug(Globals.LogTag, "Sim get msisdn call success");
+ }
+
+ catch (Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim get msisdn exception: " + ex.ToString());
+ }
+ }
+
+ private async void langPrefBtn_Clicked(object sender, EventArgs e)
+ {
+ SimLanguagePreference current = await sim.SimGetLanguagePreference();
+ try
+ {
+ Log.Debug(Globals.LogTag, "Sim get language preference call start");
+ foreach (SimLanguagePreference pref in Enum.GetValues(typeof(SimLanguagePreference)))
+ {
+ if (pref == SimLanguagePreference.Unspecified)
+ {
+ break;
+ }
+
+ Log.Debug(Globals.LogTag, "Setting sim language preference with " + pref);
+ bool setFlag = await sim.SimSetLanguagePreference(pref);
+ if (setFlag)
+ {
+ Log.Debug(Globals.LogTag, "Current sim language preference: " + await sim.SimGetLanguagePreference());
+ }
+ }
+
+ Log.Debug(Globals.LogTag, "Sim get language preference call success");
+ }
+
+ catch (Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim get language preference exception: " + ex.ToString());
+ }
+
+ finally
+ {
+ await sim.SimSetLanguagePreference(current);
+ }
+ }
+
+ private async void iccIdBtn_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ Log.Debug(Globals.LogTag, "Sim get ICC ID call start");
+ SimIccIdInfo info = await sim.SimGetIccId();
+ if (info == null)
+ {
+ Log.Debug(Globals.LogTag, "Sim icc id info is null");
+ return;
+ }
+
+ Log.Debug(Globals.LogTag, "Sim ICC ID length: " + info.IccLength);
+ Log.Debug(Globals.LogTag, "Sim ICC ID: " + info.IccNumber);
+ Log.Debug(Globals.LogTag, "Sim get ICC ID call success");
+ }
+
+ catch (Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim get ICC ID exception: " + ex.ToString());
+ }
+ }
+
+ private void appListBtn_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ Log.Debug(Globals.LogTag, "Sim get app list call start");
+ byte app = sim.SimGetApplicationList();
+ Log.Debug(Globals.LogTag, "Sim app list: " + app);
+ if ((app & (byte)SimAppType.Sim) != 0)
+ {
+ Log.Debug(Globals.LogTag, "[SIM]");
+ }
+
+ if ((app & (byte)SimAppType.Usim) != 0)
+ {
+ Log.Debug(Globals.LogTag, "[USIM]");
+ }
+
+ if ((app & (byte)SimAppType.Csim) != 0)
+ {
+ Log.Debug(Globals.LogTag, "[CSIM]");
+ }
+
+ if ((app & (byte)SimAppType.Isim) != 0)
+ {
+ Log.Debug(Globals.LogTag, "[ISIM]");
+ }
+
+ Log.Debug(Globals.LogTag, "Sim get app list call success");
+ }
+
+ catch (Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim get app list exception: " + ex.ToString());
+ }
+ }
+
+ private void SimPropertiesBtn_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ Log.Debug(Globals.LogTag, "Sim type call start");
+ Log.Debug(Globals.LogTag, "Sim card type: " + sim.SimType);
+ Log.Debug(Globals.LogTag, "Sim type call success");
+
+ Log.Debug(Globals.LogTag, "Sim imsi info call start");
+ SimImsiInfo imsi = sim.Imsi;
+ if (imsi == null)
+ {
+ Log.Debug(Globals.LogTag, "Imsi info is null");
+ return;
+ }
+
+ Log.Debug(Globals.LogTag, "Sim Mcc: " + imsi.Mcc);
+ Log.Debug(Globals.LogTag, "Sim Mnc: " + imsi.Mnc);
+ Log.Debug(Globals.LogTag, "Sim Msin: " + imsi.Msin);
+ Log.Debug(Globals.LogTag, "Sim imsi info call success");
+
+ Log.Debug(Globals.LogTag, "Sim ecc info call start");
+ SimEccInfoList eccList = sim.Ecc;
+ Log.Debug(Globals.LogTag, "Sim ECC count: " + eccList.Count);
+ List<SimEccInfo> ecc = eccList.EccList.ToList();
+ for (int i = 0; i < eccList.Count; i++)
+ {
+ Log.Debug(Globals.LogTag, "EccList.list[" + i + "].Name: " + ecc[i].Name);
+ Log.Debug(Globals.LogTag, "EccList.list[" + i + "].Number: " + ecc[i].Number);
+ Log.Debug(Globals.LogTag, "EccList.list[" + i + "].Category: " + ecc[i].Category);
+ }
+
+ Log.Debug(Globals.LogTag, "Sim ecc info call success");
+ }
+
+ catch (Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim get properties exception: " + ex.ToString());
+ }
+ }
+
+ private void SimInitInfoBtn_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ Log.Debug(Globals.LogTag, "Sim init info call start");
+ SimInitInfo info = sim.InitInfo;
+ if (info == null)
+ {
+ Log.Debug(Globals.LogTag, "Sim init info is null");
+ return;
+ }
+
+ Log.Debug(Globals.LogTag, "Sim status: " + info.Status);
+ Log.Debug(Globals.LogTag, "Sim card changed flag: " + info.IsCardChanged);
+ Log.Debug(Globals.LogTag, "Sim init info call success");
+ }
+
+ catch(Exception ex)
+ {
+ Log.Debug(Globals.LogTag, "Sim init info exception: " + ex.ToString());
+ }
+ }
+ }
+}
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <PropertyGroup>\r
- <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>\r
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
- <ProductVersion>8.0.30703</ProductVersion>\r
- <SchemaVersion>2.0</SchemaVersion>\r
- <ProjectTypeGuids>{2F98DAC9-6F16-457B-AED7-D43CAC379341};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\r
- <ProjectGuid>{BC2C461D-A67A-47FF-8AAA-D584BD379226}</ProjectGuid>\r
- <OutputType>Exe</OutputType>\r
- <AppDesignerFolder>Properties</AppDesignerFolder>\r
- <RootNamespace>Tizen.Tapitest</RootNamespace>\r
- <AssemblyName>Tizen.Tapitest</AssemblyName>\r
- <FileAlignment>512</FileAlignment>\r
- <DefaultLanguage>en-US</DefaultLanguage>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>\r
- <TargetFrameworkVersion>v1.0</TargetFrameworkVersion>\r
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
- <NuGetTargetMoniker>.NETCoreApp,Version=v1.0</NuGetTargetMoniker>\r
- <TargetFrameworkMoniker>.NETCoreApp,Version=v1.0</TargetFrameworkMoniker>\r
- <NoStdLib>true</NoStdLib>\r
- <NoWarn>$(NoWarn);1701</NoWarn>\r
- <UseVSHostingProcess>false</UseVSHostingProcess>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugSymbols>true</DebugSymbols>\r
- <DebugType>full</DebugType>\r
- <Optimize>false</Optimize>\r
- <OutputPath>bin\Debug\</OutputPath>\r
- <DefineConstants>DEBUG;TRACE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>pdbonly</DebugType>\r
- <Optimize>true</Optimize>\r
- <OutputPath>bin\Release\</OutputPath>\r
- <DefineConstants>TRACE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <ItemGroup>\r
- <None Include="Tizen.Tapitest.project.json" />\r
- <None Include="tizen-manifest.xml" />\r
- <None Include="shared\res\Tizen.Tapitest.png" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <Compile Include="CommonPage.cs" />\r
- <Compile Include="ModemPage.cs" />\r
- <Compile Include="MainPage.cs" />\r
- <Compile Include="NetworkPage.cs" />\r
- <Compile Include="Program.cs" />\r
- <Compile Include="Properties\AssemblyInfo.cs" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="..\Tizen.Tapi\Tizen.Tapi.csproj">\r
- <Project>{5bf0618d-32ca-4356-b25b-11bdfd0e6119}</Project>\r
- <Name>Tizen.Tapi</Name>\r
- </ProjectReference>\r
- </ItemGroup>\r
- <Import Project="$(MSBuildExtensionsPath)\Tizen\Tizen.CSharp.GBS.targets" Condition="Exists('$(MSBuildExtensionsPath)\Tizen\Tizen.CSharp.GBS.targets')" />\r
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectTypeGuids>{2F98DAC9-6F16-457B-AED7-D43CAC379341};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ProjectGuid>{BC2C461D-A67A-47FF-8AAA-D584BD379226}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Tizen.Tapitest</RootNamespace>
+ <AssemblyName>Tizen.Tapitest</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <DefaultLanguage>en-US</DefaultLanguage>
+ </PropertyGroup>
+ <PropertyGroup>
+ <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
+ <TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
+ <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
+ <NuGetTargetMoniker>.NETCoreApp,Version=v1.0</NuGetTargetMoniker>
+ <TargetFrameworkMoniker>.NETCoreApp,Version=v1.0</TargetFrameworkMoniker>
+ <NoStdLib>true</NoStdLib>
+ <NoWarn>$(NoWarn);1701</NoWarn>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <None Include="Tizen.Tapitest.project.json" />
+ <None Include="tizen-manifest.xml" />
+ <None Include="shared\res\Tizen.Tapitest.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="CommonPage.cs" />
+ <Compile Include="SimPage.cs" />
+ <Compile Include="ModemPage.cs" />
+ <Compile Include="MainPage.cs" />
+ <Compile Include="NetworkPage.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen.Tapi\Tizen.Tapi.csproj">
+ <Project>{5bf0618d-32ca-4356-b25b-11bdfd0e6119}</Project>
+ <Name>Tizen.Tapi</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Tizen\Tizen.CSharp.GBS.targets" Condition="Exists('$(MSBuildExtensionsPath)\Tizen\Tizen.CSharp.GBS.targets')" />
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
- -->\r
- <PropertyGroup>\r
+ -->
+ <PropertyGroup>
<!-- https://github.com/dotnet/corefxlab/tree/master/samples/NetCoreSample and
https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/target-dotnetcore-with-msbuild
- -->\r
+ -->
<!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two
properties to any folder that exists to skip the GetReferenceAssemblyPaths task (not target) and
to prevent it from outputting a warning (MSB3644).
- -->\r
- <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>\r
- <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>\r
- <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>\r
- </PropertyGroup>\r
- <!-- Include tasks for Tizen -->\r
- <PropertyGroup>\r
- <TizenBuildPath>$(MSBuildExtensionsPath)\Tizen</TizenBuildPath>\r
- <TizenToolsPath>$(TizenBuildPath)\bin</TizenToolsPath>\r
- </PropertyGroup>\r
- <UsingTask TaskName="Tizen.Tasks.SignPackage.TizenCleanPackageSource" AssemblyFile="$(TizenToolsPath)\Tizen.Tasks.SignPackage.dll" />\r
- <UsingTask TaskName="Tizen.Tasks.SignPackage.TizenPreparePackageManifest" AssemblyFile="$(TizenToolsPath)\Tizen.Tasks.SignPackage.dll" />\r
- <UsingTask TaskName="Tizen.Tasks.SignPackage.TizenPreparePackageSource" AssemblyFile="$(TizenToolsPath)\Tizen.Tasks.SignPackage.dll" />\r
- <UsingTask TaskName="Tizen.Tasks.SignPackage.TizenSignPackage" AssemblyFile="$(TizenToolsPath)\Tizen.Tasks.SignPackage.dll" />\r
- <!-- Task to clean package source -->\r
- <Target Name="_TizenCleanPkgSrc">\r
- <TizenCleanPackageSource SolutionPath="$(SolutionPath)" ProjectPath="$(MSBuildProjectFullPath)" />\r
- </Target>\r
- <!-- Task to prepare tizen-manifest.xml file -->\r
- <Target Name="_TizenPrepManifest">\r
- <TizenPreparePackageManifest SolutionPath="$(SolutionPath)" ProjectPath="$(MSBuildProjectFullPath)" />\r
- </Target>\r
- <!-- Task to prepare package sources(executable, dlls, resource files) -->\r
- <Target Name="_TizenPrepPkgSrc">\r
- <TizenPreparePackageSource SolutionPath="$(SolutionPath)" ProjectPath="$(MSBuildProjectFullPath)" AssemblyName="$(AssemblyName)" TargetPath="$(TargetPath)" />\r
- </Target>\r
- <!-- Task to signing and packaging -->\r
- <Target Name="_TizenSignPackge">\r
- <TizenSignPackage SolutionPath="$(SolutionPath)" ProjectPath="$(MSBuildProjectFullPath)" SolutionName="$(SolutionName)" AuthorCertificate="$(AuthorCertificate)" AuthorPasswd="$(AuthorPasswd)" DistribCertificate="$(DistribCertificate)" DistribPasswd="$(DistribPasswd)" />\r
- </Target>\r
- <ProjectExtensions>\r
- <VisualStudio>\r
- <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Debug|Any CPU">\r
- <ProjectCommonFlavorCfg />\r
- </FlavorProperties>\r
- <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Release|Any CPU">\r
- <ProjectCommonFlavorCfg />\r
- </FlavorProperties>\r
- </VisualStudio>\r
- </ProjectExtensions>\r
+ -->
+ <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>
+ <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>
+ <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
+ </PropertyGroup>
+ <!-- Include tasks for Tizen -->
+ <PropertyGroup>
+ <TizenBuildPath>$(MSBuildExtensionsPath)\Tizen</TizenBuildPath>
+ <TizenToolsPath>$(TizenBuildPath)\bin</TizenToolsPath>
+ </PropertyGroup>
+ <UsingTask TaskName="Tizen.Tasks.SignPackage.TizenCleanPackageSource" AssemblyFile="$(TizenToolsPath)\Tizen.Tasks.SignPackage.dll" />
+ <UsingTask TaskName="Tizen.Tasks.SignPackage.TizenPreparePackageManifest" AssemblyFile="$(TizenToolsPath)\Tizen.Tasks.SignPackage.dll" />
+ <UsingTask TaskName="Tizen.Tasks.SignPackage.TizenPreparePackageSource" AssemblyFile="$(TizenToolsPath)\Tizen.Tasks.SignPackage.dll" />
+ <UsingTask TaskName="Tizen.Tasks.SignPackage.TizenSignPackage" AssemblyFile="$(TizenToolsPath)\Tizen.Tasks.SignPackage.dll" />
+ <!-- Task to clean package source -->
+ <Target Name="_TizenCleanPkgSrc">
+ <TizenCleanPackageSource SolutionPath="$(SolutionPath)" ProjectPath="$(MSBuildProjectFullPath)" />
+ </Target>
+ <!-- Task to prepare tizen-manifest.xml file -->
+ <Target Name="_TizenPrepManifest">
+ <TizenPreparePackageManifest SolutionPath="$(SolutionPath)" ProjectPath="$(MSBuildProjectFullPath)" />
+ </Target>
+ <!-- Task to prepare package sources(executable, dlls, resource files) -->
+ <Target Name="_TizenPrepPkgSrc">
+ <TizenPreparePackageSource SolutionPath="$(SolutionPath)" ProjectPath="$(MSBuildProjectFullPath)" AssemblyName="$(AssemblyName)" TargetPath="$(TargetPath)" />
+ </Target>
+ <!-- Task to signing and packaging -->
+ <Target Name="_TizenSignPackge">
+ <TizenSignPackage SolutionPath="$(SolutionPath)" ProjectPath="$(MSBuildProjectFullPath)" SolutionName="$(SolutionName)" AuthorCertificate="$(AuthorCertificate)" AuthorPasswd="$(AuthorPasswd)" DistribCertificate="$(DistribCertificate)" DistribPasswd="$(DistribPasswd)" />
+ </Target>
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Debug|Any CPU">
+ <ProjectCommonFlavorCfg />
+ </FlavorProperties>
+ <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Release|Any CPU">
+ <ProjectCommonFlavorCfg />
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
</Project>
\ No newline at end of file