source: pacpussensors/trunk/Gps/gpsServerSocket.cpp

Last change on this file was 59, checked in by DHERBOMEZ Gérald, 10 years ago

Integration of new modules:

  • GPS NMEA0183 decoder
  • Span CPT Decoder

Update of:

File size: 2.1 KB
Line 
1/*********************************************************************
2// created: 2005/10/17 - 15:09
3// filename: gpsServerSocket.cpp
4//
5// author: Gerald Dherbomez
6//
7// version: $Id: gpsServerSocket.cpp 870 2010-07-23 09:50:45Z gdherbom $
8//
9// purpose: Implementation of the gpsServerSocket class
10*********************************************************************/
11
12
13#include "network/GpsServerSocket.h"
14#include "network/gpsServerSocketInterface.h"
15#include <qsocket.h>
16#include <qtextstream.h>
17#include "kernel/pacpus.h"
18
19
20GpsServerSocket::GpsServerSocket(int gpsServerSocketPort) : QServerSocket(gpsServerSocketPort)
21{
22 if (!ok())
23 qWarning("Failed to bind the port %d\n", gpsServerSocketPort);
24}
25
26
27GpsServerSocket::~GpsServerSocket()
28{
29 socketDevice()->close();
30}
31
32
33void GpsServerSocket::customEvent(QCustomEvent* e)
34{
35 int i;
36 switch(e->type() - QEvent::User)
37 {
38 case SIGNAL_PPS:
39 break;
40
41 case TRAME_GGA_DBL:
42 ggaData = *(trame_gga_dbl*)(e->data());
43 printf ("%d %d %d %d \n",ggaData.H, ggaData.Mi, ggaData.S, ggaData.Ms);
44 break;
45
46 case TRAME_GSA:
47 gsaData = *(trame_gsa*)(e->data());
48 printf("GSA");
49 break;
50
51 case TRAME_GST:
52 gstData = *(trame_gst*)(e->data());
53 break;
54
55 case TRAME_GSV:
56 gsvData = *(trame_gsv*)(e->data());
57 for (i=0 ; i<12 ; i++)
58 printf ("%d ",gsvData.SatellitesInView[i][0]);
59 printf ("\n");
60 break;
61
62 case TRAME_HDT:
63 hdtData = *(trame_hdt*)(e->data());
64 break;
65
66 case TRAME_RMC:
67 rmcData = *(trame_rmc*)(e->data());
68 printf("RMC");
69 break;
70
71 case TRAME_ROT:
72 rotData = *(trame_rot*)(e->data());
73 break;
74
75 case TRAME_VTG:
76 vtgData = *(trame_vtg*)(e->data());
77 printf("VTG");
78 break;
79
80 case TRAME_ZDA:
81 zdaData = *(trame_zda*)(e->data());
82 printf("ZDA");
83 break;
84
85 default:
86 qDebug("Unknown GPS data received !\n");
87 }
88
89}
90
91
92void GpsServerSocket::newConnection(int socket)
93{
94 GpsServerSocketInterface *s = new GpsServerSocketInterface(socket);
95}
Note: See TracBrowser for help on using the repository browser.