31 Commits

Autor SHA1 Mensagem Data
Conor Russomanno 2761a5b1a2 Merge pull request #144 from conorrussomanno/development
Development
2017-03-15 16:16:07 -04:00
Conor Russomanno dc9323b054 serial messages built 2017-03-15 16:12:25 -04:00
Conor Russomanno 0cb4b11e0b serial modifications 2017-03-09 14:57:17 -05:00
Conor Russomanno 509777d3f5 serial is vewwy vewwy close 2017-03-08 18:24:19 -05:00
Conor Russomanno dbd834d984 networking Serial further along 2017-03-08 09:48:03 -05:00
Conor Russomanno 1ff75e6f95 Normalized EMG now working as an output data type ... also working on Serial 2017-03-03 17:32:10 -05:00
Conor Russomanno 115487d836 Merge pull request #139 from conorrussomanno/development
Development
2017-03-02 15:07:40 -05:00
Conor Russomanno 8c66932056 power bands working with OSC 2017-03-02 15:06:49 -05:00
Conor Russomanno 1f28dafe94 power bands to networking attempt 1 2017-03-02 14:25:13 -05:00
Conor Russomanno 323e885fc4 some new power band stuff 2017-03-01 17:43:12 -05:00
Gabriel Ibagon 5fedeaaba5 Merge pull request #137 from gabrielibagon/networking
Networking
2017-02-24 19:10:06 -05:00
Conor Russomanno 5fe2bd05f8 Merge remote-tracking branch 'origin/networking' into networking
# Conflicts:
#	OpenBCI_GUI/W_networking.pde
2017-02-24 18:50:53 -05:00
Conor Russomanno a62bca7c1c Cosmetic changes to networking
woot!
2017-02-24 18:47:38 -05:00
Gabriel Ibagon 4d04bd9579 Merge pull request #136 from gabrielibagon/networking
Networking
2017-02-24 16:24:54 -05:00
gabrielibagon dd2d4213f8 changed wrong data variable for lsl 2017-02-24 12:51:49 -08:00
gabrielibagon 8bae43d42d refactored network send code 2017-02-24 12:50:30 -08:00
gabrielibagon f391f81714 variable num of channels 2017-02-23 11:46:59 -08:00
gabrielibagon 3f65c7025e extended buffer size for UDP FFT send 2017-02-22 22:30:30 -08:00
gabrielibagon a1cbf00e17 changes to FFT send 2017-02-22 22:17:27 -08:00
gabrielibagon 1ffaf36773 fixed UDP and OSC network error 2017-02-22 21:21:19 -08:00
gabrielibagon d299144c4d udp functional 2017-02-22 09:57:38 -08:00
gabrielibagon 1c10b32370 lsl implemented 2017-02-21 15:03:57 -08:00
gabrielibagon c3cde4a1da UDP fully functional :^) 2017-02-21 13:01:04 -08:00
gabrielibagon bf85663aec UI completed 2017-02-20 15:23:35 -08:00
gabrielibagon ae2926c5c8 start button added 2017-02-19 17:14:21 -08:00
gabrielibagon b1def1c571 in a second act of divine intervention - Lo! Feast yer eyes on functional dropdowns 2017-02-19 17:01:49 -08:00
gabrielibagon 71d89867d8 in a sudden burst of luminous brilliance, the radio buttons are now working 2017-02-19 16:16:31 -08:00
gabrielibagon d985991963 removed networking file 2017-02-19 13:59:01 -08:00
gabrielibagon dcdb26966a removed networking from hardware sync 2017-02-19 13:58:12 -08:00
gabrielibagon 3cea932784 removed networking variables from control panel 2017-02-19 13:57:10 -08:00
gabrielibagon 0319ac6f74 removed global networking variables 2017-02-19 13:53:21 -08:00
35 arquivos alterados com 1631 adições e 784 exclusões
Ver Arquivo
-422
Ver Arquivo
@@ -33,24 +33,6 @@ CallbackListener cb = new CallbackListener() { //used by ControlP5 to clear text
} else if (cp5.isMouseOver(cp5.get(Textfield.class, "fileNameGanglion"))){ } else if (cp5.isMouseOver(cp5.get(Textfield.class, "fileNameGanglion"))){
println("CallbackListener: controlEvent: clearing"); println("CallbackListener: controlEvent: clearing");
cp5.get(Textfield.class, "fileNameGanglion").clear(); 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; // Button openClosePort;
// boolean portButtonPressed; // boolean portButtonPressed;
int networkType = 0;
boolean calledForBLEList = false; boolean calledForBLEList = false;
Button refreshPort; Button refreshPort;
@@ -183,20 +163,6 @@ public void controlEvent(ControlEvent theEvent) {
} }
verbosePrint("SD setting = " + sdSetting); 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")){ if (theEvent.isFrom("channelList")){
int setChannelInt = int(theEvent.getValue()) + 1; int setChannelInt = int(theEvent.getValue()) + 1;
@@ -245,14 +211,8 @@ class ControlPanel {
InitBox initBox; InitBox initBox;
SyntheticChannelCountBox synthChannelCountBox; SyntheticChannelCountBox synthChannelCountBox;
NetworkingBox networkingBoxLive;
UDPOptionsBox udpOptionsBox;
OSCOptionsBox oscOptionsBox;
LSLOptionsBox lslOptionsBox;
PlaybackFileBox playbackFileBox; PlaybackFileBox playbackFileBox;
SDConverterBox sdConverterBox; SDConverterBox sdConverterBox;
NetworkingBox networkingBoxPlayback;
BLEBox bleBox; BLEBox bleBox;
DataLogBoxGanglion dataLogBoxGanglion; DataLogBoxGanglion dataLogBoxGanglion;
@@ -301,16 +261,10 @@ class ControlPanel {
channelCountBox = new ChannelCountBox(x + w, (dataLogBox.y + dataLogBox.h), w, h, globalPadding); channelCountBox = new ChannelCountBox(x + w, (dataLogBox.y + dataLogBox.h), w, h, globalPadding);
synthChannelCountBox = new SyntheticChannelCountBox(x + w, dataSourceBox.y, 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); 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 //boxes active when eegDataSource = Playback
playbackFileBox = new PlaybackFileBox(x + w, dataSourceBox.y, w, h, globalPadding); playbackFileBox = new PlaybackFileBox(x + w, dataSourceBox.y, w, h, globalPadding);
sdConverterBox = new SDConverterBox(x + w, (playbackFileBox.y + playbackFileBox.h), 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); rcBox = new RadioConfigBox(x+w, y, w, h, globalPadding);
channelPopup = new ChannelPopup(x+w, y, w, h, globalPadding); channelPopup = new ChannelPopup(x+w, y, w, h, globalPadding);
@@ -368,8 +322,6 @@ class ControlPanel {
sdBox.update(); sdBox.update();
rcBox.update(); rcBox.update();
initBox.update(); initBox.update();
networkingBoxLive.update();
//networkingBoxPlayback.update();
channelPopup.update(); channelPopup.update();
serialList.updateMenu(); serialList.updateMenu();
@@ -447,7 +399,6 @@ class ControlPanel {
dataLogBox.draw(); dataLogBox.draw();
channelCountBox.draw(); channelCountBox.draw();
sdBox.draw(); sdBox.draw();
networkingBoxLive.draw();
cp5.get(Textfield.class, "fileName").setVisible(true); //make sure the data file field is visible 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 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, "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, "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, "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 } else if (eegDataSource == DATASOURCE_PLAYBACKFILE) { //when data source is from playback file
// hideAllBoxes(); //clear lists, so they don't appear // hideAllBoxes(); //clear lists, so they don't appear
playbackFileBox.draw(); playbackFileBox.draw();
sdConverterBox.draw(); sdConverterBox.draw();
//networkingBoxPlayback.draw();
//set other CP5 controllers invisible //set other CP5 controllers invisible
// cp5.get(Textfield.class, "fileName").setVisible(false); //make sure the data file field is visible // 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(Textfield.class, "fileNameGanglion").setVisible(false); //make sure the data file field is visible
cp5.get(MenuList.class, "serialList").setVisible(false); cp5.get(MenuList.class, "serialList").setVisible(false);
cp5.get(MenuList.class, "sdTimes").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, "channelList").setVisible(false);
cp5Popup.get(MenuList.class, "pollList").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, "serialList").setVisible(false);
cp5.get(MenuList.class, "bleList").setVisible(false); cp5.get(MenuList.class, "bleList").setVisible(false);
cp5.get(MenuList.class, "sdTimes").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, "channelList").setVisible(false);
cp5Popup.get(MenuList.class, "pollList").setVisible(false); cp5Popup.get(MenuList.class, "pollList").setVisible(false);
} }
@@ -1108,24 +994,6 @@ public void initButtonPressed(){
//do nothing //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){ 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 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){ } 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 { class RadioConfigBox {
int x, y, w, h, padding; //size and position 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 { class SDConverterBox {
int x, y, w, h, padding; //size and position int x, y, w, h, padding; //size and position
+49 -1
Ver Arquivo
@@ -11,6 +11,8 @@ HashMap<String,float[][]> processed_file;
HashMap<Integer,String> index_of_times; HashMap<Integer,String> index_of_times;
HashMap<String,Integer> index_of_times_rev; HashMap<String,Integer> index_of_times_rev;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Global Functions // Global Functions
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@@ -109,6 +111,8 @@ int getDataIfAvailable(int pointCounter) {
//if (eegDataSource==DATASOURCE_PLAYBACKFILE) println("OpenBCI_GUI: getDataIfAvailable: currentTableRowIndex = " + currentTableRowIndex); //if (eegDataSource==DATASOURCE_PLAYBACKFILE) println("OpenBCI_GUI: getDataIfAvailable: currentTableRowIndex = " + currentTableRowIndex);
//println("OpenBCI_GUI: getDataIfAvailable: pointCounter = " + pointCounter); //println("OpenBCI_GUI: getDataIfAvailable: pointCounter = " + pointCounter);
} // close "has enough time passed" } // close "has enough time passed"
else{
}
} }
return pointCounter; return pointCounter;
} }
@@ -154,6 +158,7 @@ void processNewData() {
// w_openbionics.process(); // w_openbionics.process();
dataProcessing_user.process(yLittleBuff_uV, dataBuffY_uV, dataBuffY_filtY_uV, fftBuff); 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 //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]); 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 private int currentNotch_ind = 0; // set to 0 to default to 60Hz, set to 1 to default to 50Hz
float data_std_uV[]; float data_std_uV[];
float polarity[]; 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) { DataProcessing(int NCHAN, float sample_rate_Hz) {
nchan = NCHAN; nchan = NCHAN;
fs_Hz = sample_rate_Hz; fs_Hz = sample_rate_Hz;
data_std_uV = new float[nchan]; data_std_uV = new float[nchan];
polarity = 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 //check to make sure the sample rate is acceptable and then define the filters
if (abs(fs_Hz-250.0f) < 1.0) { 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 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 } //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. } //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 //find strongest channel
int refChanInd = findMax(data_std_uV); int refChanInd = findMax(data_std_uV);
@@ -696,5 +737,12 @@ class DataProcessing {
polarity[Ichan]=-1.0; 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]);
} }
} }
-8
Ver Arquivo
@@ -98,14 +98,6 @@ void serialEvent(Serial port){
numPacketsDropped = 0; 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) { switch (outputDataSource) {
case OUTPUT_SOURCE_ODF: 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()); fileoutput_odf.writeRawData_dataPacket(dataPacketBuff[curDataPacketInd], openBCI.get_scale_fac_uVolts_per_count(), openBCI.get_scale_fac_accel_G_per_count());
+1
Ver Arquivo
@@ -236,6 +236,7 @@ void parseKey(char val) {
case 's': case 's':
println("case s..."); println("case s...");
stopRunning(); stopRunning();
// stopButtonWasPressed(); // stopButtonWasPressed();
break; break;
case 'b': case 'b':
-228
Ver Arquivo
@@ -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);
}
}
+21 -23
Ver Arquivo
@@ -1,4 +1,4 @@
//<>//
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
// GUI for controlling the ADS1299-based OpenBCI // GUI for controlling the ADS1299-based OpenBCI
@@ -24,9 +24,6 @@ import java.util.*; //for Array.copyOfRange()
import java.util.Map.Entry; import java.util.Map.Entry;
import processing.serial.*; //for serial communication to Arduino/OpenBCI import processing.serial.*; //for serial communication to Arduino/OpenBCI
import java.awt.event.*; //to allow for event listener on screen resize 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 processing.net.*; // For TCP networking
import grafica.*; import grafica.*;
import java.lang.reflect.*; // For callbacks import java.lang.reflect.*; // For callbacks
@@ -37,6 +34,11 @@ import java.lang.Process;
import java.util.Random; import java.util.Random;
import java.awt.Robot; //used for simulating mouse clicks import java.awt.Robot; //used for simulating mouse clicks
import java.awt.AWTException; 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.*; import gifAnimation.*;
@@ -60,7 +62,7 @@ final int NCHAN_CYTON = 8;
final int NCHAN_CYTON_DAISY = 16; final int NCHAN_CYTON_DAISY = 16;
final int NCHAN_GANGLION = 4; final int NCHAN_GANGLION = 4;
boolean hasIntroAnimation = true; boolean hasIntroAnimation = false;
PImage cog; PImage cog;
Gif loadingGIF; Gif loadingGIF;
Gif loadingGIF_blue; 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_ODF;
// public int outputDataSource = OUTPUT_SOURCE_BDF; // 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 // Serial output
String serial_output_portName = "/dev/tty.usbmodem1411"; //must edit this based on the name of the serial/COM port String serial_output_portName = "/dev/tty.usbmodem1411"; //must edit this based on the name of the serial/COM port
Serial serial_output; Serial serial_output;
@@ -244,6 +236,8 @@ int hubPid = 0;
String nodeHubName = "GanglionHub"; String nodeHubName = "GanglionHub";
Robot rob3115; Robot rob3115;
PApplet ourApplet;
//-----------------------------------------1------------------------------- //-----------------------------------------1-------------------------------
// Global Functions // 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/"); println("For more information about how to work with this code base, please visit: http://docs.openbci.com/OpenBCI%20Software/");
//open window //open window
size(1024, 768, P2D); size(1024, 768, P2D);
ourApplet = this;
frameRate(60); //refresh rate ... this will slow automatically, if your processor can't handle the specified rate 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 smooth(); //turn this off if it's too slow
@@ -336,14 +331,14 @@ void setup() {
playground = new Playground(navBarHeight); playground = new Playground(navBarHeight);
//attempt to open a serial port for "output" //attempt to open a serial port for "output"
try { // try {
verbosePrint("OpenBCI_GUI.pde: attempting to open serial/COM port for data output = " + serial_output_portName); // 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 = new Serial(this, serial_output_portName, serial_output_baud); //open the com port
serial_output.clear(); // clear anything in the com port's buffer // serial_output.clear(); // clear anything in the com port's buffer
} // }
catch (RuntimeException e) { // catch (RuntimeException e) {
verbosePrint("OpenBCI_GUI.pde: could not open " + serial_output_portName); // verbosePrint("OpenBCI_GUI.pde: could not open " + serial_output_portName);
} // }
// println("OpenBCI_GUI: setup: hub is running " + ganglion.isHubRunning()); // println("OpenBCI_GUI: setup: hub is running " + ganglion.isHubRunning());
buttonHelpText = new ButtonHelpText(); buttonHelpText = new ButtonHelpText();
@@ -707,6 +702,8 @@ void haltSystem() {
ganglion_portName = ""; ganglion_portName = "";
controlPanel.resetListItems(); controlPanel.resetListItems();
// w_networking.clearCP5(); //closes all networking controllers
// stopDataTransfer(); // make sure to stop data transfer, if data is streaming and being drawn // stopDataTransfer(); // make sure to stop data transfer, if data is streaming and being drawn
if (eegDataSource == DATASOURCE_NORMAL_W_AUX) { 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) //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) { if (screenHasBeenResized) {
// GUIWidgets_screenResized(width, height); // GUIWidgets_screenResized(width, height);
ourApplet = this; //reset PApplet...
topNav.screenHasBeenResized(width, height); topNav.screenHasBeenResized(width, height);
wm.screenResized(); wm.screenResized();
} }
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 241 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 269 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 276 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 275 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 269 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 167 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 168 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 214 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 187 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 167 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 163 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 152 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 150 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 151 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 153 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 152 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 175 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 175 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 173 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 172 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 173 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 221 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 216 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 245 KiB

Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+13 -4
Ver Arquivo
@@ -47,9 +47,9 @@ void setupWidgets(PApplet _this, ArrayList<Widget> w){
w_accelerometer.setTitle("Accelerometer"); w_accelerometer.setTitle("Accelerometer");
addWidget(w_accelerometer, w); addWidget(w_accelerometer, w);
// w_networking = new W_networking(_this); w_networking = new W_networking(_this);
// w_networking.setTitle("Networking"); w_networking.setTitle("Networking");
// addWidget(w_networking, w); addWidget(w_networking, w);
w_emg = new W_emg(_this); w_emg = new W_emg(_this);
w_emg.setTitle("EMG"); w_emg.setTitle("EMG");
@@ -154,7 +154,8 @@ class WidgetManager{
} }
void update(){ void update(){
if(visible && updating){ // if(visible && updating){
if(visible){
for(int i = 0; i < widgets.size(); i++){ for(int i = 0; i < widgets.size(); i++){
if(widgets.get(i).isActive){ if(widgets.get(i).isActive){
widgets.get(i).update(); widgets.get(i).update();
@@ -177,6 +178,14 @@ class WidgetManager{
widgets.get(i).draw(); widgets.get(i).draw();
widgets.get(i).drawDropdowns(); widgets.get(i).drawDropdowns();
popStyle(); popStyle();
}else{
if(widgets.get(i).widgetTitle.equals("Networking")){
try{
w_networking.shutDown();
}catch (NullPointerException e){
println(e);
}
}
} }
} }
} }
@@ -1,10 +1,10 @@
package controlP5; package controlP5;
/** /**
* controlP5 is a processing gui library. * controlP5 is a processing gui library.
* *
* 2006-2015 by Andreas Schlegel * 2006-2015 by Andreas Schlegel
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 * 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 * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General * You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the * Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA * Boston, MA 02111-1307 USA
* *
* @author Andreas Schlegel (http://www.sojamo.de) * @author Andreas Schlegel (http://www.sojamo.de)
* @modified 04/14/2016 * @modified 04/14/2016
* @version 2.2.6 * @version 2.2.6
* *
*/ */
import java.util.ArrayList; 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. * 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 { 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. * 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 ) { static public float[] set( float[] theArray , float ... theValues ) {
if ( theValues.length > theArray.length ) { if ( theValues.length > theArray.length ) {
+23 -23
Ver Arquivo
@@ -2,9 +2,9 @@ package controlP5;
/** /**
* controlP5 is a processing gui library. * controlP5 is a processing gui library.
* *
* 2006-2015 by Andreas Schlegel * 2006-2015 by Andreas Schlegel
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 * 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 * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General * You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the * Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA * Boston, MA 02111-1307 USA
* *
* @author Andreas Schlegel (http://www.sojamo.de) * @author Andreas Schlegel (http://www.sojamo.de)
* @modified 04/14/2016 * @modified 04/14/2016
* @version 2.2.6 * @version 2.2.6
* *
*/ */
import java.lang.reflect.InvocationTargetException; 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 * 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 * 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. * 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 * 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 * radioButton item. radioButton.getArrayValue() returns a float array that represents the active
* (1) and inactive (0) items of a radioButton. * (1) and inactive (0) items of a radioButton.
* *
* ControlP5 CheckBox Toggle * ControlP5 CheckBox Toggle
* *
* @example controllers/ControlP5radioButton * @example controllers/ControlP5radioButton
* *
* @nosuperclasses Controller Controller * @nosuperclasses Controller Controller
@@ -68,7 +68,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
/** /**
* Convenience constructor to extend RadioButton. * Convenience constructor to extend RadioButton.
* *
* @example use/ControlP5extendController * @example use/ControlP5extendController
* @param theControlP5 * @param theControlP5
* @param theName * @param theName
@@ -189,7 +189,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
} }
/** /**
* *
* @param theDefaultImage * @param theDefaultImage
* @param theOverImage * @param theOverImage
* @param theActiveImage * @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 * 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 * recognize a custom height, the itemHeight has to be set before adding items to a
* radioButton/checkBox. * radioButton/checkBox.
* *
* @param theItemHeight * @param theItemHeight
*/ */
public RadioButton setItemHeight( int 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 * 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 * recognize a custom width, the itemWidth has to be set before adding items to a
* radioButton/checkBox. * radioButton/checkBox.
* *
* @param theItemWidth * @param theItemWidth
*/ */
public RadioButton setItemWidth( int theItemWidth ) { public RadioButton setItemWidth( int theItemWidth ) {
@@ -271,7 +271,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
/** /**
* Gets a radio button item by index. * Gets a radio button item by index.
* *
* @param theIndex * @param theIndex
* @return Toggle * @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. * Gets the state of an item - this can be true (for on) or false (for off) - by index.
* *
* @param theIndex * @param theIndex
* @return boolean * @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. * Gets the state of an item - this can be true (for on) or false (for off) - by name.
* *
* @param theName * @param theName
* @return * @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 * 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. * the limit of items per row. items exceeding the limit will be pushed to the next row.
* *
* @param theValue * @param theValue
*/ */
public RadioButton setItemsPerRow( final int theValue ) { public RadioButton setItemsPerRow( final int theValue ) {
@@ -361,7 +361,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
/** /**
* Sets the spacing in pixels between columns. * Sets the spacing in pixels between columns.
* *
* @param theSpacing * @param theSpacing
*/ */
public RadioButton setSpacingColumn( final int theSpacing ) { public RadioButton setSpacingColumn( final int theSpacing ) {
@@ -372,7 +372,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
/** /**
* Sets the spacing in pixels between rows. * Sets the spacing in pixels between rows.
* *
* @param theSpacing * @param theSpacing
*/ */
public RadioButton setSpacingRow( final int 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 * Deactivates all active RadioButton items and only activates the item corresponding to
* theIndex. * theIndex.
* TODO does not trigger function or value when called by code, fix! * TODO does not trigger function or value when called by code, fix!
* *
* @param theIndex * @param theIndex
*/ */
public RadioButton activate( int 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. * Actives an item of the Radio button by name.
* *
* @param theName * @param theName
*/ */
public RadioButton activate( String 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 * Deactivates a RadioButton by name and sets the value of the RadioButton to the default value
* -1. * -1.
* *
* @param theName * @param theName
*/ */
public RadioButton deactivate( String theName ) { public RadioButton deactivate( String theName ) {
@@ -491,7 +491,7 @@ public class RadioButton extends ControlGroup< RadioButton > {
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
* @exclude * @exclude
*/ */
@ControlP5.Invisible @Override public void controlEvent( ControlEvent theEvent ) { @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 * In order to always have 1 item selected, use setNoneSelectedAllowed(false), by default this
* is true. setNoneSelectedAllowed does not apply when in multipleChoice mode. * is true. setNoneSelectedAllowed does not apply when in multipleChoice mode.
* *
* @param theValue * @param theValue
*/ */
public RadioButton setNoneSelectedAllowed( boolean theValue ) { public RadioButton setNoneSelectedAllowed( boolean theValue ) {