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