Skip to content

Commit

Permalink
change a bit of the text view output format
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-mao committed Nov 23, 2019
1 parent 942a2cb commit 42ac73a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
19 changes: 10 additions & 9 deletions app/src/main/java/com/example/a6733/client.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public void onSensorChanged(SensorEvent event) {
Log.d(TAG,reconciliation_function.int_array_to_string(f_L_Alice_z));
Log.d(TAG, reconciliation_function.int_array_to_string(f_key_Alice_z));

client_tv_1.append(DateUtil.getNowTime() + "\nFinish sampling\n");
client_tv_1.append(DateUtil.getNowTime() + " Finish sampling\n");

} else if (sensor_sample_count < 750) {
acc_e[sensor_sample_count] = (double) accel_gl[0];
Expand Down Expand Up @@ -672,6 +672,7 @@ else if(v.getId() == R.id.client_send) {
encryption new_encryption = new encryption(mykey, message);
byte[] byte_message = new_encryption.encrypt();
new Thread(new thread_udp_send(byte_message)).start();

}
}
else if (v.getId() == R.id.client_sample_start){
Expand All @@ -690,7 +691,7 @@ public void run(){
runOnUiThread(new Runnable() {
@Override
public void run() {
client_tv_1.append(DateUtil.getNowTime() + "\nPrepare for sampling on the first heel strike...\n");
client_tv_1.append(DateUtil.getNowTime() + " Prepare for sampling on the first heel strike...\n");
}
});

Expand All @@ -705,7 +706,7 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
client_tv_1.append(DateUtil.getNowTime() + "\nStart Sampling\n");
client_tv_1.append(DateUtil.getNowTime() + " Start Sampling\n");
}
});

Expand Down Expand Up @@ -752,7 +753,7 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
client_tv_1.append(DateUtil.getNowTime() + "\nreceive message\n");
client_tv_1.append(DateUtil.getNowTime() + " receive message\n");
}
});

Expand Down Expand Up @@ -784,7 +785,7 @@ else if (messenge_counter == 2){
runOnUiThread(new Runnable() {
@Override
public void run() {
client_tv_1.append(DateUtil.getNowTime() + "\nPaired success !!\n");
client_tv_1.append(DateUtil.getNowTime() + " Paired success !!\n");
client_connection_status.setText("Pair success !!");
}
});
Expand All @@ -795,7 +796,7 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
client_tv_1.append(DateUtil.getNowTime() + "\nPaired fail !!\n");
client_tv_1.append(DateUtil.getNowTime() + " Paired fail !!\n");
client_connection_status.setText("Pair fail !!");
}
});
Expand Down Expand Up @@ -853,7 +854,7 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
client_tv_1.append(DateUtil.getNowTime() +"\nclient send message\n");
client_tv_1.append(DateUtil.getNowTime() +" client send message\n");
}
});
}
Expand All @@ -880,8 +881,8 @@ public void run(){
runOnUiThread(new Runnable() {
@Override
public void run() {
client_tv_1.append(DateUtil.getNowTime() +"\nPair fail\n");
client_connection_status.setText("Pair fail");
client_tv_1.append(DateUtil.getNowTime() +" Pair fail!!!\n");
client_connection_status.setText("Pair fail !!");
}
});
// stop the listening thread
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/java/com/example/a6733/server.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public void onSensorChanged(SensorEvent event) {
Log.d(TAG,reconciliation_function.int_array_to_string(f_L_Bob_z));
Log.d(TAG, reconciliation_function.int_array_to_string(f_key_Bob_z));

server_tv_1.append(DateUtil.getNowTime() + "\nFinish sampling\n");
server_tv_1.append(DateUtil.getNowTime() + " Finish sampling\n");

} else if (sensor_sample_count < 750) {
acc_e[sensor_sample_count] = (double) accel_gl[0];
Expand Down Expand Up @@ -650,7 +650,7 @@ public void run(){
runOnUiThread(new Runnable() {
@Override
public void run() {
server_tv_1.append(DateUtil.getNowTime() + "\nPrepare for sampling on the first heel strike...\n");
server_tv_1.append(DateUtil.getNowTime() + " Prepare for sampling on the first heel strike...\n");
}
});

Expand All @@ -662,7 +662,7 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
server_tv_1.append(DateUtil.getNowTime() + "\nStart Sampling\n");
server_tv_1.append(DateUtil.getNowTime() + " Start Sampling\n");
}
});

Expand Down Expand Up @@ -708,7 +708,7 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
server_tv_1.append(DateUtil.getNowTime() + "\nreceive message\n");
server_tv_1.append(DateUtil.getNowTime() + " receive message\n");
}
});

Expand Down Expand Up @@ -744,8 +744,8 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
server_tv_1.append(DateUtil.getNowTime() +"\nPair Success !!!\n");
server_connection_status.setText("Pair success");
server_tv_1.append(DateUtil.getNowTime() +" Pair Success !!\n");
server_connection_status.setText("Pair success !!");
}
});

Expand All @@ -757,8 +757,8 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
server_tv_1.append(DateUtil.getNowTime() +"\nPair fail !!!\n");
server_connection_status.setText("Pair fail");
server_tv_1.append(DateUtil.getNowTime() +" Pair fail !!!\n");
server_connection_status.setText("Pair fail !!");
}
});
listening_flag = false;
Expand Down Expand Up @@ -818,7 +818,7 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
server_tv_1.append(DateUtil.getNowTime() +"\nserver send message\n");
server_tv_1.append(DateUtil.getNowTime() +" server send message\n");
}
});
} catch (Exception e) {
Expand All @@ -843,8 +843,8 @@ public void run(){
runOnUiThread(new Runnable() {
@Override
public void run() {
server_tv_1.append(DateUtil.getNowTime() +"\nPair fail \n");
server_connection_status.setText("Pair fail");
server_tv_1.append(DateUtil.getNowTime() +" Pair fail!!\n");
server_connection_status.setText("Pair fail !!");
}
});

Expand Down

0 comments on commit 42ac73a

Please sign in to comment.