discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] call the work() method


From: xianda
Subject: Re: [Discuss-gnuradio] call the work() method
Date: Sat, 31 May 2014 19:21:51 +0800 (CST)

Hi:
Thank you so much.
I just want to write c++ code to realize ("fft" block+"OFDM Cyclic Prefixer").
And I attached my code which just realize ifft but the "OFDM Cyclic Prefixer" has it's work function.
#include <fstream>
#include <vector>
#include <gnuradio/gr_complex.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/digital/ofdm_cyclic_prefixer.h>

std::vector<std::complex<float> *> buff1(64);//read data
std::vector<std::complex<float> *> buff2(64);//write data

std::ifstream infile("a.dat",std::ifstream::binary);
std::ofstream outfile("b.dat",std::ofstream::binary);

int main(){
while(not infile.eof())
{
infile.read((char*)&buff1.front(),buff1.size()*sizeof(std::complex<float>));

gr::fft::fft_complex *buff=new gr::fft::fft_complex(64,0);
gr_complex *bu=buff->get_inbuf();
memcpy(bu,&buff1.front(),buff1.size()*sizeof(std::complex<float>));
buff->execute();
gr_complex *out=buff->get_outbuf();
memcpy(&buff2.front(),out,buff2.size()*sizeof(std::complex<float>));

outfile.write((char*)&buff2.front(),buff2.size()*sizeof(std::complex<float>));
}

infile.close();
outfile.close();
}

Thank you.
Best regards,
xianda

At 2014-05-31 06:33:35, "Martin Braun" <address@hidden> wrote:


On 31 May 2014 11:57, "Marcus Müller" <address@hidden> wrote:
>
> Hi Xianda,
>
>
>>          I know every block should have it's work or general_work function.And i know it's used by scheduler

For the record, a block that only uses message passing doesn't need a work function - not that that's what you're looking for here.

M




reply via email to

[Prev in Thread] Current Thread [Next in Thread]