Beispiel #1
0
        private void AddOperators()
        {
            if (mConfig == null)
            {
                return;
            }

            var id = mConfig.GetInt("ExtraOperator", "Id");

            if (id == null)
            {
                return;
            }

            var login = mConfig.GetString("ExtraOperator", "Login");

            if (login == null)
            {
                return;
            }

            var password = mConfig.GetString("ExtraOperator", "Password");

            if (password == null)
            {
                return;
            }

            var apn = mConfig.GetString("ExtraOperator", "Apn");

            if (apn == null)
            {
                return;
            }

            var phone = mConfig.GetString("ExtraOperator", "Phone");

            if (phone == null)
            {
                return;
            }

            var ussd = mConfig.GetString("ExtraOperator", "Ussd");

            if (ussd == null)
            {
                return;
            }

            Operators.Add((ushort)id, new CellOperatorInfo(login, password, apn, phone, ussd));
        }
Beispiel #2
0
        private void Init()
        {
            try
            {
                mConfig = new IniConfiguration(mLogger, "GsmModem.ini");

                // TODO: перенести конфигурацию пинов в INI файл
                mReset = new OutputPort(Pin.Gpio0_21, false); // 21
                mDtr   = new OutputPort(Pin.Gpio2_20, true);  // 84

                DataPort = new GsmChannel(mLogger, mConfig.GetString("Gprs", "DataPath"));
                DataPort.OnExecuteError += PowerOff;

                AuxPort = new GsmChannel(mLogger, mConfig.GetString("Gprs", "AuxPath"));
            }
            catch (ArgumentException) { }
            catch (IOException) { }
            catch (UnauthorizedAccessException) { }
            catch (NotSupportedException) { }
            catch (System.Security.SecurityException) { }
        }