示例#1
0
        public void TestECG()
        {
            int enabledSensors = ((int)ShimmerBluetooth.SensorBitmapShimmer3.SENSOR_EXG1_24BIT | (int)ShimmerBluetooth.SensorBitmapShimmer3.SENSOR_EXG2_24BIT); // this is to enable the two EXG Chips on the Shimmer3

            shimmerDevice.WriteSensors(enabledSensors);
            byte[] defaultECGReg1 = ShimmerBluetooth.SHIMMER3_DEFAULT_ECG_REG1; //also see ShimmerBluetooth.SHIMMER3_DEFAULT_TEST_REG1 && ShimmerBluetooth.SHIMMER3_DEFAULT_EMG_REG1
            byte[] defaultECGReg2 = ShimmerBluetooth.SHIMMER3_DEFAULT_ECG_REG2; //also see ShimmerBluetooth.SHIMMER3_DEFAULT_TEST_REG2 && ShimmerBluetooth.SHIMMER3_DEFAULT_EMG_REG2
            shimmerDevice.WriteEXGConfigurations(defaultECGReg1, defaultECGReg2);
            Thread.Sleep(1000);

            String[] array = shimmerDevice.GetSignalNameArray();
            Assert.AreEqual(array[1], Shimmer3Configuration.SignalNames.EXG1_STATUS);

            shimmerDevice.StartStreaming();
            System.Console.WriteLine("StartStreaming");
            Thread.Sleep(5000);
            if (ojc == null)
            {
                Assert.AreEqual(true, false);
            }
            else
            {
                SensorData data = ojc.GetData(Shimmer3Configuration.SignalNames.ECG_LA_RA, "CAL");
                Assert.AreNotEqual(null, data);
            }
        }
示例#2
0
        public void TestMethodWriteSensors()
        {
            shimmerDevice.WriteSensors((int)SensorBitmapShimmer3.SENSOR_A_ACCEL);
            Thread.Sleep(1000);
            String[] array = shimmerDevice.GetSignalNameArray();
            Assert.AreEqual(array[1], Shimmer3Configuration.SignalNames.LOW_NOISE_ACCELEROMETER_X);

            shimmerDevice.WriteSensors((int)SensorBitmapShimmer3.SENSOR_MPU9150_GYRO);
            Thread.Sleep(1000);
            array = shimmerDevice.GetSignalNameArray();
            Assert.AreEqual(array[1], Shimmer3Configuration.SignalNames.GYROSCOPE_X);
        }
        public void TestMethodConstructor()
        {
            ShimmerLogAndStreamSystemSerialPort shimmerDevice = new ShimmerLogAndStreamSystemSerialPort("", comport);

            shimmerDevice.UICallback += this.HandleEvent;
            ojcArray.Clear();
            ojc = null;
            shimmerDevice.Connect();
            while (shimmerDevice.GetState() != ShimmerBluetooth.SHIMMER_STATE_CONNECTED)
            {
                Thread.Sleep(100);
                if (shimmerDevice.GetState() == ShimmerBluetooth.SHIMMER_STATE_NONE)
                {
                    Assert.Fail();
                }
            }
            int enabledSensors = ((int)ShimmerBluetooth.SensorBitmapShimmer3.SENSOR_EXG1_24BIT | (int)ShimmerBluetooth.SensorBitmapShimmer3.SENSOR_EXG2_24BIT); // this is to enable the two EXG Chips on the Shimmer3

            byte[] defaultECGReg1 = ShimmerBluetooth.SHIMMER3_DEFAULT_ECG_REG1;                                                                                 //also see ShimmerBluetooth.SHIMMER3_DEFAULT_TEST_REG1 && ShimmerBluetooth.SHIMMER3_DEFAULT_EMG_REG1
            byte[] defaultECGReg2 = ShimmerBluetooth.SHIMMER3_DEFAULT_ECG_REG2;                                                                                 //also see ShimmerBluetooth.SHIMMER3_DEFAULT_TEST_REG2 && ShimmerBluetooth.SHIMMER3_DEFAULT_EMG_REG2
            shimmerDevice.WriteEXGConfigurations(defaultECGReg1, defaultECGReg2);
            Thread.Sleep(500);
            shimmerDevice.WriteSensors(enabledSensors);
            Thread.Sleep(1000);

            String[] array = shimmerDevice.GetSignalNameArray();
            Assert.AreEqual(array[1], Shimmer3Configuration.SignalNames.EXG1_STATUS);

            shimmerDevice.StartStreaming();
            System.Console.WriteLine("StartStreaming");
            Thread.Sleep(5000);
            if (ojc == null)
            {
                Assert.AreEqual(true, false);
            }
            else
            {
                SensorData data = ojc.GetData(Shimmer3Configuration.SignalNames.ECG_LA_RA, "CAL");
                Assert.AreNotEqual(null, data);
            }
            shimmerDevice.StopStreaming();
            Thread.Sleep(200);
            shimmerDevice.Disconnect();
            Thread.Sleep(1000);
            shimmerDevice = null;
        }