NetBurner 3.5.6
PDF Version
GPSSat.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4#pragma once
5#include <stdlib.h>
6#include <stdio.h>
7#include <string.h>
8#include <math.h>
9#include "GPSEnum.h"
10
11#define PI 3.14159265
12
13class GPSSat
14{
15 public:
16 GPSSat() : prn(0), elevation(0), azimuth(0), snr(0), lastPrnUpdateEpoch(0), lastDataUpdateEpoch(0) {}
17
18 void getXYvalues(int size, int *buffer);
19 void reset();
20
21 int prn;
22 int elevation;
23 int azimuth;
24 int snr;
25 uint32_t lastPrnUpdateEpoch; // When PRN was last set (from GSA)
26 uint32_t lastDataUpdateEpoch; // When elevation/azimuth/SNR were last updated (from GSV)
27};
28
29class GPSSatTracker
30{
31 public:
32 static const int MAX_CONSTELLATIONS = (int)GPSSatelliteType::CONSTELLATION_COUNT;
33 static const int MAX_USED_SATS = 12;
34
35 GPSSat usedSats[MAX_CONSTELLATIONS][MAX_USED_SATS];
36
37 void secondUpdater(uint32_t epochTime);
38
39 void invalidateUnusedSatellites(uint32_t epochTime);
40 void updateUsedSatellites(GPSSatelliteType constellation, int *satteliteList);
41
42 private:
43 uint32_t currentEpoch;
44 uint32_t lastUpdateEpoch[MAX_CONSTELLATIONS];
45};