leommxj / gr-adsbout

GNU Radio OOT module for encoding ADS-B signal
5 stars 4 forks source link

hackrf not transmitting latitude and longitude #2

Open rapbando opened 3 years ago

rapbando commented 3 years ago

Hi,

Everything works but I cant´t recieve the coordinates for the ads-b position while mode-s code icao and altitude are working.

Do I have to convert data for hackrf before as stated in adsb_encoder.py

` class HackRF: """The HackRF class has functions from converting data into a format into which the hackrf can process """

def __init__(self):
    pass

def hackrf_raw_IQ_format(self, ppm):
    """
    Args:
        ppm: this is some data in ppm (pulse position modulation) which you want to convert into raw IQ format

    Returns:
        bytearray: containing the IQ data
    """
    signal = []
    bits = numpy.unpackbits(numpy.asarray(ppm, dtype=numpy.uint8))
    for bit in bits:
        if bit == 1:
            I = 127
            Q = 127
        else:
            I = 0
            Q = 0
        signal.append(I)
        signal.append(Q)

    return bytearray(signal)

def gen_position(arguments): samples = bytearray() modes = ModeS() (df17_even, df17_odd) = modes.df17_pos_rep_encode(arguments.capability, arguments.icao, arguments.typecode, arguments.surveillancestatus, arguments.nicsupplementb, arguments.altitude, arguments.time, arguments.latitude, arguments.longitude, arguments.surface)

ppm = PPM()
df17_array = ppm.frame_1090es_ppm_modulate(df17_even, df17_odd)

hackrf = HackRF()
samples_array = hackrf.hackrf_raw_IQ_format(df17_array)
samples = samples + samples_array
#gap_array = ppm.addGap(arguments.intermessagegap)
#samples_array = hackrf.hackrf_raw_IQ_format(gap_array)
#samples = samples + samples_array
sys.stderr.write("len:{:d}\n".format(len(samples)))
return samples
#return samples.rjust(0x40000,'\x00')

def gen_ident(arguments): samples = bytearray() modes = ModeS() ppm = PPM() hackrf = HackRF()

ident_bytes = modes.df17_ident_encode(arguments.ec, arguments.icao, arguments.callsign)
ident_array = ppm.frame_1090es_ppm_modulate_normal(ident_bytes)
samples_array = hackrf.hackrf_raw_IQ_format(ident_array)
samples = samples+samples_array
#gap_array = ppm.addGap(arguments.intermessagegap)
#samples_array = hackrf.hackrf_raw_IQ_format(gap_array)
#samples = samples+samples_array
sys.stderr.write("len:{}\n".format(len(samples)))
return samples
#return samples.rjust(0x40000,'\x00')

` out grc