|
From: | Cheng Wang |
Subject: | [Discuss-gnuradio] Can't run the code, need help~~~ |
Date: | Thu, 11 Nov 2010 10:28:20 +0800 (CST) |
Hi, all, I write a DBPSK modulation/demodulation program in GNU and python. But the main frame cannot compile correctly. Can you help me to check it? Thanks. from gnuradio import gr from gnuradio import audio from array import array # Array import wx import os # Operating System dependent call import socket # Socket import sys # System call import TypeConverterModule # Type converter import DBPSKMod # DBPSK Modulation import GMSKMod # GMSK Modulation # ----------------------------------------- # Function: Read file and return data array # ----------------------------------------- def ReadFile (arrImg, fpR): while True: data = "" # Read data, 1 byte each time if len(data) == 0: # If reach EOF, finish the loop break objTypeConv = TypeConverterModule.TypeConverter() lData = objTypeConv.char2int(data) # Convert char to int arrImg.append(lData) # Store data(int) into array #print lData, ' ', return arrImg def OnDBPSK_Modulate(self): fpR = open('./JpegEncoder/s.dat', 'r') # Read the data and print arrImg = array('B') #the array is char arrImg.append(0) # you know, for the diff encoding stuff arrImg = ReadFile (arrImg, fpR) print ' ' print 'Total = ', len(arrImg), 'bytes' #self.control.SetValue('[Read File] - Finish!') # ------------------------------------------------------------- # Start to send jpeg file # ------------------------------------------------------------- # Construct graph tb = gr.top_block() #cheng arrImg[0] = 0 # you know, for the diff encoding stuff bytes_src = gr.vector_source_b(arrImg, False) objMod = DBPSKMod.dbpsk_mod() #start DBPSK demoluation objDemod = DBPSKDemod.dbpsk_demod() tb.connect(bytes_src, objMod, objDemod) tb.run() print "Finished!!!" if __name__ == '__OnDBPSK_Modulate__': OnDBPSK_Modulate(self) |
[Prev in Thread] | Current Thread | [Next in Thread] |