-
Notifications
You must be signed in to change notification settings - Fork 49
/
gps-sim.h
91 lines (80 loc) · 2.05 KB
/
gps-sim.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
* multi-sdr-gps-sim generates a IQ data stream on-the-fly to simulate a
* GPS L1 baseband signal using a SDR platform like HackRF or ADLAM-Pluto.
*
* This file is part of the Github project at
* https://github.com/mictronics/multi-sdr-gps-sim.git
*
* Copyright © 2021 Mictronics
* Distributed under the MIT License.
*
*/
#ifndef GPS_SIM_H
#define GPS_SIM_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <pthread.h>
#include <stdatomic.h>
#include "gps.h"
#define NOTUSED(V) ((void) V)
// Sampling data format
#define SC08 sizeof(signed char)
#define SC16 sizeof(signed short)
/* SDR device types */
typedef enum {
SDR_NONE = 0, SDR_IQFILE, SDR_HACKRF, SDR_PLUTOSDR
} sdr_type_t;
/* Target information. */
typedef struct {
double bearing;
double distance;
double lat;
double lon;
double height;
double velocity;
double speed;
double vertical_speed;
bool valid;
} target_t;
/* Simulator location. */
typedef struct {
double lat; // Latitude
double lon; // Longitude
double height; // Height/Elevation
} location_t;
/* All the GPS simulators variables. */
typedef struct {
atomic_bool main_exit;
atomic_bool gps_thread_exit;
atomic_bool gps_thread_running;
bool show_verbose;
bool ionosphere_enable;
bool interactive_mode;
bool use_ftp;
bool enable_tx_amp;
bool use_rinex3;
bool time_overwrite;
bool almanac_enable;
int duration;
int tx_gain;
int ppb;
int sample_size;
sdr_type_t sdr_type;
char *nav_file_name;
char *motion_file_name;
char *sdr_name;
char *pluto_uri;
char *pluto_hostname;
char *station_id;
pthread_mutex_t gps_lock;
pthread_t gps_thread;
pthread_cond_t gps_init_done; // Condition signals GPS thread is running
location_t location; // Simulator geo location
target_t target; // Target information
datetime_t start; // Simulation start time
} simulator_t;
void set_thread_name(const char *name);
int thread_to_core(int core_id);
#endif /* GPS_SIM_H */