Google
  Web www.gpspassion.com
fiogf49gjkf0d


GpsPasSion Partners



Versions

Links/Liens




Portal/Portail
Rechercher

- -

Polls/Sondages
Sondage
Pour vous guider sur la Route :
GPS Mobile (SEM)
GPS Intégré
Smartphone
Autre
Voter  -  Résultat des votes
Votes : 2813




Club GpsPasSion
Soutenez le site!

USA: (US$)
EUROPE: (€)
Guide Paypal


GpsPasSion Forums
Home | Profile | Register/Enregist. | Active Topics | Search/Recherche | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Advanced Topics
 Live GPS Tracking Systems
 TK2WWW - Simple gateway tracker to Web site
 New Topic  Reply/Répondre
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 5

barbudor

France
1844 Posts

Posted - 05 mai 2012 :  15:45:27  Show Profile  Visit barbudor's Homepage  Reply with Quote
TK2WWW - Simple Gateway between a TK-1xx tracker and a Web server


here below, I have posted a basic source code which allow a PC to forward messages from a TK tracker to a web server.

You will need a machine running 24/7 to run teh gateway. If you are on your own network, you will also need to configure your ADSL box or router so that the selected TCP port (1599 by default) is forwarded from Internet to the machin running the gateway.
The gateway receive the messages from the trackers and forward them straight away without any processing to a script on a web server. All the analysis and processing must be done on the Webs script itself.
My sample is a PHP script which just write the message into a text file. You can use cgi-bin, python or what script language you may prefer to handle the message, parse it and maybe write the result in a SQL database.

The Linux version can probably run on some hackable Linux based NAS box or why not the RaspberryPi if you manage to get one .

Tracker --(internet)-->[DSL Router]-->PC(tk2www)--(internet)-->WebServer(test.php)-->data.txt


Linux Version

The Linux version has been designed and tested with TinyCore v3.4 distro using QtCreator IDE, although it is not using any Qt librares. It is a pure console app which can even be runned as a daemon.
You will have to customize the tcpendpoint.cpp module to change the URL used to post the message to the web server. The sample URL is "http://monserveur.com/test/test.php?msg=".

This app requires libcurl v7.21 or above.

There are Makefile but I never tried to compile this outside of QtCreator.
I'm not a Linux guru so don't ask me how to build with such or such distribution or with an environement different than QtCreator.

v1.1 2012-06-29 Added curl_escape() in HttpForward to handle tracker's message which include space or other characters barbudor_tk2www-linux-1_1.zip
. . . . . . . . Thanks to nfplato for pointing this about his tk102-2.
v1.0 2012-05-05 Initial release barbudor_tk2www-linux-1_0.zip


Windows Version

C# version is planned for shortly.

Modérateur Forum Traceurs GPS et Suivi GPS Temps Réel, son Index (français) et Les bons plan SIM pour traceurs GPS
Moderator Forum Live GPS Tracking Systems and its Index (english)
Using: CompeGPS Land 7 | LocusPro | Carminat TomTom Live | Tracker Coban GPS-102 | MoBAC
Used: Look N500 | iPaq314 | CartoExp.3D | OziExp.PC | OziExp.CE | TomTomGoLive950

Edited by - barbudor on 29 juin 2012 12:59:51

Ads


xinkai

16 Posts

Posted - 19 mai 2012 :  11:26:48  Show Profile  Reply with Quote
hi Barbudor, I see your post in GPS PasSion and lot's of your posts are very helpful to new guys like me.
I also see you wrote this proxy to forward the data to web-site. you are really a good man. But I'm a little bit confused: what is the original protocols these TK201 are using? Not Http Get or post? or they simply use tcp to connect and then send over a string and disconnect? Can you share a little more details or point me to some good docs? BTW, I'm a pretty good C# programmer, maybe I can help you on the C# version of the project.
Go to Top of Page

barbudor

France
1844 Posts

Posted - 19 mai 2012 :  11:31:26  Show Profile  Visit barbudor's Homepage  Reply with Quote
Hi Winkai,

Yes they are just opening a simple TCP connection and sending over a string to the server. This is why they can't talk directly to a Web server.
Normaly the connection remains persistant and it is not closed after each string.
Coban and Xexun are using similar but still different syntax. Other brands are using a very very different syntax which may not be documented.
This is why I would advise to stick with these 2 brands.
The sample code above is independant of the tracker brand. It just takes the message string received from the tracker and push it to the web server as a GET or POST (I've tested only GET but libcurl can also do POST).

Modérateur Forum Traceurs GPS et Suivi GPS Temps Réel, son Index (français) et Les bons plan SIM pour traceurs GPS
Moderator Forum Live GPS Tracking Systems and its Index (english)
Using: CompeGPS Land 7 | LocusPro | Carminat TomTom Live | Tracker Coban GPS-102 | MoBAC
Used: Look N500 | iPaq314 | CartoExp.3D | OziExp.PC | OziExp.CE | TomTomGoLive950
Go to Top of Page

xinkai

16 Posts

Posted - 19 mai 2012 :  20:30:31  Show Profile  Reply with Quote
That's sounds not a big deal. It probably going to take me no more than 1 or 2 days to implement something like that. But what is story on the web-server side? Is there a good free software already available? Or you also have plan to implement it? Another problem is I currently don't have a TK201 to play with. I live in Seattle. What is the best way to order one? I don't want to take the risk to get a clone unit.
Go to Top of Page

barbudor

France
1844 Posts

Posted - 19 mai 2012 :  20:50:50  Show Profile  Visit barbudor's Homepage  Reply with Quote
I have no plans to implement a server.
I did that to help people who wanted to implement their own server, who have PHP, Python, Perls or whatever Web development skills but no ability to run a TCP server on a shared Web server.
For tracker, I am leaving in France and ordered my tracker from Chinavasion. It rturned out to be a Coban but I ordered it without being aware of all this clone story. So I'm lucky.
Look inside the TK102 topic you could find some email of people from Xexun who will help you in purchasing directly from them.

Modérateur Forum Traceurs GPS et Suivi GPS Temps Réel, son Index (français) et Les bons plan SIM pour traceurs GPS
Moderator Forum Live GPS Tracking Systems and its Index (english)
Using: CompeGPS Land 7 | LocusPro | Carminat TomTom Live | Tracker Coban GPS-102 | MoBAC
Used: Look N500 | iPaq314 | CartoExp.3D | OziExp.PC | OziExp.CE | TomTomGoLive950
Go to Top of Page

robertrevolver

Mexico
11 Posts

Posted - 20 juin 2012 :  03:57:45  Show Profile  Reply with Quote
Very good info, that is exactly what iam looking for, thanks a lot.

Developer, gps , nmea, Linux, .NET
Go to Top of Page

xinkai

16 Posts

Posted - 21 juin 2012 :  10:07:20  Show Profile  Reply with Quote
hi barbudor, I have a question.
I have tried both xexun TK102-2 and Coban GPS102-B. I tried GPRS reporting on both of them.
This is what I get from xexun

120621060759,+14254588776,GPRMC,060759.256,A,4734.4360,N,12209.1908,W,0.00,0.00,210612,,,A*7B,F,,imei:012896001639340,04,104.6,F:4.10V,1,138,46523,310,26,A159,253B

This data make perfect sense to me, they are just what I'm expecting. Good.
But whey I try Coban, the data looks something like this:

##,imei:359710040255557,A;

and then few seconds later, it open another new TCP connection and send me another
##,imei:359710040255557,A;

soon I end up with 5 different TCP connections from 1 single coban GPS102-B! And non of them have any useful data in it.
Do you know what should I do to it? Looks like it is expecting me to send some command to it to fetch data?

I know there might already an answer in the TK102 thread, but I don't know how to do search there.

Thanks in advance barbudor!

xinkai

Edited by - xinkai on 21 juin 2012 10:12:49
Go to Top of Page

barbudor

France
1844 Posts

Posted - 21 juin 2012 :  22:26:17  Show Profile  Visit barbudor's Homepage  Reply with Quote
That is strange. My GPS102 does not bahve like this.
Normally my code identify a Coban and is supposed to answer properly.
For a GPS102, to the above message, I should answer "LOAD"
This is what the code does in tcpendpoint.cpp :

    else if ( (nbytes >= 24) && (0 == strncmp( (char*)buffer, "##,imei:", 8 )) && isdigit(buffer[0+8]) && isdigit(buffer[14+8]) && (buffer[15+8]==',') )
    {
        // SPECIAL FOR COBAN : This is another Hearbeat, we shall answer with "LOAD"
        Send( "LOAD", 4 );
    }


You may want to add a trace in the code of the Send() function to see if I properly identify the Coban and send the message ?
May be the 102-2 hang-up the connection if it don't get the right answer ?

Also with the Coban you should send a "fix030s***n123456" command by SMS to enable periodic sending of location report (every 30s in my example).


Modérateur Forum Traceurs GPS et Suivi GPS Temps Réel, son Index (français) et Les bons plan SIM pour traceurs GPS
Moderator Forum Live GPS Tracking Systems and its Index (english)
Using: CompeGPS Land 7 | LocusPro | Carminat TomTom Live | Tracker Coban GPS-102 | MoBAC
Used: Look N500 | iPaq314 | CartoExp.3D | OziExp.PC | OziExp.CE | TomTomGoLive950
Go to Top of Page

xinkai

16 Posts

Posted - 21 juin 2012 :  23:48:25  Show Profile  Reply with Quote
Thanks barbudor! It works much better now.
So the right answer to "##,imei:359710040255557,A;" is a "LOAD". and I got few packet looks like this after that.
imei:359710040255557,tracker,1206220521,+14254588776,F,212154.000,A,4734.4347,N,12209.1984,W,0.00,0;

But few moment later it send me another "359710040255557;" and what is the RIGHT answer for that? still "LOAD"?
If I don't anwser, it still go ahead open new TCP connections to me.

It looks to me Coban GPRS reporting is not as stable as Xexun. For example, I restarted my server (to simulate the TCP is closed by force for some reason, maybe cell change).
xexun always open up a new connection promptly and silently and continue reporting. But when I do the same thing on Coban,
it sometimes trying to continue report with SMS, and then few moment later it also tried to connect new TCP again. but after a while it totally stopped working.
Now it continue open up new TCP connection (I always response with "LOAD" on new connections), but send me nothing. I tried to send "SMS123456" followed by a "GPRS123456"
but it still could not recover. I guess it's time for a hardware reset.

barbudor, do you have similar issues when you play with these "GPRS Trackers"?

Edited by - xinkai on 21 juin 2012 23:49:24
Go to Top of Page

barbudor

France
1844 Posts

Posted - 22 juin 2012 :  13:59:41  Show Profile  Visit barbudor's Homepage  Reply with Quote
Are you using my code or is it your own code ?
Look in my code tcpendpoint.cpp. I identify both type of sequences (##,imei:359710040255557,A; and 359710040255557;) and send the appropriate answer (I don't have my code here, I'm not at home).

It is likely the 102-2 resets the connection because it does not receive the proper answer.
With my 102, I don't have this (although my code send the right answer). I have very few disconnection (once every 2 hours for example) but I can't tell if it comes from the tracker, from the GSM coverage in those region or the GSM Operator.

Modérateur Forum Traceurs GPS et Suivi GPS Temps Réel, son Index (français) et Les bons plan SIM pour traceurs GPS
Moderator Forum Live GPS Tracking Systems and its Index (english)
Using: CompeGPS Land 7 | LocusPro | Carminat TomTom Live | Tracker Coban GPS-102 | MoBAC
Used: Look N500 | iPaq314 | CartoExp.3D | OziExp.PC | OziExp.CE | TomTomGoLive950

Edited by - barbudor on 22 juin 2012 14:01:25
Go to Top of Page

xinkai

16 Posts

Posted - 22 juin 2012 :  20:25:57  Show Profile  Reply with Quote
Thanks barbudor.
I'm working on my own C# code and I want to get my hand wet and play with it.
Yes, I found in the TK102 thread that the magic word to answer "359710040255557;" should be a "ON".
I will read into your code to find out more. Thanks barbudor!
Go to Top of Page

robertrevolver

Mexico
11 Posts

Posted - 23 juin 2012 :  18:18:55  Show Profile  Reply with Quote
Barbudor
Thanks a lot, yesterday I compiled the tk2www code, on a ubuntu Linux server, and the software is up & running with a gps-103 device, If somebody need the tips to compile with a gnu gcc/g++ compiler, send me a message.

Developer, gps , nmea, Linux, .NET
Go to Top of Page

sturb

Netherlands
9 Posts

Posted - 25 juin 2012 :  14:48:39  Show Profile  Visit sturb's Homepage  Reply with Quote
Hi Barbudor! Nice job on coding this server/gateway!

I was wondering if this script is blocking or non-blocking when multiple requests are being send (almost simultaneous) to the server?
Go to Top of Page

barbudor

France
1844 Posts

Posted - 25 juin 2012 :  17:37:26  Show Profile  Visit barbudor's Homepage  Reply with Quote
Hi Sturb
It is non-blocking.
For each TCP incoming connection a dedicated socket is created and added to the list of descriptors.
So I should be able to support a lot of trackers (I don't have the code with me here, but is is using C++ lists which are limited only by memory)

Modérateur Forum Traceurs GPS et Suivi GPS Temps Réel, son Index (français) et Les bons plan SIM pour traceurs GPS
Moderator Forum Live GPS Tracking Systems and its Index (english)
Using: CompeGPS Land 7 | LocusPro | Carminat TomTom Live | Tracker Coban GPS-102 | MoBAC
Used: Look N500 | iPaq314 | CartoExp.3D | OziExp.PC | OziExp.CE | TomTomGoLive950
Go to Top of Page

nfplato

15 Posts

Posted - 28 juin 2012 :  09:19:31  Show Profile  Reply with Quote
Hi all,
thanks to barbudor for tk2www.
I've successfully compiled it on Ubuntu 11.
I'm testing it with a tk102-2 (i think ... it has microSD under SIM). The message is correctly forwarded to the test.php and written in data.txt.
Just one problem, the string is truncated just before "imei:". I mean for example using the string posted above, i do not receive the full string like this from tk

120621060759,+14254588776,GPRMC,060759.256,A,4734.4360,N,12209.1908,W,0.00,0.00,210612,,,A*7B,F,,imei:012896001639340,04,104.6,F:4.10V,1,138,46523,310,26,A159,253B

but only

120621060759,+14254588776,GPRMC,060759.256,A,4734.4360,N,12209.1908,W,0.00,0.00,210612,,,A*7B,F,,

Can i patch the cpp in some way (take in account i do not write any code in C++ from 1994...;))

Thanks in advance

Edited by - nfplato on 28 juin 2012 09:50:55
Go to Top of Page

robertrevolver

Mexico
11 Posts

Posted - 28 juin 2012 :  15:19:06  Show Profile  Reply with Quote
The code in C++, don´t parse nothing, just puts the raw sentences in the php file.

Developer, gps , nmea, Linux, .NET
Go to Top of Page
Page: of 5 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply/Répondre
 Printer Friendly
Jump To:
GpsPasSion Forums © 2002-2017_GpsPasSion/Manzanite Go To Top Of Page
This page was generated in 1,08 seconds. Powered By: Snitz Forums 2000 Version 3.4.05