Exemplo n.º 1
0
        public static async Task <bool> SendMessage(string url, string message, string productionSiteId)
        {
            using (var client = new HttpClient())
            {
                var request = new Message()
                {
                    content = message,
                    device  = productionSiteId,
                    date    = DateTime.Now.ToString(),
                };

                try
                {
                    var response = await client.PostAsync(url,
                                                          new StringContent(JsonSerializer.Serialize(request),
                                                                            Encoding.UTF8, "application/json"));

                    if (response.IsSuccessStatusCode)
                    {
                        lg.AppendLog(Log.CreateLog("Measures sent to Azure via Internet", LogType.Information));
                        return(true);
                    }
                }
                catch (Exception ex)
                {
                    lg.AppendLog(Log.CreateErrorLog("Exception on Measures to Azure", ex));
                    return(false);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        public void InitInterface()
        {
            if (isInitialized)
            {
                return;
            }

            var watch = Stopwatch.StartNew();

            try
            {
                string[] ports = SerialPort.GetPortNames();

                var sigfoxPortName = ports.ToList().Where(s => s.Contains(@"ttyAMA0")).FirstOrDefault();

                serialPort = new SerialPort(sigfoxPortName);

                if (serialPort == null)
                {
                    lg.AppendLog(Log.CreateLog("Sigfox device not found", LogType.System));
                }

                lg.AppendLog(Log.CreateLog("Associating Sigfox device", LogType.System));

                // Configure serial settings
                serialPort.BaudRate     = 9600;
                serialPort.Parity       = Parity.None;
                serialPort.StopBits     = StopBits.One;
                serialPort.DataBits     = 8;
                serialPort.Handshake    = Handshake.None;
                serialPort.ReadTimeout  = 5000;
                serialPort.WriteTimeout = 5000;

                serialPort.Open();

                string strStatus = string.Empty;

                serialPort.WriteLine(isOnlineATCommand);

                Task.Delay(1000).Wait();

                strStatus = serialPort.ReadExisting();

                Console.WriteLine(strStatus);

                isInitialized = true;
            }

            catch (Exception ex)
            {
                lg.AppendLog(Log.CreateErrorLog("Exception on Sigfox Init", ex));
            }
            finally
            {
                lg.AppendLog(Log.CreateLog(String.Format("Sigfox Interface online in {0} sec.", watch.ElapsedMilliseconds / 1000), LogType.System));
                watch.Stop();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructs Htu21d with I2C bus identified
        /// </summary>
        /// <param name="i2cBusName">
        /// The bus name to provide to the enumerator
        /// </param>
        public HumidityTemperatureManager()
        {
            lg.AppendLog(Log.CreateLog("Set Air/Hum Register", LogType.Information));
            ("sudo i2cset -y 1 0x40 0xE6 0x33").Bash();

            IsConnected = false;
        }
Exemplo n.º 4
0
        public void InitFileFolder()
        {
            try
            {
                if (!File.Exists(FILE_NAME))
                {
                    var uniqueProductionSiteId = Guid.NewGuid().ToString().Substring(0, 8).ToUpper();

#if DEBUG
                    var defaultUserSettings = new UserSettings()
                    {
                        isDebugLedEnable           = false,
                        isSleepModeEnable          = false,
                        isTempHumiditySensorEnable = true,
                        isDiagnosticModeEnable     = false,
                        measureFrequency           = 1800000,
                        productionSiteId           = uniqueProductionSiteId,
                        hubMessageAPI    = "https://hub.myfood.eu/api/Messages",
                        connectivityType = ConnectivityType.Sigfox,
                        sigfoxVersion    = SigfoxVersion.v2
                    };
#endif

#if !DEBUG
                    var defaultUserSettings = new UserSettings()
                    {
                        isDebugLedEnable           = false,
                        isSleepModeEnable          = false,
                        isTempHumiditySensorEnable = true,
                        isDiagnosticModeEnable     = false,
                        measureFrequency           = 1800000,
                        productionSiteId           = uniqueProductionSiteId,
                        hubMessageAPI    = "https://hub.myfood.eu/api/Messages",
                        connectivityType = ConnectivityType.Sigfox,
                        sigfoxVersion    = SigfoxVersion.v2
                    };
#endif

                    string strSettings;
                    var    options = new JsonSerializerOptions
                    {
                        WriteIndented = true
                    };

                    strSettings = JsonSerializer.Serialize(defaultUserSettings, options);

                    File.WriteAllText(FILE_NAME, strSettings);
                }
            }
            catch (Exception ex)
            {
                lg.AppendLog(Log.CreateErrorLog("Configuration File Creation", ex));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Read the date and time from the RTC
        /// </summary>
        /// <returns>DateTime</returns>
        public DateTime ReadDate()
        {
            byte[] DateArray = helper.ReadI2CBlockData(i2cbus, 0, 7);
            int    year      = BCDtoInt(DateArray[6]) + century;
            int    month     = BCDtoInt(DateArray[5]);
            int    day       = BCDtoInt(DateArray[4]);
            int    dayofweek = BCDtoInt(DateArray[3]);
            int    hours     = BCDtoInt(DateArray[2]);
            int    minutes   = BCDtoInt(DateArray[1]);
            int    seconds   = BCDtoInt(DateArray[0]);

            try
            {
                DateTime date = new DateTime(year, month, day, hours, minutes, seconds);
                return(date);
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                lg.AppendLog(Log.CreateErrorLog("Exception on Clock read", ex));
                DateTime date = new DateTime(2016, 08, 01, 01, 01, 01);
                return(date);
            }
        }
Exemplo n.º 6
0
        private MeasureBackgroundTask()
        {
            lg.AppendLog(Log.CreateLog("Measure Service starting...", LogType.Information));

            userSettings = new UserSettings();

            userSettings = userSettingsManager.GetUserSettings();

            lg.AppendLog(Log.CreateLog("UserSettings retreived", LogType.Information));

            //Disable Diagnostic Mode on Restart
            if (userSettings.isDiagnosticModeEnable)
            {
                userSettings.isDiagnosticModeEnable = false;
                userSettingsManager.SyncUserSettings(userSettings);
            }

            bw.WorkerSupportsCancellation = true;
            bw.WorkerReportsProgress      = false;
            bw.DoWork             += Bw_DoWork;
            bw.RunWorkerCompleted += Bw_RunWorkerCompleted;
        }
        public void Run()
        {
            var watch           = Stopwatch.StartNew();
            var captureDateTime = DateTime.Now;

            var clockManager = ClockManager.GetInstance;
            var userSettings = userSettingsManager.GetUserSettings();

            lg.AppendLog(Log.CreateLog("[UTEST00] Sigfox Integration Test start", LogType.Information));
            if (clockManager != null)
            {
                Task.Run(async() =>
                {
                    clockManager.InitClock();
                    await Task.Delay(3000);
                }).Wait();

                captureDateTime = clockManager.ReadDate();

                clockManager.Dispose();
            }

            sigfoxManager = SigfoxInterfaceManager.GetInstance;

            lg.AppendLog(Log.CreateLog("[UTEST01] Sigfox Init started", LogType.Information));

            if (userSettings.connectivityType == ConnectivityType.Sigfox)
            {
                var taskSigfox = Task.Run(async() =>
                {
                    sigfoxManager.InitInterface();
                    await Task.Delay(1000);
                });
                taskSigfox.Wait();
            }

            sensorManager = AtlasSensorManager.GetInstance;

            lg.AppendLog(Log.CreateLog("[UTEST03] Atlas Sensors init", LogType.Information));
            var taskSensor = Task.Run(async() =>
            {
                sensorManager.InitSensors(false);
                await Task.Delay(1000);
            });

            taskSensor.Wait();

            lg.AppendLog(Log.CreateLog("[UTEST04] Air Temp/Hum Sensor init", LogType.Information));
            var humTempManager = HumidityTemperatureManager.GetInstance;

            var taskHumManager = Task.Run(async() =>
            {
                humTempManager.Connect();
                await Task.Delay(1000);
            });

            taskHumManager.Wait();

            try
            {
                var elapsedMs = watch.ElapsedMilliseconds;

                TimeSpan t = TimeSpan.FromMilliseconds(elapsedMs);

                var watchMesures = Stopwatch.StartNew();

                if (sensorManager.isSensorOnline(SensorTypeEnum.waterTemperature))
                {
                    lg.AppendLog(Log.CreateLog("[UTEST10] Water Temperature capturing", LogType.Information));

                    decimal capturedValue = 0;
                    capturedValue = sensorManager.RecordSensorsMeasure(SensorTypeEnum.waterTemperature, false);

                    if (capturedValue > -20 && capturedValue < 80)
                    {
                        sensorManager.SetWaterTemperatureForPHSensor(capturedValue);

                        var task = Task.Run(async() =>
                        {
                            await databaseModel.AddMesure(captureDateTime, capturedValue, SensorTypeEnum.waterTemperature);
                        });
                        task.Wait();

                        lg.AppendLog(Log.CreateLog(String.Format("[UTEST11] Water Temperature captured : {0}", capturedValue), LogType.Information));
                        var status = sensorManager.GetSensorStatus(SensorTypeEnum.waterTemperature, false);
                        lg.AppendLog(Log.CreateLog(String.Format("[UTEST12] Water Temperature status : {0}", status), LogType.System));
                    }
                    else
                    {
                        lg.AppendLog(Log.CreateLog(String.Format("[UTEST13] Water Temperature value out of range - {0}", capturedValue), LogType.Warning));
                    }
                }

                if (sensorManager.isSensorOnline(SensorTypeEnum.pH))
                {
                    lg.AppendLog(Log.CreateLog("[UTEST13] PH capturing", LogType.Information));

                    decimal capturedValue = 0;
                    capturedValue = sensorManager.RecordpHMeasure(false);

                    if (capturedValue > 1 && capturedValue < 12)
                    {
                        var task = Task.Run(async() =>
                        {
                            await databaseModel.AddMesure(captureDateTime, capturedValue, SensorTypeEnum.pH);
                        });
                        task.Wait();

                        lg.AppendLog(Log.CreateLog(String.Format("[UTEST14] PH captured : {0}", capturedValue), LogType.Information));
                        var status = sensorManager.GetSensorStatus(SensorTypeEnum.pH, false);
                        lg.AppendLog(Log.CreateLog(String.Format("[UTEST15] PH status : {0}", status), LogType.System));
                    }
                    else
                    {
                        lg.AppendLog(Log.CreateLog(String.Format("PH value out of range - {0}", capturedValue), LogType.Warning));
                    }
                }

                try
                {
                    lg.AppendLog(Log.CreateLog("[UTEST24] Air Temperature capturing", LogType.Information));

                    decimal capturedValue = (decimal)humTempManager.Temperature;

                    if (capturedValue > 0 && capturedValue < 100)
                    {
                        var taskTemp = Task.Run(async() =>
                        {
                            await databaseModel.AddMesure(captureDateTime, capturedValue, SensorTypeEnum.airTemperature);
                        });
                        taskTemp.Wait();

                        lg.AppendLog(Log.CreateLog(String.Format("[UTEST25] Air Temperature captured : {0}", capturedValue), LogType.Information));
                    }
                    else
                    {
                        lg.AppendLog(Log.CreateLog(String.Format("[UTEST26] Air Temperature out of range - {0}", capturedValue), LogType.Warning));
                    }
                }
                catch (Exception ex)
                {
                    lg.AppendLog(Log.CreateErrorLog("Exception on Air Temperature Sensor", ex));
                }

                try
                {
                    lg.AppendLog(Log.CreateLog("[UTEST27] Humidity capturing", LogType.Information));

                    decimal capturedValue = (decimal)humTempManager.Humidity;

                    if (capturedValue > 0 && capturedValue < 100)
                    {
                        var taskHum = Task.Run(async() =>
                        {
                            await databaseModel.AddMesure(captureDateTime, capturedValue, SensorTypeEnum.humidity);
                        });
                        taskHum.Wait();

                        lg.AppendLog(Log.CreateLog(String.Format("[UTEST28] Air Humidity captured : {0}", capturedValue), LogType.Information));
                    }
                    else
                    {
                        lg.AppendLog(Log.CreateLog(String.Format("[UTEST29] Air Humidity out of range - {0}", capturedValue), LogType.Warning));
                    }
                }
                catch (Exception ex)
                {
                    lg.AppendLog(Log.CreateErrorLog("Exception on Air Humidity Sensor", ex));
                }

                lg.AppendLog(Log.CreateLog(String.Format("[UTEST30] Measures captured in {0} sec.", watchMesures.ElapsedMilliseconds / 1000), LogType.System));

                watchMesures.Restart();

                string messageSignature = String.Empty;

                var taskSig = Task.Run(async() =>
                {
                    messageSignature = await databaseModel.GetLastMesureSignature();
                });
                taskSig.Wait();

                if (userSettings.connectivityType == ConnectivityType.Wifi && NetworkInterface.GetIsNetworkAvailable())
                {
                    Task.Run(async() =>
                    {
                        await HttpClientHelper.SendMessage(userSettings.hubMessageAPI,
                                                           messageSignature,
                                                           userSettings.productionSiteId);
                    }).Wait();
                }
                else
                {
                    sigfoxManager.SendMessage(messageSignature, userSettings.sigfoxVersion);
                }

                lg.AppendLog(Log.CreateLog(String.Format("[UTEST31] Data sent to Azure via Sigfox in {0} sec.", watchMesures.ElapsedMilliseconds / 1000), LogType.System));
            }
            catch (Exception ex)
            {
                lg.AppendLog(Log.CreateErrorLog("Exception on Sigfox Integration Test", ex));
            }

            watch.Stop();
        }
Exemplo n.º 8
0
        void Browser.run()
        {
            while (true)
            {
                DataGridViewRowCollection  rows  = form.getTableRows();
                DataGridViewRow            row   = rows[CommonUtils.GetRandomValue(0, rows.Count)];
                DataGridViewCellCollection cells = row.Cells;

                //SetAgentType(getCellValue(cells, Main.HEADER_AGENT));

                if (!form.isRemainTask())
                {
                    break;
                }

                if (int.Parse(getCellValue(cells, Main.HEADER_TO_COUNT)) == int.Parse(getCellValue(cells, Main.HEADER_CURR_COUNT)))
                {
                    continue;
                }

                List <Configuration> Configs = sqlite.SelectAllConfigurationByOwner(getCellValue(cells, Main.HEADER_SLOT));
                if (Configs == null || Configs.Count == 0)
                {
                    Configs = sqlite.SelectAllConfigurationByOwner(Configuration.Default);
                }

                Dictionary <string, string> dictionary = Configuration.ConvertObjectToMap(Configs);

                //  string searchText = getCellValue(cells, Main.HEADER_SEARCH);
                //   string nxSearchText = getCellValue(cells, Main.HEADER_NXSEARCH);

                try
                {
                    logManager.AppendLog("//========슬롯[{0}]의 작업을 시작합니다.========//", getCellValue(cells, Main.HEADER_SLOT));

                    form.BeginInvoke(new Action(() => { form.ChangeRowColor(row, Color.LawnGreen); }));

                    // 브라우저 시작
                    //  StartBrowser( dictionary, getCellValue(cells, Main.HEADER_BROWSER));

                    // 검색어 입력
                    //SetSearchText("#query", searchText, false);

                    // 검색전 체류
                    Stay("1차 검색 전", dictionary[Configuration.COMMON_PRE_SEARCH_STAY]);

                    // 1차 검색
                    if (agentType == Slot.AGENT_TYPE_PC)
                    {
                        ClickSearchBtn("search_btn");
                    }
                    else
                    {
                        ClickSearchBtn("query");
                    }

                    // 랭크 처리
                    //   form.SetSearchRank(row, FindSearchRank(nxSearchText));

                    // 검색 후 체류
                    Stay("1차 검색 후", dictionary[Configuration.COMMON_SEARCH_STAY]);

                    // 스크롤 처리
                    ScrollBy(dictionary);

                    // 카테고리 이동
                    //   int index = MoveTab( getCellValue(cells, Main.HEADER_CATEGORY));

                    // 카테고리 이동 후 체류
                    Stay("카테고리 이동 후", dictionary[Configuration.COMMON_SEARCH_STAY]);

                    // 2차 검색어 입력
                    //   SetSearchText("#nx_query", nxSearchText, true);

                    // 검색전 체류
                    Stay("2차 검색 전", dictionary[Configuration.COMMON_PRE_SEARCH_STAY]);

                    // 2차 검색
                    if (agentType == Slot.AGENT_TYPE_PC)
                    {
                        ClickSearchBtn("bt_search");
                    }
                    else
                    {
                        ClickSearchBtn("nx_query");
                    }

                    // 검색 후 체류
                    Stay("2차 검색 후", dictionary[Configuration.COMMON_SEARCH_STAY]);

                    int MaxPageCount = CommonUtils.GetRandomValue(dictionary[Configuration.COMMON_MAX_PAGE]);
                    for (int i = 0; i < MaxPageCount; i++)
                    {
                        // 스크롤 처리
                        ScrollBy(dictionary);

                        // 게시물 조회
                        //  bool isViewSuccess = PostViewBy(index, null, 1500, true);

                        // 게시물 조회 성공
                        // if (isViewSuccess)
                        // {
                        // 스크롤 처리
                        //    ScrollBy(dictionary);

                        // 최초방문페이지 체류
                        Stay("최초 페이지 방문 후", dictionary[Configuration.COMMON_INIT_PAGE_STAY]);
                        //   }

                        // 이전 히스토리 이동
                        HistoryBack();

                        // 이전 히스토리 이동 후 체류 시간
                        Stay("히스토리 이전으로 이동 후", dictionary[Configuration.COMMON_PRE_HISTORY_MOVE_STAY]);
                    }

                    DeleteCookie();

                    // 쿠키삭제 후 체류
                    Stay("쿠키 삭제 후", dictionary[Configuration.COOKIE_DELETE_POST_STAY]);

                    // 카운트 증가
                    ComplateProcess(row);

                    //브라우저 종료
                    CloseBrowser();

                    // 아이피 변경
                    ChangeIP(dictionary);

                    logManager.AppendLog("//========슬롯[{0}]의 작업을 종료합니다.========//", getCellValue(cells, Main.HEADER_SLOT));
                }
                catch (Exception e)
                {
                    logManager.AppendLog("Nested Exception : {0}", e.Message);

                    // 작업 종료
                    if (e is ThreadAbortException)
                    {
                        form.EnableWorkBtn(false, "정지 중");
                        ClosingProcess(row);
                        logManager.AppendLog("정상적으로 작업이 중지 되었습니다.");
                        form.EnableWorkBtn(true, "작업 실행");
                    }
                    else
                    {
                        ClosingProcess(row);
                        logManager.AppendLog("[EXCEPTION] 브라우저가 강제적으로 종료되었거나 알 수 없는 오류가 발생 하였습니다.");
                    }

                    break;
                }

                form.EnableWorkBtn(true, "작업 실행");
            }
        }
Exemplo n.º 9
0
        public void InitSensors(bool isSleepModeActivated)
        {
            if (isInitialized)
            {
                return;
            }

            var watch = Stopwatch.StartNew();

            try
            {
                string[] ports = SerialPort.GetPortNames();

                lg.AppendLog(Log.CreateLog(String.Format("Sensors found in {0} sec.", watch.ElapsedMilliseconds / 1000), LogType.System));

                for (int i = 0; i < ports.Count(); i++)
                {
                    try
                    {
                        if (ports[i].Contains("ttyUSB"))
                        {
                            try
                            {
                                lg.AppendLog(Log.CreateLog(String.Format("Associating device ID - {0}", ports[i]), LogType.System));

                                var serialPort = new SerialPort(ports[i]);

                                // Configure serial settings
                                serialPort.BaudRate     = 9600;
                                serialPort.Parity       = Parity.None;
                                serialPort.StopBits     = StopBits.One;
                                serialPort.DataBits     = 8;
                                serialPort.Handshake    = Handshake.None;
                                serialPort.ReadTimeout  = 6000;
                                serialPort.WriteTimeout = 6000;

                                serialPort.Open();

                                var tsk = Task.Run(async() =>
                                {
                                    r = await SendCommand(serialPort, informationCommand);
                                });
                                tsk.Wait();

                                tsk = Task.Run(async() =>
                                {
                                    s = await SendCommand(serialPort, getStatusCommand);
                                });
                                tsk.Wait();

                                tsk = Task.Run(async() =>
                                {
                                    strResult = await SendCommand(serialPort, getContinuousModeStatus);
                                });
                                tsk.Wait();

                                if (strResult.Contains(answersContinuousModeOn))
                                {
                                    tsk = Task.Run(async() =>
                                    {
                                        strResult = await SendCommand(serialPort, disableContinuousModeCommand);
                                    });
                                    tsk.Wait();
                                }

                                tsk = Task.Run(async() =>
                                {
                                    strResult = await SendCommand(serialPort, getAutomaticAnswerStatusv1);
                                });
                                tsk.Wait();


                                if (strResult.Contains(answersAutomaticAnswerOnv1))
                                {
                                    tsk = Task.Run(async() =>
                                    {
                                        strResult = await SendCommand(serialPort, disableAutomaticAnswerCommandv1);
                                    });
                                    tsk.Wait();
                                }

                                tsk = Task.Run(async() =>
                                {
                                    strResult = await SendCommand(serialPort, getAutomaticAnswerStatusv2);
                                });
                                tsk.Wait();

                                if (strResult.Contains(answersAutomaticAnswerOnv2))
                                {
                                    tsk = Task.Run(async() =>
                                    {
                                        strResult = await SendCommand(serialPort, disableAutomaticAnswerCommandv2);
                                    });
                                    tsk.Wait();
                                }

                                //if (isSleepModeActivated)
                                //{
                                //    var taskSleep = Task.Run(async () =>
                                //    {
                                //        await WriteAsync(sleepModeCommand, newSensor);
                                //    });

                                //    taskSleep.Wait();
                                //}

                                var newSensor = new AtlasSensor()
                                {
                                    currentSerialPort = serialPort
                                };

                                lg.AppendLog(Log.CreateLog(String.Format("Sensor Information - {0}", r), LogType.System));

                                if (r.ToUpper().Contains("RTD"))
                                {
                                    newSensor.sensorType = SensorTypeEnum.waterTemperature;
                                    lg.AppendLog(Log.CreateLog("Water Temperature online", LogType.Information));
                                    lg.AppendLog(Log.CreateLog(String.Format("Water Temperature status - {0}", s), LogType.System));
                                }

                                if (r.ToUpper().Contains("PH"))
                                {
                                    newSensor.sensorType = SensorTypeEnum.pH;
                                    lg.AppendLog(Log.CreateLog("PH online", LogType.Information));
                                    lg.AppendLog(Log.CreateLog(String.Format("PH status - {0}", s), LogType.System));
                                }

                                if (r.ToUpper().Contains("ORP"))
                                {
                                    newSensor.sensorType = SensorTypeEnum.ORP;
                                    lg.AppendLog(Log.CreateLog("ORP online", LogType.Information));
                                    lg.AppendLog(Log.CreateLog(String.Format("ORP status - {0}", s), LogType.System));
                                }

                                if (r.ToUpper().Contains("DO"))
                                {
                                    newSensor.sensorType = SensorTypeEnum.dissolvedOxygen;
                                    lg.AppendLog(Log.CreateLog("Dissolved Oxygen online", LogType.Information));
                                    lg.AppendLog(Log.CreateLog(String.Format("Dissolved Oxygen status - {0}", s), LogType.System));
                                }

                                if (r.ToUpper().Contains("EC"))
                                {
                                    newSensor.sensorType = SensorTypeEnum.EC;
                                    lg.AppendLog(Log.CreateLog("Electro-Conductivity online", LogType.Information));
                                    lg.AppendLog(Log.CreateLog(String.Format("Electro-Conductivity - {0}", s), LogType.System));
                                }

                                sensorsList.Add(newSensor);
                            }

                            catch (AggregateException ex)
                            {
                                Console.WriteLine(ex.ToString());
                                lg.AppendLog(Log.CreateErrorLog("Exception on Sensors Init", ex));
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        lg.AppendLog(Log.CreateErrorLog("Exception on Sensors Init", ex));
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                lg.AppendLog(Log.CreateErrorLog("Exception on Sensors Init", ex));
            }
            finally
            {
                isInitialized = true;

                lg.AppendLog(Log.CreateLog(String.Format("Atlas Sensors online in {0} sec.", watch.ElapsedMilliseconds / 1000), LogType.System));
                watch.Stop();
            }
        }