Skip to content

Commit d635066

Browse files
committed
Added support for BITalino pulse sensor
1 parent cb10375 commit d635066

File tree

6 files changed

+447
-8
lines changed

6 files changed

+447
-8
lines changed

libssj/src/androidTest/java/hcm/ssj/BitalinoTest.java

+42-1
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,19 @@
3535

3636
import hcm.ssj.bitalino.Bitalino;
3737
import hcm.ssj.bitalino.LUXChannel;
38+
import hcm.ssj.bitalino.PulseChannel;
3839
import hcm.ssj.core.Pipeline;
3940
import hcm.ssj.test.Logger;
4041

4142
/**
42-
* Tests all channels of the MS Band.<br>
43+
* Tests all channels of the BITalino sensor.<br>
4344
* Created by Ionut Damian
4445
*/
4546
@RunWith(AndroidJUnit4.class)
4647
@SmallTest
4748
public class BitalinoTest
4849
{
50+
/*
4951
@Test
5052
public void testChannels() throws Exception
5153
{
@@ -82,6 +84,45 @@ public void testChannels() throws Exception
8284
frame.stop();
8385
frame.clear();
8486
}
87+
*/
8588

89+
@Test
90+
public void testPulseChannel() throws Exception
91+
{
92+
// Setup
93+
Pipeline pipeline = Pipeline.getInstance();
94+
95+
// Sensor
96+
Bitalino sensor = new Bitalino();
97+
sensor.options.sr.set(10);
98+
sensor.options.address.set("20:18:05:28:47:08");
99+
100+
PulseChannel channel = new PulseChannel();
101+
channel.options.channel.set(0);
102+
103+
// Logger
104+
Logger logger = new Logger();
105+
106+
107+
pipeline.addSensor(sensor, channel);
108+
pipeline.addConsumer(logger, channel);
109+
110+
// Start framework
111+
pipeline.start();
112+
113+
// Wait duration
114+
try
115+
{
116+
Thread.sleep(TestHelper.DUR_TEST_NORMAL);
117+
}
118+
catch (Exception e)
119+
{
120+
e.printStackTrace();
121+
}
122+
123+
// Stop framework
124+
pipeline.stop();
125+
pipeline.clear();
126+
}
86127

87128
}

libssj/src/main/java/hcm/ssj/bitalino/Bitalino.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class Bitalino extends Sensor
5353
{
5454
public class Options extends OptionList
5555
{
56-
public final Option<String> name = new Option<>("name", null, String.class, "device name");
56+
public final Option<String> name = new Option<>("name", null, String.class, "device name, e.g. BITalino-47-08");
5757
public final Option<String> address = new Option<>("address", null, String.class, "mac address of device, only used if name is left empty");
5858
public final Option<Communication> connectionType = new Option<>("connectionType", Communication.BTH, Communication.class, "type of connection");
5959
public final Option<Integer> sr = new Option<>("sr", 10, Integer.class, "sample rate, supported values: 1, 10, 100, 1000");

libssj/src/main/java/hcm/ssj/bitalino/BitalinoListener.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public int getDigitalData(int pos)
6464
return digital[pos];
6565
}
6666

67-
private synchronized void dataReceived()
67+
synchronized void dataReceived()
6868
{
6969
lastDataTimestamp = System.currentTimeMillis();
7070
}

0 commit comments

Comments
 (0)