i have a teltonika tcp server that parses data it works ok but i'm not able to send gprs command and i don't know why or what i do wrong. Here is from their website documentation:
First, the Teltonika device opens the GPRS session and sends AVL data to the server (refer device protocols). Once all records are sent and correct sent data array acknowledgment is received by device then GPRS commands in Hex can be sent to the device. The ACK (acknowledge of IMEI from server) is a one-byte constant 0x01. The acknowledgment of each data array send from the device is four bytes integer – a number of received records.
this is the getinfo hex example that should work 1'st example: Sending getinfo SMS command via GPRS Codec12
Server request in hexadecimal stream: 000000000000000F0C010500000007676574696E666F0100004312
here is my nodejs tcp server
const net = require('net');
const Parser = require('teltonika-parser-ex');
const binutils = require('binutils64');
const { parse } = require('path');
let server = net.createServer((c) => {
console.log("client connected");
c.on('end', () => {
console.log("client disconnected");
});
c.on('data', (data) => {
let buffer = data;
console.log(buffer);
let parser = new Parser(buffer);
if (parser.isImei) {
c.write(Buffer.alloc(1, 1)); // send ACK for IMEI
} else {
let avl = parser.getAvl();
console.log("parseRec", avl?.records?.map(({ gps, timestamp }) => {
return { gps, timestamp }
}
)
)
let writer = new binutils.BinaryWriter();
writer.WriteInt32(avl.number_of_data);
let response = writer.ByteBuffer;
c.write(response); // send ACK for AVL DATA
// console.log(test);
c.write("000000000000000F0C010500000007676574696E666F0100004312"); // SEND GETINFO command that is not working
}
});
});
server.listen(1574, '0.0.0.0', () => {
console.log("Server started");
});
the last c.write("000000000000000F0C010500000007676574696E666F0100004312"); should send the getinfo command and i should get an answer but i don't get nothing back.