|
|
@@ -76,21 +76,23 @@ public class DeviceRepository { |
|
|
|
|
|
|
|
public void getNewReceivedMessage(String newMessage) { |
|
|
|
String[] messageString = messageStringSplitter(newMessage); |
|
|
|
String timeStamp = messageString[0]; |
|
|
|
String deviceID = messageString[1]; |
|
|
|
boolean sensorStatus = convertSensorStatus(messageString[2]); |
|
|
|
String sensorType = messageString[3]; |
|
|
|
int sensorMassage = Integer.valueOf(messageString[4]); |
|
|
|
|
|
|
|
if (deviceID.equals(checkDeviceID(localDeviceUUID))) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if(messageString[0]=="1" && messageString.length == 7){ |
|
|
|
String timeStamp = messageString[1]; |
|
|
|
String deviceID = messageString[3]; |
|
|
|
boolean sensorStatus = convertSensorStatus(messageString[4]); |
|
|
|
String sensorType = messageString[5]; |
|
|
|
int sensorMassage = Integer.valueOf(messageString[6]); |
|
|
|
|
|
|
|
if (deviceID.equals(checkDeviceID(localDeviceUUID))) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if(!connectedDevicesList.containsKey(deviceID)) { |
|
|
|
createNewDevice(timeStamp, deviceID, sensorStatus, sensorType, sensorMassage); |
|
|
|
} |
|
|
|
else { |
|
|
|
updateDevice(deviceID, timeStamp, sensorStatus, sensorType, sensorMassage); |
|
|
|
if(!connectedDevicesList.containsKey(deviceID)) { |
|
|
|
createNewDevice(timeStamp, deviceID, sensorStatus, sensorType, sensorMassage); |
|
|
|
} |
|
|
|
else { |
|
|
|
updateDevice(deviceID, timeStamp, sensorStatus, sensorType, sensorMassage); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -98,7 +100,11 @@ public class DeviceRepository { |
|
|
|
StringBuilder message = new StringBuilder(); |
|
|
|
Device device = connectedDevicesList.get(deviceID); |
|
|
|
if(device != null) { |
|
|
|
message.append(device.getTimeStamp()) |
|
|
|
message.append("1") |
|
|
|
.append(delimiter) |
|
|
|
.append(device.getTimeStamp()) |
|
|
|
.append(delimiter) |
|
|
|
.append("Gruppe3") |
|
|
|
.append(delimiter) |
|
|
|
.append(device.getDeviceID()) |
|
|
|
.append(delimiter) |
|
|
@@ -117,6 +123,10 @@ public class DeviceRepository { |
|
|
|
.append(delimiter) |
|
|
|
.append("") |
|
|
|
.append(delimiter) |
|
|
|
.append("") |
|
|
|
.append(delimiter) |
|
|
|
.append("") |
|
|
|
.append(delimiter) |
|
|
|
.append(""); |
|
|
|
} |
|
|
|
return message.toString(); |