public static void setUpBeforeClass(TestContext testContext)
        {
            factory = UnisensFactoryBuilder.createFactory();

            Test1Location = CopyExampleToTest(EXAMPLE1);
            unisens       = factory.createUnisens(Test1Location);
            signalEntry   = (SignalEntry)unisens.getEntry("ecg.bin");

            String Test3Location = CopyExampleToTest(EXAMPLE3);

            unisens3     = factory.createUnisens(Test3Location);
            signalEntry3 = (SignalEntry)unisens3.getEntry("test.bin");

            String TestUnitLocation = CopyExampleToTest(EXAMPLE_UNIT);

            unisensUint            = factory.createUnisens(TestUnitLocation);
            signalEntryUint8_2x12  = (SignalEntry)unisensUint.getEntry("test_2x12_UINT8.bin");
            signalEntryUint16_2x12 = (SignalEntry)unisensUint.getEntry("test_2x12_UINT16.bin");
            signalEntryUint32_2x12 = (SignalEntry)unisensUint.getEntry("test_2x12_UINT32.bin");
            signalEntryUint8_1x12  = (SignalEntry)unisensUint.getEntry("test_1x12_UINT8.bin");
            signalEntryUint16_1x12 = (SignalEntry)unisensUint.getEntry("test_1x12_UINT16.bin");
            signalEntryUint32_1x12 = (SignalEntry)unisensUint.getEntry("test_1x12_UINT32.bin");
            signalEntryUint8_1x1   = (SignalEntry)unisensUint.getEntry("test_1x1_UINT8.bin");
            signalEntryUint16_1x1  = (SignalEntry)unisensUint.getEntry("test_1x1_UINT16.bin");
            signalEntryUint32_1x1  = (SignalEntry)unisensUint.getEntry("test_1x1_UINT32.bin");
        }
Example #2
0
        public static void ClassInitialize(TestContext testContext)
        {
            String Test1Location = CopyExampleToTest(EXAMPLE1);
            String Test2Location = CopyExampleToTest(EXAMPLE2);

            factory  = UnisensFactoryBuilder.createFactory();
            unisens1 = factory.createUnisens(Test1Location);
            unisens2 = factory.createUnisens(Test2Location);
        }
        public void testAppendEvent()
        {
            Event newEvent = new Event(6000, "A7", "liegen");

            expected.Add(newEvent);
            eventEntry.append(newEvent);
            assertEventList(expected, eventEntry.read(0, 7));
            expected.Remove(newEvent);
            eventEntry.empty();
            eventEntry.append(expected);
            assertEventList(expected, eventEntry.read(0, 6));
            unisens.closeAll();
            unisens = factory.createUnisens(EXAMPLE2);
        }
Example #4
0
        private void eventBin()
        {
            UnisensFactory uf = UnisensFactoryBuilder.createFactory();
            Unisens        u  = uf.createUnisens(path);
            EventEntry     ee = u.createEventEntry("event.bin", 1000);

            u.setMeasurementId("sampleData");
            u.setTimestampStart(DateTime.Now);
            u.setComment("Example data set , derived from Holtervergleich_0001 .");

            ee.setFileFormat(ee.createBinFileFormat());
            ee.setCommentLength(6);
            ee.setTypeLength(1);
            List <Event> eventList = new List <Event>();

            eventList.Add(new Event(124, "N", "NORMAL"));
            eventList.Add(new Event(346, "N", "NORMAL"));
            eventList.Add(new Event(523, "V", "PVC"));
            ee.append(eventList);
            //ee.append(new Event(124, "N", "NORMAL"));
            //ee.append(new Event(346, "N", "NORMAL"));
            //ee.append(new Event(523, "V", "PVC   "));
            ee.setComment("Reference trigger list ");
            ee.setContentClass("TRIGGER");
            ee.setSourceId("trigger_reference .csv");
            ee.setSampleRate(1000);
            ee.setSource("PADSY /M. Kirst ");
            ee.setTypeLength(1);

            u.save();
            u.closeAll();
        }
Example #5
0
        public IEnumerable <XElement> Main(XDocument unisensxml, IEnumerable <XElement> selectedsignals, string path, double time_cursor, double time_start, double time_end, string parameter)
        {
            List <XElement> returnElementList = new List <XElement>();
            string          groupId           = null;
            DialogNewGroup  dialogNewGroup    = new DialogNewGroup();

            dialogNewGroup.Topmost = true;
            if (dialogNewGroup.ShowDialog() != (DialogNewGroup.newgroup))
            {
                groupId = DialogNewGroup.idOfTheGroup;
            }
            path = path.Substring(0, path.Length - 11);
            UnisensFactory factory = UnisensFactoryBuilder.createFactory();

            org.unisens.Unisens unisens      = factory.createUnisens(path);
            org.unisens.Group   group        = (org.unisens.Group)unisens.createGroup(groupId);
            XElement            groupElement = new XElement("{http://www.unisens.org/unisens2.0}group",
                                                            new XAttribute("id", groupId)
                                                            );

            foreach (XElement xe in selectedsignals)
            {
                XElement xelement = new XElement("{http://www.unisens.org/unisens2.0}groupEntry",
                                                 new XAttribute("ref", xe.Attribute("id").Value));
                groupElement.Add(xelement);
            }

            returnElementList.Add(groupElement);
            unisensxml.Root.Add(groupElement);
            unisens.closeAll();
            return(returnElementList);
        }
Example #6
0
        private void btnExml_Click(object sender, EventArgs e)
        {
            org.unisens.Unisens u = null;
            try
            {
                UnisensFactory uf = UnisensFactoryBuilder.createFactory();

                u = uf.createUnisens(folderDialogue.SelectedPath);
                var ee = u.createEventEntry("event.xml", 1000);
                ee.setFileFormat(ee.createXmlFileFormat());
                ee.append(new Event(124, "N", "NORMAL"));
                ee.append(new Event(346, "N", "NORMAL"));
                ee.append(new Event(523, "V", "PVC"));
                u.save();
                ShowInfo("Parse file {event.xml} suceed!");
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
            finally
            {
                if (u != null)
                {
                    u.closeAll();
                }
            }
        }
Example #7
0
        // Testdaten (Matlab):
        // DATA = [2^32, 0, 2^7-1, 2^15-1, 2^31-1, 2^8-1, 2^16-1, 2^32-1, -2^7, -2^15, -2^31, 123.456]';

        /// <summary>
        /// Unisens library test
        /// </summary>
        /// <param name="p">Path for test unisens dataset</param>
        public Program(string p, string p1)
        {
            this.path  = p;
            this.path1 = p1;

            string[]   fileFormatList = new string[] { "csv", "xml", "bin_LITTLE", "bin_BIG" };
            DataType[] dataTypeList   = new DataType[] { DataType.INT8, DataType.UINT8, DataType.INT16, DataType.UINT16, DataType.INT32, DataType.UINT32, DataType.FLOAT, DataType.DOUBLE };


            //Write data
            foreach (string f in fileFormatList)
            {
                foreach (DataType dataType in dataTypeList)
                {
                    signalTest(f, dataType);
                }
            }

            //Read data
            UnisensFactory uf1 = UnisensFactoryBuilder.createFactory();
            Unisens        u1  = uf1.createUnisens(path1);
            Entry          entry;

            entry = u1.getEntry("acc.bin");
            SignalEntry se1 = (SignalEntry)entry;

            short[][] A1 = (short[][])se1.read(0, 3);
            for (int i = 0; i < A1.Length; i++)
            {
                for (int j = 0; j < A1[i].Length; j++)
                {
                    MessageBox.Show(A1[i].GetValue(j).ToString());
                }
            }
        }
Example #8
0
 private void btnVxml_Click(object sender, EventArgs e)
 {
     org.unisens.Unisens u = null;
     try
     {
         UnisensFactory uf = UnisensFactoryBuilder.createFactory();
         u = uf.createUnisens(folderDialogue.SelectedPath);
         ValuesEntry ve = u.createValuesEntry("values.xml", new String[] { "A", "B" }, DataType.INT16, 250);
         ve.setFileFormat(ve.createXmlFileFormat());
         ve.append(new Value(1320, new short[] { 1, 4 }));
         ve.append(new Value(22968, new short[] { 2, 5 }));
         ve.append(new Value(30232, new short[] { 3, 6 }));
         u.save();
         ShowInfo("Parse file {values.xml} suceed!");
     }
     catch (Exception ex)
     {
         ShowError(ex.Message);
     }
     finally
     {
         if (u != null)
         {
             u.closeAll();
         }
     }
 }
Example #9
0
        private void btnSbin_Click(object sender, EventArgs e)
        {
            org.unisens.Unisens u = null;
            try
            {
                UnisensFactory uf = UnisensFactoryBuilder.createFactory();

                u = uf.createUnisens(folderDialogue.SelectedPath);
                SignalEntry se = u.createSignalEntry("signal.bin", new String[] { "A", "B" }, DataType.INT16, 250);
                var         A  = new short[][] { new short[] { 1, 4 }, new short[] { 2, 5 }, new short[] { 3, 6 } };
                //se.setFileFormat(se.createXmlFileFormat());
                var B = new short[][] { new short[] { 2, 4 }, new short[] { 3, 5 }, new short[] { 4, 6 } };
                se.append(A);
                se.append(B);
                u.save();
                ShowInfo("Parse file {signal.bin} suceed!");
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
            finally
            {
                if (u != null)
                {
                    u.closeAll();
                }
            }
        }
Example #10
0
        private void btnScsv_Click(object sender, EventArgs e)
        {
            org.unisens.Unisens u = null;
            try
            {
                UnisensFactory uf = UnisensFactoryBuilder.createFactory();

                u = uf.createUnisens(folderDialogue.SelectedPath);
                var           se  = u.createSignalEntry("signal.csv", new String[] { "A", "B" }, DataType.INT16, 250);
                var           A   = new short[][] { new short[] { 1, 4 }, new short[] { 2, 5 }, new short[] { 3, 6 } };
                CsvFileFormat cff = se.createCsvFileFormat();
                cff.setSeparator(";");
                cff.setDecimalSeparator(".");
                se.setFileFormat(cff);
                se.append(A);
                u.save();
                ShowInfo("Parse file {signal.csv} suceed!");
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
            finally
            {
                if (u != null)
                {
                    u.closeAll();
                }
            }
        }
Example #11
0
        public static void setUpBeforeClass()
        {
            File unisensPath = new File(EXAMPLE_TEMP_SPAN_ENTRY);

            if (unisensPath.exists())
            {
                for (File file : unisensPath.listFiles())
                {
                    if (file.isFile())
                    {
                        Assert.IsTrue(file.delete());
                    }
                }
            }
            else
            {
                Assert.IsTrue(unisensPath.mkdirs());
            }
            factory        = UnisensFactoryBuilder.createFactory();
            unisens        = factory.createUnisens(EXAMPLE_TEMP_SPAN_ENTRY);
            timestampStart = new DateTime();
            unisens.setTimestampStart(timestampStart);
            unisens.setMeasurementId("Temp spans");
            spans.Add(new Span(30, 220, "A1", "liegen"));
            spans.Add(new Span(500, 600, "A2", "sitzen"));
            spans.Add(new Span(1343, 1600, "A3", "stehen"));
            spans.Add(new Span(3200, 3500, "A4", "gehen"));
            spans.Add(new Span(5600, 5900, "A5", "treppe hoch"));
            spans.Add(new Span(5600, 6200, "A6", ""));
        }
Example #12
0
 public static void setUpBeforeClass(TestContext testContext)
 {
     Directory.CreateDirectory(EXAMPLE_TEMP_VALUES_ENTRY);
     factory = UnisensFactoryBuilder.createFactory();
     unisens = factory.createUnisens(EXAMPLE_TEMP_VALUES_ENTRY);
     unisens.setTimestampStart(new DateTime());
     unisens.setMeasurementId("Temp values");
 }
        public static void ClassInitialize(TestContext testContext)
        {
            String TestLocation = CopyExampleToTest(EXAMPLE2);

            factory     = UnisensFactoryBuilder.createFactory();
            unisens     = factory.createUnisens(TestLocation);
            customEntry = (CustomEntry)unisens.getEntry("entry.custom");
        }
        public void testLsbValueAgain()
        {
            double lsbValue = 1.345;

            System.IO.Directory.CreateDirectory(Test1Location + "_x");
            Unisens     unisensTest = factory.createUnisens(Test1Location + "_x");
            SignalEntry signalEntry = unisensTest.createSignalEntry("lsbtest.bin", new String[] { "c1" }, DataType.INT32, 400);

            signalEntry.append(new Int32[] { 1, 2, 3, 4 });
            signalEntry.setLsbValue(lsbValue);
            unisensTest.save();
            unisensTest.closeAll();

            SignalEntry testEntry = (SignalEntry)unisensTest.getEntry("lsbtest.bin");

            Assert.AreEqual(testEntry.getLsbValue(), signalEntry.getLsbValue());
            Assert.AreEqual(lsbValue, signalEntry.getLsbValue());
        }
Example #15
0
        private void signalBin()
        {
            UnisensFactory uf = UnisensFactoryBuilder.createFactory();
            Unisens        u  = uf.createUnisens("C:\\TestData");
            SignalEntry    se = u.createSignalEntry("signal.bin", new String[] { "A", "B" }, DataType.INT16, 250);

            short[][] A = new short[][] { new short[] { 1, 2, 3 }, new short[] { 4, 5, 6 } };
            se.append(A);
            u.save();
            u.closeAll();
        }
Example #16
0
 public void testSaveUnisens()
 {
     unisens.closeAll();
     unisens.save();
     unisens = factory.createUnisens(EXAMPLE_TEMP_SPAN_ENTRY);
     Assert.AreEqual(timestampStart.ToString(), unisens.getTimestampStart().ToString());
     spanEntry = (SpanEntry)unisens.getEntry("se.bin");
     Assert.AreEqual("BIN", spanEntry.getFileFormat().getFileFormatName());
     Assert.AreEqual(sampleRate, spanEntry.getSampleRate(), 0);
     Assert.IsTrue(spanEntry.getFileFormat() is BinFileFormat);
     Assert.AreEqual(Endianess.LITTLE, ((BinFileFormat)spanEntry.getFileFormat()).getEndianess());
 }
Example #17
0
        private void valuesXml()
        {
            UnisensFactory uf = UnisensFactoryBuilder.createFactory();
            Unisens        u  = uf.createUnisens("C:\\TestData");
            ValuesEntry    ve = u.createValuesEntry("values.xml", new String[] { "A", "B" }, DataType.INT16, 250);

            ve.setFileFormat(ve.createXmlFileFormat());
            ve.append(new Value(1320, new short[] { 1, 4 }));
            ve.append(new Value(22968, new short[] { 2, 5 }));
            ve.append(new Value(30232, new short[] { 3, 6 }));
            u.save();
            u.closeAll();
        }
Example #18
0
        private void eventXml()
        {
            UnisensFactory uf = UnisensFactoryBuilder.createFactory();
            Unisens        u  = uf.createUnisens("C:\\TestData");
            EventEntry     ee = u.createEventEntry("event.xml", 1000);

            ee.setFileFormat(ee.createXmlFileFormat());
            ee.append(new Event(124, "N", "NORMAL"));
            ee.append(new Event(346, "N", "NORMAL"));
            ee.append(new Event(523, "V", "PVC"));
            u.save();
            u.closeAll();
        }
        public static void setUpBeforeClass(TestContext testContext)
        {
            String TestLocation = CopyExampleToTest(EXAMPLE2);

            factory           = UnisensFactoryBuilder.createFactory();
            unisens           = factory.createUnisens(TestLocation);
            valuesEntry       = (ValuesEntry)unisens.getEntry("bloodpressure.csv");
            expectedArray     = new Value[] { new Value(0, new short[] { 123, 82 }), new Value(600, new short[] { 124, 87 }), new Value(1200, new short[] { 130, 67 }), new Value(1800, new short[] { 118, 78 }), new Value(2400, new short[] { 142, 92 }) };
            expectedValueList = new ValueList();
            expectedValueList.setSamplestamps(new long[] { 0, 600, 1200, 1800, 2400 });
            expectedValueList.setData(new short[][] { new short[] { 123, 82 }, new short[] { 124, 87 }, new short[] { 130, 67 }, new short[] { 118, 78 }, new short[] { 142, 92 } });
            tempValuesEntry = unisens.createValuesEntry("temp_values.csv", new String[] { "a", "b" }, DataType.INT16, 400);
        }
Example #20
0
        private void eventBin()
        {
            UnisensFactory uf = UnisensFactoryBuilder.createFactory();
            Unisens        u  = uf.createUnisens("C:\\TestData");
            EventEntry     ee = u.createEventEntry("event.bin", 1000);

            ee.setFileFormat(ee.createBinFileFormat());
            ee.setCommentLength(6);
            ee.setTypeLength(1);
            ee.append(new Event(124, "N", "NORMAL"));
            ee.append(new Event(346, "N", "NORMAL"));
            ee.append(new Event(523, "V", "PVC   "));
            u.save();
            u.closeAll();
        }
        public static void setUpBeforeClass(TestContext testContext)
        {
            String TestLocation = CopyExampleToTest(EXAMPLE2);

            factory    = UnisensFactoryBuilder.createFactory();
            unisens    = factory.createUnisens(TestLocation);
            eventEntry = (EventEntry)unisens.getEntry("events.csv");
            expected   = new List <Event>();
            expected.Add(new Event(30, "A1", "liegen"));
            expected.Add(new Event(500, "A2", "sitzen"));
            expected.Add(new Event(1343, "A3", "stehen"));
            expected.Add(new Event(3200, "A4", "gehen"));
            expected.Add(new Event(5600, "A5", "treppe hoch"));
            expected.Add(new Event(5600, "A6", ""));
        }
Example #22
0
        private void signalCsv()
        {
            UnisensFactory uf = UnisensFactoryBuilder.createFactory();
            Unisens        u  = uf.createUnisens("C:\\TestData");
            SignalEntry    se = u.createSignalEntry("signal.csv", new String[] { "A", "B" }, DataType.INT16, 250);

            short[][]     A   = new short[][] { new short[] { 1, 2, 3 }, new short[] { 4, 5, 6 } };
            CsvFileFormat cff = se.createCsvFileFormat();

            cff.setSeparator(";");
            cff.setDecimalSeparator(",");
            se.setFileFormat(cff);
            se.append(A);
            u.save();
            u.closeAll();
        }
Example #23
0
        private void signalCsvDouble()
        {
            UnisensFactory uf = UnisensFactoryBuilder.createFactory();
            Unisens        u  = uf.createUnisens("C:\\TestData");
            SignalEntry    se = u.createSignalEntry("signalD.csv", new String[] { "A", "B" }, DataType.DOUBLE, 250);

            double[][]    A   = new double[][] { new double[] { 1.3, 2.5, 3.2 }, new double[] { 4.3, 5.0, 6.123456 } };
            CsvFileFormat cff = se.createCsvFileFormat();

            cff.setSeparator(";");
            cff.setDecimalSeparator(",");
            se.setFileFormat(cff);
            se.append(A);
            u.save();
            u.closeAll();
        }
Example #24
0
        private void eventCsv()
        {
            UnisensFactory uf  = UnisensFactoryBuilder.createFactory();
            Unisens        u   = uf.createUnisens("C:\\TestData");
            EventEntry     ee  = u.createEventEntry("event.csv", 1000);
            CsvFileFormat  cff = ee.createCsvFileFormat();

            cff.setSeparator(";");
            cff.setDecimalSeparator(".");
            ee.setFileFormat(cff);
            ee.append(new Event(124, "N", "NORMAL"));
            ee.append(new Event(346, "N", "NORMAL"));
            ee.append(new Event(523, "V", "PVC"));
            u.save();
            u.closeAll();
        }
Example #25
0
        private void valuesCsv()
        {
            UnisensFactory uf  = UnisensFactoryBuilder.createFactory();
            Unisens        u   = uf.createUnisens("C:\\TestData");
            ValuesEntry    ve  = u.createValuesEntry("values.csv", new String[] { "A", "B" }, DataType.INT16, 250);
            CsvFileFormat  cff = ve.createCsvFileFormat();

            cff.setSeparator(";");
            cff.setDecimalSeparator(".");
            ve.setFileFormat(cff);
            ve.append(new Value(1320, new short[] { 1, 4 }));
            ve.append(new Value(22968, new short[] { 2, 5 }));
            ve.append(new Value(30232, new short[] { 3, 6 }));
            u.save();
            u.closeAll();
        }
 public void testSaveUnisens()
 {
     eventEntry = unisens.createEventEntry("test.bin", sampleRate);
     eventEntry.setTypeLength(2);
     eventEntry.setCommentLength(11);
     eventEntry.setFileFormat(new BinFileFormatImpl());
     eventEntry.append(events);
     unisens.closeAll();
     unisens.save();
     unisens = factory.createUnisens(EXAMPLE_TEMP_EVENT_ENTRY);
     Assert.AreEqual(timestampStart.ToString(), unisens.getTimestampStart().ToString());
     eventEntry = (EventEntry)unisens.getEntry("test.bin");
     Assert.AreEqual("BIN", eventEntry.getFileFormat().getFileFormatName());
     Assert.AreEqual(sampleRate, eventEntry.getSampleRate(), 0);
     Assert.IsTrue(eventEntry.getFileFormat() is BinFileFormat);
     Assert.AreEqual(Endianess.LITTLE, ((BinFileFormat)eventEntry.getFileFormat()).getEndianess());
 }
 public static void setUpBeforeClass(TestContext testContext)
 {
     Directory.CreateDirectory(EXAMPLE_TEMP_EVENT_ENTRY);
     factory        = UnisensFactoryBuilder.createFactory();
     unisens        = factory.createUnisens(EXAMPLE_TEMP_EVENT_ENTRY);
     timestampStart = new DateTime();
     unisens.setTimestampStart(timestampStart);
     unisens.setMeasurementId("Temp events");
     events.Add(new Event(30, "A1", "liegen"));
     events.Add(new Event(500, "A2", "sitzen"));
     events.Add(new Event(1343, "A3", "stehen"));
     events.Add(new Event(3200, "A4", "gehen"));
     events.Add(new Event(5600, "A5", "treppe hoch"));
     events.Add(new Event(5600, "A6", ""));
     events.Add(new Event(int.MaxValue - 1, "A7", ""));
     events.Add(new Event(0, "A8", ""));
 }
Example #28
0
        /// <summary>
        /// Main function for plug-ins, called by UnisensViewer.
        /// </summary>
        /// <param name="unisensxml">unisens.xml file.</param>
        /// <param name="selectedsignals">All information from unisens.xml of the selected signals.</param>
        /// <param name="path">Path of the current unisens.xml file.</param>
        /// <param name="time_cursor">Time in seconds of current cursor position. Is 0, if the plug-in is called via plug-in menu.</param>
        /// <param name="time_start">Time in seconds of start of the current selection. Is 0, when no selection exists.</param>
        /// <param name="time_end">Time in seconds of end of the current selection. Is 0, when no selection exists.</param>
        /// <param name="parameter">Additional parameter of the key bindings.</param>
        /// <returns>
        /// Returned signals have to be described by the corresponding Unisens XML element (e.g. signalEntry or eventEntry). UnisensViewer displays the returned signals directly.
        /// </returns>
        public IEnumerable <XElement> Main(XDocument unisensxml, IEnumerable <XElement> selectedsignals, string path, double time_cursor, double time_start, double time_end, string parameter)
        {
            //// When time_cursor is used (context menu or hot key), read data from cursor position. Otherwise read data from selection.
            //if (time_cursor != 0)
            //{
            //    time_start = time_cursor;
            //    time_end = time_cursor;
            //}
            List <string> entryIds = GetEntryList(selectedsignals, "SignalEntry");

            if (entryIds.Count == 0)
            {
                MessageBox.Show("The selected entry is no signalEntry. "
                                , "Wrong signalEntry",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
            else if (entryIds.Count > 1)
            {
                if (MessageBox.Show("More than one matching entry was selected. I use \n" +
                                    entryIds[0] + " for further processing.",
                                    "SignalEntry overkill",
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.Cancel)
                {
                    return(null);
                }
            }
            path = path.Substring(0, path.Length - 11);
            UnisensFactory factory = UnisensFactoryBuilder.createFactory();

            org.unisens.Unisens unisens = factory.createUnisens(path);
            entry            = (org.unisens.SignalEntry)unisens.getEntry(entryIds[0]);
            unisensXml       = unisensxml;
            selectedSignals  = selectedsignals;
            pluginTimeStart  = time_start;
            pluginTimeEnd    = time_end;
            pluginTimeLength = time_end - time_start;
            DialogMeasurement dlgMeasurement = new DialogMeasurement();

            dlgMeasurement.Topmost = true;
            dlgMeasurement.Show();

            return(null);
        }
Example #29
0
        // Testdaten (Matlab):
        // DATA = [2^32, 0, 2^7-1, 2^15-1, 2^31-1, 2^8-1, 2^16-1, 2^32-1, -2^7, -2^15, -2^31, 123.456]';

        /// <summary>
        /// Unisens library test
        /// </summary>
        /// <param name="p">Path for test unisens dataset</param>
        public Program(string p, string p1)
        {
            this.path  = p;
            this.path1 = p1;

//            string[] fileFormatList = new string[] { "csv", "bin", "xml" };
            DataType[] dataTypeList = new DataType[] { DataType.INT8, DataType.UINT8, DataType.INT16, DataType.UINT16, DataType.INT32, DataType.UINT32, DataType.FLOAT, DataType.DOUBLE };
//            string[] fileFormatList = new string[] { "csv" };
            //DataType[] dataTypeList = new DataType[] { DataType.FLOAT, DataType.DOUBLE };
            string[] fileFormatList = new string[] { "csv", "bin" };
            //DataType[] dataTypeList = new DataType[] { DataType.INT8 };


            foreach (string f in fileFormatList)
            {
                foreach (DataType dataType in dataTypeList)
                {
                    signalTest(f, dataType);
                }
            }

            //signalBin();
            //signalCsv();
            //signalXml();

            //valuesBin();
            //valuesCsv();
            //valuesXml();

            //eventBin();
            //eventCsv();
            //eventXml();
            UnisensFactory uf     = UnisensFactoryBuilder.createFactory();
            Unisens        u      = uf.createUnisens(path1);
            List <Entry>   listen = u.getEntries();

            foreach (Entry en in listen)
            {
                String name = en.getId();
                ReadFile(name);
            }
        }
        public void testZSaveUnisens()
        {
            unisens.closeAll();

            unisens = factory.createUnisens(EXAMPLE_TEMP_SIGNAL_ENTRY);
            Assert.AreEqual(timestampStart.ToString(), unisens.getTimestampStart().ToString());
            signalEntry           = (SignalEntry)unisens.createSignalEntry("se_double_be.bin", new String[] { "a", "b" }, DataType.DOUBLE, sampleRate);
            signalEntryFileFormat = (BinFileFormat)signalEntry.getFileFormat();
            signalEntryFileFormat.setEndianess(Endianess.BIG);
            signalEntry.append(double64);
            unisens.save();

            signalEntry = (SignalEntry)unisens.getEntry("se_double_be.bin");
            Assert.AreEqual("BIN", signalEntry.getFileFormat().getFileFormatName());
            Assert.AreEqual(DataType.DOUBLE, signalEntry.getDataType());
            Assert.AreEqual(sampleRate, signalEntry.getSampleRate(), 0);
            Assert.IsTrue(signalEntry.getFileFormat() is BinFileFormat);
            Assert.AreEqual(Endianess.BIG, ((BinFileFormat)signalEntry.getFileFormat()).getEndianess());

            unisens.deleteEntry(signalEntry);
            unisens.save();
        }