• Licensing
  • Network
  • Maps
  • Indoor
  • Other
  • TRBOnet Watch
  • Database
IN THIS ARTICLE

How can I transfer GPS data from TRBOnet to another application?

Incorrect email!

The article was successfully sent to the email

There are different ways to obtain GPS data from TRBOnet.

1. Report based.


1.1 Connect 3rd party application to SQL Database TRBOnet uses to store data:
GPS information is stored in table: "GpsInfo"

1.2 Use TRBOnet API:

Note!
Before performing this step, make sure that TRBOnet API is the same version as TRBOnet application you are running.
TRBOnet site contains API for current Release version, if you are running TRBOnet of another build version - contact support@trbonet.com and specify exact TRBOnet build version you are running.

Load GPS history
The example shows how you can to load GPS history of radios from server.

C#
CopyClient client = new Client();
List<Device> m_devices = new List<Device>();
//...
//...
int requestId = 0;
void GetGPSHistoryForWeek()
{
    List<int> ids = new List<int>();
    foreach (var item in m_devices)
    {
        ids.Add(item.ID);
    }
    client.HistoryDataReceived += new EventHandler<Objects.Event_args.HistoryDataReceivedEventArgs>(client_HistoryDataReceived);
    requestId = client.GetHistory(ids, DateTime.Now.Subtract(TimeSpan.FromDays(7)), DateTime.Now, false, false, new Objects.Reports.Filters.GPSCorrectParams(), false);
}

void client_HistoryDataReceived(object sender, Objects.Event_args.HistoryDataReceivedEventArgs e)
{
    if (e.RequestID == requestId)
    {
        foreach (var item in e.HistoryList)
        {
            int deviceId = item.Key;
            List<GPSInfo> gps = item.Value;
            //Some actions
            //...
        }
    }
}

2. Real-time based.


2.1 Use TRBOnet API:

Note!
Before performing this step, make sure that TRBOnet API is the same version as TRBOnet application you are running.
TRBOnet site contains API for current Release version, if you are running TRBOnet of another build version - contact support@trbonet.com and specify exact TRBOnet build version you are running.

Get new radio locations
The example shows how you can get a new locations of radios

C#

Copyclient.DeviceLocationChanged += new EventHandler<DeviceLocationChangedEventArgs>(UpdateDeviceLocation);
//...
//...
void UpdateDeviceLocation(object sender, DeviceLocationChangedEventArgs e)
{
    foreach (GPSInfo i in e.GPSData)
    {
        Device device = m_devices.Find((d) => d.ID == i.DeviceID);
        if (device != null)
            device.GPSInfo.Update(i);
    }
}

Helpful?
We're glad this article helped.

Thanks for letting us know. What went wrong?