Ejemplo n.º 1
0
        private async Task <alertType> checkHeartbeatLevels(ushort currentValue)
        {
            if (currentValue < AppSettings.MinHeartbeatValue)
            {
                if (!AppSettings.AppLaunchedForMinAlert)
                {
                    System.Diagnostics.Debug.WriteLine("_minAlertResentCounter : " + AppSettings.MinAlertCounter);
                    if (AppSettings.MinAlertCounter <= 0)
                    {
                        AppSettings.MinAlertCounter = 10;
                        System.Diagnostics.Debug.WriteLine("launchAppViaURI now");

                        ToastHelper.PopAlarmLowLimit("Heartbeat value under the specified limit, current value " + currentValue);

                        AppSettings.AppLaunchedForMinAlert = true;
                        return(alertType.minLevelAlert);
                    }

                    AppSettings.MinAlertCounter--;
                }
            }
            else
            {
                AppSettings.AppLaunchedForMinAlert = false;
            }

            if (currentValue > AppSettings.MaxHeartbeatValue)
            {
                if (!AppSettings.AppLaunchedForMaxAlert)
                {
                    System.Diagnostics.Debug.WriteLine("_maxAlertResentCounter : " + AppSettings.MaxAlertCounter);
                    if (AppSettings.MaxAlertCounter <= 0)
                    {
                        AppSettings.MaxAlertCounter = 10;
                        System.Diagnostics.Debug.WriteLine("launchAppViaURI now");

                        ToastHelper.PopAlarmHighLimit("Heartbeat value over the specified limit, current value " + currentValue);

                        AppSettings.AppLaunchedForMaxAlert = true;
                        return(alertType.maxLevelAlert);
                    }

                    AppSettings.MaxAlertCounter--;
                }
            }
            else
            {
                AppSettings.AppLaunchedForMaxAlert = false;
            }

            return(alertType.noAlert);
        }