def __init__(self, num_iterations, H, R, G): self.num_iterations = num_iterations # number codewords to pass through transmitter and decoder when computing bit error rate self.H = H # parity matrix self.R = R # decoding matrix self.G = G # code generator matrix self.Transmitter = transmitter.Transmitter(G) self.Decoder = decoder.Decoder(10, H, R)
def transmitter_main(user, serial_number, file_path, jpeg_quality, downsample): jpeg_quality = int(jpeg_quality) downsample = int(downsample) image = misc.imread(file_path) data = JPEG.JPEG_compression(image, jpeg_quality, downsample) utils.save_to_gzip(data, file_path) t = transmitter.Transmitter(user, serial_number, baud=1200, space_f=2200) t.transmit_file(file_path + ".gz", callsign)
def test_sms(user, serial_number): utils.print_msg("Running SMS Test", DEBUG) t = transmitter.Transmitter(user, serial_number, baud=1200, space_f=2200) callsign = "KM6BHD" Digi = b'WIDE1-1,WIDE2-1' dest = "APCAL" # Uncomment to Send Email #info = ":EMAIL :[email protected] Hi, test email!" # Uncomment to Send an SMS message to a phone number #info = ":SMSGTE :@4089312267 Testing from lab computers" #uncomment to show yourself on mt everest #info = "=2759.16N/08655.30E[I'm on the top of the world" #uncomment to send to everyone on the APRS system near you #info = ":ALL : CQCQCQ I would like to talk to you!" #uncomment to report position info = "=3752.50N/12215.43WlIm using a laptop in Cory Hall!" #uncomment to send a status message #info = ">I like radios" utils.print_msg("Preparing packet...", DEBUG) packet = ax25.UI( destination=dest, source=callsign, info=info, digipeaters=Digi.split(b','), ) utils.print_msg("Transmitting packet...", DEBUG) t.transmit_packet(packet) time.sleep(2) utils.print_msg("Finished transmitting packet...", DEBUG) t.terminate()
def tx(filename, transmitter_args, txrate, nsubchannels, video_fps): transmitter_args = eval('dict({})'.format(transmitter_args)) trans = transmitter.Transmitter(nsubchannels, **transmitter_args) render(code_generator(trans), filename, fps=txrate, video_fps=video_fps)
PORT = 55555 VERBOSITY = 0 if __name__ == "__main__": import time, sys if len(sys.argv) < 3: print("usage: %s <CORNER ID> <ip address>" % sys.argv[0]) sys.exit(-1) else: corner = sys.argv[1] addr = sys.argv[2] reg_port = PORT+1 t = transmitter.Transmitter(corner) r = reg_server(addr, reg_port) clients = {} while True: hosts = r.get_hosts() for host in hosts: clients[host] = time.time()+ REG_TIME s = host + ":" + str(clients[host]) if VERBOSITY > 1: print(s)
def test_image(user, serial_number): """ loop back mode """ # setup variables for tests callsign = "KK6MRI" fname = "calBlue.tiff" dir = "images/" f = open(dir + fname, "rb") fs = 48000 Abuffer = 1024 Nchunks = 12 # prepare transmitter and receiver t = transmitter.Transmitter(user, serial_number, fs=fs, Abuffer=Abuffer, Nchunks=Nchunks) r = receiver.Receiver(user, serial_number, fs=fs, Abuffer=Abuffer, Nchunks=Nchunks) # prepare i/o queues Qin = Queue.Queue() Qout = Queue.Queue() # create a control fifo to kill threads when done cQin = Queue.Queue() cQout = Queue.Queue() # create a pyaudio object p = pyaudio.PyAudio() # initialize a recording thread. t_rec = threading.Thread(target=aprs.record_audio, args=(Qin, cQin, p, fs, r.dusb_in)) t_play = threading.Thread(target=aprs.play_audio, args=(Qout, cQout, p, fs, t.dusb_out)) # generate packets and put into output queue Qout = t.generate_packets(Qout, callsign) # start the recording and playing threads t_rec.start() time.sleep(2) t_play.start() starttime = time.time() # process packets and put them into input queue r.process_packets(Qin, file_path) utils.print_msg(time.time() - starttime, DEBUG) cQout.put("EOT") cQin.put("EOT") t.terminate() r.terminate()
import transmitter import keyboard if __name__ == "__main__": tx = transmitter.Transmitter("192.168.29.122", 5005) kb = keyboard.KeyboardInter(tx) kb.listen()
import transmitter backup = transmitter.Transmitter("PINAS", 5001, ['daily'], ("0001", "2359"), "sendthis", encrypt=True) print("\nTransmitter parameters\n") print(backup.host) print(backup.port) print(backup.backup_day) print(backup.backup_timerange) print(backup.backup_dir) print("----------") backup.run_scheduler()