Git Product home page Git Product logo

Comments (24)

fvdm avatar fvdm commented on May 30, 2024

That indeed doesn't look right. Is the encoding of your script file and terminal UTF-8?

from nodejs-tk102.

jamrockmedz avatar jamrockmedz commented on May 30, 2024

I'm using Putty, Remote character set currently on

UTF-8
I tried:

socket.on('data', function (data) {
console.log ('Incoming data: ');
console.log(data.toString('UTF-8'));
});

result:

capture

from nodejs-tk102.

fvdm avatar fvdm commented on May 30, 2024

I created a separate branch to work this out. Please install with:

npm install fvdm/nodejs-tk102#charset

And add these debug lines to your code:

tk102.on ('fail', console.log);
tk102.on ('error', console.log);

from nodejs-tk102.

jamrockmedz avatar jamrockmedz commented on May 30, 2024

Results after trying new branch:

UH� t"ngq�ata: xx

UH� t"ngq�ata: xx

Incoming data: xx %��HX_[<�R�w ��

{ [Error: Cannot parse GPS data from device]
reason: 'Cannot parse GPS data from device',
socket:
{ _connecting: false,
_handle: null,
_readableState:
{ highWaterMark: 16384,
buffer: [],
length: 0,
pipes: null,
pipesCount: 0,
flowing: false,
ended: true,
endEmitted: true,
reading: false,
calledRead: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
objectMode: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ finish: [Function: onSocketFinish],
_socketEnd: [Object],
data: [Function],
readable: [Function],
close: [Function],
error: [Function] },
_maxListeners: 10,
_writableState:
{ highWaterMark: 16384,
objectMode: false,
needDrain: false,
ending: true,
ended: true,
finished: true,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
sync: true,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
buffer: [] },
writable: false,
allowHalfOpen: false,
onend: null,
destroyed: true,
errorEmitted: false,
bytesRead: 72,
_bytesDispatched: 0,
_pendingData: null,
_pendingEncoding: '',
server:
{ domain: null,
_events: [Object],
_maxListeners: 10,
_connections: 0,
connections: [Getter/Setter],
_handle: [Object],
_usingSlaves: false,
_slaves: [],
allowHalfOpen: false,
maxConnections: 10,
_connectionKey: '4:0.0.0.0:5001' },
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 1441283208806,
pipe: [Function],
addListener: [Function],
on: [Function],
pause: [Function],
resume: [Function],
read: [Function],
consuming: true,
write: [Function: writeAfterFIN] },
input: 'xx\r\u0001\u0003UH� \u0014t"\u0000\tq�\r\nxx\r\u0001\u0003UH� \u0014t"\u0000\tq�\r\nxx\u001f\u0012\u000f\t\u0003\u0007\u001a%�\u0001�H�\bX
[\u0000<�\u0001R\u0005\u0013�\u0000w\u0011\u0000\t��\r\n' }

from nodejs-tk102.

jamrockmedz avatar jamrockmedz commented on May 30, 2024

I also tried to use python to determine encoding,
function returns binary as encoding:

def handle(self):
# self.request is the TCP socket connected to the client
self.data = self.request.recv(1024 * 6)
print "{} wrote:".format(self.client_address[0])
print self.data

    m = magic.open(magic.MAGIC_MIME_ENCODING)
    m.load()
    encoding = m.buffer(self.data) 
    print "encoding: " + encoding

Results when binary is used to decode data:

Incoming data:

<Buffer 78 78 0d 01 03 55 48 80 20 14 74 22 00 0b 52 9f 0d 0a>

decoded data:

UH� t"
R�

Incoming data:

<Buffer 78 78 0d 01 03 55 48 80 20 14 74 22 00 0b 52 9f 0d 0a>

decoded data:

UH� t"
R�

{ [Error: Cannot parse GPS data from device]
reason: 'Cannot parse GPS data from device',
socket:
{ _connecting: false,
_handle: null,
_readableState:
{ highWaterMark: 16384,
buffer: [],
length: 0,
pipes: null,
pipesCount: 0,
flowing: false,
ended: true,
endEmitted: true,
reading: false,
calledRead: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
objectMode: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ finish: [Function: onSocketFinish],
_socketEnd: [Object],
data: [Function],
readable: [Function],
close: [Function],
error: [Function] },
_maxListeners: 10,
_writableState:
{ highWaterMark: 16384,
objectMode: false,
needDrain: false,
ending: true,
ended: true,
finished: true,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
sync: true,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
buffer: [] },
writable: false,
allowHalfOpen: false,
onend: null,
destroyed: true,
errorEmitted: false,
bytesRead: 36,
_bytesDispatched: 0,
_pendingData: null,
_pendingEncoding: '',
server:
{ domain: null,
_events: [Object],
_maxListeners: 10,
_connections: 0,
connections: [Getter/Setter],
_handle: [Object],
_usingSlaves: false,
_slaves: [],
allowHalfOpen: false,
maxConnections: 10,
_connectionKey: '4:0.0.0.0:5001' },
_idleTimeout: -1,
_idleNext: null,
_idlePrev: null,
_idleStart: 1441285231325,
pipe: [Function],
addListener: [Function],
on: [Function],
pause: [Function],
resume: [Function],
read: [Function],
_consuming: true,
write: [Function: writeAfterFIN] },
input: 'xx\r\u0001\u0003UH� \u0014t"\u0000\u000bR�\r\nxx\r\u0001\u0003UH� \u0014t"\u0000\u000bR�\r\n' }

from nodejs-tk102.

fvdm avatar fvdm commented on May 30, 2024

What brand and model is your tracker?

from nodejs-tk102.

jamrockmedz avatar jamrockmedz commented on May 30, 2024

This is the device being used: http://www.ebay.com/itm/331580016533?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

from nodejs-tk102.

fvdm avatar fvdm commented on May 30, 2024

I updated the code to use binary input, please retry with npm install fvdm/nodejs-tk102#charset

from nodejs-tk102.

jamrockmedz avatar jamrockmedz commented on May 30, 2024

Incoming data:

7© t"

decoded data:

7© t"

Incoming data:

7© t"

decoded data:

7© t"

Trace: { [Error: uncaught exception]
error:
7© t"ypeError: Object xx
has no method 'copy'] }
at process.tk102.createServer.tk102.settings.(anonymous function) (/var/www/smart/smart/gps_module/test2/node_modules/tk102/tk102.js:79:11)
at process.EventEmitter.emit (events.js:95:17)
at process._fatalException (node.js:272:26)

Incoming data:

UH� t"»

decoded data:

UH� t"»

Incoming data:

UH� t"»

decoded data:

UH� t"»

Trace: { [Error: uncaught exception]
error:
UH� t"»peError: Object xx
has no method 'copy'] }
at process.tk102.createServer.tk102.settings.(anonymous function) (/var/www/smart/smart/gps_module/test2/node_modules/tk102/tk102.js:79:11)
at process.EventEmitter.emit (events.js:95:17)
at process._fatalException (node.js:272:26)

Incoming data:

UH� t"üÍ

decoded data:

UH� t"üÍ

from nodejs-tk102.

fvdm avatar fvdm commented on May 30, 2024

Hm I can't help you at this moment. To further investigate the data I need my laptop, but I only have my phone with me.

Is this a high priority issue for you or can it wait a couple of weeks?

from nodejs-tk102.

jamrockmedz avatar jamrockmedz commented on May 30, 2024

Okay, thank you for the assistance. Kinda high, but will try some more troubleshooting and get another model if necessary.

from nodejs-tk102.

fvdm avatar fvdm commented on May 30, 2024

OK. I added input conversion. Set with:

tk102.settings.encoding = 'ENC';

Where ENC is one of: binary, utf16, etc.
Does this give you any better results?

In your earlier data I see \r\n and \t, I hope that doesn't mean linebreaks and tabs. The device can be one of the many fakes with weird firmware.

from nodejs-tk102.

fvdm avatar fvdm commented on May 30, 2024

Hi @jamrockmedz, could you please retry with npm install fvdm/nodejs-tk102#develop?
I changed the way incoming data is handled.

from nodejs-tk102.

jamrockmedz avatar jamrockmedz commented on May 30, 2024

I believe the issue was with the firmware, i don't currently have those devices nearby. I however got two other tk102 device from a different manufacturer which do send readable characters to the server. The only issue with these new devices is that the data format is different from the common ones I have seen.

For example:
(027043348515BR00150928A1801.5454N07650.7534W000.32321030.000000000000L00000000)

I can see the date, imei, and coordinates but i am not quite sure which sections are the velocity and bearing.

from nodejs-tk102.

fvdm avatar fvdm commented on May 30, 2024

I now have a similar device with the same data format and it's pushing more weird data, I'm working on it.

from nodejs-tk102.

tedbear avatar tedbear commented on May 30, 2024

Hi fvdm,
I have the exact same problem as jamrockmedz and with the same device as you know apparently own. Have you gotten any further in regards to decode the data?

from nodejs-tk102.

fvdm avatar fvdm commented on May 30, 2024

Hi @tedbear, I managed to get 4 different strings from the device, one including the actual GPS position. Another is some sort of keepalive message. I think it may be possible to send commands from the server to the device to program it and switch features on and off remotely without SMS contact.

from nodejs-tk102.

natehudson avatar natehudson commented on May 30, 2024

Sorry to thread hijack as I have not personally seen the binary/encoding problem but I do have a clone/fake TK102 device with the same (027043348515BR00150928A1801.5454N07650.7534W000.32321030.000000000000L00000000) format.

After finding that this new? protocol was not support with any of the TK102 websites/code (that I could find) I have been working on decoding the basics of it.

The closet protocol docs was in a pdf I found titled "TK103 ALTERNATE protocol vs 2.1.pdf" on this random protocol cache https://docs.google.com/a/docs.gogle.com/folderview?id=0B9QofkYKWsMuZnIwZ1BqeXhzQlE#list

The translation is terrible but I have seen two similar commands from my device and broken out the basic gps coords:

  1. short_imei+BP00+long_imei+HS0 = They call: Uplink -> "Handshake signal Message"
    (in which the server should respond "AP01" to the client)
  2. short_imei+BR00+date+gpsLock?+LAT+LONG+whoKnows-heading-Alt-stuff? = They call it "Isochronous and continues feedback message"

Notes:

  • These are the only 2 commands I have seen my device send.
  • I have noticed that if my server stops sending the "AP01", the GPRS data will stop coming in.

Has anyone documented the full protocol / capabilities of these clones?

from nodejs-tk102.

lorenzosfarra avatar lorenzosfarra commented on May 30, 2024

Hi everyone,

I have not other information to share, just adding myself to the conversation, asking if you had time to work on it. I am trying to contact the seller, too, but I have doubts that he knows something about it...anyway, I will update the issue asap if I am able to obtain any news.

Thanks,
Lorenzo

from nodejs-tk102.

fvdm avatar fvdm commented on May 30, 2024

Hey everyone,

Thanks for joining!

I'm fieldtesting the TK102B while at the same time collecting gps and network data from my phone. By comparing the results I can figure out (kind of) the format of the data messages. I'll share my findings here too, soon.

from nodejs-tk102.

mirkods avatar mirkods commented on May 30, 2024

I have the same problem with the encoding, how can I fix it?

This is my output

{ [Error: Cannot parse GPS data from device]
  reason: 'Cannot parse GPS data from device',
  input: 'xx\r\u0001\u0003UH� \u0011�h\u0000=�5',
  connection: 
   { address: '0.0.0.0',
     family: 'IPv4',
     port: 8000,
     remoteAddress: '5.86.224.14',
     remotePort: 65068 } }

from nodejs-tk102.

mirkods avatar mirkods commented on May 30, 2024

@fvdm any update about it?

from nodejs-tk102.

fvdm avatar fvdm commented on May 30, 2024

Hi @mirkods, sorry no update yet.
My tracker died again, the quality of these devices is really really terrible.

from nodejs-tk102.

fvdm avatar fvdm commented on May 30, 2024

This project is no longer maintained. If anyone wishes to over please tell me in issue #36.

from nodejs-tk102.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.