private async void setBarringBtn_Clicked(object sender, EventArgs e) { TapiHandle handle = Globals.handleModem0; try { Log.Debug(Globals.LogTag, "Ss set barring start"); handle.RegisterNotiEvent(Notification.SsNotifyBarring); handle.NotificationChanged += Handle_Barring_NotiEvent; SsBarringInfo info = new SsBarringInfo(SsClass.Voice, SsBarringMode.Activate, SsBarringType.Aob, "0000"); SsBarringResponse resp = await ss.SsSetBarring(info); Log.Debug(Globals.LogTag, "Record number: " + resp.RecordNumber); List <SsBarringRecord> rec = resp.Record.ToList(); for (int i = 0; i < resp.RecordNumber; i++) { Log.Debug(Globals.LogTag, "[" + i + "] Class: " + rec[i].Class); Log.Debug(Globals.LogTag, "[" + i + "] Type: " + rec[i].BarringType); Log.Debug(Globals.LogTag, "[" + i + "] Status: " + rec[i].Status); } Log.Debug(Globals.LogTag, "Ss set barring success"); } catch (Exception ex) { Log.Debug(Globals.LogTag, "Ss set barring exception: " + ex.ToString()); } finally { handle.DeregisterNotiEvent(Notification.SsNotifyBarring); handle.NotificationChanged -= Handle_Barring_NotiEvent; } }
private void Handle_Barring_NotiEvent(object sender, NotificationChangedEventArgs e) { Log.Debug(Globals.LogTag, "Ss barring noti event received"); SsBarringResponse resp = (SsBarringResponse)e.Data; Log.Debug(Globals.LogTag, "Record number: " + resp.RecordNumber); List <SsBarringRecord> rec = resp.Record.ToList(); for (int i = 0; i < resp.RecordNumber; i++) { Log.Debug(Globals.LogTag, "[" + i + "] Class: " + rec[i].Class); Log.Debug(Globals.LogTag, "[" + i + "] Type: " + rec[i].BarringType); Log.Debug(Globals.LogTag, "[" + i + "] Status: " + rec[i].Status); } }
private async void getBarringBtn_Clicked(object sender, EventArgs e) { try { Log.Debug(Globals.LogTag, "Ss get barring status start"); SsBarringResponse resp = await ss.SsGetBarringStatus(SsClass.AllTele, SsBarringType.Aob); Log.Debug(Globals.LogTag, "Record number: " + resp.RecordNumber); List <SsBarringRecord> rec = resp.Record.ToList(); for (int i = 0; i < resp.RecordNumber; i++) { Log.Debug(Globals.LogTag, "[" + i + "] Class: " + rec[i].Class); Log.Debug(Globals.LogTag, "[" + i + "] Type: " + rec[i].BarringType); Log.Debug(Globals.LogTag, "[" + i + "] Status: " + rec[i].Status); } Log.Debug(Globals.LogTag, "Ss get barring status success"); } catch (Exception ex) { Log.Debug(Globals.LogTag, "Ss set barring exception: " + ex.ToString()); } }