Commit 8d3e1fea authored by Andrey Filippov's avatar Andrey Filippov

added geomag, phone log

parent 1b048f05
This diff is collapsed.
This diff is collapsed.
<?php
$phone_ip= "http://192.168.7.222";
$phone_port= "8123";
$phone_url = $phone_ip.":".$phone_port;
$log_file = fopen("/home/eyesis/git/motosat/attic/logs/phone07.log","w");
$ts_l = 14;
$acc_l = 35;
$mag_l = 35;
$long_l = 12;
$lat_l = 12;
$salign = 128; // used 108
//$ll = $ts_l + $acc_l + $mag_l + $long_l + $lat_l;
$fs = "%".$ts_l."s,%".$acc_l."s,%".$mag_l."s,%".$lat_l."s,%".$long_l."s";
libxml_use_internal_errors(true); // supress XML errors
while (true){
$xml = simplexml_load_file($phone_url);
//PHP Warning: simplexml_load_file(http://192.168.7.222:8123): failed to open stream: Connection refused in /home/eyesis/git/motosat/log_phone_sensors.php on line 18
//PHP Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://192.168.7.222:8123" in /home/eyesis/git/motosat/log_phone_sensors.php on line 18
if ($xml) {
$ts = $xml->timestmap;
$acc = $xml->accelerometer;
$mag = $xml->magnetometer;
$long = $xml->longitude;
$lat = $xml->latitude;
$line = sprintf($fs, $ts, $acc, $mag, $long, $lat);
$line .= sprintf("%" . ($salign - strlen($line) - 1) . "s", " ") . "\n";
fwrite($log_file, $line);
}
}
function getDishAngles($xml_state){
$DishAngles = explode(",",$xml_state->DishAngle);
foreach ($DishAngles as $key => $value){
$DishAngles[$key] = floatval($value);
}
return $DishAngles;
}
/*
$xml=simplexml_load_string("<sensors><timestmap>1570632414615</timestmap><accelerometer>0.095215, -0.811707, 9.966614</accelerometer><magnetometer>-15.299988, 4.798889, 46.078491</magnetometer><azimuth>61.597424</azimuth><pitch>4.655828</pitch><roll>-0.547352</roll><longitude>-111.932889</longitude><latitude>40.723488</latitude><date>Wed Oct 09 14:46:54 MDT 2019</date></sensors>");
*/
//1570632414615 // 13
//-111.932889 // 11
//0.095215, -0.811707, 9.966614 // 29
// -15.299988, 4.798889, 46.078491 // 31
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment