FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE
Ask a question

3863 questions

4405 answers

3259 comments

46806 members

Ask a question
0 votes
181 views
in Vehicle tracking by
Hi,

Im trying to build a small GPS-tracking software.

To parse the data sent through TCP/IP from the device to my server I am using this package: https://github.com/uro/teltonika-fm-parser

I already receive all necessary information and store it to the database successfully.

But unfortunately, the FMB965 sends the same records again and again. So, after I've formatted the tracker, it start's with one record. Next connection two records, etc. etc. Seems like the ACK doesn't get back to the tracker?

The number of data bytes, sent with the payload, is matching the count of records I create from the data. And this, is matching the numberOfData of the collection. So, I don't see any problems here. Even if I use the numberOfData-bytes from the payload directly and return it with pack('N', ...), the tracker ignores it....

Thank you!
by
    $parser = new FmParser('tcp');
    $socket = stream_socket_server("tcp://$ip:$port", $errno, $errstr);
    if (!$socket) {
        throw new \Exception("$errstr ($errno)");
    } else {
        while ($conn = stream_socket_accept($socket)) {

            // Read IMEI
            $payload = fread($conn, 1024);
            $imei = $parser->decodeImei($payload);

            // Accept packet
            fwrite($conn, Reply::accept());

            // Read Data
            $payload="";
            while( !feof( $conn ) ) {
                $payload .= fread( $conn, 1024 ) ;
            }

            $packet = $parser->decodeData($payload);

            fwrite($conn, $parser->encodeAcknowledge($packet));

            foreach ($packet->getAvlDataCollection()->getAvlData() as $avlData) {
                $gps = $avlData->getGpsElement();
                // Create it in DB
                $this->info('Record created');
            }
            fclose($conn);
        }

        fclose($socket);
    }

1 Answer

0 votes
by

Hi,

We can give you the source code of our parser by creating a VIP helpdesk ticket.

Our devices are using codec protocols, you need to understand how codec 8, and codec 8 extended for data sending and codec 12 for sending GPRS commands. 

For more information kindly check this wiki link: Codec - Wiki Knowledge Base | Teltonika GPS (teltonika-gps.com)

For creating a VIP ticket kindly follow this instruction.

Please contact your sales manager. If you don't have any contacts with our Sale managers, please contact with them on our official website https://teltonika-gps.com/ and click on the "Contact Us" button. When you will click, please fill the form and submit it. Note: as a topic, please choose "Vehicle telematics". Or you can send an e-mail with description of your situation to [email protected] When contacting Us, please provide: IMEI/Logs/Configuration file/Intenational GSM number/Firmware version/ect, please follow these recommendations: https://wiki.teltonika-gps.com/view/Recommendations_for_filling_a_query_description

Best Regards,

Maynard

by

Thanks for this thread..

get-vidmateapp.com

mobdro download

by
Hm, but how can the codec help me?

Codec 8 isn't the problem here I think? I can read all the information I need from the data. The GPS-Element, IMEI, etc... I am already parsing the data successfully with this package.

But it seems like the tracker just don't accept my Reply.
by

Hi,

kindly check this ,

This is from the teltonika wiki kindly follow this example in able to received data from the device to your server.

First, when module connects to server, module sends its IMEI. First comes short identifying number of bytes written and then goes IMEI as text (bytes).

For example, IMEI 356307042441013 would be sent as 000F333536333037303432343431303133.
First two bytes denote IMEI length. In this case 0x000F means, that IMEI is 15 bytes long.
After receiving IMEI, server should determine if it would accept data from this module. If yes, server will reply to module 01, if not - 00. Note that confirmation should be sent as binary packet. I.e. 1 byte 0x01 or 0x00.
Then module starts to send first AVL data packet. After server receives packet and parses it, server must report to module number of data received as integer (four bytes).
If sent data number and reported by server doesn’t match module resends sent data. "

by
Yes, thanks. But that's exactly what I am doing. And my first reply, after the IMEi works just fine. And the tracker starts to send the AVL data.

And the count of the elements I get with the AVL data matches exactly the "Number Of Data 1". And I return exactly this count of data with the pack('N', $x) function. $x, is the number of data.

I reduced the code that way, that I, right after I read the AVL data, fetched the "Number Of Data 1" from the data and directly return it with pack('N', ...). So, no any other foreign code from me was included in any calculation or something. But the tracker still sends more and more than and never got "reset". It sends same data with same timestamp again and again.