Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.12 KB | None | 0 0
  1. {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM2","mode":1,"time":"2015-08-28T07:38:51.000Z","ept":0.005}
  2. {"class":"TPV","tag":"GLL","device":"/dev/ttyACM2","mode":0,"time":"2015-08-28T07:38:51.000Z","ept":0.005}
  3. {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM0","mode":3,"time":"2015-08-28T07:38:51.000Z","ept":0.005,"lat":-27.550550287,"lon":153.102791027,"alt":56.883,"epx":2.991,"epy":2.991,"epv}
  4. {"class":"SKY","tag":"GSV","device":"/dev/ttyACM0","xdop":0.79,"ydop":0.75,"vdop":1.88,"tdop":1.01,"hdop":0.99,"gdop":2.35,"pdop":2.12,"satellites":[{"PRN":4,"el":0,"az":0,"ss":33,"used":fal}
  5. {"class":"TPV","tag":"GLL","device":"/dev/ttyACM0","mode":3,"time":"2015-08-28T07:38:51.000Z","ept":0.005,"lat":-27.550550333,"lon":153.102791000,"alt":57.800,"epx":11.922,"epy":11.180,"epv"}
  6. {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM1","mode":1}
  7.  
  8. {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM2","mode":1,"time":"2015-08-28T07:38:52.000Z","ept":0.005}
  9. {"class":"TPV","tag":"GLL","device":"/dev/ttyACM2","mode":0,"time":"2015-08-28T07:38:52.000Z","ept":0.005}
  10. {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM0","mode":3,"time":"2015-08-28T07:38:52.000Z","ept":0.005,"lat":-27.550550218,"lon":153.102790984,"alt":56.919,"epx":2.963,"epy":2.963,"epv}
  11. {"class":"SKY","tag":"GSV","device":"/dev/ttyACM0","xdop":0.79,"ydop":0.75,"vdop":1.88,"tdop":1.01,"hdop":0.99,"gdop":2.35,"pdop":2.12,"satellites":[{"PRN":4,"el":0,"az":0,"ss":33,"used":fal}
  12. {"class":"TPV","tag":"GLL","device":"/dev/ttyACM0","mode":3,"time":"2015-08-28T07:38:52.000Z","ept":0.005,"lat":-27.550550167,"lon":153.102791000,"alt":57.800,"epx":11.922,"epy":11.180,"epv"}
  13. {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM1","mode":1}
  14.  
  15. #include <iostream>
  16. #include <stdlib.h>
  17. #include <libgpsmm.h>
  18.  
  19. using namespace std;
  20.  
  21. int main(void)
  22. {
  23. int port;
  24. gpsmm gps_rec("localhost", DEFAULT_GPSD_PORT);
  25. port = atoi(DEFAULT_GPSD_PORT);
  26. printf("port: %dn", port);
  27.  
  28. if (gps_rec.stream(WATCH_ENABLE|WATCH_JSON) == NULL) {
  29. cerr << "No GPSD running.n";
  30. return 1;
  31. }
  32.  
  33. for (;;) {
  34. // more info for gps_data_t: https://fossies.org/dox/gpsd-3.15/structgps__data__t.html
  35. struct gps_data_t* newdata;
  36.  
  37. if (!gps_rec.waiting(50000000))
  38. continue;
  39.  
  40. if ((newdata = gps_rec.read()) == NULL) {
  41. cerr << "Read error.n";
  42. return 1;
  43. } else {
  44. cout
  45. << "path: "<< newdata->devices.list[0].path
  46. << "tndevices: "<< newdata->devices.ndevices
  47. << "tlatitude: "<< newdata->fix.latitude
  48. << "tlongitude: "<< newdata->fix.longitude
  49. << endl;
  50. }
  51. }
  52. return 0;
  53. }
  54.  
  55. root@overo:~# gps_test
  56. port: 2947
  57. path: ndevices: 0 latitude: nan longitude: nan
  58. path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
  59. path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
  60. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  61. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  62. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  63. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  64. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  65. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  66. path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
  67.  
  68. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  69. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  70. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  71. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  72. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  73. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  74. path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
  75.  
  76. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  77. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  78. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5506 longitude: 153.103
  79. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  80. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  81. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  82. path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
  83.  
  84. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5506 longitude: 153.103
  85. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5506 longitude: 153.103
  86. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5506 longitude: 153.103
  87. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  88. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  89. path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
  90. path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement