Exemple #1
0
        public static HrvResults ProcessFileWithSettings(string filename, ProcessingSettings settings)
        {
            // Open file and load JObject from the file

            var content = File.ReadAllText(filename);
            var json    = JObject.Parse(content);

            TestDataJsonFormat_0_1.CheckSignature(json);

            var methodId = TestDataJsonFormat_0_1.GetMethodId(json);

            if (methodId != HrvMethodId.MethodId)
            {
                throw new NotSupportedException($"Method with id '{methodId}' is not supported!");
            }

            // extract the method-specific json
            var testDataJson = TestDataJsonFormat_0_1.GetTestData(json);

            var hrvRawData = TestDataJsonFormat_0_1.GetTestData <HrvRawData>(json);

            var dp = new HrvDataProcessor_Pro();

            if (settings != null)
            {
                dp.Set(settings);
            }
            return((HrvResults)dp.ProcessData(hrvRawData));
        }
Exemple #2
0
        private void ProcessHrvData(TestRawData hrvData, out HrvResults hrvOutData)
        {
            var hrvProcessor = new HrvDataProcessor_Pro();

            IMethodProcessedData tempHrvOutData = hrvProcessor.ProcessData(hrvData);

            hrvOutData = tempHrvOutData as HrvResults;
            if (null == hrvOutData)
            {
                throw new ArgumentException(
                          $"HRV processor returned object of an unexpected type. Data type: " +
                          $"{tempHrvOutData.GetType()}, expected: {typeof(HrvResults)}");
            }
        }