I am working on an application where I need to get my location through a GPSD service. I am using C# for my library (same as the project), which is not supported by GPSD itself, so they don't have any library. That's why I am trying to create my own library (and eventually make a nuget package of it).
But I got stuck with the following problem. I get a connection with the GPSD service through sockets, and I get the following data:
{"class":"VERSION","release":"3.11","rev":"3.11-3","proto_major":3,"proto_minor":9}
So the connection is working, but I don't know how to get the GPS data itself, there is not much documentation about it so, does anybody have any experience with this, or know how I can achieve this?
using (var client = ConnectViaHttpProxy(ServerAddress, Port, ProxyAddress, Port))
{
while (client.Connected)
{
var result = new byte[256];
client.Client.Receive(result);
//_response = Encoding.UTF8.GetString(result, 0, result.Length);
_response = Encoding.ASCII.GetString(result, 0, result.Length);
var resultClass = JsonConvert.DeserializeObject<GpsdData>(_response);
Console.WriteLine(resultClass.ToString());
Thread.Sleep(10);
}
client.Close();
}
I found out how I connect to the service: like @x...
says it is all in the link:
link
The command I need to send is:
var byteData = Encoding.ASCII.GetBytes("?WATCH={\"enable\":true,\"json\":true}");
client.Client.Send(byteData);