|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void getNewReceivedMessage(String newMessage) { |
|
|
public void getNewReceivedMessage(String newMessage) { |
|
|
String[] messageString = messageStringSplitter(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); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder message = new StringBuilder(); |
|
|
StringBuilder message = new StringBuilder(); |
|
|
Device device = connectedDevicesList.get(deviceID); |
|
|
Device device = connectedDevicesList.get(deviceID); |
|
|
if(device != null) { |
|
|
if(device != null) { |
|
|
message.append(device.getTimeStamp()) |
|
|
|
|
|
|
|
|
message.append("1") |
|
|
|
|
|
.append(delimiter) |
|
|
|
|
|
.append(device.getTimeStamp()) |
|
|
|
|
|
.append(delimiter) |
|
|
|
|
|
.append("Gruppe3") |
|
|
.append(delimiter) |
|
|
.append(delimiter) |
|
|
.append(device.getDeviceID()) |
|
|
.append(device.getDeviceID()) |
|
|
.append(delimiter) |
|
|
.append(delimiter) |
|
|
|
|
|
|
|
|
.append(delimiter) |
|
|
.append(delimiter) |
|
|
.append("") |
|
|
.append("") |
|
|
.append(delimiter) |
|
|
.append(delimiter) |
|
|
|
|
|
.append("") |
|
|
|
|
|
.append(delimiter) |
|
|
|
|
|
.append("") |
|
|
|
|
|
.append(delimiter) |
|
|
.append(""); |
|
|
.append(""); |
|
|
} |
|
|
} |
|
|
return message.toString(); |
|
|
return message.toString(); |