3 require_once
'BayEOSGatewayClient.php';
10 die(
"Usage: dumpParserExtractor.php [-o bin|text] [-s YYYY-MM-DD] [-e YYYY-MM-DD] [-k 110] dumpfile\n");
16 for($i=1;$i<count($argv);$i++){
17 if(preg_match(
'/-[tsoekh]/',$argv[$i])){
31 $from=DateTime::createFromFormat(
'Y-m-d H:i:s P',
$options[
'-s'].
' 00:00:00 +01:00');
32 $until=DateTime::createFromFormat(
'Y-m-d H:i:s P',
$options[
'-e'].
' 00:00:00 +01:00');
33 $min_date= DateTime::createFromFormat(
'Y-m-d H:i:s P',
'2000-01-01 00:00:00 +00:00');
34 $ref_date= DateTime::createFromFormat(
'Y-m-d H:i:s P',
'2000-01-01 00:00:00 +00:00');
39 if(! is_readable($file))
40 die(
"File $file not readable\n");
47 for($i=0;$i<strlen(
$options[
'-s']);$i++){
59 $length_bin=fread(
$fp,1);
61 if($length) $bayeosframe=fread(
$fp,$length);
64 if($ts>
$min && $ts<
$max && $bayeosframe){
67 fwrite(STDOUT,
"found frame: ".date(
'Y-m-d h:i:s',$ts+
$ref_date->format(
'U')).
" - ".($ts/3600).
"\n");
70 fwrite(STOUT,$ts_bin.$length_bin.$bayeosframe);
74 fwrite(STDERR,
"done: ".round(
$pos/
$fsize*100,2).
"% - found: $found ".strlen($bayeosframe).
" $last_date\n");
for($i=0;$i< strlen($options['-s']);$i++) $pos
static parseFrame($frame, $ts=FALSE, $origin='', $rssi=FALSE)
static unpackUINT32($value, $endianness=0)
static unpackUINT8($value)