forked from kevin.shehu/GGD
34 lines
1.6 KiB
Plaintext
34 lines
1.6 KiB
Plaintext
|
import java.util.List;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
import java.util.Iterator;
|
||
|
import eu.hsrw.ias.ggd.ScheduledTask;
|
||
|
import javax.swing.JOptionPane
|
||
|
import HttpCall.HttpPost;
|
||
|
import eu.hsrw.ias.ggd.SensorData
|
||
|
|
||
|
rule "DielectricPermittivity"
|
||
|
when
|
||
|
$tMap: HashMap( containsKey("dielectricPermittivity") == true )
|
||
|
//In this part we are iterating through the entire map
|
||
|
e: Map.Entry(k:key, v:value) from $tMap.entrySet()
|
||
|
// for(e <- $tMap) {
|
||
|
SensorData(level: value ) from v
|
||
|
SensorData(tag: sensorTag) from v
|
||
|
SensorData(id: deviceId) from v
|
||
|
then
|
||
|
String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||
|
HttpPost httpPost = new HttpPost();
|
||
|
if (level > 14.5 && k.equals("dielectricPermittivity") ) {
|
||
|
JOptionPane.showMessageDialog(null,"High dielectricPermittivity : "+level+" in the following sensor"+tag,"dielectricPermittivity",JOptionPane.INFORMATION_MESSAGE);
|
||
|
final String data = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High dielectricPermittivity %s\", \"dielectricPermittivity\": %s}]}}", fixedIdG1, level,level);
|
||
|
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",data);
|
||
|
System.out.println("High dielectricPermittivity"+level +" in the following sensor:"+tag);
|
||
|
|
||
|
}
|
||
|
System.out.println(k);
|
||
|
System.out.println(level);
|
||
|
System.out.println(tag);
|
||
|
System.out.println(id);
|
||
|
end
|