Comparar commits
38 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 2761a5b1a2 | |||
| dc9323b054 | |||
| 0cb4b11e0b | |||
| 509777d3f5 | |||
| dbd834d984 | |||
| 1ff75e6f95 | |||
| 115487d836 | |||
| 8c66932056 | |||
| 1f28dafe94 | |||
| 323e885fc4 | |||
| 5fedeaaba5 | |||
| 5fe2bd05f8 | |||
| a62bca7c1c | |||
| 4d04bd9579 | |||
| dd2d4213f8 | |||
| 8bae43d42d | |||
| f391f81714 | |||
| 3f65c7025e | |||
| a1cbf00e17 | |||
| 1ffaf36773 | |||
| d299144c4d | |||
| 1c10b32370 | |||
| c3cde4a1da | |||
| bf85663aec | |||
| ae2926c5c8 | |||
| b1def1c571 | |||
| 71d89867d8 | |||
| d985991963 | |||
| dcdb26966a | |||
| 3cea932784 | |||
| 0319ac6f74 | |||
| b228461253 | |||
| 059a9361a9 | |||
| d48df5a5ad | |||
| 2e9e78ab32 | |||
| fe88c989e4 | |||
| 04f20ed19b | |||
| f81407334c |
@@ -1,3 +1,8 @@
|
||||
# 2.1.2
|
||||
|
||||
### Bug Fixes
|
||||
* Fix #120 - Locale dependent formatting cause issue with output ODF file.
|
||||
|
||||
# 2.1.1
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -33,24 +33,6 @@ CallbackListener cb = new CallbackListener() { //used by ControlP5 to clear text
|
||||
} else if (cp5.isMouseOver(cp5.get(Textfield.class, "fileNameGanglion"))){
|
||||
println("CallbackListener: controlEvent: clearing");
|
||||
cp5.get(Textfield.class, "fileNameGanglion").clear();
|
||||
} else if (cp5.isMouseOver(cp5.get(Textfield.class, "udp_ip"))){
|
||||
println("CallbackListener: controlEvent: clearing");
|
||||
cp5.get(Textfield.class, "udp_ip").clear();
|
||||
} else if (cp5.isMouseOver(cp5.get(Textfield.class, "udp_port"))){
|
||||
println("CallbackListener: controlEvent: clearing");
|
||||
cp5.get(Textfield.class, "udp_port").clear();
|
||||
} else if (cp5.isMouseOver(cp5.get(Textfield.class, "osc_ip"))){
|
||||
println("CallbackListener: controlEvent: clearing");
|
||||
cp5.get(Textfield.class, "osc_ip").clear();
|
||||
} else if (cp5.isMouseOver(cp5.get(Textfield.class, "osc_address"))){
|
||||
println("CallbackListener: controlEvent: clearing");
|
||||
cp5.get(Textfield.class, "osc_address").clear();
|
||||
} else if (cp5.isMouseOver(cp5.get(Textfield.class, "lsl_data"))){
|
||||
println("CallbackListener: controlEvent: clearing");
|
||||
cp5.get(Textfield.class, "lsl_data").clear();
|
||||
} else if (cp5.isMouseOver(cp5.get(Textfield.class, "lsl_aux"))){
|
||||
println("CallbackListener: controlEvent: clearing");
|
||||
cp5.get(Textfield.class, "lsl_aux").clear();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -76,8 +58,6 @@ color isSelected_color = color(184, 220, 105);
|
||||
// Button openClosePort;
|
||||
// boolean portButtonPressed;
|
||||
|
||||
int networkType = 0;
|
||||
|
||||
boolean calledForBLEList = false;
|
||||
|
||||
Button refreshPort;
|
||||
@@ -183,20 +163,6 @@ public void controlEvent(ControlEvent theEvent) {
|
||||
}
|
||||
verbosePrint("SD setting = " + sdSetting);
|
||||
}
|
||||
if (theEvent.isFrom("networkList")){
|
||||
Map bob = ((MenuList)theEvent.getController()).getItem(int(theEvent.getValue()));
|
||||
String str = (String)bob.get("headline");
|
||||
int index = int(theEvent.getValue());
|
||||
if (index == 0) {
|
||||
networkType = 0;
|
||||
} else if (index ==1){
|
||||
networkType = 1;
|
||||
} else if (index == 2){
|
||||
networkType = 2;
|
||||
} else if (index == 3){
|
||||
networkType = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (theEvent.isFrom("channelList")){
|
||||
int setChannelInt = int(theEvent.getValue()) + 1;
|
||||
@@ -245,14 +211,8 @@ class ControlPanel {
|
||||
InitBox initBox;
|
||||
SyntheticChannelCountBox synthChannelCountBox;
|
||||
|
||||
NetworkingBox networkingBoxLive;
|
||||
UDPOptionsBox udpOptionsBox;
|
||||
OSCOptionsBox oscOptionsBox;
|
||||
LSLOptionsBox lslOptionsBox;
|
||||
|
||||
PlaybackFileBox playbackFileBox;
|
||||
SDConverterBox sdConverterBox;
|
||||
NetworkingBox networkingBoxPlayback;
|
||||
|
||||
BLEBox bleBox;
|
||||
DataLogBoxGanglion dataLogBoxGanglion;
|
||||
@@ -301,16 +261,10 @@ class ControlPanel {
|
||||
channelCountBox = new ChannelCountBox(x + w, (dataLogBox.y + dataLogBox.h), w, h, globalPadding);
|
||||
synthChannelCountBox = new SyntheticChannelCountBox(x + w, dataSourceBox.y, w, h, globalPadding);
|
||||
sdBox = new SDBox(x + w, (channelCountBox.y + channelCountBox.h), w, h, globalPadding);
|
||||
networkingBoxLive = new NetworkingBox(x + w, (sdBox.y + sdBox.h), w, 135, globalPadding);
|
||||
udpOptionsBox = new UDPOptionsBox(networkingBoxLive.x + networkingBoxLive.w, (sdBox.y + sdBox.h), w-30, networkingBoxLive.h, globalPadding);
|
||||
oscOptionsBox = new OSCOptionsBox(networkingBoxLive.x + networkingBoxLive.w, (sdBox.y + sdBox.h), w-30, networkingBoxLive.h, globalPadding);
|
||||
lslOptionsBox = new LSLOptionsBox(networkingBoxLive.x + networkingBoxLive.w, (sdBox.y + sdBox.h), w-30, networkingBoxLive.h, globalPadding);
|
||||
|
||||
|
||||
//boxes active when eegDataSource = Playback
|
||||
playbackFileBox = new PlaybackFileBox(x + w, dataSourceBox.y, w, h, globalPadding);
|
||||
sdConverterBox = new SDConverterBox(x + w, (playbackFileBox.y + playbackFileBox.h), w, h, globalPadding);
|
||||
//networkingBoxPlayback = new NetworkingBox(x + w, (sdConverterBox.y + sdConverterBox.h), w, h, globalPadding);
|
||||
|
||||
rcBox = new RadioConfigBox(x+w, y, w, h, globalPadding);
|
||||
channelPopup = new ChannelPopup(x+w, y, w, h, globalPadding);
|
||||
@@ -368,8 +322,6 @@ class ControlPanel {
|
||||
sdBox.update();
|
||||
rcBox.update();
|
||||
initBox.update();
|
||||
networkingBoxLive.update();
|
||||
//networkingBoxPlayback.update();
|
||||
|
||||
channelPopup.update();
|
||||
serialList.updateMenu();
|
||||
@@ -447,7 +399,6 @@ class ControlPanel {
|
||||
dataLogBox.draw();
|
||||
channelCountBox.draw();
|
||||
sdBox.draw();
|
||||
networkingBoxLive.draw();
|
||||
cp5.get(Textfield.class, "fileName").setVisible(true); //make sure the data file field is visible
|
||||
cp5.get(Textfield.class, "fileNameGanglion").setVisible(false); //make sure the data file field is visible
|
||||
|
||||
@@ -476,74 +427,17 @@ class ControlPanel {
|
||||
cp5.get(MenuList.class, "serialList").setVisible(true); //make sure the serialList menulist is visible
|
||||
cp5.get(MenuList.class, "bleList").setVisible(false); //make sure the serialList menulist is visible
|
||||
cp5.get(MenuList.class, "sdTimes").setVisible(true); //make sure the SD time record options menulist is visible
|
||||
cp5.get(MenuList.class, "networkList").setVisible(true); //make sure the SD time record options menulist is visible
|
||||
if (networkType == -1){
|
||||
cp5.get(Textfield.class, "udp_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "udp_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_address").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_data").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_aux").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
} else if (networkType == 0){
|
||||
cp5.get(Textfield.class, "udp_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "udp_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_address").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_data").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_aux").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
|
||||
} else if (networkType == 1){
|
||||
cp5.get(Textfield.class, "udp_ip").setVisible(true); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "udp_port").setVisible(true); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_address").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_data").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_aux").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
udpOptionsBox.draw();
|
||||
} else if (networkType == 2){
|
||||
cp5.get(Textfield.class, "udp_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "udp_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_ip").setVisible(true); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_port").setVisible(true); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_address").setVisible(true); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_data").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_aux").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
|
||||
oscOptionsBox.draw();
|
||||
} else if (networkType == 3){
|
||||
cp5.get(Textfield.class, "udp_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "udp_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_address").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_data").setVisible(true); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_aux").setVisible(true); //make sure the SD time record options menulist is visible
|
||||
lslOptionsBox.draw();
|
||||
}
|
||||
|
||||
} else if (eegDataSource == DATASOURCE_PLAYBACKFILE) { //when data source is from playback file
|
||||
// hideAllBoxes(); //clear lists, so they don't appear
|
||||
playbackFileBox.draw();
|
||||
sdConverterBox.draw();
|
||||
//networkingBoxPlayback.draw();
|
||||
|
||||
//set other CP5 controllers invisible
|
||||
// cp5.get(Textfield.class, "fileName").setVisible(false); //make sure the data file field is visible
|
||||
// cp5.get(Textfield.class, "fileNameGanglion").setVisible(false); //make sure the data file field is visible
|
||||
cp5.get(MenuList.class, "serialList").setVisible(false);
|
||||
cp5.get(MenuList.class, "sdTimes").setVisible(false);
|
||||
cp5.get(MenuList.class, "networkList").setVisible(false);
|
||||
cp5.get(Textfield.class, "udp_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "udp_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_address").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_data").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_aux").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
|
||||
cp5Popup.get(MenuList.class, "channelList").setVisible(false);
|
||||
cp5Popup.get(MenuList.class, "pollList").setVisible(false);
|
||||
|
||||
@@ -612,14 +506,6 @@ class ControlPanel {
|
||||
cp5.get(MenuList.class, "serialList").setVisible(false);
|
||||
cp5.get(MenuList.class, "bleList").setVisible(false);
|
||||
cp5.get(MenuList.class, "sdTimes").setVisible(false);
|
||||
cp5.get(MenuList.class, "networkList").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "udp_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "udp_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_ip").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_port").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "osc_address").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_data").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5.get(Textfield.class, "lsl_aux").setVisible(false); //make sure the SD time record options menulist is visible
|
||||
cp5Popup.get(MenuList.class, "channelList").setVisible(false);
|
||||
cp5Popup.get(MenuList.class, "pollList").setVisible(false);
|
||||
}
|
||||
@@ -1108,24 +994,6 @@ public void initButtonPressed(){
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
|
||||
//Network Protocol Initiation -- based on Gabe's Code
|
||||
if (networkType == 1){
|
||||
ip = cp5.get(Textfield.class, "udp_ip").getText();
|
||||
port = int(cp5.get(Textfield.class, "udp_port").getText());
|
||||
println(port);
|
||||
udp = new UDPSend(port, ip);
|
||||
} else if (networkType == 2){
|
||||
ip = cp5.get(Textfield.class, "osc_ip").getText();
|
||||
port = int(cp5.get(Textfield.class, "osc_port").getText());
|
||||
address = cp5.get(Textfield.class, "osc_address").getText();
|
||||
osc = new OSCSend(port, ip, address);
|
||||
} else if (networkType == 3){
|
||||
data_stream = cp5.get(Textfield.class, "lsl_data").getText();
|
||||
aux_stream = cp5.get(Textfield.class, "lsl_aux").getText();
|
||||
lsl = new LSLSend(data_stream, aux_stream);
|
||||
}
|
||||
|
||||
if(eegDataSource == DATASOURCE_GANGLION){
|
||||
fileName = cp5.get(Textfield.class, "fileNameGanglion").getText(); // store the current text field value of "File Name" to be passed along to dataFiles
|
||||
} else if(eegDataSource == DATASOURCE_NORMAL_W_AUX){
|
||||
@@ -1648,48 +1516,6 @@ class SDBox {
|
||||
}
|
||||
};
|
||||
|
||||
class NetworkingBox{
|
||||
int x, y, w, h, padding; //size and position
|
||||
MenuList networkList;
|
||||
|
||||
//boolean initButtonPressed; //default false
|
||||
|
||||
//boolean isSystemInitialized;
|
||||
NetworkingBox(int _x, int _y, int _w, int _h, int _padding){
|
||||
x = _x;
|
||||
y = _y;
|
||||
w = _w;
|
||||
h = _h;
|
||||
padding = _padding;
|
||||
networkList = new MenuList(cp5, "networkList", w - padding*2, 96, p4);
|
||||
networkList.setPosition(x + padding, y+padding+20);
|
||||
networkList.addItem(makeItem("None"));
|
||||
networkList.addItem(makeItem("UDP"));
|
||||
networkList.addItem(makeItem("OSC"));
|
||||
networkList.addItem(makeItem("LabStreamingLayer (LSL)"));
|
||||
networkList.scrollerLength = 0;
|
||||
networkList.activeItem = 0;
|
||||
}
|
||||
public void update() {
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
pushStyle();
|
||||
fill(boxColor);
|
||||
stroke(boxStrokeColor);
|
||||
strokeWeight(1);
|
||||
rect(x, y, w, h);
|
||||
fill(bgColor);
|
||||
textFont(h3, 16);
|
||||
textAlign(LEFT, TOP);
|
||||
text("NETWORK PROTOCOLS", x + padding, y + padding);
|
||||
fill(bgColor); //set color to green
|
||||
textFont(h3, 16);
|
||||
textAlign(LEFT, TOP);
|
||||
popStyle();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class RadioConfigBox {
|
||||
int x, y, w, h, padding; //size and position
|
||||
@@ -1781,254 +1607,6 @@ class RadioConfigBox {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class UDPOptionsBox {
|
||||
int x, y, w, h, padding; //size and position
|
||||
|
||||
UDPOptionsBox(int _x, int _y, int _w, int _h, int _padding){
|
||||
x = _x;
|
||||
y = _y;
|
||||
w = _w;
|
||||
h = _h;
|
||||
padding = _padding;
|
||||
|
||||
cp5.addTextfield("udp_ip")
|
||||
.setPosition(x + 60,y + 50)
|
||||
.setCaptionLabel("")
|
||||
.setSize(100,26)
|
||||
.setFont(f2)
|
||||
.setFocus(false)
|
||||
.setColor(color(26,26,26))
|
||||
.setColorBackground(color(255,255,255)) // text field bg color
|
||||
.setColorValueLabel(color(0,0,0)) // text color
|
||||
.setColorForeground(isSelected_color) // border color when not selected
|
||||
.setColorActive(isSelected_color) // border color when selected
|
||||
.setColorCursor(color(26,26,26))
|
||||
.setText("localhost")
|
||||
.align(5, 10, 20, 40)
|
||||
.onDoublePress(cb)
|
||||
.setVisible(false)
|
||||
.setAutoClear(true)
|
||||
;
|
||||
|
||||
cp5.addTextfield("udp_port")
|
||||
.setPosition(x + 60,y + 82)
|
||||
.setCaptionLabel("")
|
||||
.setSize(100,26)
|
||||
.setFont(f2)
|
||||
.setFocus(false)
|
||||
.setColor(color(26,26,26))
|
||||
.setColorBackground(color(255,255,255)) // text field bg color
|
||||
.setColorValueLabel(color(0,0,0)) // text color
|
||||
.setColorForeground(isSelected_color) // border color when not selected
|
||||
.setColorActive(isSelected_color) // border color when selected
|
||||
.setColorCursor(color(26,26,26))
|
||||
.setText("12345")
|
||||
.align(5, 10, 20, 40)
|
||||
.onDoublePress(cb)
|
||||
.setVisible(false)
|
||||
.setAutoClear(true)
|
||||
;
|
||||
}
|
||||
public void update(){
|
||||
}
|
||||
public void draw(){
|
||||
pushStyle();
|
||||
fill(boxColor);
|
||||
stroke(boxStrokeColor);
|
||||
strokeWeight(1);
|
||||
rect(x, y, w, h);
|
||||
fill(bgColor);
|
||||
textFont(h3, 16);
|
||||
textAlign(LEFT, TOP);
|
||||
text("Options", x + padding, y + padding);
|
||||
pushStyle();
|
||||
fill(boxColor);
|
||||
stroke(boxStrokeColor);
|
||||
strokeWeight(1);
|
||||
rect(x, y, w, h);
|
||||
fill(bgColor);
|
||||
text("UDP OPTIONS", x + padding, y + padding);
|
||||
textFont(h3, 16);
|
||||
textAlign(LEFT, TOP);
|
||||
text("IP", x + padding, y + 50 + padding);
|
||||
textFont(p4, 14);;
|
||||
text("Port", x + padding, y + 82 + padding);
|
||||
popStyle();
|
||||
}
|
||||
};
|
||||
|
||||
class OSCOptionsBox{
|
||||
int x, y, w, h, padding; //size and position
|
||||
|
||||
OSCOptionsBox(int _x, int _y, int _w, int _h, int _padding){
|
||||
x = _x;
|
||||
y = _y;
|
||||
w = _w;
|
||||
h = _h;
|
||||
padding = _padding;
|
||||
|
||||
cp5.addTextfield("osc_ip")
|
||||
.setPosition(x + 80,y + 35)
|
||||
.setCaptionLabel("")
|
||||
.setSize(100,26)
|
||||
.setFont(f2)
|
||||
.setFocus(false)
|
||||
.setColor(color(26,26,26))
|
||||
.setColorBackground(color(255,255,255)) // text field bg color
|
||||
.setColorValueLabel(color(0,0,0)) // text color
|
||||
.setColorForeground(isSelected_color) // border color when not selected
|
||||
.setColorActive(isSelected_color) // border color when selected
|
||||
.setColorCursor(color(26,26,26))
|
||||
.setText("localhost")
|
||||
.align(5, 10, 20, 40)
|
||||
.onDoublePress(cb)
|
||||
.setVisible(false)
|
||||
.setAutoClear(true)
|
||||
;
|
||||
cp5.addTextfield("osc_port")
|
||||
.setPosition(x + 80,y + 67)
|
||||
.setCaptionLabel("")
|
||||
.setSize(100,26)
|
||||
.setFont(f2)
|
||||
.setFocus(false)
|
||||
.setColor(color(26,26,26))
|
||||
.setColorBackground(color(255,255,255)) // text field bg color
|
||||
.setColorValueLabel(color(0,0,0)) // text color
|
||||
.setColorForeground(isSelected_color) // border color when not selected
|
||||
.setColorActive(isSelected_color) // border color when selected
|
||||
.setColorCursor(color(26,26,26))
|
||||
.setText("12345")
|
||||
.align(5, 10, 20, 40)
|
||||
.onDoublePress(cb)
|
||||
.setVisible(false)
|
||||
.setAutoClear(true)
|
||||
;
|
||||
cp5.addTextfield("osc_address")
|
||||
.setPosition(x + 80,y + 99)
|
||||
.setCaptionLabel("")
|
||||
.setSize(100,26)
|
||||
.setFont(f2)
|
||||
.setFocus(false)
|
||||
.setColor(color(26,26,26))
|
||||
.setColorBackground(color(255,255,255)) // text field bg color
|
||||
.setColorValueLabel(color(0,0,0)) // text color
|
||||
.setColorForeground(isSelected_color) // border color when not selected
|
||||
.setColorActive(isSelected_color) // border color when selected
|
||||
.setColorCursor(color(26,26,26))
|
||||
.setText("/openbci")
|
||||
.align(5, 10, 20, 40)
|
||||
.onDoublePress(cb)
|
||||
.setVisible(false)
|
||||
.setAutoClear(true)
|
||||
;
|
||||
}
|
||||
public void update(){
|
||||
}
|
||||
public void draw(){
|
||||
pushStyle();
|
||||
fill(boxColor);
|
||||
stroke(boxStrokeColor);
|
||||
strokeWeight(1);
|
||||
rect(x, y, w, h);
|
||||
fill(bgColor);
|
||||
textFont(h3, 16);
|
||||
textAlign(LEFT, TOP);
|
||||
text("Options", x + padding, y + padding);
|
||||
pushStyle();
|
||||
fill(boxColor);
|
||||
stroke(boxStrokeColor);
|
||||
strokeWeight(1);
|
||||
rect(x, y, w, h);
|
||||
fill(bgColor);
|
||||
text("OSC OPTIONS", x + padding, y + padding);
|
||||
textFont(h3, 16);
|
||||
textAlign(LEFT, TOP);
|
||||
text("IP", x + padding, y + 35 + padding);
|
||||
textFont(p4, 14);;
|
||||
text("Port", x + padding, y + 67 + padding);
|
||||
text("Address", x + padding, y + 99 + padding);
|
||||
popStyle();
|
||||
}
|
||||
};
|
||||
|
||||
class LSLOptionsBox {
|
||||
int x, y, w, h, padding; //size and position
|
||||
|
||||
LSLOptionsBox(int _x, int _y, int _w, int _h, int _padding){
|
||||
x = _x;
|
||||
y = _y;
|
||||
w = _w;
|
||||
h = _h;
|
||||
padding = _padding;
|
||||
|
||||
cp5.addTextfield("lsl_data")
|
||||
.setPosition(x + 115,y + 50)
|
||||
.setCaptionLabel("")
|
||||
.setSize(100,26)
|
||||
.setFont(f2)
|
||||
.setFocus(false)
|
||||
.setColor(color(26,26,26))
|
||||
.setColorBackground(color(255,255,255)) // text field bg color
|
||||
.setColorValueLabel(color(0,0,0)) // text color
|
||||
.setColorForeground(isSelected_color) // border color when not selected
|
||||
.setColorActive(isSelected_color) // border color when selected
|
||||
.setColorCursor(color(26,26,26))
|
||||
.setText("openbci_data")
|
||||
.align(5, 10, 20, 40)
|
||||
.onDoublePress(cb)
|
||||
.setVisible(false)
|
||||
.setAutoClear(true)
|
||||
;
|
||||
|
||||
cp5.addTextfield("lsl_aux")
|
||||
.setPosition(x + 115,y + 82)
|
||||
.setCaptionLabel("")
|
||||
.setSize(100,26)
|
||||
.setFont(f2)
|
||||
.setFocus(false)
|
||||
.setColor(color(26,26,26))
|
||||
.setColorBackground(color(255,255,255)) // text field bg color
|
||||
.setColorValueLabel(color(0,0,0)) // text color
|
||||
.setColorForeground(isSelected_color) // border color when not selected
|
||||
.setColorActive(isSelected_color) // border color when selected
|
||||
.setColorCursor(color(26,26,26))
|
||||
.setText("openbci_aux")
|
||||
.align(5, 10, 20, 40)
|
||||
.onDoublePress(cb)
|
||||
.setVisible(false)
|
||||
.setAutoClear(true)
|
||||
;
|
||||
}
|
||||
public void update(){
|
||||
}
|
||||
public void draw(){
|
||||
pushStyle();
|
||||
fill(boxColor);
|
||||
stroke(boxStrokeColor);
|
||||
strokeWeight(1);
|
||||
rect(x, y, w, h);
|
||||
fill(bgColor);
|
||||
textFont(h3, 16);
|
||||
textAlign(LEFT, TOP);
|
||||
text("Options", x + padding, y + padding);
|
||||
pushStyle();
|
||||
fill(boxColor);
|
||||
stroke(boxStrokeColor);
|
||||
strokeWeight(1);
|
||||
rect(x, y, w, h);
|
||||
fill(bgColor);
|
||||
text("LSL OPTIONS", x + padding, y + padding);
|
||||
textFont(h3, 16);
|
||||
textAlign(LEFT, TOP);
|
||||
text("Data Stream", x + padding, y + 50 + padding);
|
||||
textFont(p4, 14);;
|
||||
text("Aux Stream", x + padding, y + 82 + padding);
|
||||
popStyle();
|
||||
}
|
||||
};
|
||||
|
||||
class SDConverterBox {
|
||||
int x, y, w, h, padding; //size and position
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@ void openNewLogFileODF(String _fileName) {
|
||||
*/
|
||||
void playbackSelected(File selection) {
|
||||
if (selection == null) {
|
||||
println("ControlPanel: playbackSelected: Window was closed or the user hit cancel.");
|
||||
println("DataLogging: playbackSelected: Window was closed or the user hit cancel.");
|
||||
} else {
|
||||
println("ControlPanel: playbackSelected: User selected " + selection.getAbsolutePath());
|
||||
println("DataLogging: playbackSelected: User selected " + selection.getAbsolutePath());
|
||||
output("You have selected \"" + selection.getAbsolutePath() + "\" for playback.");
|
||||
playbackData_fname = selection.getAbsolutePath();
|
||||
}
|
||||
@@ -135,7 +135,7 @@ void fileSelected(File selection) { //called by the Open File dialog box after
|
||||
println("fileSelected: no selection so far...");
|
||||
} else {
|
||||
//inputFile = selection;
|
||||
playbackData_fname = selection.getAbsolutePath();
|
||||
playbackData_fname = selection.getAbsolutePath(); //<>//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ public class OutputFile_rawtxt {
|
||||
int nVal = values.length;
|
||||
for (int Ival = 0; Ival < nVal; Ival++) {
|
||||
output.print(", ");
|
||||
output.print(String.format("%.2f", scale_fac * float(values[Ival])));
|
||||
output.print(String.format(Locale.US, "%.2f", scale_fac * float(values[Ival])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ public class OutputFile_rawtxt {
|
||||
int nVal = values.length;
|
||||
for (int Ival = 0; Ival < nVal; Ival++) {
|
||||
output.print(", ");
|
||||
output.print(String.format("%.3f", scale_fac * float(values[Ival])));
|
||||
output.print(String.format(Locale.US, "%.3f", scale_fac * float(values[Ival])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1475,4 +1475,4 @@ public void convertSDFile() {
|
||||
dataWriter.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ HashMap<String,float[][]> processed_file;
|
||||
HashMap<Integer,String> index_of_times;
|
||||
HashMap<String,Integer> index_of_times_rev;
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Global Functions
|
||||
//------------------------------------------------------------------------
|
||||
@@ -109,6 +111,8 @@ int getDataIfAvailable(int pointCounter) {
|
||||
//if (eegDataSource==DATASOURCE_PLAYBACKFILE) println("OpenBCI_GUI: getDataIfAvailable: currentTableRowIndex = " + currentTableRowIndex);
|
||||
//println("OpenBCI_GUI: getDataIfAvailable: pointCounter = " + pointCounter);
|
||||
} // close "has enough time passed"
|
||||
else{
|
||||
}
|
||||
}
|
||||
return pointCounter;
|
||||
}
|
||||
@@ -154,6 +158,7 @@ void processNewData() {
|
||||
// w_openbionics.process();
|
||||
|
||||
dataProcessing_user.process(yLittleBuff_uV, dataBuffY_uV, dataBuffY_filtY_uV, fftBuff);
|
||||
dataProcessing.newDataToSend = true;
|
||||
|
||||
//look to see if the latest data is railed so that we can notify the user on the GUI
|
||||
for (int Ichan=0; Ichan < nchan; Ichan++) is_railed[Ichan].update(dataPacketBuff[lastReadDataPacketInd].values[Ichan]);
|
||||
@@ -357,14 +362,33 @@ class DataProcessing {
|
||||
private int currentNotch_ind = 0; // set to 0 to default to 60Hz, set to 1 to default to 50Hz
|
||||
float data_std_uV[];
|
||||
float polarity[];
|
||||
boolean newDataToSend;
|
||||
private String[] binNames;
|
||||
final int[] processing_band_low_Hz = {
|
||||
1, 4, 8, 13, 30
|
||||
}; //lower bound for each frequency band of interest (2D classifier only)
|
||||
final int[] processing_band_high_Hz = {
|
||||
4, 8, 13, 30, 55
|
||||
}; //upper bound for each frequency band of interest
|
||||
float avgPowerInBins[][];
|
||||
float headWidePower[];
|
||||
int numBins;
|
||||
|
||||
// indexs
|
||||
final int DELTA = 0; // 1-4 Hz
|
||||
final int THETA = 1; // 4-8 Hz
|
||||
final int ALPHA = 2; // 8-13 Hz
|
||||
final int BETA = 3; // 13-30 Hz
|
||||
final int GAMMA = 4; // 30-55 Hz
|
||||
|
||||
DataProcessing(int NCHAN, float sample_rate_Hz) {
|
||||
nchan = NCHAN;
|
||||
fs_Hz = sample_rate_Hz;
|
||||
data_std_uV = new float[nchan];
|
||||
polarity = new float[nchan];
|
||||
|
||||
newDataToSend = false;
|
||||
avgPowerInBins = new float[nchan][processing_band_low_Hz.length];
|
||||
headWidePower = new float[processing_band_low_Hz.length];
|
||||
|
||||
//check to make sure the sample rate is acceptable and then define the filters
|
||||
if (abs(fs_Hz-250.0f) < 1.0) {
|
||||
@@ -675,8 +699,25 @@ class DataProcessing {
|
||||
}
|
||||
fftBuff[Ichan].setBand(I, (float)foo); //put the smoothed data back into the fftBuff data holder for use by everyone else
|
||||
} //end loop over FFT bins
|
||||
for (int i = 0; i < processing_band_low_Hz.length; i++) {
|
||||
float sum = 0;
|
||||
for (int j = processing_band_low_Hz[i]; j < processing_band_high_Hz[i]; j++) {
|
||||
sum += fftBuff[Ichan].getBand(j);
|
||||
}
|
||||
avgPowerInBins[Ichan][i] = sum;
|
||||
}
|
||||
} //end the loop over channels.
|
||||
for (int i = 0; i < processing_band_low_Hz.length; i++) {
|
||||
float sum = 0;
|
||||
|
||||
for (int j = 0; j < nchan; j++) {
|
||||
sum += avgPowerInBins[j][i];
|
||||
}
|
||||
headWidePower[i] = sum/nchan;
|
||||
}
|
||||
|
||||
//delta in channel 2 ... avgPowerInBins[1][DELTA];
|
||||
//headwide beta ... headWidePower[BETA];
|
||||
|
||||
//find strongest channel
|
||||
int refChanInd = findMax(data_std_uV);
|
||||
@@ -696,5 +737,12 @@ class DataProcessing {
|
||||
polarity[Ichan]=-1.0;
|
||||
}
|
||||
}
|
||||
|
||||
// println("Brain Wide DELTA = " + headWidePower[DELTA]);
|
||||
// println("Brain Wide THETA = " + headWidePower[THETA]);
|
||||
// println("Brain Wide ALPHA = " + headWidePower[ALPHA]);
|
||||
// println("Brain Wide BETA = " + headWidePower[BETA]);
|
||||
// println("Brain Wide GAMMA = " + headWidePower[GAMMA]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,14 +98,6 @@ void serialEvent(Serial port){
|
||||
numPacketsDropped = 0;
|
||||
}
|
||||
|
||||
//If networking enabled --> send data every sample if 8 channels or every other sample if 16 channels
|
||||
if (networkType !=0) {
|
||||
if (nchan==8) {
|
||||
sendRawData_dataPacket(dataPacketBuff[curDataPacketInd], openBCI.get_scale_fac_uVolts_per_count(), openBCI.get_scale_fac_accel_G_per_count());
|
||||
} else if ((nchan==16) && ((dataPacketBuff[curDataPacketInd].sampleIndex %2)!=1)) {
|
||||
sendRawData_dataPacket(dataPacketBuff[curDataPacketInd], openBCI.get_scale_fac_uVolts_per_count(), openBCI.get_scale_fac_accel_G_per_count());
|
||||
}
|
||||
}
|
||||
switch (outputDataSource) {
|
||||
case OUTPUT_SOURCE_ODF:
|
||||
fileoutput_odf.writeRawData_dataPacket(dataPacketBuff[curDataPacketInd], openBCI.get_scale_fac_uVolts_per_count(), openBCI.get_scale_fac_accel_G_per_count());
|
||||
|
||||
@@ -236,6 +236,7 @@ void parseKey(char val) {
|
||||
case 's':
|
||||
println("case s...");
|
||||
stopRunning();
|
||||
|
||||
// stopButtonWasPressed();
|
||||
break;
|
||||
case 'b':
|
||||
|
||||
@@ -1,228 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Networking
|
||||
// - responsible for sending data over a Network
|
||||
// - Three types of networks are available:
|
||||
// - UDP
|
||||
// - OSC
|
||||
// - LSL
|
||||
// - In control panel, specify the network and parameters (port, ip, etc).
|
||||
// Then, you can receive the streamed data in a variety of different
|
||||
// programs, given that you specify the correct parameters to receive
|
||||
// the data stream in those networks.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float[] data_to_send;
|
||||
float[] aux_to_send;
|
||||
float[] full_message;
|
||||
|
||||
public void sendRawData_dataPacket(DataPacket_ADS1299 data, float scale_to_uV, float scale_for_aux) {
|
||||
data_to_send = writeValues(data.values,scale_to_uV);
|
||||
aux_to_send = writeValues(data.auxValues,scale_for_aux);
|
||||
|
||||
full_message = compressArray(data); //Collect packet into full_message array
|
||||
|
||||
//send to appropriate network type
|
||||
if (networkType == 1){
|
||||
udp.send_message(data_to_send); //Send full message to udp
|
||||
}else if (networkType == 2){
|
||||
osc.send_message(data_to_send); //Send full message to osc
|
||||
}else if (networkType == 3){
|
||||
lsl.send_message(data_to_send,aux_to_send); //Send
|
||||
}
|
||||
}
|
||||
// Convert counts to scientific values (uV or G)
|
||||
private float[] writeValues(int[] values, float scale_fac) {
|
||||
int nVal = values.length;
|
||||
float[] temp_buffer = new float[nVal];
|
||||
for (int Ival = 0; Ival < nVal; Ival++) {
|
||||
temp_buffer[Ival] = scale_fac * float(values[Ival]);
|
||||
}
|
||||
return temp_buffer;
|
||||
}
|
||||
|
||||
//Package all data into one array (full_message) for UDP and OSC
|
||||
private float[] compressArray(DataPacket_ADS1299 data){
|
||||
full_message = new float[1 + data_to_send.length + aux_to_send.length];
|
||||
full_message[0] = data.sampleIndex;
|
||||
for (int i=0;i<data_to_send.length;i++){
|
||||
full_message[i+1] = data_to_send[i];
|
||||
}
|
||||
for (int i=0;i<aux_to_send.length;i++){
|
||||
full_message[data_to_send.length + 1] = aux_to_send[i];
|
||||
}
|
||||
return full_message;
|
||||
}
|
||||
|
||||
//////////////
|
||||
// CLASSES //
|
||||
|
||||
/**
|
||||
* To perform any action on datagram reception, you need to implement this
|
||||
* handler in your code. This method will be automatically called by the UDP
|
||||
* object each time he receive a nonnull message. This method will send the
|
||||
* message to `udpEvent`
|
||||
*/
|
||||
// void receive(byte[] data, String ip, int port) { // <-- extended handler
|
||||
// // get the "real" message =
|
||||
// // forget the ";\n" at the end <-- !!! only for a communication with Pd !!!
|
||||
// data = subset(data, 0, data.length-2);
|
||||
// String message = new String( data );
|
||||
//
|
||||
// // Be safe, always check to make sure the parent did implement this function
|
||||
// if (ganglion.udpRx.udpEventMethod != null) {
|
||||
// try {
|
||||
// ganglion.udpRx.udpEventMethod.invoke(ganglion.udpRx.parent, message);
|
||||
// }
|
||||
// catch (Exception e) {
|
||||
// System.err.println("Disabling udpEvent() for because of an error.");
|
||||
// e.printStackTrace();
|
||||
// ganglion.udpRx.udpEventMethod = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// void clientEvent(Client someClient) {
|
||||
// print("Server Says: ");
|
||||
// dataIn = myClient.read();
|
||||
// println(dataIn);
|
||||
// background(dataIn);
|
||||
//
|
||||
// // get the "real" message =
|
||||
// // forget the ";\n" at the end <-- !!! only for a communication with Pd !!!
|
||||
// data = subset(data, 0, data.length-2);
|
||||
// String message = new String( data );
|
||||
//
|
||||
// // Be safe, always check to make sure the parent did implement this function
|
||||
// if (ganglion.udpRx.udpEventMethod != null) {
|
||||
// try {
|
||||
// ganglion.udpRx.udpEventMethod.invoke(ganglion.udpRx.parent, message);
|
||||
// }
|
||||
// catch (Exception e) {
|
||||
// System.err.println("Disabling udpEvent() for because of an error.");
|
||||
// e.printStackTrace();
|
||||
// ganglion.udpRx.udpEventMethod = null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
class UDPReceive {
|
||||
public Method udpEventMethod;
|
||||
public PApplet parent;
|
||||
int port;
|
||||
String ip;
|
||||
boolean listen;
|
||||
UDP udp;
|
||||
|
||||
/**
|
||||
* @description Used to construct a new UDP connection
|
||||
* @param `parent` {PApplet} - The object calling constructor. Implements
|
||||
* `udpEvent` if `parent` wants to recieve messages.
|
||||
* @param `port` {int} - The port number to use for the UDP port
|
||||
* @param `ip` {String} - The ip address for the UDP connection. Use `localhost`
|
||||
* to keep the port on this computer.
|
||||
* @constructor
|
||||
*/
|
||||
public UDPReceive(PApplet parent, int port, String ip) {
|
||||
// Grab vars
|
||||
this.port = port;
|
||||
this.ip = ip;
|
||||
|
||||
this.udp = new UDP(parent, port);
|
||||
println("udp bound to " + port);
|
||||
this.udp.setBuffer(1024);
|
||||
this.udp.log(false);
|
||||
this.udp.listen(true);
|
||||
|
||||
// callback: https://forum.processing.org/one/topic/noob-q-i-d-like-to-learn-more-about-callbacks.html
|
||||
// Set parent for callback
|
||||
this.parent = parent;
|
||||
|
||||
// Verify that parent actaully implements the callback
|
||||
try {
|
||||
this.udpEventMethod = this.parent.getClass().getMethod("udpEvent", new Class[] { String.class });
|
||||
println("Networking: Good job iplmenting udpEvent callback in parent " + parent);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// No such method declared, there for the parent who created this will not
|
||||
// recieve messages :(
|
||||
println("Networking: Error failed to implement udpEvent callback in parent " + this.parent);
|
||||
this.udp.listen(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// UDP SEND //
|
||||
class UDPSend {
|
||||
int port;
|
||||
String ip;
|
||||
UDP udp;
|
||||
|
||||
UDPSend(int _port, String _ip){
|
||||
port = _port;
|
||||
ip = _ip;
|
||||
udp = new UDP(this);
|
||||
udp.setBuffer(1024);
|
||||
udp.log(false);
|
||||
}
|
||||
void send_message(float[] _message){
|
||||
String message = Arrays.toString(_message);
|
||||
udp.send(message,ip,port);
|
||||
}
|
||||
|
||||
void send(String msg){
|
||||
udp.send(msg,ip,port);
|
||||
}
|
||||
}
|
||||
|
||||
// OSC SEND //
|
||||
class OSCSend{
|
||||
int port;
|
||||
String ip;
|
||||
String address;
|
||||
OscP5 osc;
|
||||
NetAddress netaddress;
|
||||
|
||||
OSCSend(int _port, String _ip, String _address){
|
||||
port = _port;
|
||||
ip = _ip;
|
||||
address = _address;
|
||||
osc = new OscP5(this,12000);
|
||||
netaddress = new NetAddress(ip,port);
|
||||
}
|
||||
void send_message(float[] _message){
|
||||
OscMessage osc_message = new OscMessage(address);
|
||||
osc_message.add(_message);
|
||||
osc.send(osc_message, netaddress);
|
||||
}
|
||||
}
|
||||
|
||||
// LSL SEND //
|
||||
class LSLSend{
|
||||
String data_stream;
|
||||
String data_stream_id;
|
||||
String aux_stream;
|
||||
String aux_stream_id;
|
||||
LSL.StreamInfo info_data;
|
||||
LSL.StreamOutlet outlet_data;
|
||||
LSL.StreamInfo info_aux;
|
||||
LSL.StreamOutlet outlet_aux;
|
||||
|
||||
LSLSend(String _data_stream, String _aux_stream){
|
||||
data_stream = _data_stream;
|
||||
data_stream_id = data_stream + "_id";
|
||||
aux_stream = _aux_stream;
|
||||
aux_stream_id = aux_stream + "_id";
|
||||
info_data = new LSL.StreamInfo(data_stream, "EEG", nchan, openBCI.get_fs_Hz(), LSL.ChannelFormat.float32, data_stream_id);
|
||||
outlet_data = new LSL.StreamOutlet(info_data);
|
||||
//info_aux = new LSL.StreamInfo("aux_stream", "AUX", 3, openBCI.get_fs_Hz(), LSL.ChannelFormat.float32, aux_stream_id);
|
||||
//outlet_aux = new LSL.StreamOutlet(info_aux);
|
||||
}
|
||||
void send_message(float[] _data_message, float[] _aux_message){
|
||||
outlet_data.push_sample(_data_message);
|
||||
//outlet_aux.push_sample(_aux_message);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
//<>//
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GUI for controlling the ADS1299-based OpenBCI
|
||||
@@ -24,9 +24,6 @@ import java.util.*; //for Array.copyOfRange()
|
||||
import java.util.Map.Entry;
|
||||
import processing.serial.*; //for serial communication to Arduino/OpenBCI
|
||||
import java.awt.event.*; //to allow for event listener on screen resize
|
||||
import netP5.*; //for OSC networking
|
||||
import oscP5.*; //for OSC networking
|
||||
import hypermedia.net.*; //for UDP networking
|
||||
import processing.net.*; // For TCP networking
|
||||
import grafica.*;
|
||||
import java.lang.reflect.*; // For callbacks
|
||||
@@ -37,6 +34,11 @@ import java.lang.Process;
|
||||
import java.util.Random;
|
||||
import java.awt.Robot; //used for simulating mouse clicks
|
||||
import java.awt.AWTException;
|
||||
import netP5.*; // for OSC
|
||||
import oscP5.*; // for OSC
|
||||
import hypermedia.net.*; //for UDP
|
||||
import java.nio.ByteBuffer; //for UDP
|
||||
|
||||
|
||||
import gifAnimation.*;
|
||||
|
||||
@@ -60,7 +62,7 @@ final int NCHAN_CYTON = 8;
|
||||
final int NCHAN_CYTON_DAISY = 16;
|
||||
final int NCHAN_GANGLION = 4;
|
||||
|
||||
boolean hasIntroAnimation = true;
|
||||
boolean hasIntroAnimation = false;
|
||||
PImage cog;
|
||||
Gif loadingGIF;
|
||||
Gif loadingGIF_blue;
|
||||
@@ -146,16 +148,6 @@ final int OUTPUT_SOURCE_BDF = 2; // The BDF data format http://www.biosemi.com/f
|
||||
public int outputDataSource = OUTPUT_SOURCE_ODF;
|
||||
// public int outputDataSource = OUTPUT_SOURCE_BDF;
|
||||
|
||||
//variables for Networking
|
||||
int port = 0;
|
||||
String ip = "";
|
||||
String address = "";
|
||||
String data_stream = "";
|
||||
String aux_stream = "";
|
||||
UDPSend udp;
|
||||
OSCSend osc;
|
||||
LSLSend lsl;
|
||||
|
||||
// Serial output
|
||||
String serial_output_portName = "/dev/tty.usbmodem1411"; //must edit this based on the name of the serial/COM port
|
||||
Serial serial_output;
|
||||
@@ -244,6 +236,8 @@ int hubPid = 0;
|
||||
String nodeHubName = "GanglionHub";
|
||||
Robot rob3115;
|
||||
|
||||
PApplet ourApplet;
|
||||
|
||||
//-----------------------------------------1-------------------------------
|
||||
// Global Functions
|
||||
//------------------------------------------------------------------------
|
||||
@@ -269,6 +263,7 @@ void setup() {
|
||||
println("For more information about how to work with this code base, please visit: http://docs.openbci.com/OpenBCI%20Software/");
|
||||
//open window
|
||||
size(1024, 768, P2D);
|
||||
ourApplet = this;
|
||||
frameRate(60); //refresh rate ... this will slow automatically, if your processor can't handle the specified rate
|
||||
smooth(); //turn this off if it's too slow
|
||||
|
||||
@@ -336,14 +331,14 @@ void setup() {
|
||||
playground = new Playground(navBarHeight);
|
||||
|
||||
//attempt to open a serial port for "output"
|
||||
try {
|
||||
verbosePrint("OpenBCI_GUI.pde: attempting to open serial/COM port for data output = " + serial_output_portName);
|
||||
serial_output = new Serial(this, serial_output_portName, serial_output_baud); //open the com port
|
||||
serial_output.clear(); // clear anything in the com port's buffer
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
verbosePrint("OpenBCI_GUI.pde: could not open " + serial_output_portName);
|
||||
}
|
||||
// try {
|
||||
// verbosePrint("OpenBCI_GUI.pde: attempting to open serial/COM port for data output = " + serial_output_portName);
|
||||
// serial_output = new Serial(this, serial_output_portName, serial_output_baud); //open the com port
|
||||
// serial_output.clear(); // clear anything in the com port's buffer
|
||||
// }
|
||||
// catch (RuntimeException e) {
|
||||
// verbosePrint("OpenBCI_GUI.pde: could not open " + serial_output_portName);
|
||||
// }
|
||||
|
||||
// println("OpenBCI_GUI: setup: hub is running " + ganglion.isHubRunning());
|
||||
buttonHelpText = new ButtonHelpText();
|
||||
@@ -707,6 +702,8 @@ void haltSystem() {
|
||||
ganglion_portName = "";
|
||||
controlPanel.resetListItems();
|
||||
|
||||
// w_networking.clearCP5(); //closes all networking controllers
|
||||
|
||||
// stopDataTransfer(); // make sure to stop data transfer, if data is streaming and being drawn
|
||||
|
||||
if (eegDataSource == DATASOURCE_NORMAL_W_AUX) {
|
||||
@@ -809,6 +806,7 @@ void systemUpdate() { // for updating data values and variables
|
||||
//re-initialize GUI if screen has been resized and it's been more than 1/2 seccond (to prevent reinitialization of GUI from happening too often)
|
||||
if (screenHasBeenResized) {
|
||||
// GUIWidgets_screenResized(width, height);
|
||||
ourApplet = this; //reset PApplet...
|
||||
topNav.screenHasBeenResized(width, height);
|
||||
wm.screenResized();
|
||||
}
|
||||
@@ -979,7 +977,7 @@ void introAnimation() {
|
||||
textLeading(24);
|
||||
fill(31, 69, 110, transparency);
|
||||
textAlign(CENTER, CENTER);
|
||||
text("OpenBCI GUI v2.1.1\nJanuary 2017", width/2, height/2 + width/9);
|
||||
text("OpenBCI GUI v2.1.2\nJanuary 2017", width/2, height/2 + width/9);
|
||||
}
|
||||
|
||||
//exit intro animation at t2
|
||||
@@ -1039,4 +1037,4 @@ PVector getWindowLocation(String renderer) {
|
||||
}
|
||||
return l;
|
||||
}
|
||||
//END OF CODE FOR FIXING WEIRD EXIT CRASH ISSUE -- 7/27/16 ===========================
|
||||
//END OF CODE FOR FIXING WEIRD EXIT CRASH ISSUE -- 7/27/16 ===========================
|
||||
|
||||
|
Depois Largura: | Altura: | Tamanho: 241 KiB |
|
Depois Largura: | Altura: | Tamanho: 269 KiB |
|
Depois Largura: | Altura: | Tamanho: 276 KiB |
|
Depois Largura: | Altura: | Tamanho: 275 KiB |
|
Depois Largura: | Altura: | Tamanho: 269 KiB |
|
Depois Largura: | Altura: | Tamanho: 167 KiB |
|
Depois Largura: | Altura: | Tamanho: 168 KiB |
|
Depois Largura: | Altura: | Tamanho: 214 KiB |
|
Depois Largura: | Altura: | Tamanho: 187 KiB |
|
Depois Largura: | Altura: | Tamanho: 167 KiB |
|
Depois Largura: | Altura: | Tamanho: 163 KiB |
|
Depois Largura: | Altura: | Tamanho: 152 KiB |
|
Depois Largura: | Altura: | Tamanho: 150 KiB |
|
Depois Largura: | Altura: | Tamanho: 151 KiB |
|
Depois Largura: | Altura: | Tamanho: 153 KiB |
|
Depois Largura: | Altura: | Tamanho: 152 KiB |
|
Depois Largura: | Altura: | Tamanho: 175 KiB |
|
Depois Largura: | Altura: | Tamanho: 175 KiB |
|
Depois Largura: | Altura: | Tamanho: 173 KiB |
|
Depois Largura: | Altura: | Tamanho: 172 KiB |
|
Depois Largura: | Altura: | Tamanho: 173 KiB |
|
Depois Largura: | Altura: | Tamanho: 221 KiB |
|
Depois Largura: | Altura: | Tamanho: 216 KiB |
|
Depois Largura: | Altura: | Tamanho: 245 KiB |
@@ -47,9 +47,9 @@ void setupWidgets(PApplet _this, ArrayList<Widget> w){
|
||||
w_accelerometer.setTitle("Accelerometer");
|
||||
addWidget(w_accelerometer, w);
|
||||
|
||||
// w_networking = new W_networking(_this);
|
||||
// w_networking.setTitle("Networking");
|
||||
// addWidget(w_networking, w);
|
||||
w_networking = new W_networking(_this);
|
||||
w_networking.setTitle("Networking");
|
||||
addWidget(w_networking, w);
|
||||
|
||||
w_emg = new W_emg(_this);
|
||||
w_emg.setTitle("EMG");
|
||||
@@ -154,7 +154,8 @@ class WidgetManager{
|
||||
}
|
||||
|
||||
void update(){
|
||||
if(visible && updating){
|
||||
// if(visible && updating){
|
||||
if(visible){
|
||||
for(int i = 0; i < widgets.size(); i++){
|
||||
if(widgets.get(i).isActive){
|
||||
widgets.get(i).update();
|
||||
@@ -177,6 +178,14 @@ class WidgetManager{
|
||||
widgets.get(i).draw();
|
||||
widgets.get(i).drawDropdowns();
|
||||
popStyle();
|
||||
}else{
|
||||
if(widgets.get(i).widgetTitle.equals("Networking")){
|
||||
try{
|
||||
w_networking.shutDown();
|
||||
}catch (NullPointerException e){
|
||||
println(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,4 @@ Project Management Plan:
|
||||
[](http://waffle.io/OpenBCI/OpenBCI_GUI_v2.0)
|
||||
|
||||
# OpenBCI_GUI_v2.0
|
||||
Based on OpenBCI_Processing, OpenBCI_GUI_v2.0 extends the GUI to include additional features, and will soon be usable with the Ganglion board.
|
||||
|
||||
## Developing
|
||||
|
||||
Drag and drop all folders in the libraries folder into your processing libraries folder.
|
||||
Based on OpenBCI_Processing, OpenBCI_GUI_v2.0 extends the GUI to include additional features, and interfaces with the OpenBCI [Cyton](http://shop.openbci.com/collections/frontpage/products/openbci-32-bit-board-kit?variant=784651699) and [Ganglion](http://shop.openbci.com/collections/frontpage/products/pre-order-ganglion-board?variant=13461804483) hardware systems. Tutorials, and getting started guides can be found on the [OpenBCI Learning Pages](http://docs.openbci.com/Getting%20Started/00-Welcome). For a guide on how to run this code in the Processing IDE, go [here](http://docs.openbci.com/OpenBCI%20Software/01-OpenBCI_GUI)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package controlP5;
|
||||
package controlP5;
|
||||
|
||||
/**
|
||||
* controlP5 is a processing gui library.
|
||||
*
|
||||
*
|
||||
* 2006-2015 by Andreas Schlegel
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1
|
||||
@@ -13,16 +13,16 @@ package controlP5;
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* @author Andreas Schlegel (http://www.sojamo.de)
|
||||
* @modified 04/14/2016
|
||||
* @version 2.2.6
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -35,7 +35,7 @@ import processing.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* ControllerGroup is an abstract class and is extended by class ControlGroup, Tab, or the ListBox.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class ControllerGroup< T > implements ControllerInterface< T > , ControlP5Constants , ControlListener {
|
||||
|
||||
@@ -924,7 +924,7 @@ public abstract class ControllerGroup< T > implements ControllerInterface< T > ,
|
||||
|
||||
/**
|
||||
* convenience method to fill a float array in favor of theArray[0] = 1.2; etc.
|
||||
* takes a float array and fills it (starting from index 0) with arguments starting from index 1.
|
||||
* takes a float array and fills it (starting from index 0) with arguments starting from index 1.
|
||||
*/
|
||||
static public float[] set( float[] theArray , float ... theValues ) {
|
||||
if ( theValues.length > theArray.length ) {
|
||||
|
||||
@@ -2,9 +2,9 @@ package controlP5;
|
||||
|
||||
/**
|
||||
* controlP5 is a processing gui library.
|
||||
*
|
||||
*
|
||||
* 2006-2015 by Andreas Schlegel
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1
|
||||
@@ -13,16 +13,16 @@ package controlP5;
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* @author Andreas Schlegel (http://www.sojamo.de)
|
||||
* @modified 04/14/2016
|
||||
* @version 2.2.6
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -36,13 +36,13 @@ import processing.core.PImage;
|
||||
* A radioButton is a list of toggles that can be turned on or off. radioButton is of type
|
||||
* ControllerGroup, therefore a controllerPlug can't be set. this means that an event from a
|
||||
* radioButton can't be forwarded to a method other than controlEvent in a sketch.
|
||||
*
|
||||
*
|
||||
* a radioButton has 2 sets of values. radioButton.getValue() returns the value of the active
|
||||
* radioButton item. radioButton.getArrayValue() returns a float array that represents the active
|
||||
* (1) and inactive (0) items of a radioButton.
|
||||
*
|
||||
*
|
||||
* ControlP5 CheckBox Toggle
|
||||
*
|
||||
*
|
||||
* @example controllers/ControlP5radioButton
|
||||
*
|
||||
* @nosuperclasses Controller Controller
|
||||
@@ -68,7 +68,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
|
||||
/**
|
||||
* Convenience constructor to extend RadioButton.
|
||||
*
|
||||
*
|
||||
* @example use/ControlP5extendController
|
||||
* @param theControlP5
|
||||
* @param theName
|
||||
@@ -189,7 +189,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param theDefaultImage
|
||||
* @param theOverImage
|
||||
* @param theActiveImage
|
||||
@@ -241,7 +241,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
* set the height of a radioButton/checkBox item. by default the height is 11px. in order to
|
||||
* recognize a custom height, the itemHeight has to be set before adding items to a
|
||||
* radioButton/checkBox.
|
||||
*
|
||||
*
|
||||
* @param theItemHeight
|
||||
*/
|
||||
public RadioButton setItemHeight( int theItemHeight ) {
|
||||
@@ -257,7 +257,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
* set the width of a radioButton/checkBox item. by default the width is 11px. in order to
|
||||
* recognize a custom width, the itemWidth has to be set before adding items to a
|
||||
* radioButton/checkBox.
|
||||
*
|
||||
*
|
||||
* @param theItemWidth
|
||||
*/
|
||||
public RadioButton setItemWidth( int theItemWidth ) {
|
||||
@@ -271,7 +271,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
|
||||
/**
|
||||
* Gets a radio button item by index.
|
||||
*
|
||||
*
|
||||
* @param theIndex
|
||||
* @return Toggle
|
||||
*/
|
||||
@@ -294,7 +294,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
|
||||
/**
|
||||
* Gets the state of an item - this can be true (for on) or false (for off) - by index.
|
||||
*
|
||||
*
|
||||
* @param theIndex
|
||||
* @return boolean
|
||||
*/
|
||||
@@ -307,7 +307,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
|
||||
/**
|
||||
* Gets the state of an item - this can be true (for on) or false (for off) - by name.
|
||||
*
|
||||
*
|
||||
* @param theName
|
||||
* @return
|
||||
*/
|
||||
@@ -350,7 +350,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
/**
|
||||
* Items of a radioButton or a checkBox are organized in columns and rows. SetItemsPerRow sets
|
||||
* the limit of items per row. items exceeding the limit will be pushed to the next row.
|
||||
*
|
||||
*
|
||||
* @param theValue
|
||||
*/
|
||||
public RadioButton setItemsPerRow( final int theValue ) {
|
||||
@@ -361,7 +361,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
|
||||
/**
|
||||
* Sets the spacing in pixels between columns.
|
||||
*
|
||||
*
|
||||
* @param theSpacing
|
||||
*/
|
||||
public RadioButton setSpacingColumn( final int theSpacing ) {
|
||||
@@ -372,7 +372,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
|
||||
/**
|
||||
* Sets the spacing in pixels between rows.
|
||||
*
|
||||
*
|
||||
* @param theSpacing
|
||||
*/
|
||||
public RadioButton setSpacingRow( final int theSpacing ) {
|
||||
@@ -398,7 +398,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
* Deactivates all active RadioButton items and only activates the item corresponding to
|
||||
* theIndex.
|
||||
* TODO does not trigger function or value when called by code, fix!
|
||||
*
|
||||
*
|
||||
* @param theIndex
|
||||
*/
|
||||
public RadioButton activate( int theIndex ) {
|
||||
@@ -434,7 +434,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
|
||||
/**
|
||||
* Actives an item of the Radio button by name.
|
||||
*
|
||||
*
|
||||
* @param theName
|
||||
*/
|
||||
public RadioButton activate( String theName ) {
|
||||
@@ -452,7 +452,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
/**
|
||||
* Deactivates a RadioButton by name and sets the value of the RadioButton to the default value
|
||||
* -1.
|
||||
*
|
||||
*
|
||||
* @param theName
|
||||
*/
|
||||
public RadioButton deactivate( String theName ) {
|
||||
@@ -491,7 +491,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
*
|
||||
* @exclude
|
||||
*/
|
||||
@ControlP5.Invisible @Override public void controlEvent( ControlEvent theEvent ) {
|
||||
@@ -572,7 +572,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
|
||||
/**
|
||||
* In order to always have 1 item selected, use setNoneSelectedAllowed(false), by default this
|
||||
* is true. setNoneSelectedAllowed does not apply when in multipleChoice mode.
|
||||
*
|
||||
*
|
||||
* @param theValue
|
||||
*/
|
||||
public RadioButton setNoneSelectedAllowed( boolean theValue ) {
|
||||
|
||||