On Wed, Nov 10, 2010 at 9:28 PM, Cheng Wang <superwangch...@yahoo.com.cn>wrote:
> 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. > Well, you haven't really given us much to go on here. What's the error? Tom > 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 = fpR.read(1) # 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) > > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > http://lists.gnu.org/mailman/listinfo/discuss-gnuradio > >
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio