2 using System.Threading.Tasks;
3 using System.Collections.Generic;
9 namespace XamarinForTizen.Tizen
11 public class SimPage : ContentPage
13 private static Sim _sim = null;
14 private ChangeNotificationEventArgs.Notification[] notiArr = { ChangeNotificationEventArgs.Notification.SimStatus,
15 ChangeNotificationEventArgs.Notification.SimCallForwardingIndicatorState };
18 var changedBtn = new Button
20 Text = "Is sim changed",
21 VerticalOptions = LayoutOptions.Start,
22 HorizontalOptions = LayoutOptions.FillAndExpand
24 changedBtn.Clicked += changedBtn_Clicked;
26 var operatorBtn = new Button
28 Text = "Get operator",
29 VerticalOptions = LayoutOptions.Start,
30 HorizontalOptions = LayoutOptions.FillAndExpand
32 operatorBtn.Clicked += operatorBtn_Clicked;
34 var iccIdBtn = new Button
37 VerticalOptions = LayoutOptions.Start,
38 HorizontalOptions = LayoutOptions.FillAndExpand
40 iccIdBtn.Clicked += iccIdBtn_Clicked;
42 var msinBtn = new Button
45 VerticalOptions = LayoutOptions.Start,
46 HorizontalOptions = LayoutOptions.FillAndExpand
48 msinBtn.Clicked += msinBtn_Clicked;
50 var spnBtn = new Button
53 VerticalOptions = LayoutOptions.Start,
54 HorizontalOptions = LayoutOptions.FillAndExpand
56 spnBtn.Clicked += spnBtn_Clicked;
58 var stateBtn = new Button
60 Text = "Get sim state",
61 VerticalOptions = LayoutOptions.Start,
62 HorizontalOptions = LayoutOptions.FillAndExpand
64 stateBtn.Clicked += stateBtn_Clicked;
66 var appListBtn = new Button
68 Text = "Get sim application list",
69 VerticalOptions = LayoutOptions.Start,
70 HorizontalOptions = LayoutOptions.FillAndExpand
72 appListBtn.Clicked += appListBtn_Clicked;
74 var subscriberBtn = new Button
76 Text = "Get subscriber number",
77 VerticalOptions = LayoutOptions.Start,
78 HorizontalOptions = LayoutOptions.FillAndExpand
80 subscriberBtn.Clicked += subscriberBtn_Clicked;
82 var subscriberIdBtn = new Button
84 Text = "Get subscriber ID",
85 VerticalOptions = LayoutOptions.Start,
86 HorizontalOptions = LayoutOptions.FillAndExpand
88 subscriberIdBtn.Clicked += subscriberIdBtn_Clicked;
90 var lockStateBtn = new Button
92 Text = "Get lock state",
93 VerticalOptions = LayoutOptions.Start,
94 HorizontalOptions = LayoutOptions.FillAndExpand
96 lockStateBtn.Clicked += lockStateBtn_Clicked;
98 var groupIdBtn = new Button
100 Text = "Get group ID1",
101 VerticalOptions = LayoutOptions.Start,
102 HorizontalOptions = LayoutOptions.FillAndExpand
104 groupIdBtn.Clicked += groupIdBtn_Clicked;
106 var cfIndiStateBtn = new Button
108 Text = "Get call forwarding indicator state",
109 VerticalOptions = LayoutOptions.Start,
110 HorizontalOptions = LayoutOptions.FillAndExpand
112 cfIndiStateBtn.Clicked += cfIndiStateBtn_Clicked;
114 Content = new StackLayout
116 VerticalOptions = LayoutOptions.Center,
118 changedBtn, operatorBtn, iccIdBtn, msinBtn, spnBtn, stateBtn, appListBtn, subscriberBtn,
119 subscriberIdBtn, lockStateBtn, groupIdBtn, cfIndiStateBtn
125 if (Globals.slotHandle == null)
127 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
131 Globals.slotHandle.ChangeNotification += SlotHandle_ChangeNotification;
132 List<ChangeNotificationEventArgs.Notification> notiList = new List<ChangeNotificationEventArgs.Notification>();
133 foreach (ChangeNotificationEventArgs.Notification noti in notiArr)
138 Globals.slotHandle.SetNotificationId(notiList);
139 _sim = new Sim(Globals.slotHandle);
144 Log.Debug(Globals.LogTag, "Exception in Sim constructor: " + ex.ToString());
148 private void SlotHandle_ChangeNotification(object sender, ChangeNotificationEventArgs e)
150 Log.Debug(Globals.LogTag, "Change notification: " + e.NotificationType);
153 private void cfIndiStateBtn_Clicked(object sender, EventArgs e)
157 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
161 Log.Debug(Globals.LogTag, "Call forwarding indicator state: " + _sim.CallForwardingIndicatorState);
164 private void groupIdBtn_Clicked(object sender, EventArgs e)
168 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
172 Log.Debug(Globals.LogTag, "Group ID1: " + _sim.GroupId1);
175 private void lockStateBtn_Clicked(object sender, EventArgs e)
179 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
183 Log.Debug(Globals.LogTag, "Sim lock state: " + _sim.CurrentLockState);
186 private void subscriberIdBtn_Clicked(object sender, EventArgs e)
190 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
194 Log.Debug(Globals.LogTag, "Subscriber ID: " + _sim.SubscriberId);
197 private void subscriberBtn_Clicked(object sender, EventArgs e)
201 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
205 Log.Debug(Globals.LogTag, "Subscriber Number: " + _sim.SubscriberNumber);
208 private void appListBtn_Clicked(object sender, EventArgs e)
212 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
216 Log.Debug(Globals.LogTag, "Application list: " + _sim.ApplicationList);
219 private void stateBtn_Clicked(object sender, EventArgs e)
223 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
227 Log.Debug(Globals.LogTag, "Sim state: " + _sim.CurrentState);
230 private void spnBtn_Clicked(object sender, EventArgs e)
234 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
238 Log.Debug(Globals.LogTag, "Spn: " + _sim.Spn);
241 private void msinBtn_Clicked(object sender, EventArgs e)
245 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
249 Log.Debug(Globals.LogTag, "Msin: " + _sim.Msin);
252 private void iccIdBtn_Clicked(object sender, EventArgs e)
256 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
260 Log.Debug(Globals.LogTag, "Icc id: " + _sim.IccId);
263 private void operatorBtn_Clicked(object sender, EventArgs e)
267 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
271 Log.Debug(Globals.LogTag, "Operator: " + _sim.Operator);
274 private void changedBtn_Clicked(object sender, EventArgs e)
278 Log.Debug(Globals.LogTag, "Telephony is not initialized/there are no sim slot handles");
282 Log.Debug(Globals.LogTag, "Is sim changed: " + _sim.IsChanged);