Jump to content

GPS tracking device


Wicket

Recommended Posts

Hi ,

 

I am looking at putting some simple fleet management into one of my projects. I need to be able to record locations of vehicles.

 

I have all of the code to place a marker using longitude and latitude in Google maps, I just need a bit of advice on what device to use to get this information from a vehicle.

 

Has anyone got any experience on using a tracking device in a car, that allows you to connect to a API, or some sort of service so I can at least get the longitude and latitude at that moment in time.

 

I could probably implement what I need using a phone, but that is easy for a user to turn off location access and thus no GPS. I need something like a black box that can be put into the vehicle, and queried to get the current location. Like a tracker device.

 

Any advice or suggestion would be greatly appreciated.

 

Sent from my Pixel using Tapatalk

Link to comment
Share on other sites

HI, 

 

I make some tests for this with android device (Tablet).

When GPS is ON then unigui application server can get 

coordinates of device.

 

 
var id, target, options;
 
function success (pos) {
  //var crd = pos.coords;
  //if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
  //  console.log('Congratulations, you reached the target');
  //navigator.geolocation.clearWatch(id);
  //  }
 
 
  var out,out2
  out = document.getElementById ("out");
  out2 = document.getElementById ("TLabel3");
 
  out.innerHTML = "lat:" + pos.coords.latitude  
+ ", long:" + pos.coords.longitude
;
 
  out2.innerHTML = "Speed: " + pos.coords.speed
+ ", Altitude: " + pos.coords.altitude
;
 
}
 
function error(err) {
  console.warn('ERROR(' + err.code + '): ' + err.message);
}
 
target = {
  latitude : 0,
  longitude: 0
};
 
options = {
  enableHighAccuracy: true,
  timeout: 0000,
  maximumAge: 0
};
 
ID = navigator.geolocation.watchPosition(success, error, options);
Link to comment
Share on other sites

There are GPS devices on the market (black box to mount the car).

When the device is running, it sends the coordinates via ComPort or on web server on internet. 

 

The device manufacturer typically offers a web server through which data from external software can be read.

Link to comment
Share on other sites

  • 3 years later...
On 2/4/2018 at 3:15 PM, irigsoft said:

HI, 

 

I make some tests for this with android device (Tablet).

When GPS is ON then unigui application server can get 

coordinates of device.

 

 
var id, target, options;
 
function success (pos) {
  //var crd = pos.coords;
  //if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
  //  console.log('Congratulations, you reached the target');
  //navigator.geolocation.clearWatch(id);
  //  }
 
 
  var out,out2
  out = document.getElementById ("out");
  out2 = document.getElementById ("TLabel3");
 
  out.innerHTML = "lat:" + pos.coords.latitude  
+ ", long:" + pos.coords.longitude
;
 
  out2.innerHTML = "Speed: " + pos.coords.speed
+ ", Altitude: " + pos.coords.altitude
;
 
}
 
function error(err) {
  console.warn('ERROR(' + err.code + '): ' + err.message);
}
 
target = {
  latitude : 0,
  longitude: 0
};
 
options = {
  enableHighAccuracy: true,
  timeout: 0000,
  maximumAge: 0
};
 
ID = navigator.geolocation.watchPosition(success, error, options);

hi, how to use this code?

Link to comment
Share on other sites

On 2/4/2018 at 3:15 PM, irigsoft said:

HI, 

 

I make some tests for this with android device (Tablet).

When GPS is ON then unigui application server can get 

coordinates of device.

 

 
var id, target, options;
 
function success (pos) {
  //var crd = pos.coords;
  //if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
  //  console.log('Congratulations, you reached the target');
  //navigator.geolocation.clearWatch(id);
  //  }
 
 
  var out,out2
  out = document.getElementById ("out");
  out2 = document.getElementById ("TLabel3");
 
  out.innerHTML = "lat:" + pos.coords.latitude  
+ ", long:" + pos.coords.longitude
;
 
  out2.innerHTML = "Speed: " + pos.coords.speed
+ ", Altitude: " + pos.coords.altitude
;
 
}
 
function error(err) {
  console.warn('ERROR(' + err.code + '): ' + err.message);
}
 
target = {
  latitude : 0,
  longitude: 0
};
 
options = {
  enableHighAccuracy: true,
  timeout: 0000,
  maximumAge: 0
};
 
ID = navigator.geolocation.watchPosition(success, error, options);

Hi, how to use this code?thanks 

Link to comment
Share on other sites

2 hours ago, irpans said:

Hi, how to use this code?thanks 

I am sorry, this is old post but I think You can use it with javascript execution from file.

there is a javascript execution function.

 

procedure JAVASCRIPT_EXEC (Sender: TObject; fType, Data, DataObjectsList  : AnsiString);
var
I           : Integer;
DataList    : TStringList;
sObject     : TObject;
begin

if (Sender <> nil) then begin
  TRY
    With TUniControl (Sender) do begin
      ScreenMask.Message := 'please, wait...';
      ScreenMask.WaitData := False;//True;
      ScreenMask.Enabled := False;//True;
    end;
  EXCEPT

  END;
end;
 

IF (Length (Data) > 1) then begin
    DataList := TStringList.Create;
    DataList.StrictDelimiter := True;
    DataList.Delimiter := ';';

       DataList.LoadFromFile (Data);
       Data := TRIM (DataList.Text);
       DataList.Clear;
    If Assigned(DataList) then
        FreeandNil (DataList);

end;

//TUnibutton (Sender).ClientEvents.ExtEvents.Values ['click'] := 'function click(sender, e, eOpts){' + Data + '}';

//UniSession.JSCode (Data);
UniSession.AddJs (Data);
//UniSession.JSONDirect (Data);
end;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...