我正在尝试通过蓝牙将来自三十部分机器(EEG耳机)的信号检索并将其写入file.csv。现在,我已经成功连接了耳机,但是在录制信号时遇到了一个我不知道的致命信号。
以下是我可能认为是问题所在的代码:
IEE_DataChannel_t[] Channel_list;
String[] Name_Channel = {"AF3","T7","Pz","T8","AF4"};
和检索数据的功能
case 2:
if(bp_writer == null) return;
for(int i=0; i < Channel_list.length; i++)
{
SWIGTYPE_p_double ptheta = edkJava.new_double_p();
SWIGTYPE_p_double palpha = edkJava.new_double_p();
SWIGTYPE_p_double plow_beta = edkJava.new_double_p();
SWIGTYPE_p_double phigh_beta = edkJava.new_double_p();
SWIGTYPE_p_double pgamma = edkJava.new_double_p();
int result = -1;
result = edkJava.IEE_GetAverageBandPowers(userId, Channel_list[i], ptheta, palpha, plow_beta, phigh_beta, pgamma);
if(result == edkJava.EDK_OK){
Log.e("FFT", "GetAverageBandPowers");
try {
bp_writer.write(Name_Channel[i] + ",");
addData(edkJava.double_p_value(ptheta));
addData(edkJava.double_p_value(palpha));
addData(edkJava.double_p_value(plow_beta));
addData(edkJava.double_p_value(phigh_beta));
addData(edkJava.double_p_value(pgamma));
bp_writer.newLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
edkJava.delete_double_p(ptheta);
edkJava.delete_double_p(palpha);
edkJava.delete_double_p(plow_beta);
edkJava.delete_double_p(phigh_beta);
edkJava.delete_double_p(pgamma);
}
break;
}
}
};
具有添加数据和设置文件的功能。csv:
private void setDataFile() {
try {
String eeg_header = "Channel , Theta ,Alpha ,Low beta ,High beta , Gamma ";
File root = Environment.getExternalStorageDirectory();
String file_path = root.getAbsolutePath()+ "/FFTSample/";
File folder=new File(file_path);
if(!folder.exists())
{
folder.mkdirs();
}
bp_writer = new BufferedWriter(new FileWriter(file_path+"bandpowerValue.csv"));
bp_writer.write(eeg_header);
bp_writer.newLine();
} catch (Exception e) {
Log.e("","Exception"+ e.getMessage());
}
}
public void addData(double data) {
if (bp_writer == null) {
return;
}
String input = "";
input += (String.valueOf(data) + ",");
try {
bp_writer.write(input);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
它成功添加了用户,但是开始录制时我遇到了
A/libc: Invalid address 0xda9739b8 passed to free: value not allocated
A/libc: Invalid address 0xda973068 passed to free: value not allocated
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 3969 (motiv.fftsample)
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 3938 (motiv.fftsample)
I/libc: Another thread contacted debuggerd first; not contacting debuggerd.
所以,我如何跟踪错误,我只是构建应用程序的初学者。谢谢