This commit is contained in:
zhongjin 2022-12-13 22:55:35 +08:00
parent 976b35a753
commit ee710128ee

View File

@ -1,14 +1,12 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from HackRF import HackRF
from PPM import PPM
from ModeS import ModeS
from getopt import getopt, GetoptError
import os,csv,sys
import numpy as np
import binascii
import socket # 导入 socket 模块
@ -72,7 +70,7 @@ class ADSB_Encoder:
s.connect((HOST, PORT))
s.sendall(str.encode(ma))
s.sendall(str.encode(mb))
#s.sendall(str.encode(mb))
s.sendall(str.encode(mc))
s.sendall(str.encode(md))
@ -84,25 +82,6 @@ class ADSB_Encoder:
#df17_array_callsign = ppm.frame_1090es_ppm_modulate(df17_callsign, df17_callsign)
#hackrf = HackRF()
#Position
#samples_array = hackrf.hackrf_raw_IQ_format(df17_array_position)
#samples = samples+samples_array
#gap_array = ppm.addGap(self.intermessagegap)
#samples_array = hackrf.hackrf_raw_IQ_format(gap_array)
#samples = samples+samples_array
#Velocity
#samples_array = hackrf.hackrf_raw_IQ_format(df17_array_velocity)
#samples = samples+samples_array
#gap_array = ppm.addGap(self.intermessagegap)
#samples_array = hackrf.hackrf_raw_IQ_format(gap_array)
#samples = samples+samples_array
#Callsign
#samples_array = hackrf.hackrf_raw_IQ_format(df17_array_callsign)
#samples = samples+samples_array
#gap_array = ppm.addGap(self.intermessagegap)
#samples_array = hackrf.hackrf_raw_IQ_format(gap_array)
#samples = samples+samples_array
return samples
def writeOutputFile(self, data):
@ -143,7 +122,7 @@ def usage(msg=False):
def main():
alt,lat,lon,capability,imgap,nicsup,rp,gnd,sstat,tc,icao,callsign,time,filename,speed,vspeed,heading = \
27000,28.81001,113.2,5,99564,0,1,False,0,11,'0x75008F','pynny',0,'Samples_256K.iq8s',300,0,0
27000,28.81001,113.21,5,99564,0,1,False,0,11,'0x75008F','pynny',0,'Samples_256K.iq8s',300,0,0
try:
(opts, args) = getopt(sys.argv[1:], 'hi:a:s:v:b:c:t:r:o:', \
['help','icao=','lat=','long=','altitude=','speed=','vspeed=','bearing=','callsign=',
@ -180,7 +159,7 @@ def main():
print(', '.join("%s: %s" % item for item in attrs.items()))
data = encoder.encode()
#encoder.writeOutputFile(data)
if __name__ == "__main__":
main()