Browse Source

merge Kommunikation Version 1.2 UDP Socket

ko
Miguel Siebenhaar 1 year ago
parent
commit
df9b28c830

+ 2
- 2
app/src/main/java/com/example/ueberwachungssystem/WifiCommunication.java View File

} catch (SocketException | UnknownHostException e) { } catch (SocketException | UnknownHostException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
mainActivity.runOnUiThread(() -> mainActivity.tvMessages.setText("Communication running"));
//mainActivity.runOnUiThread(() -> mainActivity.tvMessages.setText("Communication running"));
} }
private class ReceiveThread extends Thread { private class ReceiveThread extends Thread {
private StringBuffer rxStringBuffer = new StringBuffer(); private StringBuffer rxStringBuffer = new StringBuffer();
rxString = new String(rxPacket.getData()); rxString = new String(rxPacket.getData());
if(!previousRxString.equals(rxString)) { if(!previousRxString.equals(rxString)) {
rxStringBuffer.append(rxString).append("\n"); rxStringBuffer.append(rxString).append("\n");
mainActivity.runOnUiThread(() -> mainActivity.tvMessages.setText(rxStringBuffer));
//mainActivity.runOnUiThread(() -> mainActivity.tvMessages.setText(rxStringBuffer));
previousRxString = rxString; previousRxString = rxString;
} }



Loading…
Cancel
Save