コード例 #1
0
        private static void MonitorHealth(RouterManager rm, bool isInitialized, ILogger logger)
        {
            string connectionType = rm.GetConnectionType();

            if (!isInitialized)
            {
                logger.Info("Current connection type is {0}. Monitoring...", RouterManager.ConnectionStatusType.Parse(connectionType));
            }
            if (!string.IsNullOrEmpty(connectionType) && connectionType != RouterManager.ConnectionStatusType.LTE)
            {
                Console.WriteLine();
                logger.Info("Connection dropped to {0}. Switching.", RouterManager.ConnectionStatusType.Parse(connectionType));
                // Switch to LTE
                if (rm.Login())
                {
                    rm.SwitchConnectionType(RouterManager.ConnectionSwitchType.LTE);
                    rm.SwitchConnectionType(RouterManager.ConnectionSwitchType.Auto);
                }
                logger.Info("Switching... Done!");
            }
        }