ynik
Posts: 31
Joined: Sun Jul 15, 2007 4:39 pm

GpsGateServer - Aspicore GSM Tracker 3.14

Fri May 09, 2008 10:51 am

Hello Support,

The script below works in GpsGateServer 1.3.2.xxx with the Aspicore GSM Tracker v3.14

However the problem is it only works with one/single active connection. The second Aspicore GSM Tracker will not communicate to server.

Any suggestion to get this script works for multiple connections??

Regards,
Ynik

Code: Select all

-----------------------------------------

<%@ LANGUAGE=VBScript LCID=1033%>
<%
' Utility sample for Aspicore GSM Tracker
' Convert URL arguments into GpsGateServer HTTP format and redirect into my.site.com/GpsGate.aspx?
'
' Usage: Set "Internet page URL" in Aspicore GSM Tracker settings to point to this page.
'        Turn HTTP protocol on and altitude sending on.
'        Enter your IMEI code into GpsGateServer preferences.
'        You see two letters "OK" in the Info tab or Aspicore GSM Tracker every time the phone sends
'        successfully location data into my.site.com via a HTTP connection.
'
' (c) Aspicore Ltd 2008, www.aspicore.com
'
' Tested with Windows 2003 Server, IIS ASP 6.0
' ------------------------------
' Change History:
' 2008-04-08 jje - Script created
' 2008-04-30 jje - Converted for my.site.com
%>
<% Option Explicit
   Response.Expires = 0
   Session.LCID = 1033 ' Geographical locale telling how to format dates and times, 1033 = English - US
%>
<%
' ------------------------
' Initialize argument variables to Null
   Dim vImei
   Dim vStatus
   Dim vLat
   Dim vLon
   Dim vAlt
   Dim vSpeed
   Dim vCourse
   Dim vTime
   Dim vDate
   Dim vLabel
   Dim vRemoteIP
   Dim vInnwname
   Dim vIncell
   Dim vInlac
   Dim vInmcc
   Dim vInmnc
   Dim vOutnwname
   Dim vOutcell
   Dim vOutlac
   Dim vOutmcc
   Dim vOutmnc
   Dim vTest

   vImei = Null
   vStatus = Null
   vLat = Null
   vLon = Null
   vAlt = Null
   vSpeed = Null
   vCourse = Null
   vTime = Null
   vDate = Null
   vLabel = Null
   vRemoteIP = Request.ServerVariables("REMOTE_ADDR")
   vInnwname = Null
   vIncell = Null
   vInlac = Null
   vInmcc = Null
   vInmnc = Null
   vOutnwname = Null
   vOutcell = Null
   vOutlac = Null
   vOutmcc = Null
   vOutmnc = Null
   vTest = Null

' ------------------------
' Assign values to those argument variables that are in use

   Response.Write Now() & vbCrLf

   Dim item
   Dim itemValue

   For Each item In Request.QueryString
     itemValue = Request.QueryString(item)
     Response.Write item & " => " & itemValue
     Select Case item 
        Case "imei" 
            vImei = itemValue
        Case "status" 
            vStatus = itemValue
        Case "lat" 
            ON ERROR RESUME NEXT
            vLat = CDbl(itemValue)
            ON ERROR GOTO 0
        Case "lon" 
            ON ERROR RESUME NEXT
            vLon = CDbl(itemValue)
            ON ERROR GOTO 0
        Case "alt" 
            ON ERROR RESUME NEXT
            vAlt = CDbl(itemValue)
            ON ERROR GOTO 0
        Case "speed"
	    vSpeed = 0.0	 
            ON ERROR RESUME NEXT
            vSpeed = CDbl(itemValue)
            ON ERROR GOTO 0
        Case "course"
	    vCourse = 0.0 
            ON ERROR RESUME NEXT
            vCourse = CDbl(itemValue)
            ON ERROR GOTO 0
        Case "time" 
            vTime = itemValue
        Case "date" 
            vDate = itemValue
        Case "label" 
            vLabel = itemValue
		Case "innwname"
			vInnwname = itemValue
		Case "incell"
            ON ERROR RESUME NEXT
            vIncell = CLng(itemValue)
            ON ERROR GOTO 0
		Case "inlac"
            ON ERROR RESUME NEXT
            vInlac = CLng(itemValue)
            ON ERROR GOTO 0
		Case "inmcc"
            ON ERROR RESUME NEXT
            vInmcc = CLng(itemValue)
            ON ERROR GOTO 0
		Case "inmnc"
            ON ERROR RESUME NEXT
            vInmnc = CLng(itemValue)
            ON ERROR GOTO 0
		Case "outnwname"
			vOutnwname = itemValue
		Case "outcell"
            ON ERROR RESUME NEXT
            vOutcell = CLng(itemValue)
            ON ERROR GOTO 0
		Case "outlac"
            ON ERROR RESUME NEXT
            vOutlac = CLng(itemValue)
            ON ERROR GOTO 0
		Case "outmcc"
            ON ERROR RESUME NEXT
            vOutmcc = CLng(itemValue)
            ON ERROR GOTO 0
		Case "outmnc"
            ON ERROR RESUME NEXT
            vOutmnc = CLng(itemValue)
            ON ERROR GOTO 0
		Case "test"
			vTest = itemValue
        Case Else   ' Other values.
           Response.Write " (Ignored)"
     End Select
     Response.Write vbCrLf
   Next
   Response.Write vbCrLf

 ' ------------------------
%>
<%	
Response.Redirect "http://my.site.com/GpsGate.aspx?longitude=" & vLon & "&latitude=" & vLat & "&altitude=" & vAlt & "&speed=" & vSpeed & "&heading=" & vCourse & "&date=" & vDate & "&time=" & vTime & "&imei=" & vImei
%>

altf4
Posts: 1037
Joined: Mon Feb 04, 2008 8:05 pm
Location: Thailand
Contact: Website

RE: GpsGateServer - Aspicore GSM Tracker 3.14

Fri May 09, 2008 12:19 pm

much simpler ..
and work with multible clients ... (its anyway one way communication)

Code: Select all

<?php

$host = "http://your.gpsgate/path";

$file = file_get_contents($host."/gpsgate.aspx?longitude=".$_GET['lon']."&latitude=".$_GET['lat']."&altitude=".$_GET['alt']."&speed=".$_GET['speed']."&heading=".$_GET['course']."&date=".$_GET['date']."&time=".$_GET['time']."&imei=".$_GET['imei']);

if ($file) { echo "".$file."\n\r"; }
else {echo "Local Error (file canot be loaded)";}
?>



--
Backups are for WIMPS!
http://0x8.in.th/where (website position GpsGate Powered)

ynik
Posts: 31
Joined: Sun Jul 15, 2007 4:39 pm

RE: GpsGateServer - Aspicore GSM Tracker 3.14

Fri May 09, 2008 2:27 pm

Hi,

Thanks for the info.

Ok, I replaced the host with my hostname, edit the php script and saved to /mysite.com/gps.php

Pointed the GSM Trackker to "http://mysite.com/gps.php"

For some reason no message is showing at the Info tab, just blank - normally it says ok.

Any further help please?

Dennis

altf4
Posts: 1037
Joined: Mon Feb 04, 2008 8:05 pm
Location: Thailand
Contact: Website

RE: GpsGateServer - Aspicore GSM Tracker 3.14

Fri May 09, 2008 2:47 pm

Yes you are right ... Blank screen mean no file from the server

can you add right behind <?php

Code: Select all

ini_set('display_errors','On');
error_reporting(E_ALL);
maybe there is some error ... you will see it then on GSM-Tracker info window.

you need to add the full URI to the gpsgatesetup in $host
like

$host = "http://mysqite/gpsgateblah";
maybe thats the issue

Mario



--
Backups are for WIMPS!
http://0x8.in.th/where (website position GpsGate Powered)

altf4
Posts: 1037
Joined: Mon Feb 04, 2008 8:05 pm
Location: Thailand
Contact: Website

RE: GpsGateServer - Aspicore GSM Tracker 3.14

Fri May 09, 2008 3:25 pm

i just dicovers 2 issues

1. there seems to be a bug in GSM-Tracker ...
if you set the url to be "http://...." the software does create a error -5210

2. my script did not display the output/reply from gpsgate

i altered the script in my first post. (also altitude should work now)
replace this with what you have now ...

and remove in GSM-Tracker in the url setting the "http://"
then it will works .. and you see in the info-window the reply from GpsGate.

username/password combination not work with this .. just imei



--
Backups are for WIMPS!
http://0x8.in.th/where (website position GpsGate Powered)

ynik
Posts: 31
Joined: Sun Jul 15, 2007 4:39 pm

RE: GpsGateServer - Aspicore GSM Tracker 3.14

Fri May 09, 2008 3:41 pm

Ok this looks working!
-----------------------

<?php
ini_set('display_errors','On');
error_reporting(E_ALL);
$host= "http://mysite.com";
$file = file($host."/GpsGate.aspx?longitude=".$_GET['lon']."&latitude=".$_GET['lat']."&altitude=0&speed=".$_GET['speed']."&heading=".$_GET['course']."&date=".$_GET['date']."&time=".$_GET['time']."&imei=".$_GET['imei']);
if ($file) { echo "OK!\n\r"; }
?>

altf4
Posts: 1037
Joined: Mon Feb 04, 2008 8:05 pm
Location: Thailand
Contact: Website

RE: GpsGateServer - Aspicore GSM Tracker 3.14

Fri May 09, 2008 3:44 pm

change it to my script above ...
then you will see in the infowindow the real reply from GpsGate .. and not just "OK"

well okay GpsGate replys also just "OK" but if somethings goes wrong ... you will see it then ...
like if you send position without fix ...



--
Backups are for WIMPS!
http://0x8.in.th/where (website position GpsGate Powered)

ynik
Posts: 31
Joined: Sun Jul 15, 2007 4:39 pm

RE: GpsGateServer - Aspicore GSM Tracker 3.14

Fri May 09, 2008 4:50 pm

This seems to work OK but with minor issue which was already resolve in the ASP script by Jyrki below.

Case "speed"
vSpeed = 0.0
ON ERROR RESUME NEXT
vSpeed = CDbl(itemValue)
ON ERROR GOTO 0
Case "course"
vCourse = 0.0
ON ERROR RESUME NEXT
vCourse = CDbl(itemValue)
ON ERROR GOTO 0

With my Samsung i550w when the "Speed" or the "Course" value are "0.0" it sends NULL value to the GpsGateServer and does not recognise it.

Can you also do the same with your php script to handle the NULL value and perhaps replace it with "0".

Thanks.
Dennis

altf4
Posts: 1037
Joined: Mon Feb 04, 2008 8:05 pm
Location: Thailand
Contact: Website

RE: GpsGateServer - Aspicore GSM Tracker 3.14

Fri May 09, 2008 5:28 pm

Code: Select all

<?php
$host = "http://host.to.gpsgate/path";


if (($_GET['status'] == "A")||($_GET['status'] == "a")) {
	$course = $_GET['course'];
	if (($course =="")||($course =="0.0")) { $course = "0"; }
	$speed = $_GET['speed'];
	if (($speed =="")||($speed =="0.0")) { $speed = "0"; }
	$alt = $_GET['alt'];
	if (($alt =="")||($alt =="0.0")) { $alt = "0"; }

	$file = file_get_contents($host."/gpsgate.aspx?longitude=".$_GET['lon']."&latitude=".$_GET['lat']."&altitude=".$alt."&speed=".$speed."&heading=".$course."&date=".$_GET['date']."&time=".$_GET['time']."&imei=".$_GET['imei']);

	if ($file) {
		echo "".$file."\n\r"; }
	else {
		echo "Connection Error";}
} else {
	echo "No GPS FIX!\n\r";
}
print_r($_GET);
?>
cheap code ... but it works ;-)

later you can delete (or add //) in the line with "print_r" .. this command shows all the submited values for debugging.
if you dont have to pay for the traffic .. its fine ... but if .. better dissable this later

the script works now only if you have real GPS-FIX too .




--
Backups are for WIMPS!
http://0x8.in.th/where (website position GpsGate Powered)

Return to “GpsGate Server - How to setup and use”