forked from Matioupi/realtime-adsb-out
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AircraftInfos.py
291 lines (235 loc) · 8.33 KB
/
AircraftInfos.py
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
""" This class holds the aircraft states from the ADS-B point of view
It is refreshed by the simulation thread (or sensor feed thread) and will
be used to provide broadcasted informations
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
"""
import math
class AircraftInfos:
def __init__(self,icao,callsign,squawk,
lat_deg,lon_deg,alt_msl_ft,speed_kph,vspeed_ftpmin,maxloadfactor,track_angle_deg,
timesync,capability,type_code,surveillance_status,nicsupb,on_surface):
self._icao = int(icao,16)
self._oldicao = self._icao
self._callsign = callsign
self._oldcallsign = self._callsign
self._squawk = squawk
self._oldsquawk = self._squawk
self._lat_deg = float(lat_deg)
self._oldlat_deg = self._lat_deg
self._lon_deg = float(lon_deg)
self._oldlon_deg = self._lon_deg
self._alt_msl_m = float(alt_msl_ft)*0.3048
self._oldalt_msl_m = self._alt_msl_m
self._speed_mps = float(speed_kph)/3.6
self._oldspeed_mps = self._speed_mps
self._vspeed_mps = float(vspeed_ftpmin)*0.00508
self._oldvspeed_mps = self._vspeed_mps
self._maxloadfactor = float(maxloadfactor)
self._oldmaxloadfactor = self._maxloadfactor
self._track_angle_deg = math.fmod(float(track_angle_deg),360.0)
self._oldtrack_angle_deg = self._track_angle_deg
self._timesync = int(timesync)
self._oldtimesync = self._timesync
self._capability = int(capability)
self._oldcapability = self._capability
self._type_code = int(type_code)
self._oldtype_code = self._type_code
self._surveillance_status = int(surveillance_status)
self._oldsurveillance_status = self._surveillance_status
self._nicsupb = int(nicsupb)
self._oldnicsupb = self._nicsupb
self._on_surface = on_surface
self._oldon_surface = self._on_surface
################################################
@property
def icao(self):
return self._icao
@icao.setter
def icao(self,value):
self._oldicao = self._icao
self._icao = value
@property
def icao_changed(self):
return self._icao != self._oldicao
################################################
@property
def callsign(self):
return self._callsign
@callsign.setter
def callsign(self,value):
self._oldcallsign = self._callsign
self._callsign = value
@property
def callsign_changed(self):
return self._callsign != self._oldcallsign
################################################
@property
def squawk(self):
return self._squawk
@squawk.setter
def squawk(self,value):
self._oldsquawk = self._squawk
self._squawk = value
@property
def squawk_changed(self):
return self._squawk != self._oldsquawk
################################################
@property
def lat_deg(self):
return self._lat_deg
@lat_deg.setter
def lat_deg(self,value):
self._oldlat_deg = self._lat_deg
self._lat_deg = value
@property
def lat_changed(self):
return self._lat_deg != self._oldlat_deg
################################################
@property
def lon_deg(self):
return self._lon_deg
@lon_deg.setter
def lon_deg(self,value):
self._oldlon_deg = self._lon_deg
self._lon_deg = value
@property
def lon_changed(self):
return self._lon_deg != self._oldlon_deg
################################################
@property
def alt_msl_m(self):
return self._alt_msl_m
@property
def alt_msl_ft(self):
return self._alt_msl_m / 0.3048
@alt_msl_m.setter
def alt_msl_m(self,value):
self._oldalt_msl_m = self._alt_msl_m
self._alt_msl_m = value
@property
def alt_msl_changed(self):
return self._alt_msl_m != self._oldalt_msl_m
################################################
@property
def speed_mps(self):
return self._speed_mps
@property
def speed_kt(self):
return self._speed_mps*1.94384449244
@speed_mps.setter
def speed_mps(self,value):
self._oldspeed_mps != self._speed_mps
self._speed_mps = value
@property
def speed_changed(self):
return self._speed_mps != self._oldspeed_mps
################################################
@property
def vspeed_mps(self):
return self._vspeed_mps
@property
def vspeed_ftpmin(self):
return self._vspeed_mps * 196.850393701
@vspeed_mps.setter
def vspeed_mps(self,value):
self._oldvspeed_mps = self._vspeed_mps
self._vspeed_mps = value
@property
def vspeed_changed(self):
return self._vspeed_mps != self._oldvspeed_mps
################################################
@property
def maxloadfactor(self):
return self._maxloadfactor
@maxloadfactor.setter
def maxloadfactor(self,value):
self._oldmaxloadfactor = self._maxloadfactor
self._maxloadfactor = value
@property
def maxloadfactor_changed(self):
return self._maxloadfactor != self._oldmaxloadfactor
################################################
@property
def track_angle_deg(self):
return self._track_angle_deg
@track_angle_deg.setter
def track_angle_deg(self,value):
self._oldtrack_angle_deg = self._track_angle_deg
self._track_angle_deg = value
@property
def track_angle_changed(self):
return self._track_angle_deg != self._oldtrack_angle_deg
################################################
@property
def timesync(self):
return self._timesync
@timesync.setter
def timesync(self,value):
self._oldtimesync = self._timesync
self._timesync = value
@property
def timesync_changed(self):
return self._timesync != self._oldtimesync
################################################
@property
def capability(self):
return self._capability
@capability.setter
def capability(self,value):
self._oldcapability = self._capability
self._capability = value
@property
def capability_changed(self):
return self._capability != self._oldcapability
################################################
@property
def type_code(self):
return self._type_code
@type_code.setter
def type_code(self,value):
self._oldtype_code = self._type_code
self._type_code = value
@property
def type_code_changed(self):
return self._type_code != self._oldtype_code
################################################
@property
def surveillance_status(self):
return self._surveillance_status
@surveillance_status.setter
def surveillance_status(self,value):
self._oldsurveillance_status = self._surveillance_status
self._surveillance_status = value
@property
def surveillance_status_changed(self):
return self._surveillance_status != self._oldsurveillance_status
################################################
@property
def nicsupb(self):
return self._nicsupb
@nicsupb.setter
def nicsupb(self,value):
self._oldnicsupb = self._nicsupb
self._nicsupb = value
@property
def nicsupb_changed(self):
return self._nicsupb != self._oldnicsupb
################################################
@property
def on_surface(self):
return self._on_surface
@on_surface.setter
def on_surface(self,value):
self._oldon_surface = self._on_surface
self._on_surface = value
@property
def on_surface_changed(self):
return self._on_surface != self._oldon_surface