Using gr::fec::code::cc_encoder class in a hierarchical block

帅比萌擦擦* 提交于 2019-12-06 16:48:50

I was finally able to fix the issue. Turns out the Gnu radio FECAPI provides coder variables to define the FEC property (classes derived from the gr::fec::generic_encoder class eg. cc_encoder, ldpc_encoder etc) and deployment variables ( which interact with the scheduler and the coder variable in the GNU radio flowgraph. The deployment variable "gr::fec::encoder" can be used with a number of coder variables such as the cc_encoder or LDPC encoder. The work function now looks as shown below. The OOT now compiles and works as it should.

debug_conv_encoder_impl::debug_conv_encoder_impl(int frame_size, std::vector<int> polys, int mode, int pad)
  : gr::hier_block2("debug_conv_encoder",
          gr::io_signature::make(1, 1, sizeof(unsigned char)),
          gr::io_signature::make(1, 1, sizeof(unsigned char)))
{
  //Creating a coder variable
  int k = 7;
  int rate = 2;
  bool d_pad = (pad == 1) ? true : false;
  cc_mode_t d_mode = get_mode(mode);
  gr::fec::code::cc_encoder::sptr coder_variable(gr::fec::code::cc_encoder::make(frame_size,k,rate,polys,0,d_mode,d_pad));

  //Creating a deployment variable
  gr::fec::encoder::sptr coder_deployment(gr::fec::encoder::make(coder_variable,sizeof(unsigned char),sizeof(unsigned char)));
  connect(self() , 0 , coder_deployment , 0);
  connect(coder_deployment , 0 , self() , 0);
  //connect(encoder);
}

cc_encoder is not a block, hence you can't connect it in a flow graph like a block.

In fact, you shouldn't be able to instantiate it, even, as it's an abstract base class only:

https://gnuradio.org/doc/doxygen/classgr_1_1fec_1_1code_1_1cc__encoder.html

I'm not quite sure what an encoder you need, but in any case, this class isn't the way to go.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!