|
@@ -193,16 +193,21 @@ public abstract class BasicPacketClassifierWitLabels implements PacketSniffer {
|
|
|
if(packet instanceof MQTTpublishPacket) {
|
|
|
MQTTpublishPacket mqttPack = (MQTTpublishPacket)packet;
|
|
|
if(mqttPack.isBoolean()) {
|
|
|
+ //System.out.println("MQTT PACK: " + mqttPack.getValue() + "," +mqttPack.getSensorValue());
|
|
|
if(mqttPack.getValue() == 0) {
|
|
|
instance.setValue(6,0);
|
|
|
+ //System.out.println("False");
|
|
|
}
|
|
|
else {
|
|
|
instance.setValue(6, 1);
|
|
|
+ //System.out.println("True");
|
|
|
}
|
|
|
if(mqttPack.getSensorValue() == 0) {
|
|
|
instance.setValue(7,0);
|
|
|
+ //System.out.println("False");
|
|
|
} else {
|
|
|
- instance.setValue(7, 1);
|
|
|
+ instance.setValue(7, 1);
|
|
|
+ //System.out.println("True");
|
|
|
}
|
|
|
}else {
|
|
|
instance.setValue(6, ((MQTTpublishPacket)packet).getValue());
|
|
@@ -385,13 +390,17 @@ public abstract class BasicPacketClassifierWitLabels implements PacketSniffer {
|
|
|
MQTTpublishPacket mqttPac = (MQTTpublishPacket)packet;
|
|
|
sensorLabel = ""+mqttPac.getSensorValue();
|
|
|
if(mqttPac.isBoolean()) {
|
|
|
- sensorLabel = "" + Boolean.parseBoolean(sensorLabel);
|
|
|
+ if(mqttPac.getSensorValue() == 0)
|
|
|
+ sensorLabel = "false";
|
|
|
+ else
|
|
|
+ sensorLabel = "true";
|
|
|
}
|
|
|
sensorLabel = ","+sensorLabel;
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- double dist = classifyInstance(packet_instance, packet);
|
|
|
+ double dist = classifyInstance(packet_instance, packet);
|
|
|
+ //System.out.println(packet.getTextualRepresentation()+": "+packet.getLabel() +":"+sensorLabel);
|
|
|
if(dist<=Settings.DECISION_THRESHOLD) {
|
|
|
if(packet.getLabel()==0) {
|
|
|
tn++;
|
|
@@ -412,6 +421,7 @@ public abstract class BasicPacketClassifierWitLabels implements PacketSniffer {
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
+ System.out.println(e);
|
|
|
if(packet.getLabel()==0) {
|
|
|
fp++;
|
|
|
try {
|