Re: [Discuss-gnuradio] Exposing enums defined in a separate include file

2015-10-25 Thread Kolya
This problem is solved. I had made a mistake when adding the include file to
the the _swig.i file. Instead of including it once via #include and once
with %include I used #include both times. Everything seems to be working as
expected now. Thanks a lot for your help Ron.



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/Exposing-enums-defined-in-a-separate-include-file-tp56619p56623.html
Sent from the GnuRadio mailing list archive at Nabble.com.

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] Exposing enums defined in a separate include file

2015-10-25 Thread Kolya
Hi,
I'm working on an OOT module with multiple blocks. All blocks share a common
include file (Link26_defines.h) for module wide defines and enum structures
(this is somewhat similar to the dvb_config.h in gr-dtv).
The compilation and installation of the module works fine. But when I try to
run the qa_ test or use the block in GRC I get the following error:
/AttributeError: 'module' object has no attribute 'DC1'/

DC1 is define as an enum in Link26_defines.h, an excerpt of this file is
below:
/namespace gr {
namespace Link26 {
enum data_class_t {
DC1 = 1,
DC2 = 2,
};
}
}
typedef gr::Link26::data_class_t data_class_t;
/

I tried to follow the  OOT module configuration guide
<http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModulesConfig>  
and added the include file to the CMakeLists.txt (install public header file
section) in include/Link26/CMakeLists.txt

I also added it to the swig file Link26_swig.i.

When I run python, import Link26 and look at the defined names in the
library with /dir(Link26)/ I don't see "DC1" and "DC2" listed. When I try
the same with GNURadio's DTV block via /dir(dtv)/ I see all the defines from
dvb_config.h though. 

What am I missing? Any help is appreciated.
Thanks,
Kolya



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/Exposing-enums-defined-in-a-separate-include-file-tp56619.html
Sent from the GnuRadio mailing list archive at Nabble.com.

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] custom work function gets into an endless loop

2015-09-28 Thread Kolya
Hi Martin and Sylvain,

I obviously didn't understand the forecast function properly but with your
help it works now. I tried both: 

set_output_multiple & a correct forecast() 
and 
set_output_multiple & set_relative_rate

both approaches worked as expected :)

What threw me off was that I had based my forecast on the forecast function
in gr-dtv's dvb_bbheader_bb_impl.cc and in that example it seems to work.

I also appreciate the pointer to the logging infrastructure and I will adopt
that too. The crc32_bb is next on the list of files to dissect and learn
from. That is good stuff!

This is a great mailing list. Thanks so much for your help.

- Kolya



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/custom-work-function-gets-into-an-endless-loop-tp56304p56323.html
Sent from the GnuRadio mailing list archive at Nabble.com.

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] custom work function gets into an endless loop

2015-09-27 Thread Kolya
Hi,

I'm trying to build a custom block that takes in a stream of input samples
and simply adds a postamble of 32bits every 352 bits. The package structure
is illustrated below (payload_bits = msg_bits+postamble_bits):
---
|   msg_bits = 352 |  postamble_bits = 32  |
---

For some reason the code below gets into an endless loop when I run it
through a test and stimulate it with a non-repeating vector source. The
debug printf statements show that the loop keeps iterating even without
input.
I derived from gr_block because the number of output samples is higher than
the number of input samples and the work function is shown below:


/void bbframer_bb_impl::general_work(int noutput_items,
gr_vector_int _items,
gr_vector_const_void_star _items,
gr_vector_void_star _items)
{
  const unsigned char *in = (const unsigned char *) input_items[0];
  unsigned char *out = (unsigned char *) output_items[0];
  int out_offset = 0;
  int consumed = 0;

  for (int i = 0; i < noutput_items; i += (int)(payload_bits/8)) {

  for (int j = 0; j < (int)(msg_bits / 8); j++) {   // 
Input index loop
(byte-index)

  out[out_offset++]=in[consumed++];
  }
  // now add add postamble
  out[out_offset++]=0x00;
  out[out_offset++]=0x01;
  out[out_offset++]=0x02;
  out[out_offset++]=0x03;
  }
#ifdef VERBOSE
  printf(">>> offset= %d\n",out_offset);
  printf(">>> consumed= %d\n",consumed);
#endif

  this->consume_each(consumed);
  return out_offset;
}/

I also overrode the forecast function to account for the fact that fewer
input samples are needed than output samples are produced:

/void
bbframer_bb_impl::forecast (int noutput_items, gr_vector_int
_items_required)
{
ninput_items_required[0] = ((noutput_items - 32) / 8); // 32 bit
postamble
}/


Any feedback would be greatly appreciated.
- Kolya



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/custom-work-function-gets-into-an-endless-loop-tp56304.html
Sent from the GnuRadio mailing list archive at Nabble.com.

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio