FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

4167 questions

4739 answers

3460 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
214 views
in Vehicle tracking by anonymous

Hi, 

I'm creating a script to parse data from several teltonika devices and while saving data to Firebase I have noticed that there is a conflict between data could anyone help solve this conflict?

let server = net.createServer((c) => {

  console.log("client connected");

  c.on('end', () => {

    console.log("client disconnected");

  });

  c.on('data', (data) => {

    Lengthimei = data.length;

    if (Lengthimei <= 17) {

      this.imeidata = data;

    };

    imei = this.imeidata.toString();

    imei = imei.slice(2, 17);

    con1.query('SELECT * FROM `boitier_imei` WHERE `code_imei`=?', [imei], (err, result, fields) => {

      if (err) {

        console.log(err+"imei error");

      }

      if (result.length > 0) {

        console.log("imei exist");

        let buffer = data;

        let parser = new Parser(buffer);

        if (parser.isImei) {

          c.write(Buffer.alloc(1, 1));

        }

        else {

          let avl = parser.getAvl();

          console.log("timestamp : "+avl['records'][0].timestamp);

          console.log("longitude : "+avl['records'][0].gps.longitude);

          console.log("latitude : "+avl['records'][0].gps.latitude);

          console.log("altitude : "+avl['records'][0].gps.altitude);

          console.log("angle : "+avl['records'][0].gps.angle);

          console.log("satellites : "+avl['records'][0].gps.satellites);

          console.log("speed : "+avl['records'][0].gps.speed);

          for (i = 0; i < avl['records'][0].ioElements.length; i++) {

            console.log("ID : "+avl['records'][0].ioElements[i].id);

            console.log(""+avl['records'][0].ioElements[i].label);

            console.log(""+avl['records'][0].ioElements[i].value);

            console.log("\n");

          }

         let writer = new binutils.BinaryWriter();

          writer.WriteInt32(avl.number_of_data);

          let response = writer.ByteBuffer;

          c.write(response);

          c.write(Buffer.alloc(1, 0));

        }

      }

      else {

        console.log("not exist");

      }

    });

  });

});

server.listen(3000, '', () => {

  console.log("Server started");

});

1 Answer

0 votes
by anonymous

Hi Ghada,

Please create a VIP helpdesk ticket regarding this issue.

Please contact your sales manager. If you don't have any contact with our Sales 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 out the form and submit it. Note: as a topic, please choose "Vehicle telematics". Or you can send an e-mail with a description of your situation to info@teltonika.lt 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 C.