This commit is contained in:
curtis
2024-12-03 13:41:51 +08:00
parent f4e520d795
commit 02c2b7d8ea
10 changed files with 204 additions and 154 deletions

View File

@@ -6,7 +6,7 @@ Item {
property int hitIndex: -1
property bool bStimulate: false
property int responseTime: 10
property bool bTest: true
property bool bTest: false
property bool bConnect: false;
property var brainTrainForm: null
property string red: "#EE6352"
@@ -78,7 +78,7 @@ Item {
"qrc:/DependFile/Source/brainTrain/upTest3/upper_stretch_R14.png",
"qrc:/DependFile/Source/brainTrain/upTest3/upper_stretch_R15.png",
"qrc:/DependFile/Source/brainTrain/upTest3/upper_stretch_R16.png",
]
];
function startStimulate()
@@ -89,11 +89,8 @@ Item {
if(!bConnect)
{
clientSocket.connectToHost();
bConnect = true;
}else
{
clientSocket.writeBytes(getIntArr("1"));
}
clientSocket.writeBytes(getIntArr("1"));
}
@@ -149,6 +146,15 @@ Item {
}
}
Timer {
id: connectTimer
interval: 3*1000;
onTriggered: {
clientSocket.connected();
}
}
function ssvepHit(index)
{
if(!bStimulate)
@@ -211,8 +217,10 @@ Item {
Component.onCompleted:
{
bci.initTrain();
clientSocket.connectToHost();
}
TcpSocket{
id: clientSocket
peer: "127.0.0.1"
@@ -232,12 +240,18 @@ Item {
onConnected:
{
console.info("Client socket connected");
writeBytes(getIntArr("1"));
bConnect = true;
bci.deviceStatus(true);
if(connectTimer.running)
{
connectTimer.stop();
}
}
onDisconnected:
{
console.info("Client socket disconnected");
bConnect = false;
bci.deviceStatus(false);
}
onPeerChanged:
{
@@ -248,8 +262,12 @@ Item {
console.info("Client socket port changed: " + port);
}
onError:
{
console.info("Client socket disconnected")
{
console.info("Client socket error",socketError);
if(socketError === 0 || socketError === 1)
{
connectTimer.start();
}
}
}
BCIManager
@@ -881,10 +899,8 @@ Item {
anchors.fill: parent
onClicked: {
popimpedance.show()
popimpedance.colorChange(5,green)
popimpedance.colorChange(2,green)
popimpedance.colorChange(3,green)
}
}
@@ -892,12 +908,5 @@ Item {
PopImpedance{
id:popimpedance
}
}