php - Teltonika FM1100 GSM device Avl Data Ack -
1) gps fm1100 module sends following data
imei
123456788927333
2) send 01 binary gps module ( imei no.accepted, tell module send raw data)
3) gps send below raw data
raw data
00000000000000ff08060000014e0fcd6c30011eb91b3a0f0db2f400120019090000010402010002000118000001c700000013000000014e102471e2011eb91b3a0f0db2f4001500190b0000010402010102000118000001c700000000000000014e10396d22011eb804c50f11f254fffd0000080000010402010002000118000001c700000000000000014e10e4c5c8011eb804c50f11f25400000000000000010402010102000118000001c700000000000000014e10f90df8011eb340ff0f045796000d0000090000010402010002000118000001c70000001a000000014e14605ba4011eb340ff0f045796001c0000090000010402010102000118000001c700000000000600001880
below parsed data, after parsing sending no. of data received ex: 6 acknowledgement gps module array ( [timestamp] => 2015-06-10 04:38:48 [priority] => 1 [lng] => 51.5064245 [lat] => 25.1942671 [altitude] => 42 [angle] => 100 [statilite] => 10 [speed] => 0 [is_io_generated] => 1 [io_data] => array ( [no io rec] => 04 [data] => array ( [0] => array ( [no rec 1 byte] => 2 [data] => array ( [0] => array ( [key] => 1 [val] => 1 )
[1] => array ( [key] => 2 [val] => 0 ) ) ) [1] => array ( [no rec 2 byte] => 1 [data] => array ( [0] => array ( [key] => 24 [val] => 0 ) ) ) [2] => array ( [no rec 4 byte] => 1 [data] => array ( [0] => array ( [key] => 199 [val] => 0 ) ) ) [3] => array ( [no rec 8 byte] => 0 [data] => array ( ) ) ) )
)
4) able parse data , send acknowledgement gps module
5) gps module keeps sending old data repeatedly in spite of send correct acknowledgement data.
we not sure whether sending acknowledgement data in correct format mentioned in gps module manual.
please on regard.
?>
if(strlen($rdata) == 15){ $this->imei = $rdata; // imei number gps module $codata = pack("h*", "01"); // accept connection , tell gps module send data $this->server->send('current client socket', $codata); //send gps module }else{ $bh = bin2hex($rdata); // gps module rawdata bin hex $sql = $this->sqlparsingfm($bh); // parsing data $sdata = $data["norecord"]; // parsed data gps module. no of record received $hex = str_pad($sdata, 8, "0", str_pad_left); // $hex = "0x06"; // $hex = pack("h*", "0x06"); $this->server->send($e->parameters->idclient, $hex); }
below gps module documentation link
page no 7. communication server section. sending response module
first, don't use pack
when it's not necessary. so, replace:
$codata = pack("h*", "01"); // accept connection , tell gps module send data $this->server->send('current client socket', $codata); //send gps module
with
$this->server->send('current client socket', "\x01");
next, send correct packet confirmation, change
$this->server->send($e->parameters->idclient, $hex);
to
$this->server->send($e->parameters->idclient, pack('n', $sdata));
and should fix everything.
Comments
Post a Comment