private static string LastModemError = string.Empty; //Für Modem-Fehler nur einmal im Log aufzeichnen. #endregion private static void Gsm_GsmStatusReceived(object sender, GsmStatusArgs e) { if ((Gsm.Debug & (int)Gsm.DebugCategory.GsmStatus) > 0) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(e.Property + ":\t" + e.Value); Console.ForegroundColor = ConsoleColor.Gray; } switch (e.Property) { case Gsm.Modem.SignalQuality: MelBoxWeb.GsmStatus.SignalQuality = (int)e.Value; break; case Gsm.Modem.BitErrorRate: MelBoxWeb.GsmStatus.SignalErrorRate = (double)e.Value; break; case Gsm.Modem.OwnPhoneNumber: MelBoxWeb.GsmStatus.OwnNumber = e.Value.ToString(); break; case Gsm.Modem.OwnName: MelBoxWeb.GsmStatus.OwnName = e.Value.ToString(); break; case Gsm.Modem.ServiceCenterNumber: MelBoxWeb.GsmStatus.ServiceCenterNumber = e.Value.ToString(); break; case Gsm.Modem.NetworkRegistration: MelBoxWeb.GsmStatus.NetworkRegistration = e.Value.ToString(); if (e.Value.ToString() != "registriert") { MelBoxSql.Tab_Log.Insert(Tab_Log.Topic.Gsm, 1, "Mobilfunknetz: " + e.Value); } break; case Gsm.Modem.ProviderName: MelBoxWeb.GsmStatus.ProviderName = e.Value.ToString(); break; case Gsm.Modem.IncomingCall: string call = "Eingehender Sprachanruf von " + e.Value; MelBoxSql.Tab_Log.Insert(MelBoxSql.Tab_Log.Topic.Gsm, 2, call); Console.WriteLine(DateTime.Now + "\t" + call); break; case Gsm.Modem.RelayCallEnabled: if ((bool)e.Value) { MelBoxWeb.GsmStatus.RelayNumber = Gsm.RelayCallsToPhone; Tab_Log.Insert(Tab_Log.Topic.Gsm, 3, "Sprachanrufe werden umgeleitet an +" + Gsm.RelayCallsToPhone); } else { Tab_Log.Insert(Tab_Log.Topic.Gsm, 1, "Keine Umleitung von Sprachanrufen an +" + Gsm.RelayCallsToPhone); Gsm.Ask_RelayIncomingCalls(Gsm.RelayCallsToPhone); } break; case Gsm.Modem.PinStatus: MelBoxWeb.GsmStatus.PinStatus = e.Value.ToString(); break; case Gsm.Modem.ModemError: MelBoxWeb.GsmStatus.LastError = DateTime.Now.ToString("G") + " - " + e.Value.ToString(); if (LastModemError.Length == 0 || LastModemError != e.Value.ToString()) { Tab_Log.Insert(Tab_Log.Topic.Gsm, 2, "Fehler an Modem: " + e.Value); LastModemError = e.Value.ToString(); //Fehler nur einmal im Log aufzeichnen. } break; case Gsm.Modem.SimSlot: if ((bool)e.Value) { Console.WriteLine("SIM-Karte erkannt."); Gsm.Ask_NetworkRegistration(); } break; default: break; } }